L3DT users' wiki
Large 3D terrain generator

Scripts > HF_PeakOverlay

Description A script to add a peak overlay to the heightfield using a user-specified position, radius, height, etc.
Author Aaron
Created 2010/05/24
Last modified 2016/05/12
Requires L3DT v16.05
Download HF_PeakOverlay.zs

Script contents

// Author:  A. Torpy
// Updated: 12 May 2016

hvar hMap
set hMap <GetMap "HF">
assert hMap "Cannot get heightfield!"


// get size
int nx ny
set nx <map.GetWidth hMap>
set ny <map.GetHeight hMap>

// if heightfield is not initialised, exit
assert nx "Heightfield is not initialised!"
  
// first, create and edit settings
varlist settings
int settings.xpos
int settings.ypos
int settings.rad
float settings.height

set settings.xpos <div nx 2>
set settings.ypos <div ny 2>
set settings.rad 100
set settings.height 1000.0

if <not <EditUI &settings "Enter settings">>
  return 0
endif

// create the overlay
map MyOverlay
assert <calc.HF.GenPeakOverlay &MyOverlay settings.rad settings.height 1> "Cannot create overlay!"

// store a backup of the heightfield
L3DTio_Backup.BackupMap "HF" "HF_PeakOverlay" 0 "view.ShowMap \"HF\""

// apply the overlay
assert <calc.HF.ApplyOverlay <GetMap "HF"> &MyOverlay settings.xpos settings.ypos 1.0 true> "Cannot apply overlay!"

// redraw the heightmap
view.ShowMap "HF"
 
scripts/add_peak_overlay.txt · Last modified: 2017/08/31 06:23 (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