diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-06 19:00:22 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-06 19:00:22 +0200 |
commit | 32043605153543bd72eb012ff310367299ad4e8f (patch) | |
tree | 91371b113a60d6069dd7d90d0819e4ea3bfdf58d /src/graphics/common/texture.h | |
parent | e8c9945e13fca88a6f8232838682df0654437f3e (diff) | |
download | colobot-32043605153543bd72eb012ff310367299ad4e8f.tar.gz colobot-32043605153543bd72eb012ff310367299ad4e8f.tar.bz2 colobot-32043605153543bd72eb012ff310367299ad4e8f.zip |
Refactoring in math & texture modules
- moved texture-related structs to texture.h & code to texture.cpp
- cleaned up texture test code
- added Math:: namespace qualifiers to math modules for clarity
Diffstat (limited to 'src/graphics/common/texture.h')
-rw-r--r-- | src/graphics/common/texture.h | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/graphics/common/texture.h b/src/graphics/common/texture.h index 55d5c70..55b2fc2 100644 --- a/src/graphics/common/texture.h +++ b/src/graphics/common/texture.h @@ -20,6 +20,115 @@ namespace Gfx { +/** + \enum TexMinFilter + \brief Minification texture filter + + Corresponds to OpenGL modes but should translate to DirectX too. */ +enum TexMinFilter +{ + TEX_MIN_FILTER_NEAREST, + TEX_MIN_FILTER_LINEAR, + TEX_MIN_FILTER_NEAREST_MIPMAP_NEAREST, + TEX_MIN_FILTER_LINEAR_MIPMAP_NEAREST, + TEX_MIN_FILTER_NEAREST_MIPMAP_LINEAR, + TEX_MIN_FILTER_LINEAR_MIPMAP_LINEAR +}; + +/** + \enum TexMagFilter + \brief Magnification texture filter */ +enum TexMagFilter +{ + TEX_MAG_FILTER_NEAREST, + TEX_MAG_FILTER_LINEAR +}; + +/** + \enum TexWrapMode + \brief Wrapping mode for texture coords */ +enum TexWrapMode +{ + TEX_WRAP_CLAMP, + TEX_WRAP_REPEAT +}; + +/** + \enum TexMixOperation + \brief Multitexture mixing operation + */ +enum TexMixOperation +{ + TEX_MIX_OPER_MODULATE, + TEX_MIX_OPER_ADD +}; + +/** + \enum TexMixArgument + \brief Multitexture mixing argument + */ +enum TexMixArgument +{ + TEX_MIX_ARG_CURRENT, + TEX_MIX_ARG_TEXTURE, + TEX_MIX_ARG_DIFFUSE, + TEX_MIX_ARG_FACTOR +}; + +/** + \struct TextureCreateParams + \brief Parameters for texture creation + */ +struct TextureCreateParams +{ + //! Whether the texture image contains alpha + bool alpha; + //! Whether to generate mipmaps + bool mipmap; + //! Minification filter + Gfx::TexMinFilter minFilter; + //! Magnification filter + Gfx::TexMagFilter magFilter; + //! Wrap S coord mode + Gfx::TexWrapMode wrapS; + //! Wrap T coord mode + Gfx::TexWrapMode wrapT; + + //! Constructor; calls LoadDefault() + TextureCreateParams() + { LoadDefault(); } + + //! Loads the default values + void LoadDefault(); +}; + +/** + \struct TextureParams + \brief Parameters for texture creation + */ +struct TextureParams +{ + //! Mixing operation done on color values + Gfx::TexMixOperation colorOperation; + //! 1st argument of color operations + Gfx::TexMixArgument colorArg1; + //! 2nd argument of color operations + Gfx::TexMixArgument colorArg2; + //! Mixing operation done on alpha values + Gfx::TexMixOperation alphaOperation; + //! 1st argument of alpha operations + Gfx::TexMixArgument alphaArg1; + //! 2nd argument of alpha operations + Gfx::TexMixArgument alphaArg2; + + //! Constructor; calls LoadDefault() + TextureParams() + { LoadDefault(); } + + //! Loads the default values + void LoadDefault(); +}; + /** \struct Texture*/ struct Texture { |