Bladeren bron

Distinguish between cube/3D textures in renderpath commands by the texture unit.

Lasse Öörni 12 jaren geleden
bovenliggende
commit
c6b906a822
1 gewijzigde bestanden met toevoegingen van 8 en 2 verwijderingen
  1. 8 2
      Source/Engine/Graphics/View.cpp

+ 8 - 2
Source/Engine/Graphics/View.cpp

@@ -1530,9 +1530,15 @@ void View::SetTextures(RenderPathCommand& command)
         // Bind a texture from the resource system
         Texture* texture;
 
-        // Detect 3d textures by file extension: they are defined by an XML file
+        // Detect cube/3D textures by file extension: they are defined by an XML file
         if (GetExtension(command.textureNames_[i]) == ".xml")
-            texture = cache->GetResource<Texture3D>(command.textureNames_[i]);
+        {
+            // Assume 3D textures are only bound to the volume map unit, otherwise it's a cube texture
+            if (i == TU_VOLUMEMAP)
+                texture = cache->GetResource<Texture3D>(command.textureNames_[i]);
+            else
+                texture = cache->GetResource<TextureCube>(command.textureNames_[i]);
+        }
         else
             texture = cache->GetResource<Texture2D>(command.textureNames_[i]);