From 302f11ce816ffe4b51f48c42972bb58475bcca5d Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 16 Nov 2013 18:25:03 +0000 Subject: Material API cleanups, added support for bounds materials. --- src/model/material.h | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'src/model/material.h') diff --git a/src/model/material.h b/src/model/material.h index 6c332e2..94b4418 100644 --- a/src/model/material.h +++ b/src/model/material.h @@ -27,7 +27,7 @@ public: enum ColorType {ColorMaterial = 0, ColorPrimary = 1, ColorSecondary = 2, ColorTertiary = 3, ColorEngine = 4 }; /// surface flags - enum SurfaceFlags { FlagNone = 0, FlagBright = 1,FlagEnvironment = 2, FlagTexture = 4, FlagIgnore = 8, FlagClip = 16, FlagOrigin = 32, FlagDecal = 64 }; + enum SurfaceFlags { FlagNone = 0, FlagBright = 1,FlagEnvironment = 2, FlagTexture = 4, FlagIgnore = 8, FlagClip = 16, FlagOrigin = 32, FlagDecal = 64, FlagBounds = 128 }; /// type definition for the material registry typedef std::map Registry; @@ -78,24 +78,48 @@ public: /** * @brief returns true if the material has the requested flag set * */ - inline bool flag_is_set(const SurfaceFlags surfaceflag) const { + inline bool has_flag(const SurfaceFlags surfaceflag) const { return (((int) material_flags & surfaceflag) == surfaceflag); } + /** + * @brief returns true if the material has the Texture flag set + * @see flags() + * */ + inline bool has_flag_texture() const { + return (has_flag(FlagTexture)); + } + + /** + * @brief returns true if the material has the Clip flag set + * @see flags() + * */ + inline bool has_flag_clip() const { + return (has_flag(FlagClip)); + } + /** * @brief returns true if the material has the Ignore flag set * @see flags() * */ - inline bool ignore_is_set() const { - return (flag_is_set(FlagIgnore)); + inline bool has_flag_ignore() const { + return (has_flag(FlagIgnore)); + } + + /** + * @brief returns true if the material has the Origin flag set + * @see flags() + * */ + inline bool has_flag_origin() const { + return (has_flag(FlagOrigin)); } /** * @brief returns true if the material has the Origin flag set * @see flags() * */ - inline bool origin_is_set() const { - return (flag_is_set(FlagOrigin)); + inline bool has_flag_bounds() const { + return (has_flag(FlagBounds)); } /* ---- mutators ------------------------------------------- */ @@ -130,10 +154,18 @@ public: void set_colortype(ColorType colortype); + /** + * @brief set a specified surface flag + * @see flags() + * */ inline void set_flags(SurfaceFlags flags) { material_flags |= flags; } + /** + * @brief clear a specified surface flag + * @see flags() + * */ inline void unset_flags(SurfaceFlags flags) { material_flags &= ~flags; } -- cgit v1.2.3