Browse Source

Fix mipmap level count calculation for texture arrays

rdb 9 years ago
parent
commit
844a284925
1 changed files with 4 additions and 1 deletions
  1. 4 1
      panda/src/gobj/texture.cxx

+ 4 - 1
panda/src/gobj/texture.cxx

@@ -5672,7 +5672,10 @@ do_set_simple_ram_image(CData *cdata, CPTA_uchar image, int x_size, int y_size)
 ////////////////////////////////////////////////////////////////////
 int Texture::
 do_get_expected_num_mipmap_levels(const CData *cdata) const {
-  int size = max(cdata->_x_size, max(cdata->_y_size, cdata->_z_size));
+  int size = max(cdata->_x_size, cdata->_y_size);
+  if (cdata->_texture_type == Texture::TT_3d_texture) {
+    size = max(size, cdata->_z_size);
+  }
   int count = 1;
   while (size > 1) {
     size >>= 1;