Browse Source

set_orig_file_size

David Rose 17 years ago
parent
commit
844591b17c
2 changed files with 42 additions and 23 deletions
  1. 40 23
      panda/src/gobj/texture.cxx
  2. 2 0
      panda/src/gobj/texture.h

+ 40 - 23
panda/src/gobj/texture.cxx

@@ -2263,6 +2263,46 @@ write(ostream &out, int indent_level) const {
   }
 }
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::set_size_padded
+//       Access: Published
+//  Description: Changes the size of the texture, padding
+//               if necessary, and setting the pad region
+//               as well.
+////////////////////////////////////////////////////////////////////
+void Texture::
+set_size_padded(int x, int y, int z) {
+  ReMutexHolder holder(_lock);
+  if (get_textures_power_2() != ATS_none) {
+    set_x_size(up_to_power_2(x));
+    set_y_size(up_to_power_2(y));
+    set_z_size(up_to_power_2(z));
+  } else {
+    set_x_size(x);
+    set_y_size(y);
+    set_z_size(z);
+  }
+  set_pad_size(get_x_size() - x,
+               get_y_size() - y,
+               get_z_size() - z);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::set_orig_file_size
+//       Access: Published
+//  Description: Specifies the size of the texture as it exists in its
+//               original disk file, before any Panda scaling.
+////////////////////////////////////////////////////////////////////
+void Texture::
+set_orig_file_size(int x, int y, int z) {
+  ReMutexHolder holder(_lock);
+  _orig_file_x_size = x;
+  _orig_file_y_size = y;
+
+  nassertv(z == _z_size);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::set_format
 //       Access: Published
@@ -4290,29 +4330,6 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) {
   }
 }
 
-
-////////////////////////////////////////////////////////////////////
-//     Function: Texture::set_size_padded
-//  Description: Changes the size of the texture, padding
-//               if necessary, and setting the pad region
-//               as well.
-////////////////////////////////////////////////////////////////////
-void Texture::
-set_size_padded(int x, int y, int z) {
-  if (get_textures_power_2() != ATS_none) {
-    set_x_size(up_to_power_2(x));
-    set_y_size(up_to_power_2(y));
-    set_z_size(up_to_power_2(z));
-  } else {
-    set_x_size(x);
-    set_y_size(y);
-    set_z_size(z);
-  }
-  set_pad_size(get_x_size() - x,
-               get_y_size() - y,
-               get_z_size() - z);
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::consider_rescale
 //       Access: Private

+ 2 - 0
panda/src/gobj/texture.h

@@ -389,6 +389,8 @@ PUBLISHED:
   INLINE int get_orig_file_x_size() const;
   INLINE int get_orig_file_y_size() const;
   INLINE int get_orig_file_z_size() const;
+
+  void set_orig_file_size(int x, int y, int z = 1);
   
   void set_format(Format format);
   void set_component_type(ComponentType component_type);