فهرست منبع

fix prepare_scene

David Rose 17 سال پیش
والد
کامیت
4d09989995
2فایلهای تغییر یافته به همراه31 افزوده شده و 2 حذف شده
  1. 30 2
      panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx
  2. 1 0
      panda/src/tinydisplay/tinyGraphicsStateGuardian.h

+ 30 - 2
panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx

@@ -1559,7 +1559,7 @@ prepare_texture(Texture *tex) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: TinyGraphicsStateGuardian::update_texture
-//       Access: Public
+//       Access: Public, Virtual
 //  Description: Ensures that the current Texture data is refreshed
 //               onto the GSG.  This means updating the texture
 //               properties and/or re-uploading the texture image, if
@@ -1574,7 +1574,7 @@ prepare_texture(Texture *tex) {
 //               true).
 ////////////////////////////////////////////////////////////////////
 bool TinyGraphicsStateGuardian::
-update_texture(TextureContext *tc, bool force, int stage_index) {
+update_texture(TextureContext *tc, bool force) {
   apply_texture(tc);
 
   TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
@@ -1592,6 +1592,34 @@ update_texture(TextureContext *tc, bool force, int stage_index) {
   }
   gtc->enqueue_lru(&_prepared_objects->_graphics_memory_lru);
 
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: TinyGraphicsStateGuardian::update_texture
+//       Access: Public
+//  Description: Ensures that the current Texture data is refreshed
+//               onto the GSG.  This means updating the texture
+//               properties and/or re-uploading the texture image, if
+//               necessary.  This should only be called within the
+//               draw thread.
+//
+//               If force is true, this function will not return until
+//               the texture has been fully uploaded.  If force is
+//               false, the function may choose to upload a simple
+//               version of the texture instead, if the texture is not
+//               fully resident (and if get_incomplete_render() is
+//               true).
+////////////////////////////////////////////////////////////////////
+bool TinyGraphicsStateGuardian::
+update_texture(TextureContext *tc, bool force, int stage_index) {
+  if (!update_texture(tc, force)) {
+    return false;
+  }
+
+  TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
+  GLTexture *gltex = &gtc->_gltex;
+
   _c->current_textures[stage_index] = gltex;
   _c->zb->current_textures[stage_index] = gltex->levels;
 

+ 1 - 0
panda/src/tinydisplay/tinyGraphicsStateGuardian.h

@@ -82,6 +82,7 @@ public:
                                        const TransformState *transform);
 
   virtual TextureContext *prepare_texture(Texture *tex);
+  virtual bool update_texture(TextureContext *tc, bool force);
   bool update_texture(TextureContext *tc, bool force, int stage_index);
   virtual void release_texture(TextureContext *tc);