Commit 6f7e2a34 authored by hybrid's avatar hybrid

Fix the const things for d3d drivers.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@962 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 08e35978
...@@ -67,10 +67,6 @@ CD3D8Driver::~CD3D8Driver() ...@@ -67,10 +67,6 @@ CD3D8Driver::~CD3D8Driver()
{ {
deleteMaterialRenders(); deleteMaterialRenders();
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
if (CurrentTexture[i])
CurrentTexture[i]->drop();
// drop d3d8 // drop d3d8
if (pID3DDevice) if (pID3DDevice)
...@@ -460,10 +456,7 @@ bool CD3D8Driver::reset() ...@@ -460,10 +456,7 @@ bool CD3D8Driver::reset()
LastVertexType = (E_VERTEX_TYPE)-1; LastVertexType = (E_VERTEX_TYPE)-1;
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{ CurrentTexture[i] = 0;
if (CurrentTexture[i]) CurrentTexture[i]->drop();
CurrentTexture[i] = 0;
}
setVertexShader(EVT_STANDARD); setVertexShader(EVT_STANDARD);
setRenderStates3DMode(); setRenderStates3DMode();
...@@ -608,9 +601,6 @@ bool CD3D8Driver::setTexture(s32 stage, video::ITexture* texture) ...@@ -608,9 +601,6 @@ bool CD3D8Driver::setTexture(s32 stage, video::ITexture* texture)
return false; return false;
} }
if (CurrentTexture[stage])
CurrentTexture[stage]->drop();
CurrentTexture[stage] = texture; CurrentTexture[stage] = texture;
if (!texture) if (!texture)
...@@ -620,8 +610,7 @@ bool CD3D8Driver::setTexture(s32 stage, video::ITexture* texture) ...@@ -620,8 +610,7 @@ bool CD3D8Driver::setTexture(s32 stage, video::ITexture* texture)
} }
else else
{ {
pID3DDevice->SetTexture(stage, ((CD3D8Texture*)texture)->getDX8Texture()); pID3DDevice->SetTexture(stage, ((const CD3D8Texture*)texture)->getDX8Texture());
texture->grab();
} }
return true; return true;
} }
......
...@@ -263,7 +263,7 @@ namespace video ...@@ -263,7 +263,7 @@ namespace video
bool ResetRenderStates; // bool to make all renderstates be reseted if set. bool ResetRenderStates; // bool to make all renderstates be reseted if set.
bool Transformation3DChanged; bool Transformation3DChanged;
bool StencilBuffer; bool StencilBuffer;
ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES]; const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
core::matrix4 Matrices[ETS_COUNT]; // matrices of the 3d mode we need to restore when we switch back from the 2d mode. core::matrix4 Matrices[ETS_COUNT]; // matrices of the 3d mode we need to restore when we switch back from the 2d mode.
HINSTANCE D3DLibrary; HINSTANCE D3DLibrary;
......
...@@ -345,7 +345,7 @@ u32 CD3D8Texture::getPitch() const ...@@ -345,7 +345,7 @@ u32 CD3D8Texture::getPitch() const
//! returns the DIRECT3D8 Texture //! returns the DIRECT3D8 Texture
IDirect3DTexture8* CD3D8Texture::getDX8Texture() IDirect3DTexture8* CD3D8Texture::getDX8Texture() const
{ {
return Texture; return Texture;
} }
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
virtual u32 getPitch() const; virtual u32 getPitch() const;
//! returns the DIRECT3D8 Texture //! returns the DIRECT3D8 Texture
IDirect3DTexture8* getDX8Texture(); IDirect3DTexture8* getDX8Texture() const;
//! returns if texture has mipmap levels //! returns if texture has mipmap levels
bool hasMipMaps() const; bool hasMipMaps() const;
......
...@@ -70,10 +70,6 @@ CD3D9Driver::~CD3D9Driver() ...@@ -70,10 +70,6 @@ CD3D9Driver::~CD3D9Driver()
{ {
deleteMaterialRenders(); deleteMaterialRenders();
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
if (CurrentTexture[i])
CurrentTexture[i]->drop();
// drop d3d9 // drop d3d9
if (pID3DDevice) if (pID3DDevice)
...@@ -612,7 +608,7 @@ void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 ...@@ -612,7 +608,7 @@ void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4
//! sets the current Texture //! sets the current Texture
bool CD3D9Driver::setTexture(s32 stage, video::ITexture* texture) bool CD3D9Driver::setTexture(s32 stage, const video::ITexture* texture)
{ {
if (CurrentTexture[stage] == texture) if (CurrentTexture[stage] == texture)
return true; return true;
...@@ -623,9 +619,6 @@ bool CD3D9Driver::setTexture(s32 stage, video::ITexture* texture) ...@@ -623,9 +619,6 @@ bool CD3D9Driver::setTexture(s32 stage, video::ITexture* texture)
return false; return false;
} }
if (CurrentTexture[stage])
CurrentTexture[stage]->drop();
CurrentTexture[stage] = texture; CurrentTexture[stage] = texture;
if (!texture) if (!texture)
...@@ -635,9 +628,7 @@ bool CD3D9Driver::setTexture(s32 stage, video::ITexture* texture) ...@@ -635,9 +628,7 @@ bool CD3D9Driver::setTexture(s32 stage, video::ITexture* texture)
} }
else else
{ {
pID3DDevice->SetTexture(stage, ((CD3D9Texture*)texture)->getDX9Texture()); pID3DDevice->SetTexture(stage, ((const CD3D9Texture*)texture)->getDX9Texture());
texture->grab();
} }
return true; return true;
} }
...@@ -1920,12 +1911,7 @@ bool CD3D9Driver::reset() ...@@ -1920,12 +1911,7 @@ bool CD3D9Driver::reset()
LastVertexType = (E_VERTEX_TYPE)-1; LastVertexType = (E_VERTEX_TYPE)-1;
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
if (CurrentTexture[i])
CurrentTexture[i]->drop();
CurrentTexture[i] = 0; CurrentTexture[i] = 0;
}
setVertexShader(EVT_STANDARD); setVertexShader(EVT_STANDARD);
setRenderStates3DMode(); setRenderStates3DMode();
......
...@@ -219,7 +219,7 @@ namespace video ...@@ -219,7 +219,7 @@ namespace video
void setRenderStatesStencilShadowMode(bool zfail); void setRenderStatesStencilShadowMode(bool zfail);
//! sets the current Texture //! sets the current Texture
bool setTexture(s32 stage, video::ITexture* texture); bool setTexture(s32 stage, const video::ITexture* texture);
//! resets the device //! resets the device
bool reset(); bool reset();
...@@ -270,7 +270,7 @@ namespace video ...@@ -270,7 +270,7 @@ namespace video
bool ResetRenderStates; // bool to make all renderstates be reseted if set. bool ResetRenderStates; // bool to make all renderstates be reseted if set.
bool Transformation3DChanged; bool Transformation3DChanged;
bool StencilBuffer; bool StencilBuffer;
ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES]; const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
bool LastTextureMipMapsAvailable[MATERIAL_MAX_TEXTURES]; bool LastTextureMipMapsAvailable[MATERIAL_MAX_TEXTURES];
core::matrix4 Matrices[ETS_COUNT]; // matrizes of the 3d mode we need to restore when we switch back from the 2d mode. core::matrix4 Matrices[ETS_COUNT]; // matrizes of the 3d mode we need to restore when we switch back from the 2d mode.
......
...@@ -552,7 +552,7 @@ u32 CD3D9Texture::getPitch() const ...@@ -552,7 +552,7 @@ u32 CD3D9Texture::getPitch() const
//! returns the DIRECT3D9 Texture //! returns the DIRECT3D9 Texture
IDirect3DTexture9* CD3D9Texture::getDX9Texture() IDirect3DTexture9* CD3D9Texture::getDX9Texture() const
{ {
return Texture; return Texture;
} }
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
virtual u32 getPitch() const; virtual u32 getPitch() const;
//! returns the DIRECT3D9 Texture //! returns the DIRECT3D9 Texture
IDirect3DTexture9* getDX9Texture(); IDirect3DTexture9* getDX9Texture() const;
//! returns if texture has mipmap levels //! returns if texture has mipmap levels
bool hasMipMaps() const; bool hasMipMaps() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment