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_ const udword * GetIndices() const
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)
inline_ void GetTriangle(VertexPointers &vp, udword index) const
inline_ const udword * GetPrimitives() const
Special case for 1-node models.
udword Walk(WalkingCallback callback, void *user_data) const
inline_ void GetMin(Point &min) const
Get min point of the box.
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)
virtual bool Build(const OPCODECREATE &create)=0
static int min(int a, int b)
udword mNbLeaves
Number of leaf nodes in the model.
bool RemapClient(udword nb_indices, const udword *permutation) const
#define DELETEARRAY(x)
Deletes an array.
inline_ void SetMeshInterface(const MeshInterface *imesh)
const AABB * mAABBArray
Shortcut to an app-controlled array of AABBs.
bool Build(AABBTreeBuilder *builder)
bool mCanRemap
true => allows OPCODE to reorganize client arrays
inline_ void GetMax(Point &max) const
Get max point of the box.
Model creation structure.
bool mQuantized
true => quantize the tree (else use a normal tree)
inline_ Point & SetMinusInfinity()
unsigned int udword
sizeof(udword) must be 4
inline_ udword GetNbTriangles() const
inline_ BOOL IsQuantized() const
inline_ float Min() const
Returns MIN(x, y, z);.
#define DELETESINGLE(x)
Deletes an instance of a class.
udword mNbPrimitives
Total number of primitives.
inline_ float Max() const
Returns MAX(x, y, z);.
LeafTriangles * mTriangles
Array of mNbLeaves leaf descriptors.
virtual bool Build(AABBTree *tree)=0
udword * mIndices
Array of primitive indices.
udword CheckTopology() const
bool mNoLeaf
true => discard leaf nodes (else use a normal tree)
inline_ Point & SetPlusInfinity()
AABBOptimizedTree * mTree
Optimized tree owned by the model.
inline_ const udword * GetIndices() const
Catch the indices.
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.
inline_ udword GetNbTriangles() const
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_ udword GetTriangleIndex() const
inline_ udword GetNbNodes() const
MeshInterface * mIMesh
Mesh interface (access to triangles & vertices) (*)
const MeshInterface * mIMesh
Shortcut to an app-controlled mesh interface.
inline_ udword GetNbPrimitives() const
LeafTriangles * mTriangles
inline_ BOOL HasLeafNodes() const
udword mNbPrimitives
Number of primitives in the model.
static BodyCustomizerHandle create(BodyHandle bodyHandle, const char *modelName)
bool CreateTree(bool no_leaf, bool quantized)
BuildSettings mSettings
Builder's settings.
inline_ float FCMax2(float a, float b)
A global function to find MAX(a,b) using FCOMI/FCMOV.
static int max(int a, int b)
BuildSettings mSettings
Splitting rules & split limit [Opcode 1.3].
inline_ const LeafTriangles * GetLeafTriangles() const