Browse Source

Moved Object, Scene and Light to separate SceneGraph library.

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
e3ee7b487b
  1. 2
      CMakeLists.txt
  2. 4
      doc/mainpage.dox
  3. 13
      doc/namespaces.dox
  4. 6
      modules/FindMagnum.cmake
  5. 20
      src/CMakeLists.txt
  6. 42
      src/SceneGraph/CMakeLists.txt
  7. 4
      src/SceneGraph/Camera.cpp
  8. 14
      src/SceneGraph/Camera.h
  9. 4
      src/SceneGraph/Light.cpp
  10. 12
      src/SceneGraph/Light.h
  11. 5
      src/SceneGraph/Object.cpp
  12. 15
      src/SceneGraph/Object.h
  13. 12
      src/SceneGraph/Scene.h
  14. 3
      src/SceneGraph/Test/CMakeLists.txt
  15. 9
      src/SceneGraph/Test/CameraTest.cpp
  16. 8
      src/SceneGraph/Test/CameraTest.h
  17. 10
      src/SceneGraph/Test/ObjectTest.cpp
  18. 10
      src/SceneGraph/Test/ObjectTest.h
  19. 8
      src/SceneGraph/Test/SceneTest.cpp
  20. 8
      src/SceneGraph/Test/SceneTest.h
  21. 30
      src/SceneGraph/magnumSceneGraphVisibility.h
  22. 4
      src/Test/CMakeLists.txt

2
CMakeLists.txt

@ -11,6 +11,7 @@ option(WITH_EVERYTHING "Build everything (doesn't include contexts)" ON)
option(WITH_MESHTOOLS "Build MeshTools library" OFF) option(WITH_MESHTOOLS "Build MeshTools library" OFF)
option(WITH_PHYSICS "Build Physics library" OFF) option(WITH_PHYSICS "Build Physics library" OFF)
option(WITH_PRIMITIVES "Builf Primitives library" OFF) option(WITH_PRIMITIVES "Builf Primitives library" OFF)
option(WITH_SCENEGRAPH "Build SceneGraph library" OFF)
option(WITH_SHADERS "Build Shaders library" OFF) option(WITH_SHADERS "Build Shaders library" OFF)
cmake_dependent_option(WITH_EGLCONTEXT "Build EglContext library" OFF "TARGET_GLES" OFF) cmake_dependent_option(WITH_EGLCONTEXT "Build EglContext library" OFF "TARGET_GLES" OFF)
@ -23,6 +24,7 @@ if(WITH_EVERYTHING)
set(WITH_MESHTOOLS ON) set(WITH_MESHTOOLS ON)
set(WITH_PHYSICS ON) set(WITH_PHYSICS ON)
set(WITH_PRIMITIVES ON) set(WITH_PRIMITIVES ON)
set(WITH_SCENEGRAPH ON)
set(WITH_SHADERS ON) set(WITH_SHADERS ON)
endif() endif()

4
doc/mainpage.dox

@ -6,8 +6,8 @@ Features:
- Easy-to-use templated @ref Math "mathematical library" for matrix/vector - Easy-to-use templated @ref Math "mathematical library" for matrix/vector
calculations and @ref Math::Geometry "geometry". calculations and @ref Math::Geometry "geometry".
- Hierarchical @ref Object "scene graph" which supports transformation caching - Hierarchical @ref SceneGraph "scene graph" which supports transformation
for better performance, classes for convenient usage of caching for better performance, classes for convenient usage of
@ref AbstractShaderProgram "shaders", @ref Buffer "buffers" and @ref AbstractShaderProgram "shaders", @ref Buffer "buffers" and
@ref AbstractTexture "textures". Access to @ref Framebuffer "framebuffer" @ref AbstractTexture "textures". Access to @ref Framebuffer "framebuffer"
and @ref AbstractQuery "occlusion queries". and @ref AbstractQuery "occlusion queries".

13
doc/namespaces.dox

@ -7,8 +7,7 @@
/** @namespace Magnum /** @namespace Magnum
@brief Root namespace @brief Root namespace
Contains classes needed for building meshes, setting up and rendering the Contains classes for interacting with OpenGL.
scene.
*/ */
/** @dir Contexts /** @dir Contexts
@ -58,6 +57,16 @@ Tools for generating, optimizing and cleaning meshes.
Basic primitives for testing purposes. Basic primitives for testing purposes.
*/ */
/** @dir SceneGraph
* @brief Namespace Magnum::SceneGraph
*/
/**
@namespace Magnum::SceneGraph
@brief %Scene graph library
Setting up and rendering the scene.
*/
/** @dir Shaders /** @dir Shaders
* @brief Namespace Magnum::Shaders * @brief Namespace Magnum::Shaders
*/ */

6
modules/FindMagnum.cmake

@ -18,6 +18,7 @@
# MeshTools - MeshTools library # MeshTools - MeshTools library
# Physics - Physics library # Physics - Physics library
# Primitives - Library with stock geometric primitives (static) # Primitives - Library with stock geometric primitives (static)
# SceneGraph - Scene graph library
# Shaders - Library with stock shaders # Shaders - Library with stock shaders
# EglContext - EGL context (depends on EGL and X11 libraries) # EglContext - EGL context (depends on EGL and X11 libraries)
# GlutContext - GLUT context (depends on GLUT library) # GlutContext - GLUT context (depends on GLUT library)
@ -137,6 +138,11 @@ foreach(component ${Magnum_FIND_COMPONENTS})
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Cube.h) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Cube.h)
endif() endif()
# Scene graph library
if(${component} STREQUAL SceneGraph)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Scene.h)
endif()
# Shaders library # Shaders library
if(${component} STREQUAL Shaders) if(${component} STREQUAL Shaders)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES PhongShader.h) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES PhongShader.h)

20
src/CMakeLists.txt

@ -19,10 +19,8 @@ set(Magnum_SRCS
AbstractTexture.cpp AbstractTexture.cpp
AbstractShaderProgram.cpp AbstractShaderProgram.cpp
BufferedTexture.cpp BufferedTexture.cpp
Camera.cpp
Framebuffer.cpp Framebuffer.cpp
IndexedMesh.cpp IndexedMesh.cpp
Light.cpp
Mesh.cpp Mesh.cpp
Query.cpp Query.cpp
Renderbuffer.cpp Renderbuffer.cpp
@ -39,7 +37,6 @@ set(Magnum_HEADERS
BufferedImage.h BufferedImage.h
BufferedTexture.h BufferedTexture.h
Buffer.h Buffer.h
Camera.h
Color.h Color.h
CubeMapTextureArray.h CubeMapTextureArray.h
CubeMapTexture.h CubeMapTexture.h
@ -47,13 +44,10 @@ set(Magnum_HEADERS
Image.h Image.h
ImageWrapper.h ImageWrapper.h
IndexedMesh.h IndexedMesh.h
Light.h
Magnum.h Magnum.h
Mesh.h Mesh.h
Object.h
Query.h Query.h
Renderbuffer.h Renderbuffer.h
Scene.h
Shader.h Shader.h
SizeTraits.h SizeTraits.h
Swizzle.h Swizzle.h
@ -68,10 +62,6 @@ set(MagnumMath_SRCS
Math/Math.cpp) Math/Math.cpp)
add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS}) add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS})
# Files compiled with different flags for main library and unit test library
set(Magnum_GracefulAssert_SRCS
Object.cpp)
# Set shared library flags for the objects, as they will be part of shared lib # Set shared library flags for the objects, as they will be part of shared lib
# TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well # TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well
set_target_properties(MagnumObjects MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") set_target_properties(MagnumObjects MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
@ -79,8 +69,7 @@ set_target_properties(MagnumObjects MagnumMathObjects PROPERTIES COMPILE_FLAGS "
# Main library # Main library
add_library(Magnum SHARED add_library(Magnum SHARED
$<TARGET_OBJECTS:MagnumObjects> $<TARGET_OBJECTS:MagnumObjects>
$<TARGET_OBJECTS:MagnumMathObjects> $<TARGET_OBJECTS:MagnumMathObjects>)
${Magnum_GracefulAssert_SRCS})
target_link_libraries(Magnum ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) target_link_libraries(Magnum ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY})
if(NOT TARGET_GLES) if(NOT TARGET_GLES)
target_link_libraries(Magnum ${OPENGL_gl_LIBRARY} ${GLEW_LIBRARY}) target_link_libraries(Magnum ${OPENGL_gl_LIBRARY} ${GLEW_LIBRARY})
@ -110,6 +99,10 @@ if(WITH_PRIMITIVES)
add_subdirectory(Primitives) add_subdirectory(Primitives)
endif() endif()
if(WITH_SCENEGRAPH)
add_subdirectory(SceneGraph)
endif()
if(WITH_SHADERS) if(WITH_SHADERS)
add_subdirectory(Shaders) add_subdirectory(Shaders)
endif() endif()
@ -119,8 +112,7 @@ if(BUILD_TESTS)
# Library with graceful assert for testing # Library with graceful assert for testing
add_library(MagnumTestLib SHARED add_library(MagnumTestLib SHARED
$<TARGET_OBJECTS:MagnumObjects> $<TARGET_OBJECTS:MagnumObjects>)
${Magnum_GracefulAssert_SRCS})
set_target_properties(MagnumTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) set_target_properties(MagnumTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
target_link_libraries(MagnumTestLib ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) target_link_libraries(MagnumTestLib ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY})
if(NOT TARGET_GLES) if(NOT TARGET_GLES)

42
src/SceneGraph/CMakeLists.txt

@ -0,0 +1,42 @@
# Files shared between main library and unit test library
set(MagnumSceneGraph_SRCS
Camera.cpp
Light.cpp)
set(MagnumSceneGraph_HEADERS
Camera.h
Light.h
Object.h
Scene.h
magnumSceneGraphVisibility.h)
add_library(MagnumSceneGraphObjects OBJECT ${MagnumSceneGraph_SRCS})
# Files compiled with different flags for main library and unit test library
set(MagnumSceneGraph_GracefulAssert_SRCS
Object.cpp)
# Set shared library flags for the objects, as they will be part of shared lib
# TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well
set_target_properties(MagnumSceneGraphObjects PROPERTIES COMPILE_FLAGS "-DMagnumSceneGraphObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
# SceneGraph library
add_library(MagnumSceneGraph SHARED
$<TARGET_OBJECTS:MagnumSceneGraphObjects>
${MagnumSceneGraph_GracefulAssert_SRCS})
target_link_libraries(MagnumSceneGraph Magnum)
install(TARGETS MagnumSceneGraph DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumSceneGraph_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/SceneGraph)
if(BUILD_TESTS)
enable_testing()
# Library with graceful assert for testing
add_library(MagnumSceneGraphTestLib SHARED
$<TARGET_OBJECTS:MagnumSceneGraphObjects>
${MagnumSceneGraph_GracefulAssert_SRCS})
set_target_properties(MagnumSceneGraphTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
target_link_libraries(MagnumSceneGraphTestLib Magnum)
add_subdirectory(Test)
endif()

4
src/Camera.cpp → src/SceneGraph/Camera.cpp

@ -19,7 +19,7 @@
using namespace std; using namespace std;
namespace Magnum { namespace Magnum { namespace SceneGraph {
Camera::Camera(Object* parent): Object(parent), _aspectRatioPolicy(AspectRatioPolicy::Extend) {} Camera::Camera(Object* parent): Object(parent), _aspectRatioPolicy(AspectRatioPolicy::Extend) {}
@ -122,4 +122,4 @@ void Camera::drawChildren(Object* object, const Matrix4& transformationMatrix) {
} }
} }
} }}

14
src/Camera.h → src/SceneGraph/Camera.h

@ -1,5 +1,5 @@
#ifndef Magnum_Camera_h #ifndef Magnum_SceneGraph_Camera_h
#define Magnum_Camera_h #define Magnum_SceneGraph_Camera_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -16,7 +16,7 @@
*/ */
/** @file /** @file
* @brief Class Magnum::Camera * @brief Class Magnum::SceneGraph::Camera
*/ */
#include "Object.h" #include "Object.h"
@ -26,12 +26,12 @@
#undef far #undef far
#endif #endif
namespace Magnum { namespace Magnum { namespace SceneGraph {
/** @ingroup scene /** @ingroup scene
@brief %Camera object @brief %Camera object
*/ */
class MAGNUM_EXPORT Camera: public Object { class SCENEGRAPH_EXPORT Camera: public Object {
public: public:
/** /**
* @brief Aspect ratio policy * @brief Aspect ratio policy
@ -148,9 +148,9 @@ class MAGNUM_EXPORT Camera: public Object {
Math::Vector2<GLsizei> _viewport; Math::Vector2<GLsizei> _viewport;
AspectRatioPolicy _aspectRatioPolicy; AspectRatioPolicy _aspectRatioPolicy;
MAGNUM_LOCAL void fixAspectRatio(); SCENEGRAPH_LOCAL void fixAspectRatio();
}; };
} }}
#endif #endif

4
src/Light.cpp → src/SceneGraph/Light.cpp

@ -15,7 +15,7 @@
#include "Light.h" #include "Light.h"
namespace Magnum { namespace Magnum { namespace SceneGraph {
void Light::clean(const Matrix4& absoluteTransformation) { void Light::clean(const Matrix4& absoluteTransformation) {
Object::clean(absoluteTransformation); Object::clean(absoluteTransformation);
@ -23,4 +23,4 @@ void Light::clean(const Matrix4& absoluteTransformation) {
_position = absoluteTransformation[3]; _position = absoluteTransformation[3];
} }
} }}

12
src/Light.h → src/SceneGraph/Light.h

@ -1,5 +1,5 @@
#ifndef Magnum_Light_h #ifndef Magnum_SceneGraph_Light_h
#define Magnum_Light_h #define Magnum_SceneGraph_Light_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -16,19 +16,19 @@
*/ */
/** @file /** @file
* @brief Class Magnum::Light * @brief Class Magnum::SceneGraph::Light
*/ */
#include "Object.h" #include "Object.h"
namespace Magnum { namespace Magnum { namespace SceneGraph {
/** @ingroup scene /** @ingroup scene
* @brief Basic light object * @brief Basic light object
* *
* Provides cached light position. * Provides cached light position.
*/ */
class MAGNUM_EXPORT Light: public Object { class SCENEGRAPH_EXPORT Light: public Object {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -54,6 +54,6 @@ class MAGNUM_EXPORT Light: public Object {
Vector4 _position; Vector4 _position;
}; };
} }}
#endif #endif

5
src/Object.cpp → src/SceneGraph/Object.cpp

@ -16,12 +16,13 @@
#include "Object.h" #include "Object.h"
#include <stack> #include <stack>
#include "Scene.h" #include "Scene.h"
#include "Camera.h" #include "Camera.h"
using namespace std; using namespace std;
namespace Magnum { namespace Magnum { namespace SceneGraph {
Object* Object::setParent(Object* parent) { Object* Object::setParent(Object* parent) {
/* Skip if nothing to do or this is scene */ /* Skip if nothing to do or this is scene */
@ -149,4 +150,4 @@ void Object::setClean() {
} }
} }
} }}

15
src/Object.h → src/SceneGraph/Object.h

@ -1,5 +1,5 @@
#ifndef Magnum_Object_h #ifndef Magnum_SceneGraph_Object_h
#define Magnum_Object_h #define Magnum_SceneGraph_Object_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -16,14 +16,16 @@
*/ */
/** @file /** @file
* @brief Class Magnum::Object * @brief Class Magnum::SceneGraph::Object
*/ */
#include <set> #include <set>
#include "Magnum.h" #include "Magnum.h"
namespace Magnum { #include "magnumSceneGraphVisibility.h"
namespace Magnum { namespace SceneGraph {
class Scene; class Scene;
class Camera; class Camera;
@ -44,7 +46,7 @@ class Camera;
* @todo Transform transformation when changing parent, so the object stays in * @todo Transform transformation when changing parent, so the object stays in
* place. * place.
*/ */
class MAGNUM_EXPORT Object { class SCENEGRAPH_EXPORT Object {
Object(const Object& other) = delete; Object(const Object& other) = delete;
Object(Object&& other) = delete; Object(Object&& other) = delete;
Object& operator=(const Object& other) = delete; Object& operator=(const Object& other) = delete;
@ -268,7 +270,6 @@ class MAGNUM_EXPORT Object {
inline void Object::draw(const Matrix4&, Camera*) {} inline void Object::draw(const Matrix4&, Camera*) {}
inline void Object::clean(const Matrix4&) { dirty = false; } inline void Object::clean(const Matrix4&) { dirty = false; }
}}
}
#endif #endif

12
src/Scene.h → src/SceneGraph/Scene.h

@ -1,5 +1,5 @@
#ifndef Magnum_Scene_h #ifndef Magnum_SceneGraph_Scene_h
#define Magnum_Scene_h #define Magnum_SceneGraph_Scene_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -16,17 +16,17 @@
*/ */
/** @file /** @file
* @brief Class Magnum::Scene * @brief Class Magnum::SceneGraph::Scene
*/ */
#include "Object.h" #include "Object.h"
namespace Magnum { namespace Magnum { namespace SceneGraph {
/** @ingroup scene /** @ingroup scene
@brief %Scene @brief %Scene
*/ */
class MAGNUM_EXPORT Scene: public Object { class SCENEGRAPH_EXPORT Scene: public Object {
public: public:
/** @brief Constructor */ /** @brief Constructor */
inline Scene() { _parent = this; } inline Scene() { _parent = this; }
@ -42,6 +42,6 @@ class MAGNUM_EXPORT Scene: public Object {
inline void draw(const Magnum::Matrix4&, Camera*) {} inline void draw(const Magnum::Matrix4&, Camera*) {}
}; };
} }}
#endif #endif

3
src/SceneGraph/Test/CMakeLists.txt

@ -0,0 +1,3 @@
corrade_add_test2(SceneGraphObjectTest ObjectTest.cpp LIBRARIES MagnumSceneGraphTestLib)
corrade_add_test2(SceneGraphCameraTest CameraTest.cpp LIBRARIES MagnumSceneGraph)
corrade_add_test2(SceneGraphSceneTest SceneTest.cpp LIBRARIES MagnumSceneGraph)

9
src/Test/CameraTest.cpp → src/SceneGraph/Test/CameraTest.cpp

@ -15,12 +15,11 @@
#include "CameraTest.h" #include "CameraTest.h"
#include "Camera.h" #include "SceneGraph/Camera.h"
#include "Scene.h"
CORRADE_TEST_MAIN(Magnum::Test::CameraTest) CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::CameraTest)
namespace Magnum { namespace Test { namespace Magnum { namespace SceneGraph { namespace Test {
CameraTest::CameraTest() { CameraTest::CameraTest() {
addTests(&CameraTest::orthographic, addTests(&CameraTest::orthographic,
@ -51,4 +50,4 @@ void CameraTest::perspective() {
CORRADE_COMPARE(camera.projectionMatrix(), a); CORRADE_COMPARE(camera.projectionMatrix(), a);
} }
}} }}}

8
src/Test/CameraTest.h → src/SceneGraph/Test/CameraTest.h

@ -1,5 +1,5 @@
#ifndef Magnum_Test_CameraTest_h #ifndef Magnum_SceneGraph_Test_CameraTest_h
#define Magnum_Test_CameraTest_h #define Magnum_SceneGraph_Test_CameraTest_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -17,7 +17,7 @@
#include <TestSuite/Tester.h> #include <TestSuite/Tester.h>
namespace Magnum { namespace Test { namespace Magnum { namespace SceneGraph { namespace Test {
class CameraTest: public Corrade::TestSuite::Tester<CameraTest> { class CameraTest: public Corrade::TestSuite::Tester<CameraTest> {
public: public:
@ -27,6 +27,6 @@ class CameraTest: public Corrade::TestSuite::Tester<CameraTest> {
void perspective(); void perspective();
}; };
}} }}}
#endif #endif

10
src/Test/ObjectTest.cpp → src/SceneGraph/Test/ObjectTest.cpp

@ -14,16 +14,16 @@
*/ */
#include "ObjectTest.h" #include "ObjectTest.h"
#include "Scene.h" #include "SceneGraph/Camera.h"
#include "Camera.h" #include "SceneGraph/Scene.h"
#include <sstream> #include <sstream>
using namespace std; using namespace std;
CORRADE_TEST_MAIN(Magnum::Test::ObjectTest) CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::ObjectTest)
namespace Magnum { namespace Test { namespace Magnum { namespace SceneGraph { namespace Test {
ObjectTest::ObjectTest() { ObjectTest::ObjectTest() {
addTests(&ObjectTest::parenting, addTests(&ObjectTest::parenting,
@ -195,4 +195,4 @@ void ObjectTest::dirty() {
CORRADE_VERIFY(childThree->isDirty()); CORRADE_VERIFY(childThree->isDirty());
} }
}} }}}

10
src/Test/ObjectTest.h → src/SceneGraph/Test/ObjectTest.h

@ -1,5 +1,5 @@
#ifndef Magnum_Test_ObjectTest_h #ifndef Magnum_SceneGraph_Test_ObjectTest_h
#define Magnum_Test_ObjectTest_h #define Magnum_SceneGraph_Test_ObjectTest_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -17,9 +17,9 @@
#include <TestSuite/Tester.h> #include <TestSuite/Tester.h>
#include "Object.h" #include "SceneGraph/Object.h"
namespace Magnum { namespace Test { namespace Magnum { namespace SceneGraph { namespace Test {
class ObjectTest: public Corrade::TestSuite::Tester<ObjectTest> { class ObjectTest: public Corrade::TestSuite::Tester<ObjectTest> {
public: public:
@ -46,6 +46,6 @@ class ObjectTest: public Corrade::TestSuite::Tester<ObjectTest> {
}; };
}; };
}} }}}
#endif #endif

8
src/Test/SceneTest.cpp → src/SceneGraph/Test/SceneTest.cpp

@ -15,11 +15,11 @@
#include "SceneTest.h" #include "SceneTest.h"
#include "Scene.h" #include "SceneGraph/Scene.h"
CORRADE_TEST_MAIN(Magnum::Test::SceneTest) CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::SceneTest)
namespace Magnum { namespace Test { namespace Magnum { namespace SceneGraph { namespace Test {
SceneTest::SceneTest() { SceneTest::SceneTest() {
addTests(&SceneTest::transformation, addTests(&SceneTest::transformation,
@ -48,4 +48,4 @@ void SceneTest::parent() {
CORRADE_VERIFY(object.children().empty()); CORRADE_VERIFY(object.children().empty());
} }
}} }}}

8
src/Test/SceneTest.h → src/SceneGraph/Test/SceneTest.h

@ -1,5 +1,5 @@
#ifndef Magnum_Test_SceneTest_h #ifndef Magnum_SceneGraph_Test_SceneTest_h
#define Magnum_Test_SceneTest_h #define Magnum_SceneGraph_Test_SceneTest_h
/* /*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -17,7 +17,7 @@
#include <TestSuite/Tester.h> #include <TestSuite/Tester.h>
namespace Magnum { namespace Test { namespace Magnum { namespace SceneGraph { namespace Test {
class SceneTest: public Corrade::TestSuite::Tester<SceneTest> { class SceneTest: public Corrade::TestSuite::Tester<SceneTest> {
public: public:
@ -27,6 +27,6 @@ class SceneTest: public Corrade::TestSuite::Tester<SceneTest> {
void parent(); void parent();
}; };
}} }}}
#endif #endif

30
src/SceneGraph/magnumSceneGraphVisibility.h

@ -0,0 +1,30 @@
#ifndef Magnum_SceneGraph_magnumSceneGraphVisibility_h
#define Magnum_SceneGraph_magnumSceneGraphVisibility_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
#if defined(MagnumSceneGraph_EXPORTS) || defined(MagnumSceneGraphObjects_EXPORTS)
#define SCENEGRAPH_EXPORT __declspec(dllexport)
#else
#define SCENEGRAPH_EXPORT __declspec(dllimport)
#endif
#define SCENEGRAPH_LOCAL
#else
#define SCENEGRAPH_EXPORT __attribute__ ((visibility ("default")))
#define SCENEGRAPH_LOCAL __attribute__ ((visibility ("hidden")))
#endif
#endif

4
src/Test/CMakeLists.txt

@ -1,6 +1,2 @@
corrade_add_test2(ObjectTest ObjectTest.cpp LIBRARIES MagnumTestLib)
corrade_add_test2(CameraTest CameraTest.cpp LIBRARIES Magnum)
corrade_add_test2(SceneTest SceneTest.cpp LIBRARIES Magnum)
corrade_add_test2(ColorTest ColorTest.cpp) corrade_add_test2(ColorTest ColorTest.cpp)
corrade_add_test2(SwizzleTest SwizzleTest.cpp) corrade_add_test2(SwizzleTest SwizzleTest.cpp)

Loading…
Cancel
Save