diff options
Diffstat (limited to 'src/model/material.h')
-rw-r--r-- | src/model/material.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/model/material.h b/src/model/material.h index 9072a4d..9185fd2 100644 --- a/src/model/material.h +++ b/src/model/material.h @@ -11,6 +11,7 @@ #include <map> #include "math/color.h" +#include "math/vector2f.h" namespace model { @@ -19,8 +20,11 @@ namespace model class Material { public: + /// function pointer type for local functions + typedef void(* LoaderFuncPtr)(Material *); + /// surface flags - enum SurfaceFlags { None=0, Primary=1, Secondary=2, Tertiary=3, Bright=4, Engine=8, Environment=16, Texture=32}; + enum SurfaceFlags { None=0, Primary=1, Secondary=2, Tertiary=3, Bright=4, Engine=8, Environment=16, Texture=32, Ignore=64}; /// type definition for the material registry typedef std::map<std::string, Material *> Registry; @@ -41,14 +45,35 @@ public: inline const size_t texture_id() const { return material_texture_id; } + /** + * @brief returns the material texture size + */ + inline const math::Vector2f & size() const { return material_size; } + /* ---- mutators ------------------------------------------- */ void set_color(const math::Color &color); + /** + * @brief set the material texture name + */ void set_texture(const std::string &texture); + /** + * @brief set the material texture id + */ void set_texture_id(const size_t texture_id); + /** + * @brief set the material texture size + */ + void set_size(const float width, const float height); + + /** + * @brief set the material texture size + */ + void set_size(const math::Vector2f &size); + inline void set_flags(SurfaceFlags flags) { material_flags |= flags; @@ -92,6 +117,8 @@ public: */ static Material *find(const std::string &name); + static void set_loader_func(LoaderFuncPtr func); + private: std::string material_name; @@ -100,10 +127,15 @@ private: std::string material_texture; size_t material_texture_id; + /// size of the material + math::Vector2f material_size; + /// the materials registry static Registry material_registry; static void load_shader(const std::string &shadername); + + static LoaderFuncPtr material_loaderfunc; }; } |