From 1d518a54914531d7a4fab3a6835b75de85bd7bc7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 9 Jul 2014 19:18:31 +0000 Subject: Initial support for multi-layered materials, requires shaders files in the new format. --- src/model/layer.h | 96 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 17 deletions(-) (limited to 'src/model/layer.h') diff --git a/src/model/layer.h b/src/model/layer.h index 52ab9d8..5cc7d2b 100644 --- a/src/model/layer.h +++ b/src/model/layer.h @@ -1,5 +1,5 @@ /* - model/material.h + model/layers.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ @@ -7,6 +7,7 @@ #ifndef __INCLUDED_MODEL_LAYER_H__ #define __INCLUDED_MODEL_LAYER_H__ +#include "math/vector2f.h" #include "math/color.h" namespace model @@ -29,15 +30,6 @@ public: RGBGenTertiary = 6 // modified by tertiary entity color }; - /** - * @brief texture coordinate generation type definition - * */ - enum TCGen { - TCGenNone = 0, // no texture coordinate generation - TCGenTexCoords = 1, // use texture coordinates from vertex array - TCGenEnvironment = 2 // texture coordinates generated by GL_SPHERE_MAP/GL_REFLECTION_MAP - }; - /** * @brief texture map type definition * */ @@ -47,6 +39,14 @@ public: TexMapEnvironment = 2, // texture map with skybox TexMapLogo = 3 // use current logo texture }; + + /** + * @brief texture coordinate generation type definition + * */ + enum TCGen { + TCGenBase = 1, // use texture coordinates from vertex array + TCGenEnvironment = 2 // texture coordinates generated by GL_SPHERE_MAP/GL_REFLECTION_MAP + }; /** * @brief default constructor @@ -59,6 +59,14 @@ public: ~Layer(); /* ---- inspectors ----------------------------------------- */ + + /** + * @brief size of the layer, in pixels + */ + inline const math::Vector2f & size() const + { + return layer_size; + } /** * @brief rgb color generation source for this material layer @@ -76,6 +84,15 @@ public: { return layer_color; } + + /** + * @brief layer specular color + * The specular color is used in lighting calculations. + * */ + inline const math::Color & specular() const + { + return layer_color_specular; + } /** * @brief layer texture map @@ -89,7 +106,7 @@ public: * @brief layer texture map name * The layer texture mapa name is used if texmap() is set to TexMapTexture * */ - inline const std::string &texture_name() const + inline const std::string &texture() const { return layer_texture_name; } @@ -109,6 +126,14 @@ public: { return layer_tcgen; } + + /** + * @brief returns true if lighting calculations should be disabled for this layer + * */ + inline const bool bright() const + { + return layer_bright; + } /* ---- mutators ------------------------------------------- */ @@ -122,20 +147,57 @@ public: * */ void set_color(const math::Color & color); + /** + * @brief set layer specular color + * This value is used in lighting calculations + * */ + void set_specular(const math::Color & specular); + + + /** + * @brief set the texture map type + * */ + void set_texmap(const TexMap texmap); + + /** + * @brief set the texture map name + * */ + void set_texture(const std::string & texture); + + /** + * @brief set the renderer texture id + * */ + void set_texture_id(const size_t id); + /** * @brief set texture coordinates generation source * */ void set_tcgen(const TCGen tcgen); + + /** + * @brief enable or disable lighting calculations on this layer + * If set to true, lighting is disabled. + * */ + void set_bright(const bool bright); + + /** + * @brief set the layer size, in pixels + * */ + void set_size(const math::Vector2f & size); private: - RGBGen layer_rgbgen; - math::Color layer_color; + math::Vector2f layer_size; + RGBGen layer_rgbgen; + math::Color layer_color; + math::Color layer_color_specular; - TexMap layer_texmap; - std::string layer_texture_name; - size_t layer_texture_id; + TexMap layer_texmap; + std::string layer_texture_name; + size_t layer_texture_id; - TCGen layer_tcgen; + TCGen layer_tcgen; + + bool layer_bright; }; } // namespace model -- cgit v1.2.3