diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-05 23:47:29 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-05 23:47:29 +0200 |
commit | e8c9945e13fca88a6f8232838682df0654437f3e (patch) | |
tree | 2a0974afe8cdb30d7862e189d4d9adc5d6d59849 /src/graphics/common/device.h | |
parent | af3057df7eb41973349b407539846f17d9094c21 (diff) | |
download | colobot-e8c9945e13fca88a6f8232838682df0654437f3e.tar.gz colobot-e8c9945e13fca88a6f8232838682df0654437f3e.tar.bz2 colobot-e8c9945e13fca88a6f8232838682df0654437f3e.zip |
Fixed bug with texturing
- moved creation-time tex params to Gfx::TextureCreateParams
- fixed bug with texture creation
- added simple test for multitexturing
Diffstat (limited to 'src/graphics/common/device.h')
-rw-r--r-- | src/graphics/common/device.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/graphics/common/device.h b/src/graphics/common/device.h index 3382c9a..41181aa 100644 --- a/src/graphics/common/device.h +++ b/src/graphics/common/device.h @@ -237,11 +237,15 @@ enum TexMixArgument }; /** - \enum TextureParams + \struct TextureCreateParams \brief Parameters for texture creation - */ -struct TextureParams + */ +struct TextureCreateParams { + //! Whether the texture image contains alpha + bool alpha; + //! Whether to generate mipmaps + bool mipmap; //! Minification filter Gfx::TexMinFilter minFilter; //! Magnification filter @@ -250,6 +254,21 @@ struct TextureParams 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 @@ -302,9 +321,9 @@ D3DRENDERSTATE_ZFUNC -> SetDepthTestFunc() D3DRENDERSTATE_ZWRITEENABLE -> SetRenderState() with RENDER_STATE_DEPTH_WRITE ->> SetTextureStageState() translates to SetTextureParams() +>> SetTextureStageState() translates to SetTextureParams() or CreateTexture() for some params -Params from enum in struct TextureParams +Params from enum in struct TextureCreateParams or TextureParams D3DTSS_ADDRESS -> Gfx::TexWrapMode wrapS, wrapT D3DTSS_ALPHAARG1 -> Gfx::TexMixArgument alphaArg1 D3DTSS_ALPHAARG2 -> Gfx::TexMixArgument alphaArg2 @@ -380,7 +399,7 @@ public: virtual bool GetLightEnabled(int index) = 0; //! Creates a texture from image; the image can be safely removed after that - virtual Gfx::Texture* CreateTexture(CImage *image, bool alpha, bool mipMap) = 0; + virtual Gfx::Texture* CreateTexture(CImage *image, const Gfx::TextureCreateParams ¶ms) = 0; //! Deletes a given texture, freeing it from video memory virtual void DestroyTexture(Gfx::Texture *texture) = 0; //! Deletes all textures created so far |