TSMesh

Engine/source/ts/tsMesh.h

}

More...

Classes:

Aligned Vertex Data

{

enum
_Anonymous_ {
  StandardMeshType = 0
  SkinMeshType = 1
  DecalMeshType = 2
  SortedMeshType = 3
  NullMeshType = 4
  TypeMask = StandardMeshType|SkinMeshType|DecalMeshType|SortedMeshType|NullMeshType
  Billboard = BIT(31)
  HasDetailTexture = BIT(30)
  BillboardZAxis = BIT(29)
  UseEncodedNormals = BIT(28)
  HasColor = BIT(27)
  HasTVert2 = BIT(26)
  FlagMask = Billboard|BillboardZAxis|HasDetailTexture|UseEncodedNormals|HasColor|HasTVert2
}

Convex Hull Data

Convex hulls are convex (no angles >= 180º) meshes used for collision

Assembly Variables

variables used during assembly (for skipping mesh detail levels on load and for sharing verts between meshes)

Render Methods

This is used by sgShadowProjector to render the mesh directly, skipping the render manager.

render(TSMaterialList * , const TSRenderState & data, bool isSkinDirty, const Vector< MatrixF > & transforms, TSVertexBufferHandle & vertexBuffer, const char * meshName)

Material Methods

Collision Methods

bool
buildPolyList(S32 frame, AbstractPolyList * polyList, U32 & surfaceKey, TSMaterialList * materials)
bool
getFeatures(S32 frame, const MatrixF & , const VectorF & , ConvexFeature * , U32 & surfaceKey)
support(S32 frame, const Point3F & v, F32 * currMaxDP, Point3F * currSupport)
bool
castRay(S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList * materials)
bool
castRayRendered(S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList * materials)
bool

returns false if not convex (still builds planes)

bool
addToHull(U32 idx0, U32 idx1, U32 idx2)

Bounding Methods

calculate and get bounding information

computeBounds(const MatrixF & transform, Box3F & bounds, S32 frame, Point3F * center, F32 * radius)
computeBounds(const Point3F * , S32 numVerts, S32 stride, const MatrixF & transform, Box3F & bounds, Point3F * center, F32 * radius)

Public Friends

class

Public Attributes

billboard data

Opcode::MeshInterface *
IceMaths::Point *
IceMaths::IndexedTriangle *
Opcode::Model *

Public Static Attributes

Default node transform for standard meshes which have blend indices.

Enables mesh instancing on non-skin meshes that have less that this count of verts.

bool

on load...optionally convert primitives to other form

Public Functions

assemble(bool skip)

persist methods...

bool
buildConvexOpcode(const MatrixF & mat, const Box3F & bounds, Convex * c, Convex * list)
bool
buildPolyListOpcode(const S32 od, AbstractPolyList * polyList, const Box3F & nodeBox, TSMaterialList * materials)
bool
castRayOpcode(const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList * materials)

Clears split vertex lists.

convertToSingleStrip(const TSDrawPrimitive * primitivesIn, const S32 * indicesIn, S32 numPrimIn, S32 & numPrimOut, S32 & numIndicesOut, TSDrawPrimitive * primitivesOut, S32 * indicesOut)
convertToTris(const TSDrawPrimitive * primitivesIn, const S32 * indicesIn, S32 numPrimIn, S32 & numPrimOut, S32 & numIndicesOut, TSDrawPrimitive * primitivesOut, S32 * indicesOut)

convert primitives on load...

dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive * piArray, U16 * ibIndices)
findTangent(U32 index1, U32 index2, U32 index3, Point3F * tan0, Point3F * tan1, const Vector< Point3F > & _verts)
S32 *
getSharedData32(S32 parentMesh, S32 size, S32 ** source, bool skip)

methods used during assembly to share vertexand other info between meshes (and for skipping detail levels on load)

S8 *
getSharedData8(S32 parentMesh, S32 size, S8 ** source, bool skip)
leaveAsMultipleStrips(const TSDrawPrimitive * primitivesIn, const S32 * indicesIn, S32 numPrimIn, S32 & numPrimOut, S32 & numIndicesOut, TSDrawPrimitive * primitivesOut, S32 * indicesOut)

Moves vertices from the vertex buffer back into the split vert lists, unless verts already exist.

Public Static Functions

assembleMesh(U32 meshType, bool skip)

Detailed Description

}

Aligned Vertex Data

{

@207

Enumerator

StandardMeshType = 0

types...

SkinMeshType = 1
DecalMeshType = 2
SortedMeshType = 3
NullMeshType = 4
TypeMask = StandardMeshType|SkinMeshType|DecalMeshType|SortedMeshType|NullMeshType
Billboard = BIT(31)

flags (stored with meshType)...

HasDetailTexture = BIT(30)
BillboardZAxis = BIT(29)
UseEncodedNormals = BIT(28)
HasColor = BIT(27)
HasTVert2 = BIT(26)
FlagMask = Billboard|BillboardZAxis|HasDetailTexture|UseEncodedNormals|HasColor|HasTVert2
_convertToVertexData(TSMeshVertexArray & outArray, const Vector< Point3F > & _verts, const Vector< Point3F > & _norms)

getMeshType()

getHasColor()

getHasTVert2()

setFlags(U32 flag)

clearFlags(U32 flag)

getFlags(U32 flag)

getNormals(S32 firstVert)

convertToVertexData()

Reimplemented by: TSSkinMesh

copySourceVertexDataFrom(const TSMesh * srcMesh)

Reimplemented by: TSSkinMesh

U32 mMeshType 
Box3F mBounds 
Point3F mCenter 
F32 mRadius 
F32 mVisibility 
const GFXVertexFormat * mVertexFormat 
TSMesh * mParentMeshObject 

Current parent object instance.

U32 mPrimBufferOffset 
GFXVertexBufferDataHandle mVB 
GFXPrimitiveBufferHandle mPB 
S32 mParentMesh 

index into shapes mesh list

S32 numFrames 
S32 numMatFrames 
S32 vertsPerFrame 
U32 mVertOffset 
U32 mVertSize 
TSMeshVertexArray mVertexData 
U32 mNumVerts 

Number of verts allocated in main vertex buffer.

Vertex data

FreeableVector< Point3F > mVerts 
FreeableVector< Point3F > mNorms 
FreeableVector< Point2F > mTverts 
FreeableVector< Point4F > mTangents 
FreeableVector< Point2F > mTverts2 
FreeableVector< ColorI > mColors 

Convex Hull Data

Convex hulls are convex (no angles >= 180º) meshes used for collision

Vector< Point3F > mPlaneNormals 
Vector< F32 > mPlaneConstants 
Vector< U32 > mPlaneMaterials 
S32 mPlanesPerFrame 
U32 mMergeBufferStart 

Assembly Variables

variables used during assembly (for skipping mesh detail levels on load and for sharing verts between meshes)

Vector< Point3F * > smVertsList 
Vector< Point3F * > smNormsList 
Vector< U8 * > smEncodedNormsList 
Vector< Point2F * > smTVertsList 
Vector< Point2F * > smTVerts2List 
Vector< ColorI * > smColorsList 
Vector< bool > smDataCopied 
const Point3F smU8ToNormalTable []

Render Methods

render(TSVertexBufferHandle & vb)

This is used by sgShadowProjector to render the mesh directly, skipping the render manager.

Reimplemented by: TSSkinMesh

innerRender(TSVertexBufferHandle & vb, GFXPrimitiveBufferHandle & pb)

render(TSMaterialList * , const TSRenderState & data, bool isSkinDirty, const Vector< MatrixF > & transforms, TSVertexBufferHandle & vertexBuffer, const char * meshName)

Reimplemented by: TSSkinMesh

innerRender(TSMaterialList * , const TSRenderState & data, TSVertexBufferHandle & vb, GFXPrimitiveBufferHandle & pb, const char * meshName)

Material Methods

setFade(F32 fade)

clearFade()

Collision Methods

buildPolyList(S32 frame, AbstractPolyList * polyList, U32 & surfaceKey, TSMaterialList * materials)

Reimplemented by: TSSkinMesh, TSSortedMesh

getFeatures(S32 frame, const MatrixF & , const VectorF & , ConvexFeature * , U32 & surfaceKey)

support(S32 frame, const Point3F & v, F32 * currMaxDP, Point3F * currSupport)

castRay(S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList * materials)

Reimplemented by: TSSkinMesh, TSSortedMesh

castRayRendered(S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList * materials)

buildConvexHull()

returns false if not convex (still builds planes)

Reimplemented by: TSSkinMesh, TSSortedMesh

addToHull(U32 idx0, U32 idx1, U32 idx2)

Bounding Methods

calculate and get bounding information

computeBounds()

computeBounds(const MatrixF & transform, Box3F & bounds, S32 frame, Point3F * center, F32 * radius)

Reimplemented by: TSSkinMesh

computeBounds(const Point3F * , S32 numVerts, S32 stride, const MatrixF & transform, Box3F & bounds, Point3F * center, F32 * radius)

getBounds()

getCenter()

getRadius()

getNumPolys()

encodeNormal(const Point3F & normal)

decodeNormal(U8 ncode)

Public Friends

Public Attributes

Point3F mBillboardAxis 

billboard data

Vector< U8 > mEncodedNorms 
Vector< U32 > mIndices 
Opcode::MeshInterface * mOpMeshInterface 
IceMaths::Point * mOpPoints 
IceMaths::IndexedTriangle * mOpTris 
Opcode::Model * mOptTree 
Vector< TSDrawPrimitive > mPrimitives 

Public Static Attributes

MatrixF smDummyNodeTransform 

Default node transform for standard meshes which have blend indices.

S32 smMaxInstancingVerts 

Enables mesh instancing on non-skin meshes that have less that this count of verts.

S32 smMinStripSize 
bool smUseEncodedNormals 
bool smUseOneStrip 
bool smUseTriangles 

on load...optionally convert primitives to other form

const F32 VISIBILITY_EPSILON 

Public Functions

TSMesh()

~TSMesh()

assemble(bool skip)

persist methods...

Reimplemented by: TSSkinMesh, TSSortedMesh

buildConvexOpcode(const MatrixF & mat, const Box3F & bounds, Convex * c, Convex * list)

buildPolyListOpcode(const S32 od, AbstractPolyList * polyList, const Box3F & nodeBox, TSMaterialList * materials)

castRayOpcode(const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList * materials)

clearEditable()

Clears split vertex lists.

Reimplemented by: TSSkinMesh

convertToSingleStrip(const TSDrawPrimitive * primitivesIn, const S32 * indicesIn, S32 numPrimIn, S32 & numPrimOut, S32 & numIndicesOut, TSDrawPrimitive * primitivesOut, S32 * indicesOut)

convertToTris(const TSDrawPrimitive * primitivesIn, const S32 * indicesIn, S32 numPrimIn, S32 & numPrimOut, S32 & numIndicesOut, TSDrawPrimitive * primitivesOut, S32 * indicesOut)

convert primitives on load...

createTangents(const Vector< Point3F > & _verts, const Vector< Point3F > & _norms)

disassemble()

Reimplemented by: TSSkinMesh, TSSortedMesh

dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive * piArray, U16 * ibIndices)

findTangent(U32 index1, U32 index2, U32 index3, Point3F * tan0, Point3F * tan1, const Vector< Point3F > & _verts)

getMaxBonesPerVert()

Reimplemented by: TSSkinMesh

getNumVerts()

getSharedData32(S32 parentMesh, S32 size, S32 ** source, bool skip)

methods used during assembly to share vertexand other info between meshes (and for skipping detail levels on load)

getSharedData8(S32 parentMesh, S32 size, S8 ** source, bool skip)

leaveAsMultipleStrips(const TSDrawPrimitive * primitivesIn, const S32 * indicesIn, S32 numPrimIn, S32 & numPrimOut, S32 & numIndicesOut, TSDrawPrimitive * primitivesOut, S32 * indicesOut)

makeEditable()

Moves vertices from the vertex buffer back into the split vert lists, unless verts already exist.

Reimplemented by: TSSkinMesh

prepOpcodeCollision()

updateMeshFlags()

Public Static Functions

assembleMesh(U32 meshType, bool skip)