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 ); } } }
/// Draw the world. void draw(RenderQueueDrawContext& ctx) { if(ctx.m_debugDraw) { m_dbgDrawer.prepareFrame(&ctx); m_dbgDrawer.setViewProjectionMatrix(ctx.m_viewProjectionMatrix); m_dbgDrawer.setModelMatrix(Mat4::getIdentity()); m_physDbgDrawer.drawWorld(m_node->getSceneGraph().getPhysicsWorld()); m_dbgDrawer.finishFrame(); } }
void CharacterController::DebugDrawAI(DebugDrawer & dd) { for(int i = 0, size = _CurrentPath.size() - 1; i < size; ++i) { dd.drawLine( _CurrentPath[i] + Ogre::Vector3(0, 0.1, 0), _CurrentPath[i+1] + Ogre::Vector3(0, 0.1, 0), Ogre::ColourValue::Blue); } }
void operator()(const Vec3& lineA, const Vec3& lineB, const Vec3& color) { m_d->drawLine(lineA, lineB, color.xyz1()); }
void Camera::onDebugDraw( DebugDrawer& debug, DebugDrawFlags ) { debug.drawFrustum( CalculateWorldFrustum(transform, frustum) ); }
// ------------------------------------------------------------------------- bool OgreBulletListener::frameEnded(Real elapsedTime) { if (mQuit) return false; DebugDrawer *debugDrawer = mWorld->getDebugDrawer (); // Scene Debug Options if (mWireFrame) { const bool wasWireframeShapes = debugDrawer->doesDrawWireframe(); debugDrawer->setDrawWireframe(!wasWireframeShapes); mWorld->setShowDebugShapes(!wasWireframeShapes); mWireFrame = false; } if (mDrawAabb) { debugDrawer->setDrawAabb(!debugDrawer->doesDrawAabb()); mDrawAabb = false; } if ( mDrawFeaturesText) { debugDrawer->setDrawFeaturesText(!debugDrawer->doesDrawFeaturesText()); mDrawFeaturesText = false; } if ( mDrawContactPoints) { debugDrawer->setDrawContactPoints(!debugDrawer->doesDrawContactPoints()); mWorld->setShowDebugContactPoints(debugDrawer->doesDrawContactPoints()); mDrawContactPoints = false; } if ( mNoDeactivation) { debugDrawer->setNoDeactivation(!debugDrawer->doesNoDeactivation()); mNoDeactivation = false; } if ( mNoHelpText) { debugDrawer->setNoHelpText(!debugDrawer->doesNoHelpText()); mNoHelpText = false; } if ( mDrawText) { debugDrawer->setDrawText(!debugDrawer->doesDrawText()); mDrawText = false; } if ( mProfileTimings) { debugDrawer->setProfileTimings(!debugDrawer->doesProfileTimings()); mProfileTimings = false; } if ( mEnableSatComparison) { debugDrawer->setEnableSatComparison(!debugDrawer->doesEnableSatComparison()); mEnableSatComparison = false; } if ( mDisableBulletLCP) { debugDrawer->setDisableBulletLCP(!debugDrawer->doesDisableBulletLCP()); mDisableBulletLCP = false; } if ( mEnableCCD) { debugDrawer->setEnableCCD(!debugDrawer->doesEnableCCD()); mEnableCCD = false; } mGuiListener->getGui ()->update (elapsedTime); updateStats(); return true; }
ANKI_USE_RESULT Error init() { return m_dbgDrawer.init(&m_node->getSceneGraph().getResourceManager()); }