terrain root

 Function Name  Parameter  Return  Explain
getTexture None number  
setTexture number None  
getMaterial None material  
setMaterial material None  
getStyle None dword  
setStyle dword None  
intersectRay ray ray
boolean bCalcDis, bIgnoreBack
1). boolean bInter
2). boolean bInter
     number fDistance
     number nTriIdx

 

Detects the intersection between a terrain and a ray.

Parameters

ray :  a ray
bCalcDis : whether calculate distance from ray's start to point of intersection.
bIgnoreBack : whether ignore backward faces of the mesh.

Return Values

1. If bCalcDis is false, returns boolean indicate whether intersected.


2. If bCalcDis is true, returns:
bInter : whether intersected
fDistance : the distance between ray's start and point of intersection.
nTriIdx : The index of intersected triangle.

 
intersectSegment segment seg
boolean bCalcDis, bIgnoreBack
1). boolean bInter
2). boolean bInter
     number fDistance
     number nTriIdx
Detects the intersection between a terrain and a segment.
getAlt number x, z number altitude,
vec
normal
Gets altitude & surface normal from world space x, z
setAlt number row, col, altitude
boolean bUpdate
boolean Sets altitude, return false if failed.
The parameter bUpdate indicates whether update whole mesh info like bounding box etc. Commonly only set it to true in the last call of setALT.
getRow None number  
getCol None number  
setRowCol number row, col boolean  
getInterval None number  
setInterval number interval None  
offset vec offset None offset all vertices of terrain
scale vec scale None scale all vertices height
computeNormal None boolean calculate all vertices normal