소스 검색

Give the option to pass in FrameBufferProperties for make_texture_buffer and cubemap texture buffer.

aignacio_sf 17 년 전
부모
커밋
42daadfeb4
2개의 변경된 파일11개의 추가작업 그리고 6개의 파일을 삭제
  1. 9 4
      panda/src/display/graphicsOutput.cxx
  2. 2 2
      panda/src/display/graphicsOutput.h

+ 9 - 4
panda/src/display/graphicsOutput.cxx

@@ -732,11 +732,16 @@ get_texture_card() {
 ////////////////////////////////////////////////////////////////////
 GraphicsOutput *GraphicsOutput::
 make_texture_buffer(const string &name, int x_size, int y_size,
-                    Texture *tex, bool to_ram) {
+                    Texture *tex, bool to_ram, FrameBufferProperties *fbp) {
+
   FrameBufferProperties props;
   props.set_rgb_color(1);
   props.set_depth_bits(1);
 
+  if (fbp == NULL) {
+    fbp = &props;
+  }
+
   int flags = GraphicsPipe::BF_refuse_window;
   if (textures_power_2 != ATS_none) {
     flags |= GraphicsPipe::BF_size_power_2;
@@ -749,7 +754,7 @@ make_texture_buffer(const string &name, int x_size, int y_size,
   GraphicsOutput *buffer = get_gsg()->get_engine()->
     make_output(get_gsg()->get_pipe(),
                 name, get_child_sort(),
-                props, WindowProperties::size(x_size, y_size),
+                *fbp, WindowProperties::size(x_size, y_size),
                 flags, get_gsg(), get_host());
 
   if (buffer != (GraphicsOutput *)NULL) {
@@ -784,7 +789,7 @@ make_texture_buffer(const string &name, int x_size, int y_size,
 ////////////////////////////////////////////////////////////////////
 GraphicsOutput *GraphicsOutput::
 make_cube_map(const string &name, int size, NodePath &camera_rig,
-              DrawMask camera_mask, bool to_ram) {
+              DrawMask camera_mask, bool to_ram, FrameBufferProperties *fbp) {
   if (!to_ram) {
     // Check the limits imposed by the GSG.  (However, if we're
     // rendering the texture to RAM only, these limits may be
@@ -815,7 +820,7 @@ make_cube_map(const string &name, int size, NodePath &camera_rig,
   tex->set_wrap_v(Texture::WM_clamp);
   GraphicsOutput *buffer;
 
-  buffer = make_texture_buffer(name, size, size, tex, to_ram);
+  buffer = make_texture_buffer(name, size, size, tex, to_ram, fbp);
 
   // We don't need to clear the overall buffer; instead, we'll clear
   // each display region.

+ 2 - 2
panda/src/display/graphicsOutput.h

@@ -154,11 +154,11 @@ PUBLISHED:
 
   GraphicsOutput *make_texture_buffer(
       const string &name, int x_size, int y_size,
-      Texture *tex = NULL, bool to_ram = false);
+      Texture *tex = NULL, bool to_ram = false, FrameBufferProperties *fbp = NULL);
   GraphicsOutput *make_cube_map(const string &name, int size,
                                 NodePath &camera_rig,
                                 DrawMask camera_mask = PandaNode::get_all_camera_mask(),
-                                bool to_ram = false);
+                                bool to_ram = false, FrameBufferProperties *fbp = NULL);
 
   INLINE static Filename make_screenshot_filename(
       const string &prefix = "screenshot");