Browse Source

Moved Profiler and debug draw from Physics to new DebugTools library.

Also cleaned up the code and split renderer creation from resource
manager.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
c0a3ce84a4
  1. 11
      CMakeLists.txt
  2. 2
      doc/building.dox
  3. 2
      doc/mainpage.dox
  4. 9
      doc/namespaces.dox
  5. 10
      modules/FindMagnum.cmake
  6. 6
      src/CMakeLists.txt
  7. 24
      src/DebugTools/CMakeLists.txt
  8. 33
      src/DebugTools/DebugTools.h
  9. 10
      src/DebugTools/Implementation/AbstractBoxRenderer.cpp
  10. 10
      src/DebugTools/Implementation/AbstractBoxRenderer.h
  11. 6
      src/DebugTools/Implementation/AbstractShapeRenderer.cpp
  12. 21
      src/DebugTools/Implementation/AbstractShapeRenderer.h
  13. 7
      src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp
  14. 12
      src/DebugTools/Implementation/AxisAlignedBoxRenderer.h
  15. 7
      src/DebugTools/Implementation/BoxRenderer.cpp
  16. 12
      src/DebugTools/Implementation/BoxRenderer.h
  17. 4
      src/DebugTools/Profiler.cpp
  18. 20
      src/DebugTools/Profiler.h
  19. 38
      src/DebugTools/ResourceManager.cpp
  20. 54
      src/DebugTools/ResourceManager.h
  21. 75
      src/DebugTools/ShapeRenderer.cpp
  22. 119
      src/DebugTools/ShapeRenderer.h
  23. 28
      src/DebugTools/magnumDebugToolsVisibility.h
  24. 1
      src/Magnum.h
  25. 9
      src/Physics/CMakeLists.txt
  26. 76
      src/Physics/DebugDrawResourceManager.cpp
  27. 117
      src/Physics/DebugDrawResourceManager.h
  28. 32
      src/Physics/Implementation/AbstractDebugRenderer.cpp
  29. 42
      src/Physics/Implementation/AbstractDebugRenderer.h
  30. 58
      src/Physics/Implementation/DebugRenderer.h
  31. 6
      src/Physics/Physics.h
  32. 2
      src/ResourceManager.h

11
CMakeLists.txt

@ -9,11 +9,12 @@ cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2" ON "TARGET_GLES" OFF
# Parts of the library
option(WITH_EVERYTHING "Build everything (doesn't include *Application libraries)" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" OFF "NOT WITH_EVERYTHING;NOT WITH_PHYSICS" ON)
cmake_dependent_option(WITH_PHYSICS "Build Physics library" OFF "NOT WITH_EVERYTHING" ON)
cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" OFF "NOT WITH_EVERYTHING;NOT WITH_PHYSICS" ON)
cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" OFF "NOT WITH_EVERYTHING;NOT WITH_PHYSICS" ON)
cmake_dependent_option(WITH_SHADERS "Build Shaders library" OFF "NOT WITH_EVERYTHING;NOT WITH_PHYSICS" ON)
cmake_dependent_option(WITH_DEBUGTOOLS "Build DebugTools library" OFF "NOT WITH_EVERYTHING" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" OFF "NOT WITH_EVERYTHING;NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_PHYSICS "Build Physics library" OFF "NOT WITH_EVERYTHING;NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" OFF "NOT WITH_EVERYTHING;NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" OFF "NOT WITH_EVERYTHING;NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_SHADERS "Build Shaders library" OFF "NOT WITH_EVERYTHING;NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_MAGNUMINFO "Build magnum-info utility" OFF "NOT WITH_EVERYTHING" ON)

2
doc/building.dox

@ -66,6 +66,8 @@ specify which parts will be built and which not:
- `WITH_EVERYTHING` - Defaults to `ON`, builds everything except application
libraries. If set to `OFF`, only the main library is built and you can
select additional components with the following:
- `WITH_DEBUGTOOLS` - DebugTools library. Enables also building of MeshTools,
Physics, Primitives, SceneGraph and Shaders libraries.
- `WITH_MESHTOOLS` - MeshTools library.
- `WITH_PHYSICS` - Physics library.
- `WITH_PRIMITIVES` - Primitives library.

2
doc/mainpage.dox

@ -13,7 +13,7 @@ Features:
@ref Framebuffer "framebuffer" and @ref AbstractQuery "occlusion queries".
- @ref MeshTools "Mesh tools" for cleaning, optimizing and generating meshes,
utility classes for @ref Color.h "color conversion", @ref Timeline "timeline"
and @ref Profiler "profiling".
and @ref DebugTools::Profiler "profiling".
- Hierarchical @ref SceneGraph "scene graph" which supports transformation
caching for better performance, @ref Physics "physics library" for collision
detection and rigid body dynamics.

9
doc/namespaces.dox

@ -47,6 +47,15 @@ Various matrix and vector algorithms.
Functions for computing intersections, distances, areas and volumes.
*/
/** @dir DebugTools
* @brief Namespace Magnum::DebugTools
*/
/** @namespace Magnum::DebugTools
@brief %Debug tools
Debugging helpers, renderers and profilers.
*/
/** @dir MeshTools
* @brief Namespace Magnum::MeshTools
*/

10
modules/FindMagnum.cmake

@ -15,9 +15,10 @@
# components. The base library depends on Corrade, OpenGL and GLEW
# libraries. Additional dependencies are specified by the components. The
# optional components are:
# DebugTools - DebugTools library (depends on MeshTools, Physics,
# Primitives, SceneGraph and Shaders components)
# MeshTools - MeshTools library
# Physics - Physics library (depends on Primitives, SceneGraph and
# Shaders components)
# Physics - Physics library
# Primitives - Library with stock geometric primitives (static)
# SceneGraph - Scene graph library
# Shaders - Library with stock shaders
@ -166,6 +167,11 @@ foreach(component ${Magnum_FIND_COMPONENTS})
endif()
endif()
# DebugTools library
if(${component} STREQUAL DebugTools)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Profiler.h)
endif()
# Mesh tools library
if(${component} STREQUAL MeshTools)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES CompressIndices.h)

6
src/CMakeLists.txt

@ -23,7 +23,6 @@ set(Magnum_SRCS
Image.cpp
IndexedMesh.cpp
Mesh.cpp
Profiler.cpp
Query.cpp
Renderbuffer.cpp
Resource.cpp
@ -72,7 +71,6 @@ set(Magnum_HEADERS
IndexedMesh.h
Magnum.h
Mesh.h
Profiler.h
Query.h
Renderbuffer.h
Renderer.h
@ -140,6 +138,10 @@ add_subdirectory(Platform)
add_subdirectory(Math)
add_subdirectory(Trade)
if(WITH_DEBUGTOOLS)
add_subdirectory(DebugTools)
endif()
if(WITH_MESHTOOLS)
add_subdirectory(MeshTools)
endif()

24
src/DebugTools/CMakeLists.txt

@ -0,0 +1,24 @@
set(MagnumDebugTools_SRCS
Profiler.cpp
ResourceManager.cpp
ShapeRenderer.cpp
Implementation/AbstractBoxRenderer.cpp
Implementation/AbstractShapeRenderer.cpp
Implementation/AxisAlignedBoxRenderer.cpp
Implementation/BoxRenderer.cpp)
set(MagnumDebugTools_HEADERS
DebugTools.h
Profiler.h
ResourceManager.h
ShapeRenderer.h
magnumDebugToolsVisibility.h)
add_library(MagnumDebugTools SHARED ${MagnumDebugTools_SRCS})
target_link_libraries(MagnumDebugTools Magnum MagnumPhysics MagnumPrimitives MagnumSceneGraph MagnumShaders)
install(TARGETS MagnumDebugTools DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumDebugTools_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/DebugTools)

33
src/DebugTools/DebugTools.h

@ -0,0 +1,33 @@
#ifndef Magnum_DebugTools_DebugTools_h
#define Magnum_DebugTools_DebugTools_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
/** @file
* @brief Forward declarations for Magnum::DebugTools namespace
*/
#include <cstdint>
namespace Magnum { namespace DebugTools {
class Profiler;
class ResourceManager;
template<std::uint8_t> class ShapeRenderer;
struct ShapeRendererOptions;
}}
#endif

10
src/Physics/Implementation/AbstractBoxRenderer.cpp → src/DebugTools/Implementation/AbstractBoxRenderer.cpp

@ -16,12 +16,12 @@
#include "AbstractBoxRenderer.h"
#include "Buffer.h"
#include "Physics/DebugDrawResourceManager.h"
#include "DebugTools/ResourceManager.h"
#include "Primitives/Cube.h"
#include "Primitives/Square.h"
#include "Shaders/FlatShader.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
namespace {
template<std::uint8_t> struct BoxMesh {};
@ -55,10 +55,10 @@ namespace {
};
}
template<std::uint8_t dimensions> AbstractBoxRenderer<dimensions>::AbstractBoxRenderer(): AbstractDebugRenderer<dimensions>(BoxMesh<dimensions>::shader(), BoxMesh<dimensions>::key()), buffer(DebugDrawResourceManager::instance()->get<Buffer>(BoxMesh<dimensions>::key())) {
template<std::uint8_t dimensions> AbstractBoxRenderer<dimensions>::AbstractBoxRenderer(): AbstractShapeRenderer<dimensions>(BoxMesh<dimensions>::shader(), BoxMesh<dimensions>::key()), buffer(ResourceManager::instance()->get<Buffer>(BoxMesh<dimensions>::key())) {
if(!this->mesh) {
DebugDrawResourceManager::instance()->set(this->buffer.key(), new Buffer, ResourceDataState::Final, ResourcePolicy::Manual);
DebugDrawResourceManager::instance()->set<Mesh>(this->mesh.key(), BoxMesh<dimensions>::mesh(buffer), ResourceDataState::Final, ResourcePolicy::Manual);
ResourceManager::instance()->set(this->buffer.key(), new Buffer, ResourceDataState::Final, ResourcePolicy::Manual);
ResourceManager::instance()->set<Mesh>(this->mesh.key(), BoxMesh<dimensions>::mesh(buffer), ResourceDataState::Final, ResourcePolicy::Manual);
}
}

10
src/Physics/Implementation/AbstractBoxRenderer.h → src/DebugTools/Implementation/AbstractBoxRenderer.h

@ -1,5 +1,5 @@
#ifndef Magnum_Physics_Implementation_AbstractBoxRenderer_h
#define Magnum_Physics_Implementation_AbstractBoxRenderer_h
#ifndef Magnum_DebugTools_Implementation_AbstractBoxRenderer_h
#define Magnum_DebugTools_Implementation_AbstractBoxRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -15,13 +15,13 @@
GNU Lesser General Public License version 3 for more details.
*/
#include "AbstractDebugRenderer.h"
#include "AbstractShapeRenderer.h"
#include "corradeCompatibility.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> class AbstractBoxRenderer: public AbstractDebugRenderer<dimensions> {
template<std::uint8_t dimensions> class AbstractBoxRenderer: public AbstractShapeRenderer<dimensions> {
public:
AbstractBoxRenderer();

6
src/Physics/Implementation/AbstractShapeRenderer.cpp → src/DebugTools/Implementation/AbstractShapeRenderer.cpp

@ -17,12 +17,12 @@
#include "AbstractShaderProgram.h"
#include "Mesh.h"
#include "Physics/DebugDrawResourceManager.h"
#include "DebugTools/ResourceManager.h"
#include "Shaders/FlatShader.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> AbstractShapeRenderer<dimensions>::AbstractShapeRenderer(ResourceKey shader, ResourceKey mesh): shader(DebugDrawResourceManager::instance()->get<AbstractShaderProgram, Shaders::FlatShader<dimensions>>(shader)), mesh(DebugDrawResourceManager::instance()->get<Mesh>(mesh)) {}
template<std::uint8_t dimensions> AbstractShapeRenderer<dimensions>::AbstractShapeRenderer(ResourceKey shader, ResourceKey mesh): shader(ResourceManager::instance()->get<AbstractShaderProgram, Shaders::FlatShader<dimensions>>(shader)), mesh(ResourceManager::instance()->get<Mesh>(mesh)) {}
template<std::uint8_t dimensions> AbstractShapeRenderer<dimensions>::~AbstractShapeRenderer() {}

21
src/Physics/Implementation/AbstractShapeRenderer.h → src/DebugTools/Implementation/AbstractShapeRenderer.h

@ -1,5 +1,5 @@
#ifndef Magnum_Physics_Implementation_AbstractShapeRenderer_h
#define Magnum_Physics_Implementation_AbstractShapeRenderer_h
#ifndef Magnum_DebugTools_Implementation_AbstractShapeRenderer_h
#define Magnum_DebugTools_Implementation_AbstractShapeRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -18,19 +18,10 @@
#include "DimensionTraits.h"
#include "ResourceManager.h"
#include "SceneGraph/SceneGraph.h"
#include "Shaders/Shaders.h"
#include "DebugTools/DebugTools.h"
namespace Magnum {
class AbstractShaderProgram;
class Mesh;
namespace Shaders {
template<std::uint8_t> class FlatShader;
}
namespace Physics { namespace Implementation {
struct Options;
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> class AbstractShapeRenderer {
public:
@ -38,7 +29,7 @@ template<std::uint8_t dimensions> class AbstractShapeRenderer {
virtual ~AbstractShapeRenderer();
virtual void draw(Resource<Options>& options, const typename DimensionTraits<dimensions>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions>* camera) = 0;
virtual void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions>* camera) = 0;
protected:
Resource<AbstractShaderProgram, Shaders::FlatShader<dimensions>> shader;

7
src/Physics/Implementation/AxisAlignedBoxRenderer.cpp → src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp

@ -16,13 +16,14 @@
#include "AxisAlignedBoxRenderer.h"
#include "Mesh.h"
#include "Physics/DebugDrawResourceManager.h"
#include "DebugTools/ResourceManager.h"
#include "DebugTools/ShapeRenderer.h"
#include "SceneGraph/AbstractCamera.h"
#include "Shaders/FlatShader.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> void AxisAlignedBoxRenderer<dimensions>::draw(Resource<Options>& options, const typename DimensionTraits<dimensions>::MatrixType&, typename SceneGraph::AbstractCamera<dimensions>* camera) {
template<std::uint8_t dimensions> void AxisAlignedBoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions>::MatrixType&, typename SceneGraph::AbstractCamera<dimensions>* camera) {
typename DimensionTraits<dimensions>::MatrixType transformation =
DimensionTraits<dimensions>::MatrixType::translation(axisAlignedBox.transformedPosition())*
DimensionTraits<dimensions>::MatrixType::scaling(axisAlignedBox.transformedSize());

12
src/Physics/Implementation/AxisAlignedBoxRenderer.h → src/DebugTools/Implementation/AxisAlignedBoxRenderer.h

@ -1,5 +1,5 @@
#ifndef Magnum_Physics_Implementation_AxisAlignedBoxRenderer_h
#define Magnum_Physics_Implementation_AxisAlignedBoxRenderer_h
#ifndef Magnum_DebugTools_Implementation_AxisAlignedBoxRenderer_h
#define Magnum_DebugTools_Implementation_AxisAlignedBoxRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -21,16 +21,16 @@
#include "corradeCompatibility.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> class AxisAlignedBoxRenderer: public AbstractBoxRenderer<dimensions> {
public:
inline AxisAlignedBoxRenderer(AxisAlignedBox<dimensions>& axisAlignedBox): axisAlignedBox(axisAlignedBox) {}
inline AxisAlignedBoxRenderer(Physics::AxisAlignedBox<dimensions>& axisAlignedBox): axisAlignedBox(axisAlignedBox) {}
void draw(Resource<Options>& options, const typename DimensionTraits<dimensions>::MatrixType& transformation, typename SceneGraph::AbstractCamera<dimensions>* camera) override;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions>::MatrixType& transformation, typename SceneGraph::AbstractCamera<dimensions>* camera) override;
private:
AxisAlignedBox<dimensions>& axisAlignedBox;
Physics::AxisAlignedBox<dimensions>& axisAlignedBox;
};
}}}

7
src/Physics/Implementation/BoxRenderer.cpp → src/DebugTools/Implementation/BoxRenderer.cpp

@ -16,13 +16,14 @@
#include "BoxRenderer.h"
#include "Mesh.h"
#include "Physics/DebugDrawResourceManager.h"
#include "DebugTools/ResourceManager.h"
#include "DebugTools/ShapeRenderer.h"
#include "SceneGraph/AbstractCamera.h"
#include "Shaders/FlatShader.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> void BoxRenderer<dimensions>::draw(Resource<Options>& options, const typename DimensionTraits<dimensions>::MatrixType&, typename SceneGraph::AbstractCamera<dimensions>* camera) {
template<std::uint8_t dimensions> void BoxRenderer<dimensions>::draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions>::MatrixType&, typename SceneGraph::AbstractCamera<dimensions>* camera) {
this->shader->setTransformationProjectionMatrix(camera->projectionMatrix()*camera->cameraMatrix()*box.transformedTransformation())
->setColor(options->color)
->use();

12
src/Physics/Implementation/BoxRenderer.h → src/DebugTools/Implementation/BoxRenderer.h

@ -1,5 +1,5 @@
#ifndef Magnum_Physics_Implementation_BoxRenderer_h
#define Magnum_Physics_Implementation_BoxRenderer_h
#ifndef Magnum_DebugTools_Implementation_BoxRenderer_h
#define Magnum_DebugTools_Implementation_BoxRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -21,16 +21,16 @@
#include "corradeCompatibility.h"
namespace Magnum { namespace Physics { namespace Implementation {
namespace Magnum { namespace DebugTools { namespace Implementation {
template<std::uint8_t dimensions> class BoxRenderer: public AbstractBoxRenderer<dimensions> {
public:
inline BoxRenderer(Box<dimensions>& box): box(box) {}
inline BoxRenderer(Physics::Box<dimensions>& box): box(box) {}
void draw(Resource<Options>& options, const typename DimensionTraits<dimensions>::MatrixType& transformation, typename SceneGraph::AbstractCamera<dimensions>* camera) override;
void draw(Resource<ShapeRendererOptions>& options, const typename DimensionTraits<dimensions>::MatrixType& transformation, typename SceneGraph::AbstractCamera<dimensions>* camera) override;
private:
Box<dimensions>& box;
Physics::Box<dimensions>& box;
};
}}}

4
src/Profiler.cpp → src/DebugTools/Profiler.cpp

@ -21,7 +21,7 @@
#include "Magnum.h"
namespace Magnum {
namespace Magnum { namespace DebugTools {
Profiler::Section Profiler::addSection(const std::string& name) {
CORRADE_ASSERT(!enabled, "Profiler: cannot add section when profiling is enabled", 0);
@ -108,4 +108,4 @@ void Profiler::printStatistics() {
Debug() << ' ' << sections[totalSorted[i]] << std::chrono::microseconds(totalData[totalSorted[i]]).count()/frameCount << u8"µs";
}
}
}}

20
src/Profiler.h → src/DebugTools/Profiler.h

@ -1,5 +1,5 @@
#ifndef Magnum_Profiler_h
#define Magnum_Profiler_h
#ifndef Magnum_DebugTools_Profiler_h
#define Magnum_DebugTools_Profiler_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -16,7 +16,7 @@
*/
/** @file
* @brief Class Magnum::Profiler
* @brief Class Magnum::DebugTools::Profiler
*/
#include <chrono>
@ -24,22 +24,22 @@
#include <string>
#include <vector>
#include "magnumVisibility.h"
#include "magnumDebugToolsVisibility.h"
namespace Magnum {
namespace Magnum { namespace DebugTools {
/**
@brief Measuring elapsed time in each frame
@brief %Profiler
Measures time passed during specified sections of each frame. It's meant to be
used in rendering and event loops (e.g. Platform::GlutApplication::drawEvent()),
but it's possible to use it standalone elsewhere. Example usage:
@code
Profiler p;
DebugTools::Profiler p;
// Register named sections
struct {
Profiler::Section ai, physics, draw, bufferSwap;
DebugTools::Profiler::Section ai, physics, draw, bufferSwap;
} sections;
sections.ai = p.addSection("AI");
sections.physics = p.addSection("Physics");
@ -88,7 +88,7 @@ stop it again using stop(), if you are not interested in profiling the rest.
@todo Some unit testing
@todo More time intervals
*/
class MAGNUM_EXPORT Profiler {
class MAGNUM_DEBUGTOOLS_EXPORT Profiler {
public:
/**
* @brief Section ID
@ -201,6 +201,6 @@ class MAGNUM_EXPORT Profiler {
Section currentSection;
};
}
}}
#endif

38
src/DebugTools/ResourceManager.cpp

@ -0,0 +1,38 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#define MAGNUM_RESOURCEMANAGER_DEFINE_INTERNALINSTANCE
#include "ResourceManager.h"
#include "Buffer.h"
#include "Mesh.h"
#include "Shaders/FlatShader.h"
#include "ShapeRenderer.h"
namespace Magnum {
template class ResourceManager<AbstractShaderProgram, Buffer, Mesh, DebugTools::ShapeRendererOptions>;
namespace DebugTools {
ResourceManager::ResourceManager() {
setFallback(new ShapeRendererOptions);
set<AbstractShaderProgram>("shader2d", new Shaders::FlatShader<2>, ResourceDataState::Final, ResourcePolicy::Resident);
}
ResourceManager::~ResourceManager() {}
}}

54
src/DebugTools/ResourceManager.h

@ -0,0 +1,54 @@
#ifndef Magnum_DebugTools_ResourceManager_h
#define Magnum_DebugTools_ResourceManager_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
/** @file
* @brief Class Magnum::DebugTools::ResourceManager
*/
#include "Magnum.h"
#ifndef MAGNUM_RESOURCEMANAGER_DEFINE_INTERNALINSTANCE
#define MAGNUM_RESOURCEMANAGER_DONT_DEFINE_INTERNALINSTANCE
#endif
#include "../ResourceManager.h"
#include "SceneGraph/SceneGraph.h"
#include "Physics/Physics.h"
#include "DebugTools.h"
#include "magnumDebugToolsVisibility.h"
namespace Magnum {
extern template ResourceManager<AbstractShaderProgram, Buffer, Mesh, DebugTools::ShapeRendererOptions> MAGNUM_DEBUGTOOLS_EXPORT *& ResourceManager<AbstractShaderProgram, Buffer, Mesh, DebugTools::ShapeRendererOptions>::internalInstance();
namespace DebugTools {
/**
@brief %Resource manager for debug tools
Stores various data used by debug renderers.
*/
class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager: public Magnum::ResourceManager<AbstractShaderProgram, Buffer, Mesh, DebugTools::ShapeRendererOptions> {
public:
explicit ResourceManager();
~ResourceManager();
};
}}
#endif

75
src/DebugTools/ShapeRenderer.cpp

@ -0,0 +1,75 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "ShapeRenderer.h"
#include "ResourceManager.h"
#include "Physics/AbstractShape.h"
#include "Physics/AxisAlignedBox.h"
#include "Physics/Box.h"
#include "Physics/ObjectShape.h"
#include "Physics/ShapeGroup.h"
#include "Implementation/AxisAlignedBoxRenderer.h"
#include "Implementation/BoxRenderer.h"
namespace Magnum { namespace DebugTools {
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Implementation {
template<> void createDebugMesh(ShapeRenderer<2>* renderer, Physics::AbstractShape<2>* shape) {
switch(shape->type()) {
case Physics::AbstractShape2D::Type::AxisAlignedBox:
renderer->renderers.push_back(new Implementation::AxisAlignedBoxRenderer<2>(*static_cast<Physics::AxisAlignedBox2D*>(shape)));
case Physics::AbstractShape2D::Type::Box:
renderer->renderers.push_back(new Implementation::BoxRenderer<2>(*static_cast<Physics::Box2D*>(shape)));
break;
case Physics::AbstractShape2D::Type::ShapeGroup: {
Physics::ShapeGroup2D* group = static_cast<Physics::ShapeGroup2D*>(shape);
if(group->first()) createDebugMesh(renderer, group->first());
if(group->second()) createDebugMesh(renderer, group->second());
} break;
default:
Warning() << "DebugTools::ShapeRenderer2D::createShapeRenderer(): type" << shape->type() << "not implemented";
}
}
template<> void createDebugMesh(ShapeRenderer<3>*, Physics::AbstractShape<3>* shape) {
switch(shape->type()) {
default:
Warning() << "DebugTools::ShapeRenderer3D::createShapeRenderer(): type" << shape->type() << "not implemented";
}
}
}
#endif
template<std::uint8_t dimensions> ShapeRenderer<dimensions>::ShapeRenderer(Physics::ObjectShape<dimensions>* shape, ResourceKey options, SceneGraph::DrawableGroup<dimensions>* drawables): SceneGraph::Drawable<dimensions>(shape->object(), drawables), options(ResourceManager::instance()->get<ShapeRendererOptions>(options)) {
Implementation::createDebugMesh(this, shape->shape());
}
template<std::uint8_t dimensions> ShapeRenderer<dimensions>::~ShapeRenderer() {
for(auto i: renderers) delete i;
}
template<std::uint8_t dimensions> void ShapeRenderer<dimensions>::draw(const typename DimensionTraits<dimensions>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions>* camera) {
for(auto i: renderers) i->draw(options, transformationMatrix, camera);
}
template class ShapeRenderer<2>;
template class ShapeRenderer<3>;
}}

119
src/DebugTools/ShapeRenderer.h

@ -0,0 +1,119 @@
#ifndef Magnum_DebugTools_ShapeRenderer_h
#define Magnum_DebugTools_ShapeRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "Color.h"
#include "Resource.h"
#include "SceneGraph/Drawable.h"
#include "Physics/Physics.h"
#include "magnumDebugToolsVisibility.h"
namespace Magnum { namespace DebugTools {
template<std::uint8_t> class ShapeRenderer;
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Implementation {
template<std::uint8_t> class AbstractShapeRenderer;
template<std::uint8_t dimensions> void createDebugMesh(ShapeRenderer<dimensions>* renderer, Physics::AbstractShape<dimensions>* shape);
}
#endif
/**
@brief Shape renderer options
See ShapeRenderer documentation for more information.
*/
struct ShapeRendererOptions {
Color3<> color; /**< @brief Color */
};
/**
@brief Shape renderer
Creates renderers for object collision shape.
@section ShapeRenderer-usage Basic usage
ResourceManager must be instanced for the whole lifetime of debug
renderers. You can specify options via Options struct - add it to the manager
and then create debug renderer with the same options key. This way you can
easily share the same options with more renderers. If no options for given key
exist, default is used.
Example code:
@code
// Instance the manager at first
DebugTools::ResourceManager manager;
// Group of drawables, preferrably dedicated for debug renderers, so you can
// easily enable or disable debug draw
SceneGraph::DrawableGroup2D debugDrawables;
// Create some options
auto o = new DebugTools::ShapeRendererOptions {
{1.0f, 0.0f, 0.0f} // Red color
};
manager->set<DebugTools::ShapeRendererOptions>("red", o, ResourceDataState::Final, ResourcePolicy::Persistent);
// Create debug renderer for given shape, use "red" options for it
Physics::ObjectShape2D* shape;
debugDrawables.add(new DebugTools::ShapeRenderer2D(shape, "red", debugDrawables));
@endcode
@see ShapeRenderer2D, ShapeRenderer3D
*/
template<std::uint8_t dimensions> class MAGNUM_DEBUGTOOLS_EXPORT ShapeRenderer: public SceneGraph::Drawable<dimensions> {
#ifndef DOXYGEN_GENERATING_OUTPUT
friend void Implementation::createDebugMesh<>(ShapeRenderer<dimensions>*, Physics::AbstractShape<dimensions>*);
#endif
public:
/**
* @brief Constructor
* @param shape Shape for which to create debug renderer
* @param options Options resource key. See
* @ref ShapeRenderer-usage "class documentation" for more
* information.
* @param drawables Drawable group
*
* @attention @p shape must be available for the whole lifetime of
* this class
*/
explicit ShapeRenderer(Physics::ObjectShape<dimensions>* shape, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions>* drawables = nullptr);
~ShapeRenderer();
protected:
/** @todoc Remove GLfloat when Doxygen properly treats this as override */
void draw(const typename DimensionTraits<dimensions, GLfloat>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions, GLfloat>* camera) override;
private:
Resource<ShapeRendererOptions> options;
std::vector<Implementation::AbstractShapeRenderer<dimensions>*> renderers;
};
/** @brief Two-dimensional shape renderer */
typedef ShapeRenderer<2> ShapeRenderer2D;
/** @brief Three-dimensional shape renderer */
typedef ShapeRenderer<3> ShapeRenderer3D;
}}
#endif

28
src/DebugTools/magnumDebugToolsVisibility.h

@ -0,0 +1,28 @@
#ifndef Magnum_DebugTools_magnumDebugToolsVisibility_h
#define Magnum_DebugTools_magnumDebugToolsVisibility_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#ifdef _WIN32
#ifdef MagnumDebugTools_EXPORTS
#define MAGNUM_DEBUGTOOLS_EXPORT __declspec(dllexport)
#else
#define MAGNUM_DEBUGTOOLS_EXPORT __declspec(dllimport)
#endif
#else
#define MAGNUM_DEBUGTOOLS_EXPORT __attribute__ ((visibility ("default")))
#endif
#endif

1
src/Magnum.h

@ -175,7 +175,6 @@ typedef ImageWrapper<3> ImageWrapper3D;
class IndexedMesh;
class Mesh;
class Profiler;
class Query;
class Renderbuffer;

9
src/Physics/CMakeLists.txt

@ -3,26 +3,19 @@ set(MagnumPhysics_SRCS
AxisAlignedBox.cpp
Box.cpp
Capsule.cpp
DebugDrawResourceManager.cpp
Line.cpp
Plane.cpp
Point.cpp
ObjectShape.cpp
ObjectShapeGroup.cpp
ShapeGroup.cpp
Sphere.cpp
Implementation/AbstractBoxRenderer.cpp
Implementation/AbstractDebugRenderer.cpp
Implementation/AxisAlignedBoxRenderer.cpp
Implementation/BoxRenderer.cpp)
Sphere.cpp)
set(MagnumPhysics_HEADERS
AbstractShape.h
AxisAlignedBox.h
Box.h
Capsule.h
DebugDrawResourceManager.h
Line.h
LineSegment.h
ObjectShape.h

76
src/Physics/DebugDrawResourceManager.cpp

@ -1,76 +0,0 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#define MAGNUM_RESOURCEMANAGER_DEFINE_INTERNALINSTANCE
#include "DebugDrawResourceManager.h"
#include "AbstractShaderProgram.h"
#include "Buffer.h"
#include "Mesh.h"
#include "ResourceManager.h"
#include "Shaders/FlatShader.h"
#include "AbstractShape.h"
#include "AxisAlignedBox.h"
#include "Box.h"
#include "ObjectShape.h"
#include "ShapeGroup.h"
#include "Implementation/AxisAlignedBoxRenderer.h"
#include "Implementation/BoxRenderer.h"
#include "Implementation/DebugRenderer.h"
namespace Magnum {
template class ResourceManager<AbstractShaderProgram, Buffer, Mesh, Physics::Implementation::Options>;
namespace Physics {
template<std::uint8_t dimensions> SceneGraph::Drawable<dimensions>* DebugDrawResourceManager::createDebugRenderer(ObjectShape<dimensions>* shape, ResourceKey options) {
Implementation::DebugRenderer<dimensions>* renderer = new Implementation::DebugRenderer<dimensions>(shape->object(), instance()->get<Options>(options));
createDebugMesh(renderer, shape->shape());
return renderer;
}
template SceneGraph::Drawable<2> MAGNUM_PHYSICS_EXPORT * DebugDrawResourceManager::createDebugRenderer(ObjectShape<2>* shape, ResourceKey options);
template SceneGraph::Drawable<3> MAGNUM_PHYSICS_EXPORT * DebugDrawResourceManager::createDebugRenderer(ObjectShape<3>* shape, ResourceKey options);
void DebugDrawResourceManager::createDebugMesh(Implementation::DebugRenderer<2>* renderer, AbstractShape2D* shape) {
switch(shape->type()) {
case AbstractShape2D::Type::AxisAlignedBox:
renderer->addRenderer(new Implementation::AxisAlignedBoxRenderer<2>(*static_cast<AxisAlignedBox2D*>(shape)));
case AbstractShape2D::Type::Box:
renderer->addRenderer(new Implementation::BoxRenderer<2>(*static_cast<Box2D*>(shape)));
break;
case AbstractShape2D::Type::ShapeGroup: {
ShapeGroup2D* group = static_cast<ShapeGroup2D*>(shape);
if(group->first()) createDebugMesh(renderer, group->first());
if(group->second()) createDebugMesh(renderer, group->second());
break;
}
default:
Warning() << "Physics::DebugDrawResourceManager::createDebugRenderer(): type" << shape->type() << "not implemented";
}
}
void DebugDrawResourceManager::createDebugMesh(Implementation::DebugRenderer<3>*, AbstractShape3D*) {}
DebugDrawResourceManager::DebugDrawResourceManager() {
setFallback<Options>(new Options);
set<AbstractShaderProgram>("shader2d", new Shaders::FlatShader<2>, ResourceDataState::Final, ResourcePolicy::Resident);
}
DebugDrawResourceManager::~DebugDrawResourceManager() {}
}}

117
src/Physics/DebugDrawResourceManager.h

@ -1,117 +0,0 @@
#ifndef Magnum_Physics_DebugDrawResourceManager_h
#define Magnum_Physics_DebugDrawResourceManager_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
/** @file
* @brief Class Magnum::Physics::DebugDrawResourceManager
*/
#include "Magnum.h"
#include "Color.h"
#ifndef MAGNUM_RESOURCEMANAGER_DEFINE_INTERNALINSTANCE
#define MAGNUM_RESOURCEMANAGER_DONT_DEFINE_INTERNALINSTANCE
#endif
#include "ResourceManager.h"
#include "SceneGraph/SceneGraph.h"
#include "Physics.h"
#include "magnumPhysicsVisibility.h"
namespace Magnum {
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Physics { namespace Implementation {
struct Options {
Color3<> color;
};
template<std::uint8_t> class DebugRenderer;
}}
#endif
extern template ResourceManager<AbstractShaderProgram, Buffer, Mesh, Physics::Implementation::Options> MAGNUM_PHYSICS_EXPORT *& ResourceManager<AbstractShaderProgram, Buffer, Mesh, Physics::Implementation::Options>::internalInstance();
namespace Physics {
/**
@brief %Resource manager for physics debug draw
Can create objects which draw object collision shape for debugging purposes.
@section DebugDrawResourceManager-usage Basic usage
The manager must be instanced for the whole lifetime of debug draw objects.
To create debug renderers, call createDebugRenderer() and add the resulting
drawable to some group. You can specify options via Options struct - add it to
the manager and then create debug renderer with the same options key. This way
you can easily share the same options with more renderers. If no options for
given key exist, default is used.
Example code:
@code
// Group of drawables,preferrably dedicated for debug renderers, so you can
// easily enable or disable debug draw
DrawableGroup2D group;
// Instance the manager at first
DebugDrawResourceManager manager;
// Create some options
auto o = new DebugDrawResourceManager::Options {
{1.0f, 0.0f, 0.0f} // Red color
};
manager->set<DebugDrawResourceManager::Options>("red", o, ResourceDataState::Final, ResourcePolicy::Persistent);
// Create debug renderer for given shape, use "red" options for it. Don't
// forget to add it to some drawable group.
ObjectShape2D* shape;
group.add(DebugDrawResourceManager::createDebugRenderer(shape, "red"));
@endcode
*/
class MAGNUM_PHYSICS_EXPORT DebugDrawResourceManager: public ResourceManager<AbstractShaderProgram, Buffer, Mesh, Physics::Implementation::Options> {
public:
#ifdef DOXYGEN_GENERATING_OUTPUT
/** @brief %Options */
struct Options {
Color3<> color; /**< @brief Color */
};
#else
typedef Implementation::Options Options;
#endif
/**
* @brief Create debug renderer for given shape
* @param shape Shape for which to create debug renderer
* @param options Options resource key. See
* @ref DebugDrawResourceManager-usage "class documentation" for
* more information.
*
* Returned drawable is not part of any group, you have to add it to
* one yourself.
*/
template<std::uint8_t dimensions> static SceneGraph::Drawable<dimensions>* createDebugRenderer(ObjectShape<dimensions>* shape, ResourceKey options = ResourceKey());
explicit DebugDrawResourceManager();
~DebugDrawResourceManager();
private:
static void createDebugMesh(Implementation::DebugRenderer<2>* renderer, AbstractShape2D* shape);
static void createDebugMesh(Implementation::DebugRenderer<3>* renderer, AbstractShape3D* shape);
};
}}
#endif

32
src/Physics/Implementation/AbstractDebugRenderer.cpp

@ -1,32 +0,0 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "AbstractDebugRenderer.h"
#include "AbstractShaderProgram.h"
#include "Mesh.h"
#include "Physics/DebugDrawResourceManager.h"
#include "Shaders/FlatShader.h"
namespace Magnum { namespace Physics { namespace Implementation {
template<std::uint8_t dimensions> AbstractDebugRenderer<dimensions>::AbstractDebugRenderer(ResourceKey shader, ResourceKey mesh): shader(DebugDrawResourceManager::instance()->get<AbstractShaderProgram, Shaders::FlatShader<dimensions>>(shader)), mesh(DebugDrawResourceManager::instance()->get<Mesh>(mesh)) {}
template<std::uint8_t dimensions> AbstractDebugRenderer<dimensions>::~AbstractDebugRenderer() {}
template class AbstractDebugRenderer<2>;
template class AbstractDebugRenderer<3>;
}}}

42
src/Physics/Implementation/AbstractDebugRenderer.h

@ -1,42 +0,0 @@
#ifndef Magnum_Physics_Implementation_AbstractDebugRenderer_h
#define Magnum_Physics_Implementation_AbstractDebugRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "DimensionTraits.h"
#include "ResourceManager.h"
#include "SceneGraph/SceneGraph.h"
#include "Shaders/Shaders.h"
namespace Magnum { namespace Physics { namespace Implementation {
struct Options;
template<std::uint8_t dimensions> class AbstractDebugRenderer {
public:
AbstractDebugRenderer(ResourceKey shader, ResourceKey mesh);
virtual ~AbstractDebugRenderer();
virtual void draw(Resource<Options>& options, const typename DimensionTraits<dimensions>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions>* camera) = 0;
protected:
Resource<AbstractShaderProgram, Shaders::FlatShader<dimensions>> shader;
Resource<Mesh> mesh;
};
}}}
#endif

58
src/Physics/Implementation/DebugRenderer.h

@ -1,58 +0,0 @@
#ifndef Magnum_Physics_Implementation_DebugRenderer_h
#define Magnum_Physics_Implementation_DebugRenderer_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "ResourceManager.h"
#include "SceneGraph/Drawable.h"
#include "AbstractDebugRenderer.h"
namespace Magnum {
class AbstractShaderProgram;
class Mesh;
namespace Shaders {
template<std::uint8_t> class FlatShader;
}
namespace Physics { namespace Implementation {
struct Options;
template<std::uint8_t dimensions> class DebugRenderer: public SceneGraph::Drawable<dimensions> {
public:
DebugRenderer(SceneGraph::AbstractObject<dimensions>* object, Resource<Options>&& options): SceneGraph::Drawable<dimensions>(object), options(options) {}
inline ~DebugRenderer() {
for(auto i: renderers) delete i;
}
inline void addRenderer(AbstractDebugRenderer<dimensions>* renderer) {
renderers.push_back(renderer);
}
inline void draw(const typename DimensionTraits<dimensions>::MatrixType& transformationMatrix, SceneGraph::AbstractCamera<dimensions>* camera) override {
for(auto i: renderers) i->draw(options, transformationMatrix, camera);
}
private:
Resource<Options> options;
std::vector<AbstractDebugRenderer<dimensions>*> renderers;
};
}}}
#endif

6
src/Physics/Physics.h

@ -15,12 +15,12 @@
GNU Lesser General Public License version 3 for more details.
*/
#include <cstdint>
/** @file
* @brief Forward declarations for Magnum::Physics namespace
*/
#include <cstdint>
namespace Magnum { namespace Physics {
template<std::uint8_t> class AbstractShape;
@ -39,8 +39,6 @@ template<std::uint8_t> class Capsule;
typedef Capsule<2> Capsule2D;
typedef Capsule<3> Capsule3D;
class DebugDrawResourceManager;
template<std::uint8_t> class Line;
typedef Line<2> Line2D;
typedef Line<3> Line3D;

2
src/ResourceManager.h

@ -15,7 +15,7 @@
GNU Lesser General Public License version 3 for more details.
*/
/** @file
/** @file /ResourceManager.h
* @brief Class Magnum::ResourceManager, enum Magnum::ResourceDataState, Magnum::ResourcePolicy
*/

Loading…
Cancel
Save