118 void HybridModel::Release()
195 if(current->IsLeaf())
197 Internal* Data = (Internal*)user_data;
206 if(current->IsLeaf())
208 Internal* Data = (Internal*)user_data;
211 Data->
mLeaves[Data->mNbLeaves] = *current->GetAABB();
215 Data->mTriangles[Data->mNbLeaves].SetData(current->
GetNbPrimitives(), Index);
226 mNbLeaves = Data.mNbLeaves;
237 Data.mLeaves =
new AABB[Data.mNbLeaves];
CHECKALLOC(Data.mLeaves);
241 Data.mTriangles = mTriangles;
248 bool MustKeepIndices =
true;
256 MustKeepIndices =
false;
264 mIndices =
new udword[mNbPrimitives];
278 if(!LeafTree->
Build(&TB))
goto FreeAndExit;
309 if(mIndices) UsedBytes += mNbPrimitives *
sizeof(
udword);
310 if(mTriangles) UsedBytes += mNbLeaves *
sizeof(
LeafTriangles);
317 #ifdef OPC_USE_FCOMI // a 15% speedup on my machine, not much
347 if(!
mTree)
return false;
365 if(Current.HasPosLeaf())
367 const LeafTriangles& CurrentLeaf = LT[Current.GetPosPrimitive()];
372 Point TmpMin, TmpMax;
410 if(Current.HasNegLeaf())
412 const LeafTriangles& CurrentLeaf = LT[Current.GetNegPrimitive()];
417 Point TmpMin, TmpMax;
455 Min.
x = FCMin2(Min.
x, Min_.
x);
456 Max.
x = FCMax2(Max.
x, Max_.
x);
457 Min.
y = FCMin2(Min.
y, Min_.
y);
458 Max.
y = FCMax2(Max.
y, Max_.
y);
459 Min.
z = FCMin2(Min.
z, Min_.
z);
460 Max.
z = FCMax2(Max.
z, Max_.
z);
465 Current.mAABB.SetMinMax(Min, Max);