[2.2] Patch file for removing RTV from texture definition

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
SolarPortal
OGRE Contributor
OGRE Contributor
Posts: 203
Joined: Sat Jul 16, 2011 8:29 pm
Location: UK
x 51

[2.2] Patch file for removing RTV from texture definition

Post by SolarPortal »

Hi, i needed to remove some RTV's from a shared compositor node and noticed that there was no remove RTV from the mLocalRtvs,
here is the patch file:

Code: Select all

diff --git a/OgreMain/include/Compositor/OgreTextureDefinition.h b/OgreMain/include/Compositor/OgreTextureDefinition.h
index 8b7a91c0a..18c1b729d 100644
--- a/OgreMain/include/Compositor/OgreTextureDefinition.h
+++ b/OgreMain/include/Compositor/OgreTextureDefinition.h
@@ -320,6 +320,8 @@ namespace Ogre
         RenderTargetViewDef* addRenderTextureView( IdString name );
         const RenderTargetViewDef* getRenderTargetViewDef( IdString name ) const;
         RenderTargetViewDef* getRenderTargetViewDefNonConstNoThrow( IdString name );
+		void removeRenderTextureView( IdString name );
+		void removeAllRenderTextureViews( void );
 
         /** Utility function to create the textures based on a given set of
             texture definitions and put them in a container.
diff --git a/OgreMain/src/Compositor/OgreTextureDefinition.cpp b/OgreMain/src/Compositor/OgreTextureDefinition.cpp
index 1c9f25cd3..d5a84f4b0 100644
--- a/OgreMain/src/Compositor/OgreTextureDefinition.cpp
+++ b/OgreMain/src/Compositor/OgreTextureDefinition.cpp
@@ -269,6 +269,19 @@ namespace Ogre
         return retVal;
     }
     //-----------------------------------------------------------------------------------
+	void TextureDefinitionBase::removeRenderTextureView( IdString name )
+	{
+		RenderTargetViewDefMap::iterator itor = mLocalRtvs.find(name);
+		if (itor != mLocalRtvs.end())
+			mLocalRtvs.erase(itor);
+	}
+	//-----------------------------------------------------------------------------------
+	void TextureDefinitionBase::removeAllRenderTextureViews(void)
+	{
+		mLocalRtvs.clear();
+	}
+	//-----------------------------------------------------------------------------------
     void TextureDefinitionBase::createTextures( const TextureDefinitionVec &textureDefs,
                                                 CompositorChannelVec &inOutTexContainer,
                                                 IdType id,
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5446
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1348

Re: [2.2] Patch file for removing RTV from texture definition

Post by dark_sylinc »

Code: Select all

error: corrupt patch at line 37
Please upload it as a text file, I suspect some EOL thing preventing the patch from working
User avatar
SolarPortal
OGRE Contributor
OGRE Contributor
Posts: 203
Joined: Sat Jul 16, 2011 8:29 pm
Location: UK
x 51

Re: [2.2] Patch file for removing RTV from texture definition

Post by SolarPortal »

Here you go: (used "git diff > patch.diff")
patch.zip
You do not have the required permissions to view the files attached to this post.
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5446
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1348

Re: [2.2] Patch file for removing RTV from texture definition

Post by dark_sylinc »

Thanks. Added to 2.2 branch. It will eventually be merged into master.
User avatar
SolarPortal
OGRE Contributor
OGRE Contributor
Posts: 203
Joined: Sat Jul 16, 2011 8:29 pm
Location: UK
x 51

Re: [2.2] Patch file for removing RTV from texture definition

Post by SolarPortal »

sure, no problem :)
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk