ent_getmesh(ENTITY* ent,var num,var lod);
ent_setmesh(ENTITY* ent,void* mesh,var num,var lod);
Returns or sets the DirectX mesh of the given model or terrain entity.
Parameters:
ent - model or terrain entity pointer, or NULL for level blocks ( A7 only)
num - number of the terrain chunk or level block,
beginning with 0.
lod - number of the lod step for the mesh, 0..3.
Returns
LPD3DXMESH cast to void*, or zero if the entity contains
less meshes
than the given mesh or lod number.
Speed:
FastRemarks:
- When setting the mesh of an entity, the old mesh is automatically
released.
- Meshes can be set only for nonanimated entities.
-
The mesh vertex format (D3DVERTEX) is described
in the shader
section, and defined in the atypes.h file
in the lite-C
include directory.
- You can set a mesh that you've allocated, but you should
then release it yourself at the end of the game (see example).
The reason is that a mesh allocated by a DLL compiled
with a certain DirectX SDK version should be released using the
same SDK version.
Example (lite-C):
...
#include <d3d9.h>
...
LPD3DXMESH pMesh = (LPD3DXMESH)ent_getmesh(my,0,0);
LPD3DXMESH pNewMesh;
D3DXCreateMeshFVF(num_tris,num_verts,D3DXMESH_MANAGED,D3DFVF_D3DVERTEX,(LPDIRECT3DDEVICE9)pd3ddev,&pNewMesh);
// set vertices, triangles, and attributes
...
ent_setmesh(my,pNewMesh,0,0);
...
// deallocate mesh at end of level or game
pNewMesh = ent_getmesh(my,0,0);
pNewMesh->Release();
ent_setmesh(my,NULL,0,0);
See also:
ent_vertices
► latest
version online