160 if(NbDegenerate)
Log(
"OPCODE WARNING: found %d degenerate faces in model! Collision might report wrong results!\n", NbDegenerate);
193 if(current->IsLeaf())
204 if(current->IsLeaf())
246 bool MustKeepIndices =
true;
254 MustKeepIndices =
false;
276 if(!LeafTree->
Build(&TB))
goto FreeAndExit;
315 #ifdef OPC_USE_FCOMI // a 15% speedup on my machine, not much 345 if(!
mTree)
return false;
363 if(Current.HasPosLeaf())
365 const LeafTriangles& CurrentLeaf = LT[Current.GetPosPrimitive()];
370 Point TmpMin, TmpMax;
408 if(Current.HasNegLeaf())
410 const LeafTriangles& CurrentLeaf = LT[Current.GetNegPrimitive()];
415 Point TmpMin, TmpMax;
463 Current.mAABB.SetMinMax(Min, Max);
virtual udword GetUsedBytes() const =0
virtual udword GetUsedBytes() const =0
inline_ void ComputeMinMax(Point &min, Point &max, const VertexPointers &vp)
inline_ void GetMin(Point &min) const
Get min point of the box.
inline_ float FCMin2(float a, float b)
A global function to find MIN(a,b) using FCOMI/FCMOV.
inline_ void SetData(udword nb, udword index)
Special case for 1-node models.
bool mKeepOriginal
true => keep a copy of the original tree (debug purpose)
#define null
our own NULL pointer
AABBTree * mSource
Original source tree.
udword mModelCode
Model code = combination of ModelFlag(s)
inline_ udword GetNbPrimitives() const
inline_ udword GetNbTriangles() const
virtual bool Build(const OPCODECREATE &create)=0
static int min(int a, int b)
udword mNbLeaves
Number of leaf nodes in the model.
#define DELETEARRAY(x)
Deletes an array.
inline_ const udword * GetIndices() const
inline_ void SetMeshInterface(const MeshInterface *imesh)
const AABB * mAABBArray
Shortcut to an app-controlled array of AABBs.
udword Walk(WalkingCallback callback, void *user_data) const
bool Build(AABBTreeBuilder *builder)
bool mCanRemap
true => allows OPCODE to reorganize client arrays
Model creation structure.
bool mQuantized
true => quantize the tree (else use a normal tree)
inline_ Point & SetMinusInfinity()
inline_ const udword * GetIndices() const
Catch the indices.
inline_ const udword * GetPrimitives() const
inline_ const LeafTriangles * GetLeafTriangles() const
unsigned int udword
sizeof(udword) must be 4
inline_ void GetMax(Point &max) const
Get max point of the box.
bool RemapClient(udword nb_indices, const udword *permutation) const
#define DELETESINGLE(x)
Deletes an instance of a class.
udword mNbPrimitives
Total number of primitives.
inline_ float Min() const
Returns MIN(x, y, z);.
LeafTriangles * mTriangles
Array of mNbLeaves leaf descriptors.
inline_ void GetTriangle(VertexPointers &vp, udword index) const
virtual bool Build(AABBTree *tree)=0
inline_ udword GetNbNodes() const
udword * mIndices
Array of primitive indices.
bool mNoLeaf
true => discard leaf nodes (else use a normal tree)
inline_ Point & SetPlusInfinity()
AABBOptimizedTree * mTree
Optimized tree owned by the model.
inline_ void CopyMemory(void *dest, const void *src, udword size)
udword mLimit
Limit number of primitives / node. If limit is 1, build a complete tree (2*N-1 nodes) ...
inline_ float FCMin3(float a, float b, float c)
A global function to find MIN(a,b,c) using FCOMI/FCMOV.
const MeshInterface * mIMesh
User-defined mesh interface.
inline_ float FCMax3(float a, float b, float c)
A global function to find MAX(a,b,c) using FCOMI/FCMOV.
inline_ float Max() const
Returns MAX(x, y, z);.
MeshInterface * mIMesh
Mesh interface (access to triangles & vertices) (*)
const MeshInterface * mIMesh
Shortcut to an app-controlled mesh interface.
inline_ BOOL IsQuantized() const
LeafTriangles * mTriangles
udword mNbPrimitives
Number of primitives in the model.
static BodyCustomizerHandle create(BodyHandle bodyHandle, const char *modelName)
bool CreateTree(bool no_leaf, bool quantized)
inline_ udword GetTriangleIndex() const
BuildSettings mSettings
Builder's settings.
udword CheckTopology() const
inline_ float FCMax2(float a, float b)
A global function to find MAX(a,b) using FCOMI/FCMOV.
inline_ BOOL HasLeafNodes() const
static int max(int a, int b)
inline_ udword GetNbTriangles() const
BuildSettings mSettings
Splitting rules & split limit [Opcode 1.3].