@@ -603,56 +603,29 @@ void Ogre2GpuRays::Destroy()
603
603
auto engine = Ogre2RenderEngine::Instance ();
604
604
auto ogreRoot = engine->OgreRoot ();
605
605
auto textureGpuManager = ogreRoot->getRenderSystem ()->getTextureGpuManager ();
606
- if (this ->dataPtr ->cubeUVTexture )
607
- {
608
- textureGpuManager->destroyTexture (this ->dataPtr ->cubeUVTexture );
609
- this ->dataPtr ->cubeUVTexture = nullptr ;
610
- }
611
- if (this ->dataPtr ->colorTexture )
612
- {
613
- textureGpuManager->destroyTexture (this ->dataPtr ->colorTexture );
614
- this ->dataPtr ->colorTexture = nullptr ;
615
- }
616
- if (this ->dataPtr ->depthTexture )
617
- {
618
- textureGpuManager->destroyTexture (this ->dataPtr ->depthTexture );
619
- this ->dataPtr ->depthTexture = nullptr ;
620
- }
621
- if (this ->dataPtr ->particleTexture )
622
- {
623
- textureGpuManager->destroyTexture (this ->dataPtr ->particleTexture );
624
- this ->dataPtr ->particleTexture = nullptr ;
625
- }
626
- if (this ->dataPtr ->particleDepthTexture )
627
- {
628
- textureGpuManager->destroyTexture (this ->dataPtr ->particleDepthTexture );
629
- this ->dataPtr ->particleDepthTexture = nullptr ;
630
- }
631
606
632
607
Ogre::CompositorManager2 *ogreCompMgr = ogreRoot->getCompositorManager2 ();
633
608
634
609
// remove 1st pass textures, material, compositors
635
610
for (auto i : this ->dataPtr ->cubeFaceIdx )
636
611
{
637
- if (this ->dataPtr ->firstPassTextures [i])
638
- {
639
- ogreRoot->getRenderSystem ()->getTextureGpuManager ()->destroyTexture (
640
- this ->dataPtr ->firstPassTextures [i]);
641
- this ->dataPtr ->firstPassTextures [i] = nullptr ;
642
- }
643
612
if (this ->dataPtr ->ogreCompositorWorkspace1st [i])
644
613
{
645
614
ogreCompMgr->removeWorkspace (
646
615
this ->dataPtr ->ogreCompositorWorkspace1st [i]);
647
616
this ->dataPtr ->ogreCompositorWorkspace1st [i] = nullptr ;
648
617
}
618
+ if (this ->dataPtr ->firstPassTextures [i])
619
+ {
620
+ textureGpuManager->destroyTexture (this ->dataPtr ->firstPassTextures [i]);
621
+ this ->dataPtr ->firstPassTextures [i] = nullptr ;
622
+ }
649
623
}
650
624
651
625
// remove 2nd pass texture, material, compositor
652
626
if (this ->dataPtr ->secondPassTexture )
653
627
{
654
- ogreRoot->getRenderSystem ()->getTextureGpuManager ()->destroyTexture (
655
- this ->dataPtr ->secondPassTexture );
628
+ textureGpuManager->destroyTexture (this ->dataPtr ->secondPassTexture );
656
629
this ->dataPtr ->secondPassTexture = nullptr ;
657
630
}
658
631
@@ -662,6 +635,32 @@ void Ogre2GpuRays::Destroy()
662
635
this ->dataPtr ->ogreCompositorWorkspace2nd = nullptr ;
663
636
}
664
637
638
+ if (this ->dataPtr ->cubeUVTexture )
639
+ {
640
+ textureGpuManager->destroyTexture (this ->dataPtr ->cubeUVTexture );
641
+ this ->dataPtr ->cubeUVTexture = nullptr ;
642
+ }
643
+ if (this ->dataPtr ->colorTexture )
644
+ {
645
+ textureGpuManager->destroyTexture (this ->dataPtr ->colorTexture );
646
+ this ->dataPtr ->colorTexture = nullptr ;
647
+ }
648
+ if (this ->dataPtr ->depthTexture )
649
+ {
650
+ textureGpuManager->destroyTexture (this ->dataPtr ->depthTexture );
651
+ this ->dataPtr ->depthTexture = nullptr ;
652
+ }
653
+ if (this ->dataPtr ->particleTexture )
654
+ {
655
+ textureGpuManager->destroyTexture (this ->dataPtr ->particleTexture );
656
+ this ->dataPtr ->particleTexture = nullptr ;
657
+ }
658
+ if (this ->dataPtr ->particleDepthTexture )
659
+ {
660
+ textureGpuManager->destroyTexture (this ->dataPtr ->particleDepthTexture );
661
+ this ->dataPtr ->particleDepthTexture = nullptr ;
662
+ }
663
+
665
664
if (this ->scene )
666
665
{
667
666
Ogre::SceneManager *ogreSceneManager = this ->scene ->OgreSceneManager ();
0 commit comments