本文整理汇总了C++中AABB::Extend方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::Extend方法的具体用法?C++ AABB::Extend怎么用?C++ AABB::Extend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::Extend方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
AABB ShapeSet::triData::box() const
{
AABB b = AABB::Identity();
for (unsigned int i = 0; i < 3; i++)
b = b.Extend(p[i]);
return b;
}
示例2: Update
void GameObjectGroup::Update(const FrameTime& fr, UpdateTypeEnum updateType)
{
bool boundDirty = m_boundsDirty;
super::Update(fr,updateType);
m_boundsDirty = boundDirty;
for( auto it = m_children.begin(); it != m_children.end(); ++it)
{
(*it)->Update(fr,updateType);
}
// Update bounds
if(m_boundsDirty)
{
bool usechildbounds = false;
AABB childbounds; // default ctor will set initial value of min and max.
// merge bounds for the the visibile children.
for (auto it = m_children.begin(); it != m_children.end(); ++it)
{
if( (*it)->IsVisible())
{
AABB local = (*it)->GetLocalBounds();
local.Transform((*it)->GetTransform());
childbounds.Extend( local );
usechildbounds = true;
}
}
// set local bounds
m_localBounds = usechildbounds ? childbounds : AABB(float3(-0.5f,-0.5f,-0.5f), float3(0.5f,0.5f,0.5f));
UpdateWorldAABB();
}
}
示例3: ComputeGlobalBox
bool AABBTreeOfVerticesBuilder::ComputeGlobalBox(const udword* primitives, udword nb_prims, AABB& global_box) const
{
// Checkings
if(!primitives || !nb_prims) return false;
// Initialize global box
global_box.SetEmpty();
// Loop through vertices
for(udword i=0;i<nb_prims;i++)
{
// Update global box
global_box.Extend(mVertexArray[primitives[i]]);
}
return true;
}
示例4: GetPartList
const Math::AABB CObject::CalcAabb(void) const
{
//TODO this doesn't take into account the position of the aabb, we need the points in world space
AABB aabb;
aabb.MakeLimits();
std::list<Part::IPart*> list = GetPartList(this);
for (auto iter = list.begin(); iter != list.end(); ++iter)
{
if ((*iter)->IsRenderable())
{
Script::IRenderPart* pRenderPart = static_cast<Script::IRenderPart*>((*iter));
aabb.Extend(pRenderPart->GetAABB());
}
}
return aabb;
}
示例5: LoadBIN
static bool LoadBIN(const char* filename, SurfaceManager& test, const float* scale=null, bool mergeMeshes=false, udword tesselation=0, TesselationScheme ts = TESS_BUTTERFLY)
{
IceFile BinFile(filename);
if(!BinFile.IsValid())
return false;
const udword NbMeshes = BinFile.LoadDword();
printf("LoadBIN: loading %d meshes...\n", NbMeshes);
AABB GlobalBounds;
GlobalBounds.SetEmpty();
udword TotalNbTris = 0;
udword TotalNbVerts = 0;
if(!mergeMeshes)
{
for(udword i=0;i<NbMeshes;i++)
{
const udword Collidable = BinFile.LoadDword();
const udword Renderable = BinFile.LoadDword();
const udword NbVerts = BinFile.LoadDword();
const udword NbFaces = BinFile.LoadDword();
// TotalNbTris += NbFaces;
// TotalNbVerts += NbVerts;
IndexedSurface* IS = test.CreateManagedSurface();
bool Status = IS->Init(NbFaces, NbVerts);
ASSERT(Status);
Point* Verts = IS->GetVerts();
for(udword j=0;j<NbVerts;j++)
{
Verts[j].x = BinFile.LoadFloat();
Verts[j].y = BinFile.LoadFloat();
Verts[j].z = BinFile.LoadFloat();
if(scale)
Verts[j] *= *scale;
if(0)
{
Matrix3x3 RotX;
RotX.RotX(HALFPI*0.5f);
Verts[j] *= RotX;
Verts[j] += Point(0.1f, -0.2f, 0.3f);
}
GlobalBounds.Extend(Verts[j]);
}
IndexedTriangle* F = IS->GetFaces();
for(udword j=0;j<NbFaces;j++)
{
F[j].mRef[0] = BinFile.LoadDword();
F[j].mRef[1] = BinFile.LoadDword();
F[j].mRef[2] = BinFile.LoadDword();
}
/* if(tesselation)
{
for(udword j=0;j<tesselation;j++)
{
if(ts==TESS_BUTTERFLY)
{
ButterflyScheme BS;
IS->Subdivide(BS);
}
else if(ts==TESS_POLYHEDRAL)
{
PolyhedralScheme PS;
IS->Subdivide(PS);
}
}
}*/
if(tesselation)
Tesselate(IS, tesselation, ts);
if(gUseMeshCleaner)
{
MeshCleaner Cleaner(IS->GetNbVerts(), IS->GetVerts(), IS->GetNbFaces(), IS->GetFaces()->mRef);
IS->Init(Cleaner.mNbTris, Cleaner.mNbVerts, Cleaner.mVerts, (const IndexedTriangle*)Cleaner.mIndices);
}
TotalNbTris += IS->GetNbFaces();
TotalNbVerts += IS->GetNbVerts();
// SaveBIN("c:\\TessBunny.bin", *IS);
}
}
else
{
IndexedSurface* IS = test.CreateManagedSurface();
for(udword i=0;i<NbMeshes;i++)
{
const udword Collidable = BinFile.LoadDword();
const udword Renderable = BinFile.LoadDword();
const udword NbVerts = BinFile.LoadDword();
const udword NbFaces = BinFile.LoadDword();
//.........这里部分代码省略.........