Browse Source

When texture size is assigned for Texture2D / Texture2DArray / TextureCube, set depth to 1 to allow generic width * height * depth calculations. Closes #1894.

Lasse Öörni 8 years ago
parent
commit
76ae937ceb

+ 1 - 0
Source/Urho3D/Graphics/Texture2D.cpp

@@ -153,6 +153,7 @@ bool Texture2D::SetSize(int width, int height, unsigned format, TextureUsage usa
     width_ = width;
     height_ = height;
     format_ = format;
+    depth_ = 1;
     multiSample_ = multiSample;
     autoResolve_ = autoResolve;
 

+ 1 - 0
Source/Urho3D/Graphics/Texture2DArray.cpp

@@ -187,6 +187,7 @@ bool Texture2DArray::SetSize(unsigned layers, int width, int height, unsigned fo
     width_ = width;
     height_ = height;
     format_ = format;
+    depth_ = 1;
     if (layers)
         layers_ = layers;
 

+ 1 - 0
Source/Urho3D/Graphics/TextureCube.cpp

@@ -308,6 +308,7 @@ bool TextureCube::SetSize(int size, unsigned format, TextureUsage usage, int mul
 
     width_ = size;
     height_ = size;
+    depth_ = 1;
     format_ = format;
     multiSample_ = multiSample;
     autoResolve_ = multiSample > 1;