diff options
Diffstat (limited to 'src/graphics/common')
-rw-r--r-- | src/graphics/common/device.cpp | 8 | ||||
-rw-r--r-- | src/graphics/common/device.h | 31 |
2 files changed, 32 insertions, 7 deletions
diff --git a/src/graphics/common/device.cpp b/src/graphics/common/device.cpp index bb51699..79102b2 100644 --- a/src/graphics/common/device.cpp +++ b/src/graphics/common/device.cpp @@ -32,14 +32,20 @@ void Gfx::DeviceConfig::LoadDefault() noFrame = false; } -void Gfx::TextureParams::LoadDefault() +void Gfx::TextureCreateParams::LoadDefault() { + alpha = false; + mipmap = false; + minFilter = Gfx::TEX_MIN_FILTER_NEAREST; magFilter = Gfx::TEX_MAG_FILTER_NEAREST; wrapS = Gfx::TEX_WRAP_REPEAT; wrapT = Gfx::TEX_WRAP_REPEAT; +} +void Gfx::TextureParams::LoadDefault() +{ colorOperation = Gfx::TEX_MIX_OPER_MODULATE; colorArg1 = Gfx::TEX_MIX_ARG_CURRENT; colorArg2 = Gfx::TEX_MIX_ARG_TEXTURE; 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 |