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(); }
/* * 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); }