L3DT users' wiki
Large 3D terrain generator

Scripts > Calculate gradient

Description Calculate the gradient map of the heightfield.
Author Aaron
Created 2012/03/19 06:20
Requires L3DT v12.03
Download HF_CalcGradient.zs

Script contents

hvar pHF
set pHF <project.GetMap "HF">
assert pHF "Error: cannot get heightfield!"
assert <map.GetWidth pHF> "Error: heightfield not initialised!"

hvar hOutput
set hOutput <project.GetMap "HF_Grad">
if hOutput
  L3DTio_Backup.BackupMap "HF_Grad" "HF_CalcGrad" 0 "view.ShowMap \"HF_Grad\""
  map.Free hOutput
else
  set hOutput <project.CreateMap "HF_Grad">
endif

if <not <calc.HF.CalcGrad pHF hOutput 0x7 true>>
  echo "HF_CalcGrad.zs error - call to 'calc.HF.CalcGrad' failed"
  return -1
endif

map.SetFlag hOutput 1 true // ready
map.SetFlag hOutput 5 true // modified

view.ShowMap "HF_Grad"

return 0
 
scripts/calculate_gradient.txt · Last modified: 2013/08/21 17:09 (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