diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4628ede79..31565244c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,6 @@ set(Magnum_SRCS Mesh.cpp Query.cpp Renderbuffer.cpp - Scene.cpp Shader.cpp SizeTraits.cpp TypeTraits.cpp diff --git a/src/Camera.h b/src/Camera.h index c5874d01a..136962673 100644 --- a/src/Camera.h +++ b/src/Camera.h @@ -33,6 +33,13 @@ namespace Magnum { */ class MAGNUM_EXPORT Camera: public Object { public: + /** @brief Features */ + enum class Feature: GLenum { + AlphaBlending = GL_BLEND, /**< Alpha blending */ + DepthTest = GL_DEPTH_TEST, /**< Depth test */ + FaceCulling = GL_CULL_FACE /**< Face culling */ + }; + /** @brief Aspect ratio policy */ enum AspectRatioPolicy { NotPreserved, /**< @brief Don't preserve aspect ratio */ @@ -40,6 +47,12 @@ class MAGNUM_EXPORT Camera: public Object { Clip /**< @brief Clip on smaller side of view */ }; + /** @brief Set feature */ + /** @todo Depth clamping (OpenGL 3.2, ARB_depth_clamp) */ + inline static void setFeature(Feature feature, bool enabled) { + enabled ? glEnable(static_cast(feature)) : glDisable(static_cast(feature)); + } + /** * @brief Constructor * @param parent Parent object diff --git a/src/Scene.cpp b/src/Scene.cpp deleted file mode 100644 index 2c2901d14..000000000 --- a/src/Scene.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright © 2010, 2011, 2012 Vladimír Vondruš - - 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 "Scene.h" - -namespace Magnum { - -void Scene::setFeature(Scene::Feature feature, bool enabled) { - GLenum _feature; - switch(feature) { - case AlphaBlending: _feature = GL_BLEND; break; - case DepthTest: _feature = GL_DEPTH_TEST; break; - case FaceCulling: _feature = GL_CULL_FACE; break; - default: return; - } - - enabled ? glEnable(_feature) : glDisable(_feature); -} - -} diff --git a/src/Scene.h b/src/Scene.h index 137784b7d..2ed62cc42 100644 --- a/src/Scene.h +++ b/src/Scene.h @@ -26,15 +26,8 @@ namespace Magnum { /** @brief %Scene */ class MAGNUM_EXPORT Scene: public Object { public: - /** @brief Features */ - enum Feature { - AlphaBlending = 0x01, /**< @brief Alpha blending */ - DepthTest = 0x02, /**< @brief Depth test */ - FaceCulling = 0x04 /**< @brief Face culling */ - }; - /** @brief Constructor */ - inline Scene(): _features(0) { _parent = this; } + inline Scene() { _parent = this; } void setParent(Object* parent) = delete; void setTransformation(const Matrix4& transformation) = delete; @@ -43,16 +36,7 @@ class MAGNUM_EXPORT Scene: public Object { void scale(Vector3 vec, Transformation type = Transformation::Global) = delete; void rotate(GLfloat angle, Vector3 vec, Transformation type = Transformation::Global) = delete; - /** @brief Which features are set */ - inline unsigned int features() const { return _features; } - - /** @brief Set feature */ - /** @todo Depth clamping (OpenGL 3.2, ARB_depth_clamp) */ - void setFeature(Feature feature, bool enabled); - private: - unsigned int _features; - inline virtual void draw(const Magnum::Matrix4& transformationMatrix, Camera* camera) {} };