L3DT users' wiki
Large 3D terrain generator

Scripts > Export fractal

Description A script to generate a fractal map, and export it as a PNG image.
Author Aaron
Created 2010/05/24
Requires L3DT 11.07 beta 2 or later
Download Export fractal.zs

Script contents

// Author:  A. Torpy
// Updated: 14 Jul 2011

// create settings list 'ls'
varlist ls
int ls.PowerOfTwo
float ls.AltRange
float ls.Roughness
bool ls.WrapFlag

set ls.PowerOfTwo 10 // 8 = 256x256, 9 = 512x512, 10 = 1024x1024
set ls.Roughness 0.55
set ls.AltRange 100
set ls.WrapFlag false

// edit settings list
assert <EditUI &ls "Enter fractal settings"> "Calculation aborted!"

// create our map variable
map mymap

// create the fractal map
assert <calc.HF.Fractal &mymap ls.PowerOfTwo ls.Roughness ls.AltRange ls.WrapFlag true> "Error generating fractal map"

// initialise and edit file selector
FileSelector FS
filesel.Init &FS false NULL "Bitmap image (*.bmp)|*.bmp|PNG image (*.png)|*.png|Terragen file (*.ter)|*.ter|Heightfield file (*.hfz)|*.hfz|All files (*.*)|*.*|" NULL NULL
assert <EditUI &FS "Select export filename"> "Export aborted"

// save the map file
assert <map.SaveFile2 &mymap <filesel.GetPathA &FS> false true> "Export failed!"



scripts/export_fractal.txt · Last modified: 2017/08/31 07:06 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki