本文整理汇总了C++中CObject3D::GetBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CObject3D::GetBoundingBox方法的具体用法?C++ CObject3D::GetBoundingBox怎么用?C++ CObject3D::GetBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObject3D
的用法示例。
在下文中一共展示了CObject3D::GetBoundingBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _glDrawNodeBoundingBox
static void _glDrawNodeBoundingBox(CSceneNode *pnode, const Vector3f &linecolor)
{
if (pnode==NULL) return;
glPushMatrix();
if (pnode->m_pFrame) glMultMatrixd(pnode->m_pFrame->matrix());
CGLDrawParms *pdraw = &pnode->m_DrawParms;
pdraw->BeginDrawing();
CObject3D *p = pnode->m_pObject;
if (p == NULL)
p= pnode->m_pSimulationObject;
AxisAlignedBox box;
p->GetBoundingBox(box);
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
glLineWidth(2);
glColor3f(linecolor.x, linecolor.y, linecolor.z);
glDisable(GL_LIGHTING);
const Vector3d& p0=box.minp;
const Vector3d& p1=box.maxp;
DrawBoundingBox(p0, p1);
const Vector3d dist = (p1 - p0)*0.33;
glLineWidth(4);
glColor3f(1.0,0,0);
glBegin(GL_LINES);
glVertex3f(p0.x, p0.y, p0.z);
glVertex3f(p0.x+dist.x, p0.y, p0.z);
glEnd();
glColor3f(0,1,0);
glBegin(GL_LINES);
glVertex3f(p0.x, p0.y, p0.z);
glVertex3f(p0.x, dist.y+p0.y, p0.z);
glEnd();
glColor3f(0,0,1);
glBegin(GL_LINES);
glVertex3f(p0.x, p0.y, p0.z);
glVertex3f(p0.x, p0.y, p0.z+dist.z);
glEnd();
pdraw->PostDrawing();
glPopMatrix();
}
示例2: CopySourceBrushSectorsToObject
/*
* Copy selected sectors of a source brush to a 3D object.
*/
void CWorld::CopySourceBrushSectorsToObject(
CEntity &enBrush,
CBrushSectorSelectionForCSG &bscselSectors,
const CPlacement3D &plSourcePlacement,
CObject3D &obObject,
const CPlacement3D &plTargetPlacement,
DOUBLEaabbox3D &boxSourceAbsolute
)
{
ASSERT(GetFPUPrecision()==FPT_53BIT);
// get the brush mip from the entity
CBrushMip &bmBrushMip = *GetBrushMip(enBrush);
// calculate placement of the brush in absolute space (taking relative
// world placement and entity placement in account)
CPlacement3D plBrush = enBrush.en_plPlacement;
plBrush.RelativeToAbsolute(plSourcePlacement);
// copy selected sectors of brush to object3d object
bmBrushMip.ToObject3D(obObject, bscselSectors);
// make a copy of the object and find its box in absolute space
CObject3D obAbsolute;
obAbsolute = obObject;
CSimpleProjection3D_DOUBLE prToAbsolute;
prToAbsolute.ObjectPlacementL() = plBrush;
prToAbsolute.ViewerPlacementL() = CPlacement3D(FLOAT3D(0,0,0), ANGLE3D(0,0,0));
prToAbsolute.Prepare();
obAbsolute.Project(prToAbsolute);
obAbsolute.GetBoundingBox(boxSourceAbsolute);
// project the brush into target space
CSimpleProjection3D_DOUBLE prSimple;
prSimple.ObjectPlacementL() = plBrush;
prSimple.ViewerPlacementL() = plTargetPlacement;
prSimple.Prepare();
obObject.Project(prSimple);
}