» Back To Index
Demoniak3D/LUA Api: Meshes Management library
The
HYP_Mesh library performs general operations on the meshes of the scene.
HYP_Mesh.CastRay
HYP_Mesh.CopyVerticesList
HYP_Mesh.CreateBox
HYP_Mesh.CreatePlane
HYP_Mesh.CreateSphere
HYP_Mesh.CreateTorus
HYP_Mesh.DoTweening
HYP_Mesh.FlipNormals
HYP_Mesh.GetElevation
HYP_Mesh.GetFaceIndexes
HYP_Mesh.GetFaceNormal
HYP_Mesh.GetNumFaces
HYP_Mesh.GetNumPlaneSegments
HYP_Mesh.GetNumVertices
HYP_Mesh.GetVertexAttrib
HYP_Mesh.GetVertexColor
HYP_Mesh.GetVertexNormal
HYP_Mesh.GetVertexPosition
HYP_Mesh.GetVertexUVCoords
HYP_Mesh.PopVerticesList
HYP_Mesh.PushVerticesList
HYP_Mesh.ScaleVertices
HYP_Mesh.SetTexCoordsOffset
HYP_Mesh.SetTexCoordsTiling
HYP_Mesh.SetPivotPosition
HYP_Mesh.SetPivotOrientation
HYP_Mesh.SetVertexAttrib
HYP_Mesh.SetVertexColor
HYP_Mesh.SetVerticesColor
HYP_Mesh.SetVertexNormal
HYP_Mesh.SetVertexPosition
HYP_Mesh.SetVertexUVCoords
HYP_Mesh.UpdateAllNormals
HYP_Mesh.UpdateFaceNormalField
HYP_Mesh.UpdateVertexNormalField
HYP_Mesh.VBQuad_Create
HYP_Mesh.VBQuad_Destroy
HYP_Mesh.VBQuad_SetQuadVertexUV
HYP_Mesh.VBQuad_GetQuadVertexUV
HYP_Mesh.VBQuad_AddQuad
HYP_Mesh.VBQuad_SetQuadVertexPosition
HYP_Mesh.VBQuad_GetQuadVertexPosition
HYP_Mesh.VBQuad_SetQuadVertexColor
HYP_Mesh.VBQuad_GetQuadVertexColor
HYP_Mesh.VBQuad_SortFacesInCameraSpace
HYP_Mesh.Destroy
HYP_Mesh.GetFaceCenterPosition
CopyVerticesList
CopyVerticesList allows to copy all vertices from a source mesh to a destination mesh.
Syntax
HYP_Mesh.CopyVerticesList( src_mesh_name| src_mesh_id,
dst_mesh_name| dst_mesh_id );
- src_mesh_name - [STR127] - name of the source mesh specified in the XML script by the name attribute.
- src_mesh_id - [INTEGER] - source mesh identifier.
- dst_mesh_name - [STR127] - name of the destination mesh specified in the XML script by the name attribute.
- dst_mesh_id - [INTEGER] - destination mesh identifier.
SetCloningMode
SetCloningMode allows to specify the manner a mesh is cloned.
Syntax
HYP_Mesh.SetCloningMode( mesh_name| mesh_id, options );
- mesh_name - [STR127] - name of the mesh to be cloned specified in the XML script by the name attribute.
- mesh_id - [INTEGER] - identifier of the mesh to be cloned.
- options - [INTEGER] - type of cloning:
- new clone holds its own mesh data: MESH_CLONING_NOT_SHARE_MESHDATA = 1 - default value.
- new clone shares mesh data with the base mesh: MESH_CLONING_SHARE_MESHDATA = 2.
FlipNormals
FlipNormals allows to inverse the mesh normals.
Syntax
HYP_Mesh.FlipNormals( mesh_name| mesh_id );
- mesh_name - [STR127] - name of the mesh specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
GetNumFaces
GetNumFaces allows to get the number of faces of a mesh.
Syntax
num_faces = HYP_Mesh.GetNumFaces( mesh_name| mesh_id );
- mesh_name - [STR127] - name of the mesh specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- num_faces - [INTEGER] - number of faces of the mesh.
GetFaceIndexes
GetFaceIndexes allows to get index of vertices of a particular face of the mesh. The meshes handled in
Hyperion thus have triangular faces each face has 3 index. Each one of these index can then be used in
the Set/GetVertex_ function... () to reach and modify the vertices of the face.
Syntax
a, b, c = HYP_Mesh.GetFaceIndexes( mesh_name| mesh_id, face_index );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- face_index - [INTEGER] - index of the face. This index must lie between 0 and HYP_Mesh.GetNumFaces()-1.
- a, b, c - [INTEGER] - index of the 3 vertices of the face.
GetFaceNormal
GetFaceNormal allows to get the normal vector of a particular face of the mesh.
The normal vector is expressed in model local space.
Syntax
x, y, z = HYP_Mesh.GetFaceNormal( mesh_name| mesh_id, face_index );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- face_index - [INTEGER] - index of the face. This index must lie between 0 and HYP_Mesh.GetNumFaces()-1.
- x, y, z - [REAL] - coordinates of the normal vector.
GetElevation
GetElevation allows to get the height (y) and the index (in the faces list) of a mesh's face that is vertically located just below the active camera.
This function allows the camera to follow the relief of a ground, for example.
This function performs a ray throw whose origin is the position of the camera and whose direction is the
<0.0, -1.0, 0.0> vector.
The returned y_out value is the y coordinate of the collision point between the ray and the face of the mesh.
Syntax
y_out, face_index = HYP_Mesh.GetElevation( mesh_name| mesh_id,
cam_x, cam_y, cam_z );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- cam_x - [REAL] - X position of the active camera.
- cam_y - [REAL] - Y position of the active camera.
- cam_z - [REAL] - Z position of the active camera.
- y_out - [REAL] - height (Y axis) of the triangle detected below the camera.
- face_index - [INTEGER] - index of the current face detected below the camera.
CastRay
CastRay allows to cast a ray (orig + t*dir) and get the result of the collision with the mesh.
If no collision is detected, the collision time si set to 99999999.0.
Syntax
x, y, z, face, time = HYP_Mesh.CastRay( mesh_name| mesh_id,
orig_x, orig_y, orig_z,
dir_x, dir_y, dir_z );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- orig_x - [REAL] - X coordinate of the origin of the ray.
- orig_y - [REAL] - Y coordinate of the origin of the ray.
- orig_z - [REAL] - Z coordinate of the origin of the ray.
- dir_x - [REAL] - X coordinate of the direction vector of the ray.
- dir_y - [REAL] - Y coordinate of the direction vector of the ray.
- dir_z - [REAL] - Z coordinate of the direction vector of the ray.
- x - [REAL] - X position of the collision point with the mesh.
- y - [REAL] - Y position of the collision point with the mesh.
- z - [REAL] - Z position of the collision point with the mesh.
- face - [INTEGER] - index of the collision face.
- time - [INTEGER] - collision time.
DoTweening
DoTweening allows to morph (to gradually transform) a tween mesh between a mesh of beginning (start mesh) and a mesh of ending (end mesh).
The morphing is linear between the 2 meshes. The meshes must have the same topology (same number of vertices and faces).
This function is used in the characters keyframes animations.
Syntax
HYP_Mesh.DoTweening( tween_mesh_name| tween_mesh_id,
start_mesh_name| start_mesh_id,
end_mesh_name| end_mesh_id,
time );
- tween_mesh_name - [STR127] - name of the tween mesh as specified in the the XML script by the name attribute.
- tween_mesh_id - [INTEGER] - mesh tween identifier.
- start_mesh_name - [STR127] - name of the starting mesh as specified in the XML script by the name attribute.
- start_mesh_id - [INTEGER] - starting mesh identifier.
- end_mesh_name - [STR127] - name of the ending mesh as specified in the XML script by the "name" attribute.
- end_mesh_id - [INTEGER] - ending mesh identifier.
- time - [REAL] - value of the morphing (or blending) parameter specifying a precise transformation state between the starting mesh and the ending mesh.
The time parameter must lie between 0.0 and 1.0 (0.0 corresponds to the starting mesh and 1.0 corresponds to the ending mesh).
Remark
This function interpolates the position and the normal of each vertex.
SetVertexNormal
SetVertexNormal allows to change the value of the normal vector associated with a particular vertex.
Syntax
HYP_Mesh.SetVertexNormal( mesh_name| mesh_id,
vertex_index, nx, ny, nz );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex ranging between 0 and HYP_GetMeshVerticesNumber()-1.
- nx - [REAL] - new value of the X coordinate of the normal.
- ny - [REAL] - new value of the Y coordinate of the normal.
- nz - [REAL] - new value of the Z coordinate of the normal.
Example
local vec = {x=0.0, y=1.0, z=0.0};
local vi = 0;
local max_vertices = HYP_Mesh.GetNumVertices("mySphere");
while(vi<max_vertices) do
HYP_Mesh.SetVertexNormal( "mySphere", vi, vec.x, vec.y, vec.z );
vi = vi + 1;
end
Remark
In order to get correct lighting calculations, do not forget to standardize the normal vector (length of the vector = 1.0).
GetVertexNormal
GetVertexNormal allows to get the value of the normal vector associated with a particular vertex.
Syntax
nx, ny, nz = HYP_Mesh.GetVertexNormal( mesh_name| mesh_id, vertex_index );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex ranging between 0 and HYP_GetMeshVerticesNumber()-1.
- nx - [REAL] - new value of the X coordinate of the normal.
- ny - [REAL] - new value of the Y coordinate of the normal.
- nz - [REAL] - new value of the Z coordinate of the normal.
GetVertexColor
GetVertexColor allows to get the value of the color associated with a particular vertex.
Syntax
r, g, b, a = HYP_Mesh.GetVertexColor( mesh_name| mesh_id,
vertex_index );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index du vertex compris entre 0 et HYP_GetMeshVerticesNumber()-1.
- r - [CLAMPED_REAL] - value of the red component.
- g - [CLAMPED_REAL] - value of the green component.
- b - [CLAMPED_REAL] - value of the blue component.
- a - [CLAMPED_REAL] - value of the alpha component.
GetVertexUVCoords
GetVertexUVCoords allows to get the value of the texture coordinates associated with a particular
vertex and for a given texture unit.
Syntax
u, v = HYP_Mesh.GetVertexUVCoords( mesh_name| mesh_id,
vertex_index, texture_unit );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex ranging between 0 and HYP_GetMeshVerticesNumber()-1.
- texture_unit - [INTEGER] - texture unit ranging between 0 and 7.
- u - [REAL] - value of the U component of the texture coordinates.
- v - [REAL] - value of the V component of the texture coordinates.
SetVertexUVCoords
SetVertexUVCoords allows to change the value of the texture coordinates of a particular vertex of a mesh.
Syntax
HYP_Mesh.SetVertexUVCoords( mesh_name|mesh_id,
vertex_index, texture_unit, new_u, new_v );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex starting from 0 for the first index.
- texture_unit - [INTEGER] - number of the texture unit (TU) ranging between 0 and 7.
In practice, only units 0 and 1 are used in the case of 2 layers multitexturing.
- new_u - [REAL] - new value of the tiling factor of the U texture coordinate.
- new_v - [REAL] - new value of the tiling factor of the V texture coordinate.
SetPivotPosition
SetPivotPosition allows to change the position of the mesh pivot (or local reference mark) without changing
the position of the vertices.
Syntax
HYP_Mesh.SetPivotPosition( mesh_name| mesh_id,
new_x, new_y, new_z );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- new_x - [REAL] - new X position of the pivot.
- new_y - [REAL] - new Y position of the pivot.
- new_z - [REAL] - new Z position of the pivot.
SetPivotOrientation
SetPivotOrientation allows to change the position of the mesh pivot (or local reference mark) without changing
the position of the vertices.
Syntax
HYP_Mesh.SetPivotOrientation( mesh_name| mesh_id,
angle, axe_x, axe_y, axe_z );
or
HYP_Mesh.SetPivotOrientation( mesh_name| mesh_id,
pitch, yaw, roll );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- angle - [REAL] - rotation angle in degrees around the axis defined by the following X, Y and Z values.
- axe_x - [REAL] - X coordinate of the rotation axis.
- axe_y - [REAL] - Y coordinate of the rotation axis.
- axe_z - [REAL] - Z coordinate of the rotation axis.
- pitch - [REAL] - rotation angle in degrees around the X axis.
- yaw - [REAL] - rotation angle in degrees around the Y axis.
- roll - [REAL] - rotation angle in degrees around the Z axis.
SetVerticesColor
SetVerticesColor allows to change the color of all the vertices of a mesh.
Syntax
HYP_Mesh.SetVerticesColor( mesh_name|mesh_id,
new_r, new_g, new_b, new_a );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- new_r - [CLAMPED_REAL] - red component of the vertices color.
- new_g - [CLAMPED_REAL] - green component of the vertices color.
- new_b - [CLAMPED_REAL] - blue component of the vertices color.
- new_a - [CLAMPED_REAL] - alpha component of the vertices color.
GetNumVertices
GetNumVertices allows to get the number of vertices of a mesh.
Syntax
n = HYP_Mesh.GetNumVertices( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
GetVertexPosition
GetVertexPosition allows to get the position of a particular vertex of a mesh.
Syntax
x, y, z = HYP_Mesh.GetVertexPosition( mesh_name|mesh_id, vertex_index );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index du vertex en commençant à partir de 0 pour le premier index.
- x - [REAL] - X position of the vertex.
- y - [REAL] - Y position of the vertex.
- z - [REAL] - Z position of the vertex.
PushVerticesList
PushVerticesList allows to save the current vertices of the mesh before modification.
The HYP_PopMeshVerticesList function will make it possible to restore them.
Syntax
HYP_Mesh.PushVerticesList( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
PopVerticesList
PopVerticesList allows to restore the vertices of the mesh that have been saved with
HYP_PushMeshVerticesList.
Syntax
HYP_Mesh.PopVerticesList( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
GetNumPlaneSegments
GetNumPlaneSegments allows to get the number of segments of a mesh plane as initialized in the XML script.
Syntax
nXSegs, nYSegs = HYP_Mesh.GetNumPlaneSegments( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- nXSegs - [INTEGER] - number of segments in the width.
- nYSegs - [INTEGER] - number of segments in the height.
UpdateAllNormals
UpdateAllNormals allows to recompute the normal vector with each vertex after modification.
This is fundamental for lighting calculations.
Syntax
HYP_Mesh.UpdateAllNormals( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
UpdateVertexNormalField
UpdateVertexNormalField allows to recompute the vertices normal vectors field.
Syntax
HYP_Mesh.UpdateVertexNormalField( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
UpdateFaceNormalField
UpdateFaceNormalField allows to recompute the faces normal vectors field.
Syntax
HYP_Mesh.UpdateFaceNormalField( mesh_name|mesh_id );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
SetVertexPosition
SetVertexPosition allows to change the position of a particular vertex of a mesh.
Syntax
HYP_Mesh.SetVertexPosition( mesh_name|mesh_id,
vertex_index,
new_x, new_y, new_z );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - vertex index starting from 0 for the first index.
- x - [REAL] - X position of the vertex.
- y - [REAL] - Y position of the vertex.
- z - [REAL] - Z position of the vertex.
Remarks
For the sake of speed, SetVertexPosition_Fast does not verify the validity of the input parameters.
SetVertexColor
SetVertexColor allows to change the color of a particular vertex of a mesh.
Syntax
HYP_Mesh.SetVertexColor( mesh_name|mesh_id,
vertex_index,
new_r, new_g, new_b, new_a );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex starting from 0 for the first index.
- new_r - [CLAMPED_REAL] - new value of the red component of the vertex color.
- new_g - [CLAMPED_REAL] - new value of the green component of the vertex color.
- new_b - [CLAMPED_REAL] - new value of the blue component of the vertex color.
- new_a - [CLAMPED_REAL] - new value of the alpha component of the vertex color.
SetTexCoordsTiling
SetTexCoordsTiling allows to multiply the texture coordinates of all the mesh's vertices by a tiling factor.
Default value is 1.0.
Syntax
HYP_Mesh.SetTexCoordsTiling( mesh_name|mesh_id,
tu,
tile_u, tile_v );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- tu - [INTEGER] - number of the texture unit (Texture Unit). In practice, only units 0 and 1 are used in the case of 2 layers multitexturing.
- tile_u - [REAL] - new value of the tiling factor of the U texture coordinate.
- tile_v - [REAL] - new value of the tiling factor of the V texture coordinate.
SetTexCoordsOffset
SetTexCoordsOffset allows to add an offset to the texture coordinates of all the mesh's vertices.
Default value is 0.0.
Syntax
HYP_Mesh.SetTexCoordsOffset( mesh_name|mesh_id,
tu,
offset_u, offset_v );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- tu - [INTEGER] - number of the texture unit (Texture Unit). In practice, only units 0 and 1 are used in the case of 2 layers multitexturing.
- offset_u - [REAL] - offset to be added to u coords.
- offset_v - [REAL] - offset to be added to v coords.
ScaleVertices
ScaleVertices allows to apply a scale factor to the vertices of the mesh.
The original position of the vertices is automatically saved. This makes that when using a factor of 1.0,
the vertices will take place again in their original position.
Syntax
HYP_Mesh.ScaleVertices( mesh_name|mesh_id,
scale_factor_x, scale_factor_y, scale_factor_z );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- scale_factor_x - [REAL] - X scaling factor of the vertex.
- scale_factor_y - [REAL] - Y scaling factor of the vertex.
- scale_factor_z - [REAL] - Z scaling factor of the vertex.
SetVertexAttrib
SetVertexAttrib allows to modify the 4d vector associated with each of the 5 vertex attributes.
By default the first 2 vertex attributes are initialised by oZone3D when the mesh is built
and represent the tangent vectors to each vertex (tangent: 1 and binormal: 2).
Syntax
HYP_Mesh.SetVertexAttrib( mesh_name|mesh_id,
vertex_index, vertex_attrib, x, y, z, w );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex from 0 to n-1 vertices.
- vertex_attrib - [INTEGER] - number of the vertex attributes from 1 to 5.
- x - [REAL] - X component of the attribute's 4d vector.
- y - [REAL] - Y component of the attribute's 4d vector.
- z - [REAL] - Z component of the attribute's 4d vector.
- w - [REAL] - W component of the attribute's 4d vector.
GetVertexAttrib
GetVertexAttrib allows to get the 4d vector associated with each of the 5 vertex attributes.
Syntax
x, y, z, w = HYP_Mesh.GetVertexAttrib( mesh_name|mesh_id,
vertex_index, vertex_attrib );
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier.
- vertex_index - [INTEGER] - index of the vertex from 0 to n-1 vertices.
- vertex_attrib - [INTEGER] - number of the vertex attributes from 1 to 5.
- x - [REAL] - X component of the attribute's 4d vector.
- y - [REAL] - Y component of the attribute's 4d vector.
- z - [REAL] - Z component of the attribute's 4d vector.
- w - [REAL] - W component of the attribute's 4d vector.
VBQuad_Create
VBQuad_Create allows to create a VBQuad.
Syntaxe
HYP_Mesh.VBQuad_Create( num_quads );
- num_quads - [INTEGER] - number of quads managed by the VBQuad.
VBQuad_Destroy
VBQuad_Destroy allows to destroy a VBQuad.
Syntaxe
HYP_Mesh.VBQuad_Destroy( mesh_name| mesh_id );
- mesh_name - [STR127] - name of the vb_quad.
- mesh_id - [INTEGER] - vb_quad identifier.
VBQuad_AddQuad
VBQuad_AddQuad allows to add a quad to a VB_QUAD type mesh.
Syntax
HYP_Mesh.VBQuad_AddQuad( mesh_name| mesh_id ,
quad_name|quad_id);
- mesh_name - [STR127] - name of the mesh as specified in the XML script by the "name" attribute.
- mesh_id - [INTEGER] - mesh identifier returned by HYP_Mesh.Clone(), or HYP_Model.GetSubMeshByName() or HYP_Model.GetFirstSubMesh().
- quad_name - [STR127] - name of the quad primitive as specified in the XML script by the name attribute.
- quad_id - [INTEGER] - identifier of the QUAD type primitive.
Example
local i = 0;
while(i<1000) do
local id_quad = HYP_Primitive.CloneQuad("masterQuad");
HYP_Mesh.VBQuad_AddQuad( "grassVertexBufferMesh", id_quad );
i = i + 1;
end
VBQuad_SetQuadVertexPosition
VBQuad_SetQuadVertexPosition allows to modify the position of one of the four vertices of a particular quad of a VB_Quad mesh.
Syntaxe
HYP_Mesh.VBQuad_SetQuadVertexPosition( mesh_id,
quad_index, vertex_index, x, y, z );
- mesh_id - [INTEGER] - mesh identifier.
- quad_index - [INTEGER] - zero-based quad index.
- vertex_index - [INTEGER] - zero-based vertex index. 0<=vertex_index<=3.
- x, y, z - [REAL] - new vertex position.
Remarque
For the sake of speed, this function does not check the validity of input parameters.
VBQuad_GetQuadVertexPosition
VBQuad_GetQuadVertexPosition allows to retrieve the position of one of the four vertices of a particular quad of a VB_Quad mesh.
Syntaxe
x, y, z = HYP_Mesh.VBQuad_GetQuadVertexPosition( mesh_id,
quad_index, vertex_index );
- mesh_id - [INTEGER] - mesh identifier.
- quad_index - [INTEGER] - zero-based quad index.
- vertex_index - [INTEGER] - zero-based vertex index. 0<=vertex_index<=3.
- x, y, z - [REAL] - vertex position.
Remarque
For the sake of speed, this function does not check the validity of input parameters.
VBQuad_SetQuadVertexUV
VBQuad_SetQuadVertexUV allows to modify the UV coordinates of one of the four vertices of a particular quad of a VB_Quad mesh.
Syntaxe
HYP_Mesh.VBQuad_SetQuadVertexUV( mesh_id,
quad_index, vertex_index, tu, u, v );
- mesh_id - [INTEGER] - mesh identifier.
- quad_index - [INTEGER] - zero-based quad index.
- vertex_index - [INTEGER] - zero-based vertex index. 0<=vertex_index<=3.
- tu - [INTEGER] - texture unit from 0 to 7.
- u, v - [REAL] - new texture coords.
VBQuad_GetQuadVertexUV
VBQuad_GetQuadVertexUV allows to read the UV coordinates of one of the four vertices of a particular quad of a VB_Quad mesh.
Syntaxe
u, v = HYP_Mesh.VBQuad_GetQuadVertexUV( mesh_id,
quad_index, vertex_index, tu );
- mesh_id - [INTEGER] - mesh identifier.
- quad_index - [INTEGER] - zero-based quad index.
- vertex_index - [INTEGER] - zero-based vertex index. 0<=vertex_index<=3.
- tu - [INTEGER] - texture unit from 0 to 7.
- u, v - [REAL] - new texture coords.
VBQuad_SetQuadVertexColor
VBQuad_SetQuadVertexColor allows to modify the color of one of the four vertices of a particular quad of a VB_Quad mesh.
Syntaxe
HYP_Mesh.VBQuad_SetQuadVertexColor( mesh_id,
quad_index, vertex_index, r, g, b, a );
- mesh_id - [INTEGER] - mesh identifier.
- quad_index - [INTEGER] - zero-based quad index.
- vertex_index - [INTEGER] - zero-based vertex index. 0<=vertex_index<=3.
- r, g, b, a - [REAL] - new vertex color.
Remarque
For the sake of speed, this function does not check the validity of input parameters.
VBQuad_GetQuadVertexColor
VBQuad_GetQuadVertexColor allows to retrieve the color of one of the four vertices of a particular quad of a VB_Quad mesh.
Syntaxe
r, g, b, a = HYP_Mesh.VBQuad_GetQuadVertexColor( mesh_id,
quad_index, vertex_index );
- mesh_id - [INTEGER] - mesh identifier.
- quad_index - [INTEGER] - zero-based quad index.
- vertex_index - [INTEGER] - zero-based vertex index. 0<=vertex_index<=3.
- r, g, b, a - [REAL] - vertex color.
Remarque
For the sake of speed, this function does not check the validity of input parameters.
CreateBox
CreateBox allows to create a BOX mesh.
Syntax
id = HYP_Mesh.CreateBox( name,
width, height, depth,
w_segs, h_segs, d_segs );
- name - [STR127] - name to be given to the mesh.
- width - [REAL] - width (X) of the box
- height - [REAL] - height (Y) of the box
- depth - [REAL] - depth (Z) of the box
- w_segs - [INTEGER] - number of X segments
- h_segs - [INTEGER] - number of Y segments
- d_segs - [INTEGER] - number of Z segments
- id - [INTEGER] - identifier of the new created mesh.
CreatePlane
CreatePlane allows to create a PLANE mesh.
Syntax
id = HYP_Mesh.CreatePlane( name,
width, height,
w_segs, h_segs );
- name - [STR127] - name to be given to the mesh.
- width - [REAL] - width (X) of the plane
- height - [REAL] - height (Z) of the plane
- w_segs - [INTEGER] - number of X segments
- h_segs - [INTEGER] - number of Z segments
- id - [INTEGER] - identifier of the new created mesh.
CreateSphere
CreateSphere allows to create a SPHERE type mesh.
Syntax
id = HYP_Mesh.CreateSphere( name, radius, stacks, slices );
- name - [STR127] - name to be given to the mesh.
- radius - [REAL] - sphere radius.
- stacks - [INTEGER] - number of vertical divisions.
- slices - [INTEGER] - number of horizontal divisions.
- id - [INTEGER] - identifier of the new created mesh.
CreateTorus
CreateTorus allows to create a TORUS type mesh.
Syntax
id = HYP_Mesh.CreateTorus( name,
radius,
slices,
section_radius );
- name - [STR127] - name to be given to the mesh.
- radius - [REAL] - large radius of the torus.
- slices - [INTEGER] - number of horizontal divisions.
- section_radius - [REAL] - small radius of the torus.
- id - [INTEGER] - identifier of the new created mesh.
Destroy
Destroy allows to destroy a mesh created with one of the mesh creation functions.
Syntax
HYP_Mesh.Destroy( name|id );
- name - [STR127] - mesh name.
- id - [INTEGER] - mesh identifier.
GetFaceCenterPosition
GetFaceCenterPosition allows to get the centre position of a mesh paticular face.
Syntax
x, y, z = HYP_Mesh.GetFaceCenterPosition( mesh_name| mesh_id, face_index );
- mesh_name - [STR127] - mesh name as spécified in the XML script wiht the name attribute.
- mesh_id - [INTEGER] - mesh identifier.
- face_index - [INTEGER] - face index. This index must be contained between 0 and HYP_Mesh.GetNumFaces()-1.
- x, y, z - [REAL] - position coordinates.
VBQuad_SortFacesInCameraSpace
VBQuad_SortFacesInCameraSpace performs faces sorting in camera space.
Syntax
HYP_Mesh.VBQuad_SortFacesInCameraSpace( vbquad_id, camera_id, order );
- vbquad_id - [INTEGER] - vbquad identifier.
- camera_id - [INTEGER] - camera identifier.
- order - [INTEGER] - faces sorting order:
- FRONT_TO_BACK = 0
- BACK_TO_FRONT = 1