| @@ -0,0 +1,32 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #ifndef OPENLIMA_GRAPHICS_IPASS_HPP | ||
| #define OPENLIMA_GRAPHICS_IPASS_HPP | ||
|
|
||
| #include <openlima/util/macros.hpp> | ||
| #include <openlima/util/types.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| class IPass { | ||
| public: | ||
|
|
||
| OPENLIMA_DLL virtual ~IPass() {} | ||
|
|
||
|
|
||
| OPENLIMA_DLL virtual void setProperties() = 0; | ||
|
|
||
| OPENLIMA_DLL virtual void unsetProperties() = 0; | ||
|
|
||
| }; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif /* OPENLIMA_GRAPHICS_IPASS_HPP */ |
| @@ -0,0 +1,43 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #ifndef OPENLIMA_GRAPHICS_SIMPLEPASS_HPP | ||
| #define OPENLIMA_GRAPHICS_SIMPLEPASS_HPP | ||
|
|
||
| #include <openlima/util/macros.hpp> | ||
| #include <openlima/util/types.hpp> | ||
| #include <openlima/util/Color.hpp> | ||
| #include <openlima/graphics/IPass.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| class SimplePass : public IPass { | ||
| private: | ||
| float* ambient; | ||
| float* diffuse; | ||
| float* specular; | ||
| float* emission; | ||
| float shininess; | ||
|
|
||
| public: | ||
| OPENLIMA_DLL SimplePass(openlima::util::Color ambient, openlima::util::Color diffuse, | ||
| openlima::util::Color specular, openlima::util::Color emission, float shininess); | ||
|
|
||
| OPENLIMA_DLL virtual ~SimplePass(); | ||
|
|
||
|
|
||
| OPENLIMA_DLL virtual void setProperties(); | ||
|
|
||
| OPENLIMA_DLL virtual void unsetProperties(); | ||
|
|
||
| }; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif /* OPENLIMA_GRAPHICS_SIMPLEPASS_HPP */ |
| @@ -0,0 +1,24 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #ifndef OPENLIMA_GRAPHICS_WAVEFRONTOBJMATERIAL_HPP | ||
| #define OPENLIMA_GRAPHICS_WAVEFRONTOBJMATERIAL_HPP | ||
|
|
||
| #include <openlima/util/macros.hpp> | ||
| #include <openlima/graphics/Material.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| class WavefrontObjMaterial : public Material { | ||
|
|
||
| }; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif /* OPENLIMA_GRAPHICS_WAVEFRONTOBJMATERIAL_HPP */ |
| @@ -0,0 +1,31 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #ifndef OPENLIMA_GRAPHICS_WAVEFRONTOBJMATERIALLIBRARY_HPP | ||
| #define OPENLIMA_GRAPHICS_WAVEFRONTOBJMATERIALLIBRARY_HPP | ||
|
|
||
| #include <openlima/util/macros.hpp> | ||
| #include <map> | ||
| #include <string> | ||
| #include <boost/smart_ptr.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| class WavefrontObjMaterialLibrary { | ||
| private: | ||
| std::map<string, boost::shared_ptr<WavefrontObjMaterial>> materials; | ||
|
|
||
| public: | ||
| OPENLIMA_DLL boost::shared_ptr<WavefrontObjMaterial> getMaterial(string name); | ||
|
|
||
| }; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif /* OPENLIMA_GRAPHICS_WAVEFRONTOBJMATERIALLIBRARY_HPP */ |
| @@ -0,0 +1,32 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #ifndef OPENLIMA_GRAPHICS_WAVEFRONTOBJOBJECT_HPP | ||
| #define OPENLIMA_GRAPHICS_WAVEFRONTOBJOBJECT_HPP | ||
|
|
||
| #include <openlima/util/macros.hpp> | ||
| #include <boost/smart_ptr.hpp> | ||
| #include <openlima/graphics/IRenderable.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| class WavefrontObjObject : public IRenderable { | ||
| public: | ||
| boost::shared_ptr<WavefrontObjMaterial> material; | ||
| boost::shared_ptr<StaticMesh> mesh; | ||
|
|
||
| //OPENLIMA_DLL WavefrontObjObject(); | ||
| //OPENLIMA_DLL virtual ~WavefrontObjObject(); | ||
|
|
||
| OPENLIMA_DLL void render(); | ||
| }; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif /* OPENLIMA_GRAPHICS_WAVEFRONTOBJOBJECT_HPP */ |
| @@ -0,0 +1,23 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #ifndef OPENLIMA_GRAPHICS_WAVEFRONTOBJSCENE_HPP | ||
| #define OPENLIMA_GRAPHICS_WAVEFRONTOBJSCENE_HPP | ||
|
|
||
| #include <openlima/util/macros.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| class WavefrontObjScene { | ||
|
|
||
| }; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| #endif /* OPENLIMA_GRAPHICS_WAVEFRONTOBJSCENE_HPP */ |
| @@ -0,0 +1,47 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #include <openlima/graphics/SimplePass.hpp> | ||
| #include <openlima/sil/sigl.hpp> | ||
|
|
||
| using namespace openlima::util; | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| SimplePass::SimplePass(Color ambient, Color diffuse, Color specular, Color emission, | ||
| float shininess) : shininess(shininess) { | ||
| this->ambient = new float[4]; | ||
| this->diffuse = new float[4]; | ||
| this->specular = new float[4]; | ||
| this->emission = new float[4]; | ||
| ambient.fill(this->ambient); | ||
| diffuse.fill(this->diffuse); | ||
| specular.fill(this->specular); | ||
| emission.fill(this->emission); | ||
| } | ||
|
|
||
| SimplePass::~SimplePass() { | ||
| delete [] ambient; | ||
| delete [] diffuse; | ||
| delete [] specular; | ||
| delete [] emission; | ||
| } | ||
|
|
||
| void SimplePass::setProperties() { | ||
| glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); | ||
| glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); | ||
| glMaterialfv(GL_FRONT, GL_SPECULAR, specular); | ||
| glMaterialfv(GL_FRONT, GL_EMISSION, emission); | ||
| glMaterialf(GL_FRONT, GL_SHININESS, shininess); | ||
| } | ||
|
|
||
| void SimplePass::unsetProperties() { | ||
| } | ||
|
|
||
| } | ||
| } |
| @@ -0,0 +1,18 @@ | ||
| // Copyright (C) 2011 Robert Boehm | ||
| // This file is part of openLima. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with openLima. If not, see: <http://www.gnu.org/licenses/>. | ||
|
|
||
| #include <openlima/graphics/WavefrontObjObject.hpp> | ||
|
|
||
|
|
||
| namespace openlima { | ||
| namespace graphics { | ||
|
|
||
| void WavefrontObjObject::render() { | ||
| this->material->render(this->mesh); | ||
| } | ||
|
|
||
| } | ||
| } |