Browse Source

SceneGraph: template implementation file for Drawable class.

The class has virtual member, so it's good to have it in one place and
not in thousand five ones.
pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
2b4d52ea3c
  1. 1
      src/SceneGraph/CMakeLists.txt
  2. 12
      src/SceneGraph/Drawable.h
  3. 39
      src/SceneGraph/Drawable.hpp
  4. 4
      src/SceneGraph/instantiation.cpp

1
src/SceneGraph/CMakeLists.txt

@ -51,6 +51,7 @@ set(MagnumSceneGraph_HEADERS
Camera3D.h
Camera3D.hpp
Drawable.h
Drawable.hpp
DualComplexTransformation.h
DualQuaternionTransformation.h
RigidMatrixTransformation2D.h

12
src/SceneGraph/Drawable.h

@ -114,6 +114,16 @@ void MyApplication::drawEvent() {
}
@endcode
@section Drawable-explicit-specializations Explicit template specializations
The following specializations are explicitly compiled into @ref SceneGraph
library. For other specializations (e.g. using @ref Double type) you have to
use @ref Drawable.hpp implementation file to avoid linker errors. See also
@ref compilation-speedup-hpp for more information.
- @ref Drawable2D
- @ref Drawable3D
@see @ref scenegraph, @ref BasicDrawable2D, @ref BasicDrawable3D,
@ref Drawable2D, @ref Drawable3D, @ref DrawableGroup
*/
@ -127,7 +137,7 @@ template<UnsignedInt dimensions, class T> class Drawable: public AbstractGrouped
* Adds the feature to the object and also to the group, if specified.
* Otherwise you can use DrawableGroup::add().
*/
explicit Drawable(AbstractObject<dimensions, T>& object, DrawableGroup<dimensions, T>* drawables = nullptr): AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T>(object, drawables) {}
explicit Drawable(AbstractObject<dimensions, T>& object, DrawableGroup<dimensions, T>* drawables = nullptr);
/**
* @brief Group containing this drawable

39
src/SceneGraph/Drawable.hpp

@ -0,0 +1,39 @@
#ifndef Magnum_SceneGraph_Drawable_hpp
#define Magnum_SceneGraph_Drawable_hpp
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
/** @file
* @brief @ref compilation-speedup-hpp "Template implementation" for @ref Drawable.h
*/
#include "Drawable.h"
namespace Magnum { namespace SceneGraph {
template<UnsignedInt dimensions, class T> Drawable<dimensions, T>::Drawable(AbstractObject<dimensions, T>& object, DrawableGroup<dimensions, T>* drawables): AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T>(object, drawables) {}
}}
#endif

4
src/SceneGraph/instantiation.cpp

@ -26,6 +26,7 @@
#include "SceneGraph/Animable.hpp"
#include "SceneGraph/Camera2D.hpp"
#include "SceneGraph/Camera3D.hpp"
#include "SceneGraph/Drawable.hpp"
#include "SceneGraph/DualComplexTransformation.h"
#include "SceneGraph/DualQuaternionTransformation.h"
#include "SceneGraph/FeatureGroup.hpp"
@ -66,6 +67,9 @@ template class MAGNUM_SCENEGRAPH_EXPORT_HPP AbstractCamera<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP BasicCamera2D<Float>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP BasicCamera3D<Float>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP Drawable<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP Drawable<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP Object<BasicDualComplexTransformation<Float>>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP Object<BasicDualQuaternionTransformation<Float>>;
template class MAGNUM_SCENEGRAPH_EXPORT_HPP Object<BasicMatrixTransformation2D<Float>>;

Loading…
Cancel
Save