surface root

 Function Name  Parameter  Return  Explain
getTexture None number  
setTexture number None  
transTexture number u, v None  
rotateTexture number angle None  
scaleTexture number u, v None  
getMaterial None material  
setMaterial material None  
getStyle None dword Styles List

SURFS_REFLECTION -- reflection
SURFS_SPECULARSPOT -- specular spot
SURFS_ALPHATEST -- alpha test
SURFS_ALPHABLEND -- alpha blend
SURFS_COLORADD -- color add
SURFS_DOUBLESIDE -- double side
SURFS_NOCLIP -- don't affect collision detection
SURFS_NOLIGHTMAP --  no lightmap

setStyle dword None  
getPlane None plane  
getLmOrg None vec get lightmap origin
getLmU None vec get lightmap u dir
getLmV None vec get lightmap v dir
intersectRay ray ray
boolean bCalcDis, bIgnoreBack
1). boolean bInter
2). boolean bInter
     number fDistance
     number nTriIdx

 

Detects the intersection between a surface 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 surface.

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 surface and a segment.