summaryrefslogtreecommitdiffstats
path: root/src/graphics/core/texture.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-08-12 19:28:22 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-08-12 19:28:22 +0200
commit45a5e1e865ec02892054080e1fc0b7e7c463e9d3 (patch)
tree7cbeeb13b077c677f170595e53fab48e8699cae7 /src/graphics/core/texture.h
parentb4b74c30e9aa93ae736db73df5cb0c5d508ec6ed (diff)
downloadcolobot-45a5e1e865ec02892054080e1fc0b7e7c463e9d3.tar.gz
colobot-45a5e1e865ec02892054080e1fc0b7e7c463e9d3.tar.bz2
colobot-45a5e1e865ec02892054080e1fc0b7e7c463e9d3.zip
Object handling in CEngine
- finished rewriting CEngine object, shadow, etc. handling - refactored texture code - added new log levels
Diffstat (limited to 'src/graphics/core/texture.h')
-rw-r--r--src/graphics/core/texture.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/graphics/core/texture.h b/src/graphics/core/texture.h
index c36b6c6..8abe86a 100644
--- a/src/graphics/core/texture.h
+++ b/src/graphics/core/texture.h
@@ -192,9 +192,7 @@ struct TextureStageParams
Also contains some additional data. */
struct Texture
{
- //! Whether the texture (ID) is valid
- bool valid;
- //! ID of the texture in graphics engine
+ //! ID of the texture in graphics engine; 0 = invalid texture
unsigned int id;
//! Size of texture
Math::IntPoint size;
@@ -203,23 +201,34 @@ struct Texture
Texture()
{
- valid = false;
id = 0;
alpha = false;
}
+ //! Returns whether the texture is valid (ID != 0)
+ bool Valid() const
+ {
+ return id != 0;
+ }
+
+ //! Sets the ID to invalid value (0)
+ void SetInvalid()
+ {
+ id = 0;
+ }
+
//! Comparator for use in texture maps and sets
inline bool operator<(const Gfx::Texture &other) const
{
// Invalid textures are always "less than" every other texture
- if ( (!valid) && (!other.valid) )
+ if ( (! Valid()) && (! other.Valid()) )
return false;
- if (!valid)
+ if (! Valid())
return true;
- if (!other.valid)
+ if (! other.Valid())
return false;
return id < other.id;
@@ -228,9 +237,9 @@ struct Texture
//! Comparator
inline bool operator==(const Gfx::Texture &other) const
{
- if (valid != other.valid)
+ if (Valid() != other.Valid())
return false;
- if ( (!valid) && (!other.valid) )
+ if ( (! Valid()) && (! other.Valid()) )
return true;
return id == other.id;