Browse Source

minor adjustments

David Rose 20 years ago
parent
commit
b9f5dfd75d
2 changed files with 30 additions and 29 deletions
  1. 25 25
      panda/src/gobj/texture.cxx
  2. 5 4
      panda/src/gobj/texture.h

+ 25 - 25
panda/src/gobj/texture.cxx

@@ -73,7 +73,7 @@ Texture(const string &name) :
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::Destructor
 //     Function: Texture::Destructor
-//       Access: Published
+//       Access: Published, Virtual
 //  Description:
 //  Description:
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 Texture::
 Texture::
@@ -1271,31 +1271,9 @@ string_filter_type(const string &string) {
   }
   }
 }
 }
 
 
-////////////////////////////////////////////////////////////////////
-//     Function: Texture::clear_prepared
-//       Access: Private
-//  Description: Removes the indicated PreparedGraphicsObjects table
-//               from the Texture's table, without actually releasing
-//               the texture.  This is intended to be called only from
-//               PreparedGraphicsObjects::release_texture(); it should
-//               never be called by user code.
-////////////////////////////////////////////////////////////////////
-void Texture::
-clear_prepared(PreparedGraphicsObjects *prepared_objects) {
-  Contexts::iterator ci;
-  ci = _contexts.find(prepared_objects);
-  if (ci != _contexts.end()) {
-    _contexts.erase(ci);
-  } else {
-    // If this assertion fails, clear_prepared() was given a
-    // prepared_objects which the texture didn't know about.
-    nassertv(false);
-  }
-}
-
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::up_to_power_2
 //     Function: Texture::up_to_power_2
-//       Access: Private, Static
+//       Access: Protected, Static
 //  Description: Returns the smallest power of 2 greater than or equal
 //  Description: Returns the smallest power of 2 greater than or equal
 //               to value.
 //               to value.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -1310,7 +1288,7 @@ up_to_power_2(int value) {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::down_to_power_2
 //     Function: Texture::down_to_power_2
-//       Access: Private, Static
+//       Access: Protected, Static
 //  Description: Returns the largest power of 2 less than or equal
 //  Description: Returns the largest power of 2 less than or equal
 //               to value.
 //               to value.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -1323,6 +1301,28 @@ down_to_power_2(int value) {
   return x;
   return x;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::clear_prepared
+//       Access: Private
+//  Description: Removes the indicated PreparedGraphicsObjects table
+//               from the Texture's table, without actually releasing
+//               the texture.  This is intended to be called only from
+//               PreparedGraphicsObjects::release_texture(); it should
+//               never be called by user code.
+////////////////////////////////////////////////////////////////////
+void Texture::
+clear_prepared(PreparedGraphicsObjects *prepared_objects) {
+  Contexts::iterator ci;
+  ci = _contexts.find(prepared_objects);
+  if (ci != _contexts.end()) {
+    _contexts.erase(ci);
+  } else {
+    // If this assertion fails, clear_prepared() was given a
+    // prepared_objects which the texture didn't know about.
+    nassertv(false);
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::consider_rescale
 //     Function: Texture::consider_rescale
 //       Access: Private
 //       Access: Private

+ 5 - 4
panda/src/gobj/texture.h

@@ -133,7 +133,7 @@ PUBLISHED:
 
 
 PUBLISHED:
 PUBLISHED:
   Texture(const string &name = string());
   Texture(const string &name = string());
-  ~Texture();
+  virtual ~Texture();
 
 
   void setup_texture(TextureType texture_type,
   void setup_texture(TextureType texture_type,
                      int x_size, int y_size, int z_size,
                      int x_size, int y_size, int z_size,
@@ -266,11 +266,12 @@ public:
   static WrapMode string_wrap_mode(const string &string);
   static WrapMode string_wrap_mode(const string &string);
   static FilterType string_filter_type(const string &string);
   static FilterType string_filter_type(const string &string);
 
 
-private:
-  void clear_prepared(PreparedGraphicsObjects *prepared_objects);
-
+protected:
   static int up_to_power_2(int value);
   static int up_to_power_2(int value);
   static int down_to_power_2(int value);
   static int down_to_power_2(int value);
+
+private:
+  void clear_prepared(PreparedGraphicsObjects *prepared_objects);
   
   
   void consider_rescale(PNMImage &pnmimage);
   void consider_rescale(PNMImage &pnmimage);
   void consider_downgrade(PNMImage &pnmimage, int num_channels);
   void consider_downgrade(PNMImage &pnmimage, int num_channels);