Panda3D

stereoDisplayRegion.h

00001 // Filename: stereoDisplayRegion.h
00002 // Created by:  drose (19Feb09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef STEREODISPLAYREGION_H
00016 #define STEREODISPLAYREGION_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "displayRegion.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : StereoDisplayRegion
00024 // Description : This is a special DisplayRegion wrapper that actually
00025 //               includes a pair of DisplayRegions internally: the
00026 //               left and right eyes.  The DisplayRegion represented
00027 //               here does not have a physical association with the
00028 //               window, but it pretends it does.  Instead, it
00029 //               maintains a pointer to the left and right
00030 //               DisplayRegions separately.
00031 //
00032 //               Operations on the StereoDisplayRegion object affect
00033 //               both left and right eyes together.  To access the
00034 //               left or right eyes independently, use get_left_eye()
00035 //               and get_right_eye().
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDA_DISPLAY StereoDisplayRegion : public DisplayRegion {
00038 protected:
00039   StereoDisplayRegion(GraphicsOutput *window,
00040                       float l, float r, float b, float t,
00041                       DisplayRegion *left, DisplayRegion *right);
00042 
00043 public:
00044   virtual ~StereoDisplayRegion();
00045 
00046 PUBLISHED:
00047   // Inherited from DrawableRegion
00048   virtual void set_clear_active(int n, bool clear_aux_active);
00049   virtual void set_clear_value(int n, const Colorf &clear_value);
00050   virtual void disable_clears();
00051   virtual void set_pixel_zoom(float pixel_zoom);
00052 
00053   // Inherited from DisplayRegion
00054   virtual void set_dimensions(float l, float r, float b, float t);
00055   virtual bool is_stereo() const;
00056   virtual void set_camera(const NodePath &camera);
00057   virtual void set_active(bool active);
00058   virtual void set_sort(int sort);
00059   virtual void set_stereo_channel(Lens::StereoChannel stereo_channel);
00060   virtual void set_incomplete_render(bool incomplete_render);
00061   virtual void set_texture_reload_priority(int texture_reload_priority);
00062   virtual void set_cull_traverser(CullTraverser *trav);
00063   virtual void set_cube_map_index(int cube_map_index);
00064 
00065   virtual void output(ostream &out) const;
00066   virtual PT(PandaNode) make_cull_result_graph();
00067 
00068   INLINE DisplayRegion *get_left_eye();
00069   INLINE DisplayRegion *get_right_eye();
00070 
00071 private:
00072   PT(DisplayRegion) _left_eye;
00073   PT(DisplayRegion) _right_eye;
00074 
00075 public:
00076   static TypeHandle get_class_type() {
00077     return _type_handle;
00078   }
00079   static void init_type() {
00080     DisplayRegion::init_type();
00081     register_type(_type_handle, "StereoDisplayRegion",
00082                   DisplayRegion::get_class_type());
00083   }
00084   virtual TypeHandle get_type() const {
00085     return get_class_type();
00086   }
00087   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00088 
00089 private:
00090   static TypeHandle _type_handle;
00091 
00092   friend class GraphicsOutput;
00093   friend class DisplayRegionPipelineReader;
00094 };
00095 
00096 #include "stereoDisplayRegion.I"
00097 
00098 #endif
 All Classes Functions Variables Enumerations