소스 검색

clarify complex if logic

David Rose 17 년 전
부모
커밋
9d1bba55aa
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      panda/src/gobj/texturePeeker.cxx

+ 7 - 1
panda/src/gobj/texturePeeker.cxx

@@ -44,7 +44,12 @@ TexturePeeker(Texture *tex) {
     // Regular 1-d, 2-d, or 3-d texture.  The coordinates map
     // Regular 1-d, 2-d, or 3-d texture.  The coordinates map
     // directly.  Simple ram images are possible if it is a 2-d
     // directly.  Simple ram images are possible if it is a 2-d
     // texture.
     // texture.
-    if (!(tex->do_has_ram_image() && tex->_ram_image_compression == Texture::CM_off) && !tex->_simple_ram_image._image.empty()) {
+    if (tex->do_has_ram_image() && tex->_ram_image_compression == Texture::CM_off) {
+      // Get the regular RAM image if it is available.
+      _image = tex->do_get_ram_image();
+
+    } else if (!tex->_simple_ram_image._image.empty()) {
+      // Get the simple RAM image if *that* is available.
       _image = tex->_simple_ram_image._image;
       _image = tex->_simple_ram_image._image;
       _x_size = tex->_simple_x_size;
       _x_size = tex->_simple_x_size;
       _y_size = tex->_simple_y_size;
       _y_size = tex->_simple_y_size;
@@ -56,6 +61,7 @@ TexturePeeker(Texture *tex) {
       _component_type = Texture::T_unsigned_byte;
       _component_type = Texture::T_unsigned_byte;
 
 
     } else {
     } else {
+      // Failing that, reload and get the uncompressed RAM image.
       _image = tex->do_get_uncompressed_ram_image();
       _image = tex->do_get_uncompressed_ram_image();
     }
     }
   }
   }