|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CMeshGeom Class ReferenceA mesh geometry.
More...
#include <mesh.h>
Inheritance diagram for NL3D::CMeshGeom:
List of all members.
Skinning |
enum | TSkinType { SkinPosOnly = 0,
SkinWithNormal,
SkinWithTgSpace
} |
void | buildSkin (CMesh::CMeshBuild &m, std::vector< CFaceTmp > &tmpFaces) |
void | buildBoneUsageVer3 () |
void | bkupOriginalSkinVertices () |
void | restoreOriginalSkinVertices () |
void | applySkin (CSkeletonModel *skeleton) |
void | flagSkinVerticesForMatrixBlock (uint8 *skinFlags, CMatrixBlock &mb) |
void | computeSkinMatrixes (CSkeletonModel *skeleton, CMatrix3x4 *matrixes, CMatrixBlock *prevBlock, CMatrixBlock &curBlock) |
void | computeSoftwarePointSkinning (CMatrix3x4 *matrixes, CVector *srcVector, CPaletteSkin *srcPal, float *srcWgt, CVector *dstVector) |
void | computeSoftwareVectorSkinning (CMatrix3x4 *matrixes, CVector *srcVector, CPaletteSkin *srcPal, float *srcWgt, CVector *dstVector) |
VBufferHard mgt. |
void | updateVertexBufferHard (IDriver *drv) |
| update the VertexBufferHard if NULL (ie not created or deleted by driver) or if VertexBufferDirty. More...
|
CRefPtr< IVertexBufferHard > | _VertexBufferHard |
| The only one VBufferHard of the mesh. NULL by default. More...
|
CRefPtr< IDriver > | _Driver |
| This is the driver used to setup the vbuffer hard. error if a mesh has not the same driver in his life. More...
|
bool | _VertexBufferHardDirty |
| This tells if the VBuffer has changed since the last time or not. More...
|
Public Methods |
| CMeshGeom () |
| Constructor. More...
|
virtual | ~CMeshGeom () |
void | build (CMesh::CMeshBuild &mbuild, uint numMaxMaterial) |
| Build a meshGeom. More...
|
void | setBlendShapes (std::vector< CBlendShape > &bs) |
| If all texture coordinates are of dimension 2, we can setup the flags as before. More...
|
void | applyMaterialRemap (const std::vector< sint > &remap) |
| change materials Ids (called from CMesh::optimizeMaterialUsage()). More...
|
void | renderSimpleWithMaterial (IDriver *drv, const CMatrix &worldMatrix, CMaterial &mat) |
| render the mesh geometry with a single material. More...
|
|
virtual void | initInstance (CMeshBaseInstance *mbi) |
| Init instance info. More...
|
virtual bool | clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix) |
| clip this mesh. More...
|
virtual void | render (IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha) |
| render() this mesh in a driver. More...
|
virtual void | renderSkin (CTransformShape *trans, float alphaMRM) |
| render() this mesh as a skin. More...
|
virtual float | getNumTriangles (float distance) |
| get an approximation of the number of triangles this instance will render for a fixed distance. More...
|
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| serial this mesh. More...
|
| NLMISC_DECLARE_CLASS (CMeshGeom) |
|
const NLMISC::CAABBoxExt & | getBoundingBox () const |
| get the extended axis aligned bounding box of the mesh. More...
|
const CVertexBuffer & | getVertexBuffer () const |
| get the vertex buffer used by the mesh. More...
|
uint | getNbMatrixBlock () const |
| get the number of matrix block. More...
|
uint | getNbRdrPass (uint matrixBlockIndex) const |
| get the number of rendering pass for a given matrix block. More...
|
const CPrimitiveBlock & | getRdrPassPrimitiveBlock (uint matrixBlockIndex, uint renderingPassIndex) const |
| get the primitive block associated with a rendering pass of a matrix block. More...
|
uint32 | getRdrPassMaterial (uint matrixBlockIndex, uint renderingPassIndex) const |
| get the material ID associated with a rendering pass of a matrix block. More...
|
|
bool | isSkinned () const |
| Return true if the mesh is skinned, else return false. More...
|
void | computeBonesId (CSkeletonModel *skeleton) |
| Compute skinning id. More...
|
void | updateSkeletonUsage (CSkeletonModel *sm, bool increment) |
| update Skeleton Usage. increment or decrement. computeBonesId must has been called before. More...
|
const std::vector< sint32 > & | getSkinBoneUsage () const |
| return array of bones used by the skin. computeBonesId must has been called before. More...
|
|
virtual bool | supportMeshBlockRendering () const |
| true if this meshGeom support meshBlock rendering. More...
|
virtual bool | sortPerMaterial () const |
| true if the sort criterion must be by material. More...
|
virtual uint | getNumRdrPasses () const |
| return the number of renderPasses for this mesh. More...
|
virtual void | beginMesh (CMeshGeomRenderContext &rdrCtx) |
| The framework call this method when he will render instances of this meshGeom soon. More...
|
virtual void | activeInstance (CMeshGeomRenderContext &rdrCtx, CMeshBaseInstance *inst, float polygonCount) |
| The framework call this method any time a change of instance occurs. More...
|
virtual void | renderPass (CMeshGeomRenderContext &rdrCtx, CMeshBaseInstance *inst, float polygonCount, uint rdrPass) |
| The framework call this method to render the current renderPass, with the current instance NB: if the material is blended, DON'T render it!! More...
|
virtual void | endMesh (CMeshGeomRenderContext &rdrCtx) |
| The framework call this method when it has done with this meshGeom. More...
|
virtual bool | getVBHeapInfo (uint &vertexFormat, uint &numVertices) |
| The framework call this method to know if the mesh can fit in VBHeap. More...
|
virtual void | computeMeshVBHeap (void *dst, uint indexStart) |
| When the framework succes to allocate a VBHeap space, it call this method to fill this space and compute shifted Primitive block. More...
|
Private Types |
typedef std::map< uint, CBoneTmp > | TBoneMap |
| Just for build process. More...
|
typedef TBoneMap::iterator | ItBoneMap |
typedef std::set< CCornerTmp *,
CCornerPred > | TCornerSet |
typedef TCornerSet::iterator | ItCornerSet |
Private Methods |
void | findVBId (TCornerSet &corners, const CCornerTmp *corn, sint ¤tVBIndex, const CVector &vert, const CMesh::CMeshBuild &mb) |
void | optimizeTriangleOrder () |
void | compileRunTime () |
Private Attributes |
std::vector< CVector > | _OriginalSkinVertices |
| Skinning: this is the list of vertices (mirror of VBuffer), at the bind Pos. More...
|
std::vector< CVector > | _OriginalSkinNormals |
std::vector< CVector > | _OriginalTGSpace |
CVertexBuffer | _VBuffer |
| VBuffer of the mesh (potentially modified by the mesh morpher and skinning). More...
|
CVertexBuffer | _VBufferOri |
| The original VBuffer of the mesh used only if there are blend shapes. More...
|
std::vector< CMatrixBlock > | _MatrixBlocks |
| The matrix blocks. More...
|
NLMISC::CAABBoxExt | _BBox |
| For clipping. More...
|
bool | _Skinned |
| This tells if the mesh is correctly skinned. More...
|
bool | _OriginalSkinRestored |
| This tells if the mesh VBuffer has coorect BindPos vertices. More...
|
bool | _BoneIdComputed |
| This boolean is true if the bones id have been passed in the skeleton. More...
|
bool | _BoneIdExtended |
| true if the _BonesIdExt have been computed (for bone Usage). More...
|
std::vector< std::string > | _BonesName |
| This array give the name of the local bones used. More...
|
std::vector< sint32 > | _BonesId |
| This array give the index in the skeleton of the local bones used. computed at first computeBoneId(). More...
|
std::vector< sint32 > | _BonesIdExt |
| Same as _BonesId but with parent of bones added. (used for bone usage). More...
|
bool | _PreciseClipping |
| Estimate if we must do a Precise clipping (ie with bboxes). More...
|
CMeshMorpher * | _MeshMorpher |
NLMISC::CSmartPtr< IMeshVertexProgram > | _MeshVertexProgram |
|
bool | _SupportMeshBlockRendering |
| setuped at compileRunTime. More...
|
Detailed Description
A mesh geometry.
Skinning support: support only palette skinning. -
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2000
Definition at line 328 of file mesh.h.
Member Typedef Documentation
typedef TBoneMap::iterator NL3D::CMeshGeom::ItBoneMap [private]
|
|
typedef TCornerSet::iterator NL3D::CMeshGeom::ItCornerSet [private]
|
|
typedef std::map<uint, CBoneTmp> NL3D::CMeshGeom::TBoneMap [private]
|
|
|
Just for build process.
A map of Bone.
Definition at line 589 of file mesh.h.
Referenced by buildSkin. |
Member Enumeration Documentation
enum NL3D::CMeshGeom::TSkinType [private]
|
|
|
-
Enumeration values:
-
SkinPosOnly |
|
SkinWithNormal |
|
SkinWithTgSpace |
|
Definition at line 776 of file mesh.h.
Referenced by applySkin. |
Constructor & Destructor Documentation
NL3D::CMeshGeom::CMeshGeom |
( |
|
) |
|
|
NL3D::CMeshGeom::~CMeshGeom |
( |
|
) |
[virtual] |
|
Member Function Documentation
|
The framework call this method any time a change of instance occurs.
Implements NL3D::IMeshGeom.
Definition at line 1956 of file mesh.cpp. |
void NL3D::CMeshGeom::applyMaterialRemap |
( |
const std::vector< sint > & |
remap |
) |
|
|
void NL3D::CMeshGeom::applySkin |
( |
CSkeletonModel * |
skeleton |
) |
[private] |
|
|
Definition at line 1690 of file mesh.cpp.
References _MatrixBlocks, _OriginalSkinNormals, _OriginalSkinRestored, _OriginalSkinVertices, _OriginalTGSpace, _VBuffer, computeSkinMatrixes, computeSoftwarePointSkinning, computeSoftwareVectorSkinning, flagSkinVerticesForMatrixBlock, NL3D_SOFTSKIN_VCOMPUTED, NL3D_SOFTSKIN_VMUSTCOMPUTE, NL3D_SOFTSKIN_VNEEDCOMPUTE, nlassert, SkinPosOnly, SkinWithNormal, SkinWithTgSpace, and TSkinType.
Referenced by renderSkin. |
void NL3D::CMeshGeom::bkupOriginalSkinVertices |
( |
|
) |
[private] |
|
|
Build a meshGeom.
Definition at line 172 of file mesh.cpp.
References _BBox, _BoneIdComputed, _BoneIdExtended, _BonesName, _MatrixBlocks, _MeshMorpher, _MeshVertexProgram, _Skinned, _VBuffer, _VertexBufferHardDirty, buildSkin, compileRunTime, findVBId, NL3D::makeBBox, matrix, nlassert, optimizeTriangleOrder, NLMISC::CAABBoxExt::setCenter, NLMISC::CAABBoxExt::setSize, and TCornerSet. |
void NL3D::CMeshGeom::buildBoneUsageVer3 |
( |
|
) |
[private] |
|
bool NL3D::CMeshGeom::clip |
( |
const std::vector< CPlane > & |
pyramid, |
|
|
const CMatrix & |
worldMatrix |
|
) |
[virtual] |
|
void NL3D::CMeshGeom::compileRunTime |
( |
|
) |
[private] |
|
|
Definition at line 1049 of file mesh.cpp.
References _BBox, _MatrixBlocks, _MeshMorpher, _MeshVertexProgram, _PreciseClipping, _Skinned, _SupportMeshBlockRendering, bkupOriginalSkinVertices, NLMISC::CAABBoxExt::getRadius, and NL3D_MESH_PRECISE_CLIP_THRESHOLD.
Referenced by build, and setBlendShapes. |
void NL3D::CMeshGeom::computeMeshVBHeap |
( |
void * |
dst, |
|
|
uint |
indexStart |
|
) |
[virtual] |
|
|
When the framework succes to allocate a VBHeap space, it call this method to fill this space and compute shifted Primitive block.
-
Parameters:
-
the |
dest VertexBuffer. NB: start to fill at dst[0] |
indexStart |
used to shift primitive block. |
Reimplemented from NL3D::IMeshGeom.
Definition at line 2002 of file mesh.cpp.
References _MatrixBlocks, _VBuffer, and nlassert. |
void NL3D::CMeshGeom::computeSoftwarePointSkinning |
( |
CMatrix3x4 * |
matrixes, |
|
|
CVector * |
srcVector, |
|
|
CPaletteSkin * |
srcPal, |
|
|
float * |
srcWgt, |
|
|
CVector * |
dstVector |
|
) |
[private] |
|
void NL3D::CMeshGeom::computeSoftwareVectorSkinning |
( |
CMatrix3x4 * |
matrixes, |
|
|
CVector * |
srcVector, |
|
|
CPaletteSkin * |
srcPal, |
|
|
float * |
srcWgt, |
|
|
CVector * |
dstVector |
|
) |
[private] |
|
|
The framework call this method when it has done with this meshGeom.
Implements NL3D::IMeshGeom.
Definition at line 1986 of file mesh.cpp. |
void NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock |
( |
uint8 * |
skinFlags, |
|
|
CMatrixBlock & |
mb |
|
) |
[private] |
|
uint NL3D::CMeshGeom::getNbMatrixBlock |
( |
|
) |
const [inline] |
|
uint NL3D::CMeshGeom::getNbRdrPass |
( |
uint |
matrixBlockIndex |
) |
const [inline] |
|
|
get the number of rendering pass for a given matrix block.
-
Parameters:
-
matrixBlockIndex |
the index of the matrix block the rendering passes belong to |
Definition at line 388 of file mesh.h.
References _MatrixBlocks.
Referenced by applyMaterialRemap. |
uint NL3D::CMeshGeom::getNumRdrPasses |
( |
|
) |
const [virtual] |
|
float NL3D::CMeshGeom::getNumTriangles |
( |
float |
distance |
) |
[virtual] |
|
|
get an approximation of the number of triangles this instance will render for a fixed distance.
-
Parameters:
-
distance |
is the distance of the shape from the eye. |
-
Returns:
-
the approximate number of triangles this instance will render at this distance. This number can be a float. The function MUST be decreasing or constant with the distance but don't have to be continus.
Implements NL3D::IMeshGeom.
Definition at line 1404 of file mesh.cpp.
References _MatrixBlocks. |
uint32 NL3D::CMeshGeom::getRdrPassMaterial |
( |
uint |
matrixBlockIndex, |
|
|
uint |
renderingPassIndex |
|
) |
const [inline] |
|
|
get the material ID associated with a rendering pass of a matrix block.
-
Parameters:
-
matrixBlockIndex |
the index of the matrix block the renderin pass belong to |
renderingPassIndex |
the index of the rendering pass in the matrix block |
Definition at line 403 of file mesh.h.
References _MatrixBlocks. |
const CPrimitiveBlock& NL3D::CMeshGeom::getRdrPassPrimitiveBlock |
( |
uint |
matrixBlockIndex, |
|
|
uint |
renderingPassIndex |
|
) |
const [inline] |
|
|
get the primitive block associated with a rendering pass of a matrix block.
-
Parameters:
-
matrixBlockIndex |
the index of the matrix block the renderin pass belong to |
renderingPassIndex |
the index of the rendering pass in the matrix block |
Definition at line 394 of file mesh.h.
References _MatrixBlocks. |
const std::vector<sint32>& NL3D::CMeshGeom::getSkinBoneUsage |
( |
|
) |
const [inline] |
|
|
return array of bones used by the skin. computeBonesId must has been called before.
Definition at line 427 of file mesh.h.
References _BonesId. |
bool NL3D::CMeshGeom::getVBHeapInfo |
( |
uint & |
vertexFormat, |
|
|
uint & |
numVertices |
|
) |
[virtual] |
|
const CVertexBuffer& NL3D::CMeshGeom::getVertexBuffer |
( |
|
) |
const [inline] |
|
|
get the vertex buffer used by the mesh.
Definition at line 380 of file mesh.h.
References _VBuffer. |
bool NL3D::CMeshGeom::isSkinned |
( |
|
) |
const [inline] |
|
|
Return true if the mesh is skinned, else return false.
Definition at line 415 of file mesh.h.
References _Skinned. |
NL3D::CMeshGeom::NLMISC_DECLARE_CLASS |
( |
CMeshGeom |
|
) |
|
|
void NL3D::CMeshGeom::optimizeTriangleOrder |
( |
|
) |
[private] |
|
|
render() this mesh in a driver.
Implements NL3D::IMeshGeom.
Definition at line 589 of file mesh.cpp.
References _MatrixBlocks, _MeshMorpher, _MeshVertexProgram, _OriginalSkinNormals, _OriginalSkinRestored, _OriginalSkinVertices, _OriginalTGSpace, _Skinned, _VBuffer, _VBufferOri, _VertexBufferHard, H_AUTO, nlassert, NL3D::OptFastFloor, restoreOriginalSkinVertices, and updateVertexBufferHard. |
|
The framework call this method to render the current renderPass, with the current instance NB: if the material is blended, DON'T render it!!
Implements NL3D::IMeshGeom.
Definition at line 1967 of file mesh.cpp.
References _MatrixBlocks. |
void NL3D::CMeshGeom::renderSimpleWithMaterial |
( |
IDriver * |
drv, |
|
|
const CMatrix & |
worldMatrix, |
|
|
CMaterial & |
mat |
|
) |
|
|
|
render the mesh geometry with a single material.
Render is said "Simple" because no special features are used:
- mesh is rendered without VertexProgram (if it has one).
- mesh is rendered without Skinning.
- mesh is rendered without use of VertexBufferHard.
- mesh is rendered without MeshMorpher.
- .....
Definition at line 907 of file mesh.cpp.
References _MatrixBlocks, _VBuffer, and nlassert. |
void NL3D::CMeshGeom::renderSkin |
( |
CTransformShape * |
trans, |
|
|
float |
alphaMRM |
|
) |
[virtual] |
|
|
render() this mesh as a skin.
Implements NL3D::IMeshGeom.
Definition at line 780 of file mesh.cpp.
References _MatrixBlocks, _MeshMorpher, _MeshVertexProgram, _OriginalSkinNormals, _OriginalSkinVertices, _OriginalTGSpace, _Skinned, _VBuffer, _VBufferOri, _VertexBufferHard, applySkin, H_AUTO, nlassert, and updateVertexBufferHard. |
void NL3D::CMeshGeom::restoreOriginalSkinVertices |
( |
|
) |
[private] |
|
void NL3D::CMeshGeom::setBlendShapes |
( |
std::vector< CBlendShape > & |
bs |
) |
|
|
|
If all texture coordinates are of dimension 2, we can setup the flags as before.
If this isn't the case, we must setup a custom format
Definition at line 446 of file mesh.cpp.
References _MeshMorpher, and compileRunTime. |
bool NL3D::CMeshGeom::sortPerMaterial |
( |
|
) |
const [virtual] |
|
|
true if the sort criterion must be by material.
Else, sort per instance.
Implements NL3D::IMeshGeom.
Definition at line 1920 of file mesh.cpp. |
bool NL3D::CMeshGeom::supportMeshBlockRendering |
( |
|
) |
const [virtual] |
|
void NL3D::CMeshGeom::updateSkeletonUsage |
( |
CSkeletonModel * |
sm, |
|
|
bool |
increment |
|
) |
|
|
|
update Skeleton Usage. increment or decrement. computeBonesId must has been called before.
Definition at line 1571 of file mesh.cpp.
References _BonesIdExt, and nlerror. |
void NL3D::CMeshGeom::updateVertexBufferHard |
( |
IDriver * |
drv |
) |
[private] |
|
Member Data Documentation
bool NL3D::CMeshGeom::_BoneIdComputed [private]
|
|
bool NL3D::CMeshGeom::_BoneIdExtended [private]
|
|
std::vector<sint32> NL3D::CMeshGeom::_BonesId [private]
|
|
std::vector<sint32> NL3D::CMeshGeom::_BonesIdExt [private]
|
|
std::vector<std::string> NL3D::CMeshGeom::_BonesName [private]
|
|
CRefPtr<IDriver> NL3D::CMeshGeom::_Driver [private]
|
|
std::vector<CMatrixBlock> NL3D::CMeshGeom::_MatrixBlocks [private]
|
|
|
The matrix blocks.
Definition at line 644 of file mesh.h.
Referenced by applyMaterialRemap, applySkin, build, buildBoneUsageVer3, buildSkin, compileRunTime, computeBonesId, computeMeshVBHeap, getNbMatrixBlock, getNbRdrPass, getNumRdrPasses, getNumTriangles, getRdrPassMaterial, getRdrPassPrimitiveBlock, optimizeTriangleOrder, render, renderPass, renderSimpleWithMaterial, and renderSkin. |
std::vector<CVector> NL3D::CMeshGeom::_OriginalSkinNormals [private]
|
|
bool NL3D::CMeshGeom::_OriginalSkinRestored [private]
|
|
std::vector<CVector> NL3D::CMeshGeom::_OriginalSkinVertices [private]
|
|
std::vector<CVector> NL3D::CMeshGeom::_OriginalTGSpace [private]
|
|
bool NL3D::CMeshGeom::_PreciseClipping [private]
|
|
bool NL3D::CMeshGeom::_Skinned [private]
|
|
bool NL3D::CMeshGeom::_SupportMeshBlockRendering [private]
|
|
|
VBuffer of the mesh (potentially modified by the mesh morpher and skinning).
Definition at line 640 of file mesh.h.
Referenced by applySkin, beginMesh, bkupOriginalSkinVertices, build, computeMeshVBHeap, findVBId, getVBHeapInfo, getVertexBuffer, render, renderSimpleWithMaterial, renderSkin, restoreOriginalSkinVertices, and updateVertexBufferHard. |
|
The original VBuffer of the mesh used only if there are blend shapes.
Definition at line 642 of file mesh.h.
Referenced by render, and renderSkin. |
bool NL3D::CMeshGeom::_VertexBufferHardDirty [private]
|
|
The documentation for this class was generated from the following files:
|
|