PhysicsDebugNode.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (C) 2009-2022, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Scene/PhysicsDebugNode.h>
  6. #include <AnKi/Scene/Components/SpatialComponent.h>
  7. #include <AnKi/Scene/SceneGraph.h>
  8. #include <AnKi/Resource/ResourceManager.h>
  9. namespace anki {
  10. PhysicsDebugNode::PhysicsDebugNode(SceneGraph* scene, CString name)
  11. : SceneNode(scene, name)
  12. , m_physDbgDrawer(&scene->getDebugDrawer())
  13. {
  14. // TODO
  15. #if 0
  16. RenderComponent* rcomp = newComponent<RenderComponent>();
  17. rcomp->setFlags(RenderComponentFlag::kNone);
  18. rcomp->initRaster(
  19. [](RenderQueueDrawContext& ctx, ConstWeakArray<void*> userData) {
  20. static_cast<PhysicsDebugNode*>(userData[0])->draw(ctx);
  21. },
  22. this, 0);
  23. #endif
  24. SpatialComponent* scomp = newComponent<SpatialComponent>();
  25. scomp->setUpdateOctreeBounds(false); // Don't mess with the bounds
  26. scomp->setAabbWorldSpace(Aabb(getSceneGraph().getSceneMin(), getSceneGraph().getSceneMax()));
  27. scomp->setSpatialOrigin(Vec3(0.0f));
  28. }
  29. PhysicsDebugNode::~PhysicsDebugNode()
  30. {
  31. }
  32. void PhysicsDebugNode::draw(RenderQueueDrawContext& ctx)
  33. {
  34. #if 0
  35. if(ctx.m_debugDraw)
  36. {
  37. m_physDbgDrawer.start(ctx.m_viewProjectionMatrix, ctx.m_commandBuffer, ctx.m_rebarStagingPool);
  38. m_physDbgDrawer.drawWorld(*getExternalSubsystems().m_physicsWorld);
  39. m_physDbgDrawer.end();
  40. }
  41. #endif
  42. }
  43. } // end namespace anki