[2.2] Where are the TextureTypes?

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
rujialiu
Goblin
Posts: 230
Joined: Mon May 09, 2016 8:21 am
x 24

Re: [2.2] Where are the TextureTypes?

Post by rujialiu » Wed Jun 05, 2019 6:40 am

Lax wrote:
Tue Jun 04, 2019 8:24 pm
or do you mean:
hlmsPbs->setDebugOutputPath(true, true);
hlmsUnlit->setDebugOutputPath(true, true);
hlmsTerra->setDebugOutputPath(true, true);
Yeah.... but if I remember it correctly, you have to provide a output path (the third parameter, which is blank by default) and you need to do it before registerHlms() (maybe you don't need, but anyway... that's why I did)

If everything's fine, you'll see a bounch of hlsl files generated in the HlmsDebug output path, like HlmsDebug/100000000PixelShader_ps.hlsl, the first lines look like:

Code: Select all

#if 0
    *** hlms_uv_count0  2
    *** fwd_clustered_lights_per_cell   389
    *** obb_restraint_ltc   1
    *** uv_emissive 0

...
The actual shader code goes after the following marks:

Code: Select all

    DONE DUMPING PROPERTIES
    DONE DUMPING PIECES
#endif
Note that these dumps are NOT part of the real shader codes for compilation. For example, if hlsl compiler tells you line 100 has an error, that line 100 is BEFORE adding the dumps (i.e. the #if 0 block). Then you compare the dumps of the shaders generated for the cloned datablock and original datablock (you can find the hlsl source code for your datablock with visual studio but you can also guess). There should be a few mismatches.
Lax wrote:
Tue Jun 04, 2019 8:24 pm
Do you have an example how to use one?
just subclass Ogre::ResourceLoadingListener like this:

Code: Select all

class MyResourceLoadingListenerImpl : public Ogre::ResourceLoadingListener {
...
and override every virtual function and add if(name == "_rt") in every such function 8-)

Make sure you create the listener before parsing config figure and call addResourceLocation (and before you do any actual resource loading, of course):

Code: Select all

        m_resourceLoadingListener = new MyResourceLoadingListenerImpl();
        Ogre::ResourceGroupManager::getSingleton().setLoadingListener(m_resourceLoadingListener);
1 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Wed Jun 05, 2019 5:36 pm

Hi,

I implemented the ResourceListener. But I have no idea, what should be returned in those overriden functions like:

Code: Select all

Ogre::SharedPtr<Ogre::DataStream> ResourceLoadingListenerImpl::resourceLoading(const Ogre::String& name, const Ogre::String& group, Ogre::Resource* resource)
	{
		if (name == "_rt")
		{
			int i = 0;
			i = 1;
		}
		// Ogre::DataStreamResourcePtr dataStreamResource = Ogre::Datastream::getSingleton().load(name, group);
		// DataStreamPtr encoded = dataStreamResource->getDataStream();
		// return encoded;
		// Ogre::SharedPtr<Ogre::DataStream> dataStream = Ogre::ResourceGroupManager::getSingletonPtr()->createResource(name, group);
		// return dataStream;
		return Ogre::SharedPtr<Ogre::DataStream>();
	}
Because the functions do crash. Its strange, that I have to return a DataStream, since I just want to react, when a resource is loaded...

Best Regards
Lax
0 x

rujialiu
Goblin
Posts: 230
Joined: Mon May 09, 2016 8:21 am
x 24

Re: [2.2] Where are the TextureTypes?

Post by rujialiu » Thu Jun 06, 2019 3:18 am

Lax wrote:
Wed Jun 05, 2019 5:36 pm
I implemented the ResourceListener. But I have no idea, what should be returned in those overriden functions like:
You can simply return null and the caller will use default ways for loading. What I'm suggesting is you INSPECT the loading REQUESTs rather than provide real custom resource loading machenism. It's for troubleshooting so you don't need to do anything serious :)
0 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Thu Jun 06, 2019 8:08 pm

The problem is, I cannot just return nullptr or 0, because it is not compatible with OgreSharedPtr<DataStream>. So I return an empty shared ptr:

Code: Select all

return Ogre::SharedPtr<Ogre::DataStream>();
But this causes a crash, because internally Ogre wants to load an image of that return value and does crash.

Best Regards
Lax
0 x

rujialiu
Goblin
Posts: 230
Joined: Mon May 09, 2016 8:21 am
x 24

Re: [2.2] Where are the TextureTypes?

Post by rujialiu » Fri Jun 07, 2019 8:32 am

Lax wrote:
Thu Jun 06, 2019 8:08 pm
But this causes a crash, because internally Ogre wants to load an image of that return value and does crash.
ahhh.. sorry, I forgot you MUST override this:

Code: Select all

  virtual bool grouplessResourceExists(const Ogre::String &name);
Return false for everything (you can also inspect the name here), then Ogre should not call the resourceLoading functions. I just realize that probably a faster way to debug is to place a breakpoint here:

Code: Select all

void TextureGpu::unsafeScheduleTransitionTo( GpuResidency::GpuResidency nextResidency,
                                                 Image2 *image, bool autoDeleteImage )
    {
        mNextResidencyStatus = nextResidency;
        ++mPendingResidencyChanges;
        if( isManualTexture() )
        {
            OGRE_ASSERT_LOW( !image && "Image pointer must null for manual textures!" );
            //Transition immediately. There's nothing from file or listener to load.
            this->_transitionTo( nextResidency, (uint8*)0 ); /////////////// add your breakpoint here
        }
        else
        {
            //Schedule transition, we'll be loading from a worker thread.
            mTextureManager->_scheduleTransitionTo( this, nextResidency, image, autoDeleteImage );
        }
    }
Since I suspect "rt" is a rendertarget, it should go into the "isManualTexture()" branch. And since you're using a simplest workspace, there should be VERY FEW breakpoint hits. Just inspect them one by one.

BTW: Maybe it's a MyGUI render target?
0 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Fri Jun 07, 2019 9:12 pm

Hi rujialiu,

the problem is, that all methods must be implemented, since this listener is an interface, hence I get compile errors:

Code: Select all

 class ResourceLoadingListener
    {
    public:
        virtual ~ResourceLoadingListener() {}

        /** This event is called when a resource beings loading. */
        virtual DataStreamPtr resourceLoading(const String &name, const String &group, Resource *resource) = 0;

        /// Gets called when a groupless manager (like TextureGpuManager) wants to check if there's
        /// a resource with that name provided by this listener.
        /// This function is called from main thread.
        virtual bool grouplessResourceExists( const String &name ) = 0;

        /// Gets called when a groupless manager (like TextureGpuManager) loads a resource.
        /// WARNING: This function is likely going to be called from a worker thread.
        virtual DataStreamPtr grouplessResourceLoading( const String &name ) = 0;
        /// Similar to resourceStreamOpened, gets called when a groupless manager has already
        /// opened a resource and you may want to modify the stream.
        /// If grouplessResourceLoading has been called, then this function won't.
        /// WARNING: This function is likely going to be called from a worker thread.
        virtual DataStreamPtr grouplessResourceOpened( const String &name, Archive *archive,
                                                       DataStreamPtr &dataStream ) = 0;

        /** This event is called when a resource stream has been opened, but not processed yet. 
        @remarks
            You may alter the stream if you wish or alter the incoming pointer to point at
            another stream if you wish.
        */
        virtual void resourceStreamOpened(const String &name, const String &group, Resource *resource, DataStreamPtr& dataStream) = 0;

        /** This event is called when a resource collides with another existing one in a resource manager
          */
        virtual bool resourceCollision(Resource *resource, ResourceManager *resourceManager) = 0;
    };
I have no idea, why this listener, has been implemented this way...

I also tried, as you said to set the breakpoint in unsafeScheduleTransitionTo, but I only see that the data block name is empty and the type unknown.

You mentioned, "_rt" could come from MyGUI. Do I have to change something with MyGUI, when workspace will be recreated?

Best Regards
Lax
0 x

rujialiu
Goblin
Posts: 230
Joined: Mon May 09, 2016 8:21 am
x 24

Re: [2.2] Where are the TextureTypes?

Post by rujialiu » Sat Jun 08, 2019 7:43 am

Lax wrote:
Fri Jun 07, 2019 9:12 pm
the problem is, that all methods must be implemented, since this listener is an interface, hence I get compile errors:
Could you post your whole class's code (I think it should be short). You need to implement every function like "virtual f() = 0;"
I also tried, as you said to set the breakpoint in unsafeScheduleTransitionTo, but I only see that the data block name is empty and the type unknown.
You mentioned, "_rt" could come from MyGUI. Do I have to change something with MyGUI, when workspace will be recreated?
Could you post the whole stack trace when the breakpoint is hit?
0 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Sat Jun 08, 2019 9:54 am

Stacktrace:

Code: Select all

>	OgreMain_d.dll!Ogre::TextureGpu::unsafeScheduleTransitionTo(Ogre::GpuResidency::GpuResidency nextResidency, Ogre::Image2 * image, bool autoDeleteImage) Zeile 157	C++
 	OgreMain_d.dll!Ogre::TextureGpu::scheduleTransitionTo(Ogre::GpuResidency::GpuResidency nextResidency, Ogre::Image2 * image, bool autoDeleteImage) Zeile 166	C++
 	OgreHlmsPbs_d.dll!Ogre::HlmsPbsBaseTextureDatablock::loadAllTextures() Zeile 487	C++
 	OgreHlmsPbs_d.dll!Ogre::HlmsPbs::calculateHashFor(Ogre::Renderable * renderable, unsigned int & outHash, unsigned int & outCasterHash) Zeile 566	C++
 	OgreMain_d.dll!Ogre::Renderable::setDatablock(Ogre::HlmsDatablock * datablock) Zeile 99	C++
 	OgreMain_d.dll!Ogre::v1::SubEntity::setDatablock(Ogre::HlmsDatablock * datablock) Zeile 85	C++
 	OgreMain_d.dll!Ogre::v1::Entity::_initialise(bool forceReinitialise) Zeile 215	C++
 	OgreMain_d.dll!Ogre::v1::Entity::Entity(unsigned int id, Ogre::ObjectMemoryManager * objectMemoryManager, Ogre::SceneManager * manager, const Ogre::SharedPtr<Ogre::v1::Mesh> & mesh) Zeile 118	C++
 	OgreMain_d.dll!Ogre::v1::EntityFactory::createInstanceImpl(unsigned int id, Ogre::ObjectMemoryManager * objectMemoryManager, Ogre::SceneManager * manager, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::STLAllocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::CategorisedAllocPolicy<0> > > * params) Zeile 2092	C++
 	OgreMain_d.dll!Ogre::MovableObjectFactory::createInstance(unsigned int id, Ogre::ObjectMemoryManager * objectMemoryManager, Ogre::SceneManager * manager, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::STLAllocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::CategorisedAllocPolicy<0> > > * params) Zeile 895	C++
 	OgreMain_d.dll!Ogre::SceneManager::createMovableObject(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & typeName, Ogre::ObjectMemoryManager * objectMemMgr, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::STLAllocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,Ogre::CategorisedAllocPolicy<0> > > * params) Zeile 4708	C++
 	OgreMain_d.dll!Ogre::SceneManager::createEntity(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & meshName, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & groupName, Ogre::SceneMemoryMgrTypes sceneType) Zeile 624	C++
 	OgreMain_d.dll!Ogre::SceneManager::createEntity(const Ogre::SharedPtr<Ogre::v1::Mesh> & pMesh, Ogre::SceneMemoryMgrTypes sceneType) Zeile 631	C++
 	NOWA_Engine_d.dll!NOWA::DotSceneImportModule::processEntity(rapidxml::xml_node<char> * xmlNode, Ogre::SceneNode * parent) Zeile 2456	C++
 	NOWA_Engine_d.dll!NOWA::DotSceneImportModule::processNode(rapidxml::xml_node<char> * xmlNode, Ogre::SceneNode * parent) Zeile 2268	C++
 	NOWA_Engine_d.dll!NOWA::DotSceneImportModule::processNodes(rapidxml::xml_node<char> * xmlNode, Ogre::SceneNode * parent) Zeile 2144	C++
 	NOWA_Engine_d.dll!NOWA::DotSceneImportModule::processScene(rapidxml::xml_node<char> * xmlRoot) Zeile 680	C++
 	NOWA_Engine_d.dll!NOWA::DotSceneImportModule::parseScene(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & projectName, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & sceneName, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & resourceGroupName, Ogre::Light * sunLight, NOWA::DotSceneImportModule::IWorldLoaderCallback * worldLoaderCallback, bool showProgress, bool createWorkspace) Zeile 300	C++
 	NOWA_Design_d.exe!ProjectManager::loadProject(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & filePathName) Zeile 460	C++
 	NOWA_Design_d.exe!MainMenuBar::notifyPopupMenuAccept(MyGUI::MenuControl * sender, MyGUI::MenuItem * item) Zeile 372	C++
 	NOWA_Design_d.exe!MyGUI::delegates::CMethodDelegate2<MainMenuBar,MyGUI::MenuControl *,MyGUI::MenuItem *>::invoke(MyGUI::MenuControl * p1, MyGUI::MenuItem * p2) Zeile 90	C++
 	MyGuiEngine_d.dll!MyGUI::delegates::CMultiDelegate2<MyGUI::MenuControl *,MyGUI::MenuItem *>::operator()(MyGUI::MenuControl * p1, MyGUI::MenuItem * p2) Zeile 289	C++
 	MyGuiEngine_d.dll!MyGUI::MenuControl::notifyMenuCtrlAccept(MyGUI::MenuItem * _item) Zeile 338	C++
 	MyGuiEngine_d.dll!MyGUI::MenuControl::notifyMenuCtrlAccept(MyGUI::MenuItem * _item) Zeile 337	C++
 	MyGuiEngine_d.dll!MyGUI::MenuControl::notifyMouseButtonClick(MyGUI::Widget * _sender) Zeile 472	C++
 	MyGuiEngine_d.dll!MyGUI::delegates::CMethodDelegate1<MyGUI::MenuControl,MyGUI::Widget *>::invoke(MyGUI::Widget * p1) Zeile 89	C++
 	MyGuiEngine_d.dll!MyGUI::delegates::CMultiDelegate1<MyGUI::Widget *>::operator()(MyGUI::Widget * p1) Zeile 289	C++
 	MyGuiEngine_d.dll!MyGUI::WidgetInput::_riseMouseButtonClick() Zeile 92	C++
 	MyGuiEngine_d.dll!MyGUI::InputManager::injectMouseRelease(int _absx, int _absy, MyGUI::MouseButton _id) Zeile 334	C++
 	NOWA_Engine_d.dll!NOWA::Core::mouseReleased(const OIS::MouseEvent & evt, OIS::MouseButtonID id) Zeile 2246	C++
 	NOWA_Design_d.exe!DesignState::mouseReleased(const OIS::MouseEvent & evt, OIS::MouseButtonID id) Zeile 1675	C++
 	OIS_d.dll!OIS::Win32Mouse::_doMouseClick(int mouseButton, DIDEVICEOBJECTDATA & di) Zeile 206	C++
 	OIS_d.dll!OIS::Win32Mouse::capture() Zeile 120	C++
 	NOWA_Engine_d.dll!NOWA::AppStateManager::restrictedFPSRendering() Zeile 217	C++
 	NOWA_Engine_d.dll!NOWA::AppStateManager::start(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & applicationStateName, bool renderWhenInactive, bool restrictFps) Zeile 96	C++
 	NOWA_Design_d.exe!MainApplication::startSimulation(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & configName) Zeile 74	C++
 	NOWA_Design_d.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * __formal, char * strCmdLine, int __formal) Zeile 20	C++
 	[Externer Code]	
 	[Die unten aufgeführten Frames sind möglicherweise nicht korrekt und/oder fehlen, für "kernel32.dll" wurden keine Symbole geladen.]	Unbekannt
 	NOWA_Design_d.exe!pugi::impl::`anonymous namespace'::xpath_ast_node::eval_string_concat(const pugi::impl::`anonymous-namespace'::xpath_context & c, const pugi::impl::`anonymous-namespace'::xpath_stack & stack) Zeile 8360	C++
"this" pointer of TextureGPU:

Code: Select all

-		this	0x19ad2c18 {mDefaultDisplaySrv=0x076c82cc <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...}	Ogre::TextureGpu * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpu}
-		[Ogre::D3D11TextureGpu]	{mDefaultDisplaySrv=0x076c82cc <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...}	RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpu
+		Ogre::TextureGpu	{mWidth=0 mHeight=0 mDepthOrSlices=0 ...}	RenderSystem_Direct3D11_d.dll!Ogre::TextureGpu
+		mDefaultDisplaySrv	0x076c82cc <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.>	RenderSystem_Direct3D11_d.dll!ID3D11ShaderResourceView *
+		mDisplayTextureName	0x0739c724 <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.>	RenderSystem_Direct3D11_d.dll!ID3D11Resource *
+		mFinalTextureName	0x00000000 <NULL>	RenderSystem_Direct3D11_d.dll!ID3D11Resource *
+		mMsaaFramebufferName	0x00000000 <NULL>	RenderSystem_Direct3D11_d.dll!ID3D11Resource *
		Ogre::GpuTrackedResource	{...}	Ogre::GpuTrackedResource
-		Ogre::GpuResource	{mResidencyStatus=OnStorage (0) mNextResidencyStatus=Resident (2) mPageOutStrategy=Discard (1) ...}	Ogre::GpuResource
		Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<5> >	{...}	Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<5> >
+		__vfptr	0x06a1e500 {RenderSystem_Direct3D11_d.dll!void(* Ogre::D3D11TextureGpu::`vftable'[25])()} {0x068b97d2 {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpu::`vector deleting destructor'(unsigned int)}, ...}	void * *
		mResidencyStatus	OnStorage (0)	Ogre::GpuResidency::GpuResidency
		mNextResidencyStatus	Resident (2)	Ogre::GpuResidency::GpuResidency
		mPageOutStrategy	Discard (1)	Ogre::GpuPageOutStrategy::GpuPageOutStrategy
		mPendingResidencyChanges	1	unsigned int
		mRank	1	int
		mLastFrameUsed	490	unsigned int
		mLowestDistanceToCamera	0.000000000	float
+		mVaoManager	0x05f04fb8 {mVbos=0x05f0515c {0x05f0515c {{ size=1 }, { size=0 }, { size=0 }}, 0x05f0518c {{ size=0 }, ...}, ...} ...}	Ogre::VaoManager * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11VaoManager}
+		mName	{mHash=2894295915 mDebugString=0x19ad2c40 "" }	Ogre::IdString
		mWidth	0	unsigned int
		mHeight	0	unsigned int
		mDepthOrSlices	0	unsigned int
		mNumMipmaps	1 '\x1'	unsigned char
		mMsaa	1 '\x1'	unsigned char
		mMsaaPattern	Undefined (0)	Ogre::MsaaPatterns::MsaaPatterns
		mInternalSliceStart	0	unsigned short
		mTextureType	TypeCube (5)	Ogre::TextureTypes::TextureTypes
		mPixelFormat	PFG_UNKNOWN (0)	Ogre::PixelFormatGpu
		mTextureFlags	128	unsigned int
		mPoolId	0	unsigned int
+		mSysRamCopy	0x00000000 <NULL>	unsigned char *
+		mTextureManager	0x072f8e20 {mBlankTexture=0x072f9034 {0x0739c124 {...}, 0x072f9124 {...}, 0x0739b8e4 {...}, 0x0739c124 {...}, ...} ...}	Ogre::TextureGpuManager * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpuManager}
+		mTexturePool	0x00000000 <NULL>	const Ogre::TexturePool *
+		mListeners	{ size=1 }	std::vector<Ogre::TextureGpuListener *,Ogre::STLAllocator<Ogre::TextureGpuListener *,Ogre::CategorisedAllocPolicy<0> > >
		autoDeleteImage	true	bool
+		image	0x00000000 <NULL>	Ogre::Image2 *
		nextResidency	Resident (2)	Ogre::GpuResidency::GpuResidency
The set datablock:

Code: Select all

+		this	0x19bb5678 {mParentEntity=0x063e8448 {mMesh={pRep=0x25a76270 {mSubMeshList={ size=1 } mFreshFromDisk=...} ...} ...} ...}	Ogre::v1::SubEntity *
-		datablock	0x19cc68b8 {mUvSource=0x19cc69e4 "" mBlendModes=0x19cc69f2 "" mFresnelTypeSizeBytes=4 '\x4' ...}	Ogre::HlmsDatablock * {OgreHlmsPbs_d.dll!Ogre::HlmsPbsDatablock}
-		[Ogre::HlmsPbsDatablock]	{mUvSource=0x19cc69e4 "" mBlendModes=0x19cc69f2 "" mFresnelTypeSizeBytes=4 '\x4' ...}	OgreHlmsPbs_d.dll!Ogre::HlmsPbsDatablock
+		Ogre::HlmsPbsBaseTextureDatablock	{mTexIndices=0x19cc6934 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} mTexturesDescSet=0x00000000 <NULL> ...}	OgreHlmsPbs_d.dll!Ogre::HlmsPbsBaseTextureDatablock
+		mUvSource	0x19cc69e4 ""	unsigned char[14]
+		mBlendModes	0x19cc69f2 ""	unsigned char[4]
		mFresnelTypeSizeBytes	4 '\x4'	unsigned char
		mTwoSided	false	bool
		mUseAlphaFromTextures	false	bool
		mWorkflow	0 '\0'	unsigned char
		mReceiveShadows	true	bool
		mCubemapIdxInDescSet	255 'ÿ'	unsigned char
		mUseEmissiveAsLightmap	false	bool
		mTransparencyMode	Transparent (1)	OgreHlmsPbs_d.dll!Ogre::HlmsPbsDatablock::TransparencyModes
+		mBgDiffuse	0x19cc6a04 {1.00000000, 1.00000000, 1.00000000, 1.00000000}	float[4]
		mkDr	0.999493062	float
		mkDg	0.999493062	float
		mkDb	0.999493062	float
		_padding0	0.500000000	float
		mkSr	1.00000000	float
		mkSg	1.00000000	float
		mkSb	1.00000000	float
		mRoughness	1.00000000	float
		mFresnelR	0.00999999978	float
		mFresnelG	0.818000019	float
		mFresnelB	0.818000019	float
		mTransparencyValue	0.899999976	float
+		mDetailNormalWeight	0x19cc6a44 {1.00000000, 1.00000000, 1.00000000, 1.00000000}	float[4]
+		mDetailWeight	0x19cc6a54 {1.00000000, 1.00000000, 1.00000000, 1.00000000}	float[4]
+		mDetailsOffsetScale	0x19cc6a64 {0x19cc6a64 {0.000000000, 0.000000000, 1.00000000, 1.00000000}, 0x19cc6a74 {0.000000000, ...}, ...}	float[4][4]
+		mEmissive	0x19cc6aa4 {0.000000000, 0.000000000, 0.000000000}	float[3]
		mNormalMapWeight	1.00000000	float
+		mUserValue	0x19cc6ab4 {0x19cc6ab4 {0.000000000, 0.000000000, 0.000000000, 0.000000000}, 0x19cc6ac4 {0.000000000, ...}, ...}	float[3][4]
+		mCubemapProbe	0x00000000 <NULL>	OgreHlmsPbs_d.dll!Ogre::CubemapProbe *
		mBrdf	2147483648	unsigned int
		Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<5> >	{...}	Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<5> >
+		__vfptr	0x50755b84 {OgreHlmsPbs_d.dll!void(* Ogre::HlmsPbsDatablock::`vftable'[9])()} {0x50695a24 {OgreHlmsPbs_d.dll!Ogre::HlmsPbsDatablock::`vector deleting destructor'(unsigned int)}, ...}	void * *
+		mLinkedRenderables	{ size=1 }	std::vector<Ogre::Renderable *,Ogre::STLAllocator<Ogre::Renderable *,Ogre::CategorisedAllocPolicy<0> > >
+		mCreator	0x07c85220 {mPreparedPass={shadowMaps={mData=0x19b8cd30 {0x1a27f7b8 {mWidth=3722304989 mHeight=3722304989 ...}} ...} ...} ...}	Ogre::Hlms * {NOWA_Engine_d.dll!Ogre::HlmsPbs}
+		mName	{mHash=2934449670 mDebugString=0x19cc68d4 "WhiteLine" }	Ogre::IdString
		mTextureHash	0	unsigned int
+		mMacroblockHash	0x19cc68f8 {0, 32}	unsigned short[2]
		mType	1 '\x1'	unsigned char
+		mMacroblock	0x19cc6900 {0x0634d008 {mScissorTestEnabled=false mDepthCheck=true mDepthWrite=true ...}, 0x0634d02c {...}}	const Ogre::HlmsMacroblock *[2]
+		mBlendblock	0x19cc6908 {0x06371038 {mAlphaToCoverageEnabled=false mBlendChannelMask=15 '\xf' mIsTransparent=false ...}, ...}	const Ogre::HlmsBlendblock *[2]
		mAllowTextureResidencyChange	true	bool
		mIgnoreFlushRenderables	false	bool
		mAlphaTestCmp	1 '\x1'	unsigned char
		mAlphaTestShadowCasterOnly	false	bool
		mAlphaTestThreshold	0.500000000	float
		mShadowConstantBias	0.00999999978	float
For this simple entity, the datablock "WhiteLine" is set, which has the following content:

Code: Select all

"WhiteLine" :
		{
			"macroblock" : "NOWA2_Macroblock_0",
			"blendblock" : "NOWA2_Blendblock_0",
			"shadow_const_bias" : 0.01,
			"workflow" : "specular",
			"brdf" : "default_uncorrelated",
			"transparency" :
			{
				"value" : 0.9,
				"mode" : "Transparent",
				"use_alpha_from_textures" : false
			},
			"diffuse" :
			{
				"value" : [3.14, 3.14, 3.14],
				"background" : [1, 1, 1, 1]
			},
			"specular" :
			{
				"value" : [1, 1, 1]
			}
		},
It has no texture. But that does not matter. I tried with other datablocks (with textures etc.). The error is always the same.
Its always the first entity, that is created and the datablock set, which causes this error:

Code: Select all

11:00:59: [GameObject] Creating Gameobject 3619609577 for scene node name: MainCamera
11:00:59: [CameraComponent] Init camera component for game object: MainCamera
11:01:00: [WorkspaceModule] Creating workspace: NOWAPbsWorkspace
11:01:01: Mesh: Loading Node.mesh.
11:01:01: WARNING: Node.mesh is an older format ([MeshSerializer_v1.8]); you should upgrade it as soon as possible using the OgreMeshTool tool.
11:01:01: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource _rt. in resource group Autodetect or any other group. in ResourceGroupManager::_getArchiveToResource at h:\gameenginedevelopment2_2\external\ogre2.2sdk\ogremain\src\ogreresourcegroupmanager.cpp (line 874)
11:01:03: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource _rt. in resource group Autodetect or any other group. in ResourceGroupManager::_getArchiveToResource at h:\gameenginedevelopment2_2\external\ogre2.2sdk\ogremain\src\ogreresourcegroupmanager.cpp (line 874)
11:01:03: Couldn't apply datablock 'WhiteLine' to this renderable. Using default one. Check previous log messages to see if there's more information.
11:01:03: [GameObject] Creating Gameobject 1111111111 for scene node name: MainGameObject
11:01:03: [GameObject] Creating Gameobject 3596263612 for scene node name: Node_0
I found that out, because I changed the order of entities to be loaded and when the workspace is created etc.

I also disabled workspace destruction, when creating a new scene. The log error was the same. In fact I got a crash, because a new camera has been created and the old for the workspace destroyed, which caused a crash, but I just wanted to see, if the log error occurs, even when the workspace is the same.

ResourceLoadingListenerImpl:

Code: Select all

ResourceLoadingListenerImpl::ResourceLoadingListenerImpl()
	{

	}

	ResourceLoadingListenerImpl::~ResourceLoadingListenerImpl()
	{

	}

	Ogre::SharedPtr<Ogre::DataStream> ResourceLoadingListenerImpl::resourceLoading(const Ogre::String& name, const Ogre::String& group, Ogre::Resource* resource)
	{
		if (name == "_rt")
		{
			int i = 0;
			i = 1;
		}
		// Ogre::DataStreamResourcePtr dataStreamResource = Ogre::Datastream::getSingleton().load(name, group);
		// DataStreamPtr encoded = dataStreamResource->getDataStream();
		// return encoded;
		// Ogre::SharedPtr<Ogre::DataStream> dataStream = Ogre::ResourceGroupManager::getSingletonPtr()->createResource(name, group);
		// return dataStream;
		return Ogre::SharedPtr<Ogre::DataStream>();
	}

	bool ResourceLoadingListenerImpl::grouplessResourceExists(const Ogre::String& name)
	{
		if (name == "_rt")
		{
			int i = 0;
			i = 1;
		}
		return false;
	}

	Ogre::SharedPtr<Ogre::DataStream> ResourceLoadingListenerImpl::grouplessResourceLoading(const Ogre::String& name)
	{
		if (name == "_rt")
		{
			int i = 0;
			i = 1;
		}
		// Ogre::SharedPtr<Ogre::DataStream> dataStream = Ogre::ResourceGroupManager::getSingletonPtr()->createResource(name);
		// return dataStream;
		return Ogre::SharedPtr<Ogre::DataStream>();
	}

	Ogre::SharedPtr<Ogre::DataStream> ResourceLoadingListenerImpl::grouplessResourceOpened(const Ogre::String& name, Ogre::Archive* archive, Ogre::SharedPtr<Ogre::DataStream>& dataStream)
	{
		if (name == "_rt")
		{
			int i = 0;
			i = 1;
		}
		return dataStream;
	}

	void ResourceLoadingListenerImpl::resourceStreamOpened(const Ogre::String& name, const Ogre::String& group, Ogre::Resource* resource, Ogre::SharedPtr<Ogre::DataStream>& dataStream)
	{
		if (name == "_rt")
		{
			int i = 0;
			i = 1;
		}
	}

	bool ResourceLoadingListenerImpl::resourceCollision(Ogre::Resource* resource, Ogre::ResourceManager* resourceManager)
	{
		return false;
	}
Note: The "int I = 0" etc. is just for the breakpoint.

Best Regards
Lax
0 x

rujialiu
Goblin
Posts: 230
Joined: Mon May 09, 2016 8:21 am
x 24

Re: [2.2] Where are the TextureTypes?

Post by rujialiu » Tue Jun 11, 2019 5:33 am

hmm... I'm puzzled. Do you have a .material (the old material) of the same name as the .mesh file? Maybe it's loaded first?
0 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Tue Jun 11, 2019 8:18 pm

Hi,

I got the ResourceListener working, and the breakpoints are now hit, because I checked against "_rt." (See comments below). Its really really strange everything.
I also updated Ogre 2.2 version and build everything carefully from the scratch, but no improvement :(

The current values before the exception does occur are the following:

Code: Select all

-		this	0x18243c60 {mUvSource=0x18243d8c "" mBlendModes=0x18243d9a "" mFresnelTypeSizeBytes=4 '\x4' ...}	Ogre::HlmsPbsBaseTextureDatablock * {Ogre::HlmsPbsDatablock}
+		[Ogre::HlmsPbsDatablock]	{mUvSource=0x18243d8c "" mBlendModes=0x18243d9a "" mFresnelTypeSizeBytes=4 '\x4' ...}	Ogre::HlmsPbsDatablock
+		Ogre::HlmsDatablock	{mLinkedRenderables={ size=1 } mCreator=0x07d9be00 {mPreparedPass={shadowMaps={mData=0x180944e8 {0x18989498 {...}} ...} ...} ...} ...}	Ogre::HlmsDatablock
+		Ogre::ConstBufferPoolUser	{mAssignedSlot=196 mAssignedPool=0x07d4eae8 {hash=0 freeSlots={ size=0 } materialBuffer=0x07d1aeb0 {...} ...} ...}	Ogre::ConstBufferPoolUser
+		Ogre::TextureGpuListener	{...}	Ogre::TextureGpuListener
+		mTexIndices	0x18243cdc {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}	unsigned short[15]
+		mTexturesDescSet	0x00000000 <NULL>	const Ogre::DescriptorSetTexture *
+		mSamplersDescSet	0x00000000 <NULL>	const Ogre::DescriptorSetSampler *
-		mTextures	0x18243d04 {0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, ...}	Ogre::TextureGpu *[15]
+		[0]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[1]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[2]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[3]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[4]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[5]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[6]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[7]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[8]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[9]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[10]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[11]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[12]	0x00000000 <NULL>	Ogre::TextureGpu *
+		[13]	0x00000000 <NULL>	Ogre::TextureGpu *
-		[14]	0x186b2eb0 {mDefaultDisplaySrv=0x07c3044c <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...}	Ogre::TextureGpu * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpu}
+		[Ogre::D3D11TextureGpu]	{mDefaultDisplaySrv=0x07c3044c <Keine Informationen verfügbar. Für d3d11.dll wurden keine Symbole geladen.> ...}	RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpu
		Ogre::GpuTrackedResource	{...}	Ogre::GpuTrackedResource
+		Ogre::GpuResource	{mResidencyStatus=OnStorage (0) mNextResidencyStatus=OnStorage (0) mPageOutStrategy=Discard (1) ...}	Ogre::GpuResource
		mWidth	0	unsigned int
		mHeight	0	unsigned int
		mDepthOrSlices	0	unsigned int
		mNumMipmaps	1 '\x1'	unsigned char
		mMsaa	1 '\x1'	unsigned char
		mMsaaPattern	Undefined (0)	Ogre::MsaaPatterns::MsaaPatterns
		mInternalSliceStart	0	unsigned short
		mTextureType	TypeCube (5)	Ogre::TextureTypes::TextureTypes
		mPixelFormat	PFG_UNKNOWN (0)	Ogre::PixelFormatGpu
		mTextureFlags	128	unsigned int
		mPoolId	0	unsigned int
+		mSysRamCopy	0x00000000 <NULL>	unsigned char *
+		mTextureManager	0x063f3730 {mBlankTexture=0x063f3944 {0x063f70a4 {...}, 0x063f5da4 {...}, 0x063f6724 {...}, 0x063f70a4 {...}, ...} ...}	Ogre::TextureGpuManager * {RenderSystem_Direct3D11_d.dll!Ogre::D3D11TextureGpuManager}
+		mTexturePool	0x00000000 <NULL>	const Ogre::TexturePool *
+		mListeners	{ size=1 }	std::vector<Ogre::TextureGpuListener *,Ogre::STLAllocator<Ogre::TextureGpuListener *,Ogre::CategorisedAllocPolicy<0> > >
+		mSamplerblocks	0x18243d40 {0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, 0x00000000 <NULL>, ...}	const Ogre::HlmsSamplerblock *[15]
+		mTexLocationInDescSet	0x18243d7c "\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf\xf...	unsigned char[15]
		i	-858993460	int
The strange thing is, that in Ogre::TextureGpu, the 14 index is the texture of type "PFG_UNKNOWN". It is a TypeCube, this must be the "_rt" texture, because the Datablock name is empty "". But what does that mean?

From the texture index 14 "scheduleTransition" is called, which causes the exception:

Code: Select all

void OGRE_HLMS_TEXTURE_BASE_CLASS::loadAllTextures(void)
    {
        if( !mAllowTextureResidencyChange )
            return;

        for( int i=0; i<OGRE_HLMS_TEXTURE_BASE_MAX_TEX; ++i )
        {
            if( mTextures[i] )
                mTextures[i]->scheduleTransitionTo( GpuResidency::Resident );
        }
    }
The "_rt" name comes from the function, but it is called actually "_rt." (with dot):

Code: Select all

void TextureGpuManager::scheduleLoadRequest( TextureGpu *texture, Image2 *image,
                                                 bool autoDeleteImage, bool toSysRam )
    {
        OGRE_ASSERT_LOW( texture->getResidencyStatus() == GpuResidency::OnStorage );

        String name, resourceGroup;
        uint32 filters = 0;
        ResourceEntryMap::const_iterator itor = mEntries.find( texture->getName() );
        if( itor != mEntries.end() )
        {
            name = itor->second.name;
            resourceGroup = itor->second.resourceGroup;
            filters = itor->second.filters;
        }

        if( texture->getTextureType() != TextureTypes::TypeCube )
        {
            scheduleLoadRequest( texture, name, resourceGroup, filters,
                                 image, autoDeleteImage, toSysRam );
        }
        else
        {
            String baseName;
            String ext;
            String::size_type pos = name.find_last_of( '.' );
            if( pos != String::npos )
            {
                baseName    = name.substr( 0, pos );
                ext         = name.substr( pos + 1u );
            }
            else
            {
                baseName = name;
            }

            String lowercaseExt = ext;
            StringUtil::toLowerCase( lowercaseExt );

            if( lowercaseExt == "dds" ||lowercaseExt == "oitd" )
            {
                // XX HACK there should be a better way to specify whether
                // all faces are in the same file or not
                scheduleLoadRequest( texture, name, resourceGroup, filters,
                                     image, autoDeleteImage, toSysRam );
            }
            else
            {
                static const String suffixes[6] = { "_rt.", "_lf.", "_up.", "_dn.", "_fr.", "_bk." };

                for( uint32 i=0; i<6u; ++i )
                {
                    const bool skipMetadataCache = i != 0;
                    scheduleLoadRequest( texture, baseName + suffixes[i] + ext,
                                         resourceGroup, filters, i == 0 ? image : 0,
                                         autoDeleteImage, toSysRam, skipMetadataCache, i );
                }
            }
        }
    }
The "_rt." cannot be found in function "_getArchiveToResource" and causes the exception:

Code: Select all

Archive* ResourceGroupManager::_getArchiveToResource( const String& resourceName,
                                                          const String& groupName,
                                                          bool searchGroupsIfNotFound )
    {
        OgreAssert(!resourceName.empty(), "resourceName is empty string");
        OGRE_LOCK_AUTO_MUTEX;

        /*TODO
        if(mLoadingListener)
        {
            DataStreamPtr stream = mLoadingListener->resourceLoading(resourceName, groupName, resourceBeingLoaded);
            if(!stream.isNull())
                return stream;
        }*/

        // Try to find in resource index first
        ResourceGroup* grp = getResourceGroup(groupName);
        if (!grp)
        {
            OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND,
                         "Cannot locate a resource group called '" + groupName +
                         "' for resource '" + resourceName + "'" ,
                         "ResourceGroupManager::_getArchiveToResource" );
        }

        OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME); // lock group mutex

        Archive* pArch = 0;
        ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find(resourceName);
        if (rit != grp->resourceIndexCaseSensitive.end())
        {
            // Found in the index
            pArch = rit->second;
            return pArch;
        }
        else
        {
            // try case insensitive
            String lcResourceName = resourceName;
            StringUtil::toLowerCase(lcResourceName);
            rit = grp->resourceIndexCaseInsensitive.find(lcResourceName);
            if (rit != grp->resourceIndexCaseInsensitive.end())
            {
                // Found in the index
                pArch = rit->second;
                return pArch;
            }
            else
            {
                // Search the hard way
                LocationList::iterator li, liend;
                liend = grp->locationList.end();
                for (li = grp->locationList.begin(); li != liend; ++li)
                {
                    Archive* arch = (*li)->archive;
                    if (arch->exists(resourceName))
                        return arch;
                }
            }
        }


        // Not found
        if (searchGroupsIfNotFound)
        {
            ResourceGroup* foundGrp = findGroupContainingResourceImpl(resourceName);
            if (foundGrp)
            {
                return _getArchiveToResource( resourceName, foundGrp->name, false );
            }
            else
            {
                OGRE_EXCEPT( Exception::ERR_FILE_NOT_FOUND,
                             "Cannot locate resource " + resourceName +
                             " in resource group " + groupName + " or any other group.",
                             "ResourceGroupManager::_getArchiveToResource" );
            }
        }

        OGRE_EXCEPT( Exception::ERR_FILE_NOT_FOUND, "Cannot locate resource " +
                     resourceName + " in resource group " + groupName + ".",
                     "ResourceGroupManager::_getArchiveToResource" );
    }
I also checked my meshes, if something is wrong, and also used a different datablock, but the error remains the same.

Best Regards
Lax
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4116
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 243
Contact:

Re: [2.2] Where are the TextureTypes?

Post by dark_sylinc » Wed Jun 12, 2019 7:22 am

Check you're in the main thread. These functions can't be called from secondary threads.

If you're at OGRE_HLMS_TEXTURE_BASE_CLASS, it would happen after you assign a material to an Item.
Try checking HlmsDatablock::getNameStr to see the name of the material.

mTextures[14] corresponds to PBSM_REFLECTION btw, which means it should be a cubemap texture.

Cubemap textures must be loaded with the proper initialType in createTexture/createOrRetrieveTexture; else stuff like this happens I guess. Additionally if texture->getName() is empty or is not in mEntries, then something has been seriously corrupted. Or maybe the texture has been already been freed.
0 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Thu Jun 13, 2019 4:08 pm

Hi dark_sylinc,

ok, thanks for the information.
Do you know, when a cubemap is automatically created?
Because I'm using for testing the simplest workspace and I'm not aware, that I loading something, that includes a cubemap.

Best Regards
Lax
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4116
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 243
Contact:

Re: [2.2] Where are the TextureTypes?

Post by dark_sylinc » Thu Jun 13, 2019 5:10 pm

We don't automatically create cubemaps unless you're using PCC (Parallax Corrected Cubemaps). Point light shadow maps also create a cubemap.

But if a material asks for a reflection texture, we may try to load a cubemap texture from file. Such as in HlmsPbsDatablock::setTexture:

Code: Select all

if( texUnit == PBSM_REFLECTION )
    textureType = TextureTypes::TypeCube;
or in HlmsJsonPbs::loadTexture:

Code: Select all

if( textureType == PBSM_REFLECTION )
{
    internalTextureType = TextureTypes::TypeCube;
    textureFlags &= ~TextureFlags::AutomaticBatching;
}
Try placing breakpoints there to see if something useful comes up.
1 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Thu Jun 13, 2019 7:01 pm

oh ha. Indeed what I do is the following:
- When Reflection Workspace is active, GameObjects can use reflection map. So when I create any workspace, I do reset any reflection for each GameObject:

Code: Select all

void GameObject::setUseReflection(bool useReflection)
	{
		this->useReflection->setValue(useReflection);

		Ogre::v1::Entity* entity = dynamic_cast<Ogre::v1::Entity*>(this->movableObject);
		if (nullptr != entity)
		{
			for (size_t i = 0; i < entity->getNumSubEntities(); i++)
			{
				Ogre::HlmsPbsDatablock* pbsDatablock = dynamic_cast<Ogre::HlmsPbsDatablock*>(entity->getSubEntity(i)->getDatablock());
				if (nullptr != pbsDatablock)
				{
					// Only usable for skybox reflection
					if (true == this->useReflection->getBool() && WorkspaceModule::getInstance()->getWorkspaceName() == WorkspaceModule::getInstance()->workspaceNameSkyReflection)
					{
// Attention: Is this correct?
						pbsDatablock->setTexture(Ogre::PBSM_REFLECTION, WorkspaceModule::getInstance()->getDynamicCubemapTexture()->getNameStr());
					}
					else
					{
					// -> This causes the faulty behavior!!
						pbsDatablock->setTexture(Ogre::PBSM_REFLECTION, "");
					}
				}
			}
		}
	}
This could cause the faulty behavior!

So the question is: When a GameObject does have a reflection texture, how can I remove that texture?
In Ogre2.1 the code above did work, but with Ogre2.2 not anymore, as it seems.

But when I remove the code, "unloadPlugins();" does not hang anymore and I can successfully exit the application!!

Best Regards
Lax
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4116
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 243
Contact:

Re: [2.2] Where are the TextureTypes?

Post by dark_sylinc » Fri Jun 14, 2019 6:51 am

Just call

Code: Select all

pbsDatablock->setTexture(Ogre::PBSM_REFLECTION, nullptr ); //or (void*)0
As a sidenote, we should detect empty strings.
0 x

Lax
Gnome
Posts: 382
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 9

Re: [2.2] Where are the TextureTypes?

Post by Lax » Sat Jun 15, 2019 9:49 pm

Ok, thanks. I think that should work.

Topic solved!
0 x

Post Reply