Browse Source

Forward declarations for Physics namespace in Physics/Physics.h.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
19a92f3ca7
  1. 1
      doc/compilation-speedup.dox
  2. 5
      src/Physics/CMakeLists.txt
  3. 4
      src/Physics/Capsule.h
  4. 13
      src/Physics/DebugDrawResourceManager.h
  5. 3
      src/Physics/ObjectShape.h
  6. 4
      src/Physics/ObjectShapeGroup.h
  7. 76
      src/Physics/Physics.h
  8. 2
      src/Physics/Plane.cpp
  9. 6
      src/Physics/Plane.h
  10. 5
      src/Physics/Sphere.h

1
doc/compilation-speedup.dox

@ -20,6 +20,7 @@ typedefs etc. In this case a header with forward declarations is usually
available, each namespace has its own:
- Magnum.h
- Physics/Physics.h
- SceneGraph/SceneGraph.h
- Shaders/Shaders.h

5
src/Physics/CMakeLists.txt

@ -25,10 +25,11 @@ set(MagnumPhysics_HEADERS
DebugDrawResourceManager.h
Line.h
LineSegment.h
Plane.h
Point.h
ObjectShape.h
ObjectShapeGroup.h
Physics.h
Plane.h
Point.h
ShapeGroup.h
Sphere.h

4
src/Physics/Capsule.h

@ -21,14 +21,12 @@
#include "Math/Vector3.h"
#include "AbstractShape.h"
#include "Physics.h"
#include "magnumCompatibility.h"
namespace Magnum { namespace Physics {
template<std::uint8_t> class Point;
template<std::uint8_t> class Sphere;
/**
@brief %Capsule defined by cylinder start and end point and radius

13
src/Physics/DebugDrawResourceManager.h

@ -28,15 +28,12 @@
#include "ResourceManager.h"
#include "SceneGraph/SceneGraph.h"
#include "Physics.h"
#include "magnumPhysicsVisibility.h"
namespace Magnum {
class AbstractShaderProgram;
class Buffer;
class Mesh;
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Physics { namespace Implementation {
struct Options {
@ -50,14 +47,6 @@ extern template ResourceManager<AbstractShaderProgram, Buffer, Mesh, Physics::Im
namespace Physics {
template<std::uint8_t> class AbstractShape;
typedef AbstractShape<2> AbstractShape2D;
typedef AbstractShape<3> AbstractShape3D;
template<std::uint8_t> class ObjectShape;
typedef ObjectShape<2> ObjectShape2D;
typedef ObjectShape<3> ObjectShape3D;
/**
@brief %Resource manager for physics debug draw

3
src/Physics/ObjectShape.h

@ -26,9 +26,6 @@
namespace Magnum { namespace Physics {
template<std::uint8_t> class ObjectShapeGroup;
template<std::uint8_t> class AbstractShape;
/**
@brief Object shape

4
src/Physics/ObjectShapeGroup.h

@ -23,17 +23,15 @@
#include <vector>
#include "SceneGraph/FeatureGroup.h"
#include "Physics.h"
#include "magnumPhysicsVisibility.h"
namespace Magnum { namespace Physics {
template<std::uint8_t> class ObjectShape;
/**
@brief Group of object shapes
@see ObjectShapeGroup2D, ObjectShapeGroup3D
*/
template<std::uint8_t dimensions> class PHYSICS_EXPORT ObjectShapeGroup: public SceneGraph::FeatureGroup<dimensions, ObjectShape<dimensions>> {

76
src/Physics/Physics.h

@ -0,0 +1,76 @@
#ifndef Magnum_Physics_Physics_h
#define Magnum_Physics_Physics_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 <cstdint>
/** @file
* @brief Forward declarations for Magnum::Physics namespace
*/
namespace Magnum { namespace Physics {
template<std::uint8_t> class AbstractShape;
typedef AbstractShape<2> AbstractShape2D;
typedef AbstractShape<3> AbstractShape3D;
template<std::uint8_t> class AxisAlignedBox;
typedef AxisAlignedBox<2> AxisAlignedBox2D;
typedef AxisAlignedBox<3> AxisAlignedBox3D;
template<std::uint8_t> class Box;
typedef Box<2> Box2D;
typedef Box<3> Box3D;
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;
template<std::uint8_t> class LineSegment;
typedef LineSegment<2> LineSegment2D;
typedef LineSegment<3> LineSegment3D;
template<std::uint8_t> class ObjectShape;
typedef ObjectShape<2> ObjectShape2D;
typedef ObjectShape<3> ObjectShape3D;
template<std::uint8_t> class ObjectShapeGroup;
typedef ObjectShapeGroup<2> ObjectShapeGroup2D;
typedef ObjectShapeGroup<3> ObjectShapeGroup3D;
class Plane;
template<std::uint8_t> class Point;
typedef Point<2> Point2D;
typedef Point<3> Point3D;
template<std::uint8_t> class ShapeGroup;
typedef ShapeGroup<2> ShapeGroup2D;
typedef ShapeGroup<3> ShapeGroup3D;
template<std::uint8_t> class Sphere;
typedef Sphere<2> Sphere2D;
typedef Sphere<3> Sphere3D;
}}
#endif

2
src/Physics/Plane.cpp

@ -28,7 +28,7 @@ using namespace Magnum::Math::Geometry;
namespace Magnum { namespace Physics {
void Plane::applyTransformation(const Matrix4& transformation) {
_transformedPosition = (transformation*Point3D(_position)).xyz();
_transformedPosition = (transformation*Magnum::Point3D(_position)).xyz();
_transformedNormal = transformation.rotation()*_normal;
}

6
src/Physics/Plane.h

@ -21,16 +21,12 @@
#include "Math/Vector3.h"
#include "AbstractShape.h"
#include "Physics.h"
#include "magnumCompatibility.h"
namespace Magnum { namespace Physics {
template<std::uint8_t> class Line;
typedef Line<3> Line3D;
template<std::uint8_t> class LineSegment;
typedef LineSegment<3> LineSegment3D;
/** @brief Infinite plane, defined by position and normal (3D only) */
class PHYSICS_EXPORT Plane: public AbstractShape<3> {
public:

5
src/Physics/Sphere.h

@ -21,15 +21,12 @@
#include "Math/Vector3.h"
#include "AbstractShape.h"
#include "Physics.h"
#include "magnumCompatibility.h"
namespace Magnum { namespace Physics {
template<std::uint8_t> class Line;
template<std::uint8_t> class LineSegment;
template<std::uint8_t> class Point;
/**
@brief %Sphere defined by position and radius

Loading…
Cancel
Save