00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LIGHTLENSNODE_H
00016 #define LIGHTLENSNODE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "light.h"
00021 #include "camera.h"
00022 #include "graphicsStateGuardianBase.h"
00023 #include "graphicsOutputBase.h"
00024
00025 class ShaderGenerator;
00026 class GraphicsStateGuardian;
00027
00028
00029
00030
00031
00032
00033
00034
00035 class EXPCL_PANDA_PGRAPHNODES LightLensNode : public Light, public Camera {
00036 PUBLISHED:
00037 LightLensNode(const string &name, Lens *lens = new PerspectiveLens());
00038 virtual ~LightLensNode();
00039
00040 INLINE bool is_shadow_caster();
00041 INLINE void set_shadow_caster(bool caster);
00042 INLINE void set_shadow_caster(bool caster, int buffer_xsize, int buffer_ysize, int sort = -10);
00043
00044 protected:
00045 LightLensNode(const LightLensNode ©);
00046 void clear_shadow_buffers();
00047
00048 bool _shadow_caster;
00049 int _sb_xsize, _sb_ysize, _sb_sort;
00050
00051
00052 typedef pmap<PT(GraphicsStateGuardianBase), PT(GraphicsOutputBase) > ShadowBuffers;
00053 ShadowBuffers _sbuffers;
00054
00055 public:
00056 virtual PandaNode *as_node();
00057 virtual Light *as_light();
00058
00059 PUBLISHED:
00060
00061
00062 virtual void output(ostream &out) const;
00063 virtual void write(ostream &out, int indent_level = 0) const;
00064
00065 public:
00066 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00067
00068 protected:
00069 void fillin(DatagramIterator &scan, BamReader *manager);
00070
00071 public:
00072 static TypeHandle get_class_type() {
00073 return _type_handle;
00074 }
00075 static void init_type() {
00076 Light::init_type();
00077 Camera::init_type();
00078 register_type(_type_handle, "LightLensNode",
00079 Light::get_class_type(),
00080 Camera::get_class_type());
00081 }
00082 virtual TypeHandle get_type() const {
00083 return get_class_type();
00084 }
00085 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00086
00087 private:
00088 static TypeHandle _type_handle;
00089
00090 friend class GraphicsStateGuardian;
00091 friend class ShaderGenerator;
00092 };
00093
00094 INLINE ostream &operator << (ostream &out, const LightLensNode &light) {
00095 light.output(out);
00096 return out;
00097 }
00098
00099 #include "lightLensNode.I"
00100
00101 #endif