Browse Source

*** empty log message ***

rdb 17 years ago
parent
commit
bb008e40e4

+ 1 - 0
panda/src/display/drawableRegion.cxx

@@ -54,6 +54,7 @@ get_renderbuffer_type(int rtp) {
   switch(rtp) {
   case RTP_stencil:        return RenderBuffer::T_stencil;
   case RTP_depth:          return RenderBuffer::T_depth;
+  case RTP_depth_stencil:  return RenderBuffer::T_depth;
   case RTP_color:          return RenderBuffer::T_color;
   case RTP_aux_rgba_0:     return RenderBuffer::T_aux_rgba_0;
   case RTP_aux_rgba_1:     return RenderBuffer::T_aux_rgba_1;

+ 1 - 1
panda/src/display/drawableRegion.h

@@ -46,7 +46,6 @@ PUBLISHED:
   enum RenderTexturePlane {
     RTP_stencil=0,
     RTP_depth_stencil=1,
-    RTP_depth=1,
     RTP_color,
     RTP_aux_rgba_0,
     RTP_aux_rgba_1,
@@ -60,6 +59,7 @@ PUBLISHED:
     RTP_aux_float_1,
     RTP_aux_float_2,
     RTP_aux_float_3,
+    RTP_depth,
     RTP_COUNT
   };
 

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

@@ -237,6 +237,7 @@ clear_render_textures() {
 //               You can specify a bitplane to attach the texture to.
 //               the legal choices are:
 //
+//               * RTP_depth
 //               * RTP_depth_stencil
 //               * RTP_color
 //               * RTP_aux_rgba_0
@@ -248,6 +249,7 @@ clear_render_textures() {
 //               texture to, this routine will use a default based
 //               on the texture's format:
 //
+//               * F_depth_component attaches to RTP_depth
 //               * F_depth_stencil attaches to RTP_depth_stencil
 //               * all other formats attach to RTP_color.
 //
@@ -291,6 +293,8 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
   if (plane == RTP_COUNT) {
     if (tex->get_format()==Texture::F_depth_stencil) {
       plane = RTP_depth_stencil;
+    } else if (tex->get_format()==Texture::F_depth_component) {
+      plane = RTP_depth;
     } else {
       plane = RTP_color;
     }
@@ -299,8 +303,11 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
   // Set the texture's format to match the bitplane.
   // (And validate the bitplane, while we're at it).
 
-  if (plane == RTP_depth_stencil) {
-    tex->set_format(Texture::F_depth_stencil);
+  if (plane == RTP_depth) {
+    tex->set_format(Texture::F_depth_component);
+    tex->set_match_framebuffer_format(true);
+  } else if (plane == RTP_depth_stencil) {
+    tex->set_format(Texture::F_depth_component);
     tex->set_match_framebuffer_format(true);
   } else if ((plane == RTP_color)||
              (plane == RTP_aux_rgba_0)||

+ 2 - 0
panda/src/display/graphicsStateGuardian.cxx

@@ -1027,6 +1027,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name, LMatrix4f
   case Shader::SMO_clip_x_to_view: {
     const NodePath &np = _target_shader->get_shader_input_nodepath(name);
     nassertr(!np.is_empty(), &LMatrix4f::ident_mat());
+    nassertr(np.node()->is_of_type(LensNode::get_class_type()), &LMatrix4f::ident_mat());
     Lens *lens = DCAST(LensNode, np.node())->get_lens();
     t = lens->get_projection_mat_inv(_current_stereo_channel) *
       LMatrix4f::convert_mat(lens->get_coordinate_system(), _coordinate_system) *
@@ -1037,6 +1038,7 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name, LMatrix4f
   case Shader::SMO_view_to_clip_x: {
     const NodePath &np = _target_shader->get_shader_input_nodepath(name);
     nassertr(!np.is_empty(), &LMatrix4f::ident_mat());
+    nassertr(np.node()->is_of_type(LensNode::get_class_type()), &LMatrix4f::ident_mat());
     Lens *lens = DCAST(LensNode, np.node())->get_lens();
     t = get_scene()->get_camera_transform()->get_mat() *
       invert(np.get_net_transform()->get_mat()) *