Procházet zdrojové kódy

need BF_size_square for cube maps

David Rose před 19 roky
rodič
revize
6c3ac71c05

+ 6 - 0
panda/src/display/graphicsEngine.cxx

@@ -308,6 +308,9 @@ make_output(GraphicsPipe *pipe,
   if ((x_size==0) || (y_size == 0)) {
     flags |= GraphicsPipe::BF_size_track_host;
   }
+  if (flags & GraphicsPipe::BF_size_square) {
+    x_size = y_size = min(x_size, y_size);
+  }
   if (host != 0) {
     host = host->get_host();
   }
@@ -420,6 +423,9 @@ make_output(GraphicsPipe *pipe,
     if (y_size > host->get_y_size()) {
       y_size = Texture::down_to_power_2(host->get_y_size());
     }
+    if (flags & GraphicsPipe::BF_size_square) {
+      x_size = y_size = min(x_size, y_size);
+    }
     ParasiteBuffer *buffer = new ParasiteBuffer(host, name, x_size, y_size, flags);
     buffer->_sort = sort;
     do_add_window(buffer, gsg, threading_model);

+ 1 - 0
panda/src/display/graphicsPipe.h

@@ -90,6 +90,7 @@ PUBLISHED:
     BF_size_track_host     = 0x0100, // Buffer should track the host size.
     BF_rtt_cumulative      = 0x0200, // Buffer supports cumulative render-to-texture.
     BF_fb_props_optional   = 0x0400, // FrameBufferProperties can be ignored.
+    BF_size_square         = 0x0800, // x_size must equal y_size (e.g. for cube maps)
   };
 
   INLINE bool is_valid() const;