本文整理汇总了C++中Polyhedron::getNumEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::getNumEdges方法的具体用法?C++ Polyhedron::getNumEdges怎么用?C++ Polyhedron::getNumEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::getNumEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_extraPlane
void test_extraPlane()
{
Vector< PlaneF > planes;
// Build planes for a unit cube centered at the origin.
// Note that the normals must be facing inwards.
planes.push_back( PlaneF( Point3F( -0.5f, 0.f, 0.f ), Point3F( 1.f, 0.f, 0.f ) ) );
planes.push_back( PlaneF( Point3F( 0.5f, 0.f, 0.f ), Point3F( -1.f, 0.f, 0.f ) ) );
planes.push_back( PlaneF( Point3F( 0.f, -0.5f, 0.f ), Point3F( 0.f, 1.f, 0.f ) ) );
planes.push_back( PlaneF( Point3F( 0.f, 0.5f, 0.f ), Point3F( 0.f, -1.f, 0.f ) ) );
planes.push_back( PlaneF( Point3F( 0.f, 0.f, -0.5f ), Point3F( 0.f, 0.f, 1.f ) ) );
planes.push_back( PlaneF( Point3F( 0.f, 0.f, 0.5f ), Point3F( 0.f, 0.f, -1.f ) ) );
// Add extra plane that doesn't contribute a new edge.
planes.push_back( PlaneF( Point3F( 0.5f, 0.5f, 0.5f ), Point3F( -1.f, -1.f, -1.f ) ) );
// Turn it into a polyhedron.
Polyhedron polyhedron;
polyhedron.buildFromPlanes(
PlaneSetF( planes.address(), planes.size() )
);
// Check if we got a cube back.
TEST( polyhedron.getNumPoints() == 8 );
TEST( polyhedron.getNumPlanes() == 6 );
TEST( polyhedron.getNumEdges() == 12 );
}
示例2: debugRenderCullingVolumes
void SceneCullingState::debugRenderCullingVolumes() const
{
const ColorI occluderColor( 255, 0, 0, 255 );
const ColorI includerColor( 0, 255, 0, 255 );
const PlaneF& nearPlane = getCullingFrustum().getPlanes()[ Frustum::PlaneNear ];
const PlaneF& farPlane = getCullingFrustum().getPlanes()[ Frustum::PlaneFar ];
DebugDrawer* drawer = DebugDrawer::get();
const SceneZoneSpaceManager* zoneManager = mSceneManager->getZoneManager();
bool haveDebugZone = false;
const U32 numZones = mZoneStates.size();
for( S32 zoneId = numZones - 1; zoneId >= 0; -- zoneId )
{
if( !zoneManager->isValidZoneId( zoneId ) )
continue;
const SceneZoneCullingState& zoneState = mZoneStates[ zoneId ];
if( !zoneManager->getZoneOwner( zoneId )->isSelected() && ( zoneId != SceneZoneSpaceManager::RootZoneId || haveDebugZone ) )
continue;
haveDebugZone = true;
for( SceneZoneCullingState::CullingVolumeIterator iter( zoneState );
iter.isValid(); ++ iter )
{
// Temporarily add near and far plane to culling volume so that
// no matter how it is defined, it has a chance of being properly
// capped.
const U32 numPlanes = iter->getPlanes().getNumPlanes();
const PlaneF* planes = iter->getPlanes().getPlanes();
TempAlloc< PlaneF > tempPlanes( numPlanes + 2 );
tempPlanes[ 0 ] = nearPlane;
tempPlanes[ 1 ] = farPlane;
dMemcpy( &tempPlanes[ 2 ], planes, numPlanes * sizeof( PlaneF ) );
// Build a polyhedron from the plane set.
Polyhedron polyhedron;
polyhedron.buildFromPlanes(
PlaneSetF( tempPlanes, numPlanes + 2 )
);
// If the polyhedron has any renderable data,
// hand it over to the debug drawer.
if( polyhedron.getNumEdges() )
drawer->drawPolyhedron( polyhedron, iter->isOccluder() ? occluderColor : includerColor );
}
}
}