Commit 2dc10511 authored by hybrid's avatar hybrid

Added a name parameter to render target textures just as for usual textures.

Exposed findTexture in IVideoDriver to check if a texture was already loaded.
Reordered some more OpenGL render state settings in the materials.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@783 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 9fc207d1
...@@ -196,7 +196,7 @@ namespace video ...@@ -196,7 +196,7 @@ namespace video
\return Returns a pointer to the created texture or 0 if the texture could not \return Returns a pointer to the created texture or 0 if the texture could not
be created. If you no longer need the image, you should call ITexture::drop(). be created. If you no longer need the image, you should call ITexture::drop().
See IUnknown::drop() for more information. */ See IUnknown::drop() for more information. */
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size) = 0; virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name = 0) = 0;
//! Removes a texture from the texture cache and deletes it, freeing lot of memory. //! Removes a texture from the texture cache and deletes it, freeing lot of memory.
/** Please note that after calling this, the pointer to the ITexture /** Please note that after calling this, the pointer to the ITexture
...@@ -788,6 +788,9 @@ namespace video ...@@ -788,6 +788,9 @@ namespace video
//! Returns an image created from the last rendered frame. //! Returns an image created from the last rendered frame.
virtual IImage* createScreenShot() = 0; virtual IImage* createScreenShot() = 0;
//! looks if the image is already loaded
virtual video::ITexture* findTexture(const c8* filename) = 0;
}; };
} // end namespace video } // end namespace video
......
...@@ -763,9 +763,9 @@ bool CD3D8Driver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer ...@@ -763,9 +763,9 @@ bool CD3D8Driver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer
} }
//! Creates a render target texture. //! Creates a render target texture.
ITexture* CD3D8Driver::createRenderTargetTexture(const core::dimension2d<s32>& size) ITexture* CD3D8Driver::createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name)
{ {
return new CD3D8Texture(this, size, 0); return new CD3D8Texture(this, size, name);
} }
......
...@@ -175,7 +175,7 @@ namespace video ...@@ -175,7 +175,7 @@ namespace video
virtual IVideoDriver* getVideoDriver(); virtual IVideoDriver* getVideoDriver();
//! Creates a render target texture. //! Creates a render target texture.
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size); virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name);
//! Clears the ZBuffer. //! Clears the ZBuffer.
virtual void clearZBuffer(); virtual void clearZBuffer();
......
...@@ -2045,9 +2045,9 @@ IVideoDriver* CD3D9Driver::getVideoDriver() ...@@ -2045,9 +2045,9 @@ IVideoDriver* CD3D9Driver::getVideoDriver()
//! Creates a render target texture. //! Creates a render target texture.
ITexture* CD3D9Driver::createRenderTargetTexture(const core::dimension2d<s32>& size) ITexture* CD3D9Driver::createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name)
{ {
return new CD3D9Texture(this, size, 0); return new CD3D9Texture(this, size, name);
} }
......
...@@ -169,7 +169,7 @@ namespace video ...@@ -169,7 +169,7 @@ namespace video
virtual IVideoDriver* getVideoDriver(); virtual IVideoDriver* getVideoDriver();
//! Creates a render target texture. //! Creates a render target texture.
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size); virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name);
//! Clears the ZBuffer. //! Clears the ZBuffer.
virtual void clearZBuffer(); virtual void clearZBuffer();
......
...@@ -1696,7 +1696,7 @@ s32 CNullDriver::addShaderMaterialFromFiles(const c8* vertexShaderProgramFileNam ...@@ -1696,7 +1696,7 @@ s32 CNullDriver::addShaderMaterialFromFiles(const c8* vertexShaderProgramFileNam
} }
//! Creates a render target texture. //! Creates a render target texture.
ITexture* CNullDriver::createRenderTargetTexture(const core::dimension2d<s32>& size) ITexture* CNullDriver::createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name)
{ {
return 0; return 0;
} }
......
...@@ -248,7 +248,7 @@ namespace video ...@@ -248,7 +248,7 @@ namespace video
virtual void removeAllTextures(); virtual void removeAllTextures();
//! Creates a render target texture. //! Creates a render target texture.
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size); virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name);
//! Creates an 1bit alpha channel of the texture based of an color key. //! Creates an 1bit alpha channel of the texture based of an color key.
virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color); virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color);
...@@ -398,14 +398,14 @@ namespace video ...@@ -398,14 +398,14 @@ namespace video
//! Fills an SMaterial structure from attributes. //! Fills an SMaterial structure from attributes.
virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes); virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes);
//! looks if the image is already loaded
virtual video::ITexture* findTexture(const c8* filename);
protected: protected:
//! deletes all textures //! deletes all textures
void deleteAllTextures(); void deleteAllTextures();
//! looks if the image is already loaded
video::ITexture* findTexture(const c8* filename);
//! opens the file and loads it into the surface //! opens the file and loads it into the surface
video::ITexture* loadTextureFromFile(io::IReadFile* file, const c8* hashName = 0); video::ITexture* loadTextureFromFile(io::IReadFile* file, const c8* hashName = 0);
......
...@@ -550,19 +550,19 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -550,19 +550,19 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].Pos); glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].Pos);
glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].Normal); glNormalPointer(GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].Normal);
// texture coordinates // texture coordinates
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].TCoords);
if (MultiTextureExtension) if (MultiTextureExtension)
{ {
extGlClientActiveTexture(GL_TEXTURE1_ARB); extGlClientActiveTexture(GL_TEXTURE1_ARB);
glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].TCoords2); glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].TCoords2);
extGlClientActiveTexture(GL_TEXTURE0_ARB);
} }
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex2TCoords), &((S3DVertex2TCoords*)vertices)[0].TCoords);
break; break;
case EVT_TANGENTS: case EVT_TANGENTS:
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Pos); glVertexPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Pos);
glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Normal); glNormalPointer(GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Normal);
// texture coordinates // texture coordinates
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].TCoords);
if (MultiTextureExtension) if (MultiTextureExtension)
{ {
extGlClientActiveTexture(GL_TEXTURE1_ARB); extGlClientActiveTexture(GL_TEXTURE1_ARB);
...@@ -572,10 +572,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -572,10 +572,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
extGlClientActiveTexture(GL_TEXTURE2_ARB); extGlClientActiveTexture(GL_TEXTURE2_ARB);
glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Binormal); glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].Binormal);
extGlClientActiveTexture(GL_TEXTURE0_ARB);
} }
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertexTangents), &((S3DVertexTangents*)vertices)[0].TCoords);
break; break;
} }
...@@ -615,9 +612,6 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -615,9 +612,6 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
glFlush(); glFlush();
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
if (MultiTextureExtension) if (MultiTextureExtension)
{ {
if (vType==EVT_TANGENTS) if (vType==EVT_TANGENTS)
...@@ -625,13 +619,16 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun ...@@ -625,13 +619,16 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
extGlClientActiveTexture(GL_TEXTURE2_ARB); extGlClientActiveTexture(GL_TEXTURE2_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
} }
if (vType!=EVT_STANDARD && MultiTextureExtension) if (vType!=EVT_STANDARD)
{ {
extGlClientActiveTexture(GL_TEXTURE1_ARB); extGlClientActiveTexture(GL_TEXTURE1_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
} }
extGlClientActiveTexture(GL_TEXTURE0_ARB); extGlClientActiveTexture(GL_TEXTURE0_ARB);
} }
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
} }
...@@ -2068,21 +2065,23 @@ IGPUProgrammingServices* COpenGLDriver::getGPUProgrammingServices() ...@@ -2068,21 +2065,23 @@ IGPUProgrammingServices* COpenGLDriver::getGPUProgrammingServices()
return this; return this;
} }
ITexture* COpenGLDriver::createRenderTargetTexture(const core::dimension2d<s32>& size) ITexture* COpenGLDriver::createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name)
{ {
//disable mip-mapping //disable mip-mapping
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS); bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false); setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
video::ITexture* rtt = 0; video::ITexture* rtt = 0;
if (name==0)
name="rt";
#if defined(GL_EXT_framebuffer_object) #if defined(GL_EXT_framebuffer_object)
// if driver supports FrameBufferObjects, use them // if driver supports FrameBufferObjects, use them
if (queryFeature(EVDF_FRAMEBUFFER_OBJECT)) if (queryFeature(EVDF_FRAMEBUFFER_OBJECT))
rtt = new COpenGLTexture(size, PackedDepthStencilExtension, "rt", this); rtt = new COpenGLTexture(size, PackedDepthStencilExtension, name, this);
else else
#endif #endif
{ {
rtt = addTexture(size, "rt"); rtt = addTexture(size, name);
if (rtt) if (rtt)
rtt->grab(); rtt->grab();
} }
......
...@@ -96,20 +96,20 @@ namespace video ...@@ -96,20 +96,20 @@ namespace video
//! destructor //! destructor
virtual ~COpenGLDriver(); virtual ~COpenGLDriver();
//! presents the rendered scene on the screen, returns false if failed
virtual bool endScene( s32 windowId, core::rect<s32>* sourceRect=0 );
//! clears the zbuffer //! clears the zbuffer
virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color); virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color);
//! presents the rendered scene on the screen, returns false if failed
virtual bool endScene( s32 windowId, core::rect<s32>* sourceRect=0 );
//! sets transformation //! sets transformation
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat); virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat);
//! draws a vertex primitive list //! draws a vertex primitive list
void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType); virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType);
//! queries the features of the driver, returns true if feature is available //! queries the features of the driver, returns true if feature is available
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature)
{ {
return COpenGLExtensionHandler::queryFeature(feature); return COpenGLExtensionHandler::queryFeature(feature);
} }
...@@ -222,7 +222,7 @@ namespace video ...@@ -222,7 +222,7 @@ namespace video
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state); virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);
//! Can be called by an IMaterialRenderer to make its work easier. //! Can be called by an IMaterialRenderer to make its work easier.
void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,
bool resetAllRenderstates); bool resetAllRenderstates);
//! Sets a vertex shader constant. //! Sets a vertex shader constant.
...@@ -247,17 +247,17 @@ namespace video ...@@ -247,17 +247,17 @@ namespace video
//! Adds a new material renderer to the VideoDriver, using extGLGetObjectParameterivARB(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status) pixel and/or //! Adds a new material renderer to the VideoDriver, using extGLGetObjectParameterivARB(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status) pixel and/or
//! vertex shaders to render geometry. //! vertex shaders to render geometry.
s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram, virtual s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram,
IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData); IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData);
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry. //! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
s32 addHighLevelShaderMaterial(const c8* vertexShaderProgram, const c8* vertexShaderEntryPointName, virtual s32 addHighLevelShaderMaterial(const c8* vertexShaderProgram, const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget, const c8* pixelShaderProgram, const c8* pixelShaderEntryPointName, E_VERTEX_SHADER_TYPE vsCompileTarget, const c8* pixelShaderProgram, const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget, IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, E_PIXEL_SHADER_TYPE psCompileTarget, IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial,
s32 userData); s32 userData);
//! Returns pointer to the IGPUProgrammingServices interface. //! Returns pointer to the IGPUProgrammingServices interface.
IGPUProgrammingServices* getGPUProgrammingServices(); virtual IGPUProgrammingServices* getGPUProgrammingServices();
//! Returns a pointer to the IVideoDriver interface. (Implementation for //! Returns a pointer to the IVideoDriver interface. (Implementation for
//! IMaterialRendererServices) //! IMaterialRendererServices)
...@@ -268,9 +268,9 @@ namespace video ...@@ -268,9 +268,9 @@ namespace video
//! call. //! call.
virtual u32 getMaximalPrimitiveCount(); virtual u32 getMaximalPrimitiveCount();
ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size); virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name);
bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer, virtual bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
bool clearZBuffer, SColor color); bool clearZBuffer, SColor color);
//! Clears the ZBuffer. //! Clears the ZBuffer.
...@@ -301,7 +301,7 @@ namespace video ...@@ -301,7 +301,7 @@ namespace video
void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel); void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel);
// returns the current size of the screen or rendertarget // returns the current size of the screen or rendertarget
core::dimension2d<s32> getCurrentRenderTargetSize(); virtual core::dimension2d<s32> getCurrentRenderTargetSize();
void createMaterialRenderers(); void createMaterialRenderers();
......
...@@ -46,6 +46,8 @@ public: ...@@ -46,6 +46,8 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
// thanks to Murphy, the following line removed some // thanks to Murphy, the following line removed some
...@@ -54,7 +56,6 @@ public: ...@@ -54,7 +56,6 @@ public:
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
} }
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
} }
}; };
...@@ -72,7 +73,6 @@ public: ...@@ -72,7 +73,6 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
// if (material.MaterialType != lastMaterial.MaterialType || // if (material.MaterialType != lastMaterial.MaterialType ||
...@@ -165,6 +165,7 @@ public: ...@@ -165,6 +165,7 @@ public:
Driver->setTexture(1, material.Textures[1]); Driver->setTexture(1, material.Textures[1]);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
if (Driver->queryFeature(EVDF_MULTITEXTURE)) if (Driver->queryFeature(EVDF_MULTITEXTURE))
...@@ -195,6 +196,8 @@ public: ...@@ -195,6 +196,8 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates) if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates)
{ {
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
...@@ -203,8 +206,6 @@ public: ...@@ -203,8 +206,6 @@ public:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND); glEnable(GL_BLEND);
} }
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
} }
virtual void OnUnsetMaterial() virtual void OnUnsetMaterial()
...@@ -233,6 +234,7 @@ public: ...@@ -233,6 +234,7 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{ {
...@@ -250,7 +252,6 @@ public: ...@@ -250,7 +252,6 @@ public:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); glEnable(GL_BLEND);
} }
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
...@@ -289,7 +290,6 @@ public: ...@@ -289,7 +290,6 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates
...@@ -343,7 +343,6 @@ public: ...@@ -343,7 +343,6 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -383,7 +382,6 @@ public: ...@@ -383,7 +382,6 @@ public:
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setTexture(1, material.Textures[1]); Driver->setTexture(1, material.Textures[1]);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -479,7 +477,6 @@ public: ...@@ -479,7 +477,6 @@ public:
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setTexture(1, material.Textures[1]); Driver->setTexture(1, material.Textures[1]);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -524,7 +521,6 @@ public: ...@@ -524,7 +521,6 @@ public:
{ {
Driver->disableTextures(1); Driver->disableTextures(1);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -573,7 +569,6 @@ public: ...@@ -573,7 +569,6 @@ public:
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setTexture(1, material.Textures[1]); Driver->setTexture(1, material.Textures[1]);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
...@@ -644,7 +639,6 @@ public: ...@@ -644,7 +639,6 @@ public:
Driver->disableTextures(2); Driver->disableTextures(2);
Driver->setTexture(1, material.Textures[1]); Driver->setTexture(1, material.Textures[1]);
Driver->setTexture(0, material.Textures[0]); Driver->setTexture(0, material.Textures[0]);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
......
...@@ -314,7 +314,8 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32 ...@@ -314,7 +314,8 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32
break; break;
} }
if (i == num) return false; if (i == num)
return false;
#ifdef GL_ARB_shader_objects #ifdef GL_ARB_shader_objects
switch (UniformInfo[i].type) switch (UniformInfo[i].type)
......
...@@ -818,10 +818,10 @@ const core::matrix4& CSoftwareDriver::getTransform(E_TRANSFORMATION_STATE state) ...@@ -818,10 +818,10 @@ const core::matrix4& CSoftwareDriver::getTransform(E_TRANSFORMATION_STATE state)
} }
//! Creates a render target texture. //! Creates a render target texture.
ITexture* CSoftwareDriver::createRenderTargetTexture(const core::dimension2d<s32>& size) ITexture* CSoftwareDriver::createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name)
{ {
CImage* img = new CImage(video::ECF_A1R5G5B5, size); CImage* img = new CImage(video::ECF_A1R5G5B5, size);
ITexture* tex = new CSoftwareTexture(img, 0); ITexture* tex = new CSoftwareTexture(img, name);
img->drop(); img->drop();
return tex; return tex;
} }
......
...@@ -82,7 +82,7 @@ namespace video ...@@ -82,7 +82,7 @@ namespace video
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state); virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);
//! Creates a render target texture. //! Creates a render target texture.
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size); virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name);
//! Clears the ZBuffer. //! Clears the ZBuffer.
virtual void clearZBuffer(); virtual void clearZBuffer();
......
...@@ -1818,11 +1818,11 @@ const core::matrix4& CSoftwareDriver2::getTransform(E_TRANSFORMATION_STATE state ...@@ -1818,11 +1818,11 @@ const core::matrix4& CSoftwareDriver2::getTransform(E_TRANSFORMATION_STATE state
} }
//! Creates a render target texture. //! Creates a render target texture.
ITexture* CSoftwareDriver2::createRenderTargetTexture(const core::dimension2d<s32>& size) ITexture* CSoftwareDriver2::createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name)
{ {
CImage* img = new CImage(ECF_SOFTWARE2, size); CImage* img = new CImage(ECF_SOFTWARE2, size);
ITexture* tex = new CSoftwareTexture2(img, 0, false); ITexture* tex = new CSoftwareTexture2(img, name, false);
img->drop(); img->drop();
return tex; return tex;
} }
......
...@@ -98,7 +98,7 @@ namespace video ...@@ -98,7 +98,7 @@ namespace video
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state); virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state);
//! Creates a render target texture. //! Creates a render target texture.
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size); virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size, const c8* name);
//! Clears the DepthBuffer. //! Clears the DepthBuffer.
virtual void clearZBuffer(); virtual void clearZBuffer();
......
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