00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PLANARREFLECTOR_H
00019 #define PLANARREFLECTOR_H
00020
00021
00022
00023
00024 #include <pandabase.h>
00025
00026 #include "casterShader.h"
00027 #include <pixelBuffer.h>
00028 #include <planeNode.h>
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class EXPCL_SHADER PlanarReflector : public CasterShader
00039 {
00040 public:
00041
00042 PlanarReflector(void);
00043 PlanarReflector(PlaneNode* plane_node);
00044 PlanarReflector(const Colorf& c);
00045 PlanarReflector(PlaneNode* plane_node, const Colorf& c);
00046
00047 virtual void pre_apply(Node *node, const AllAttributesWrapper &init_state,
00048 const AllTransitionsWrapper &net_trans,
00049 GraphicsStateGuardian *gsg);
00050 virtual void apply(Node *node, const AllAttributesWrapper &init_state,
00051 const AllTransitionsWrapper &net_trans,
00052 GraphicsStateGuardian *gsg);
00053
00054 INLINE void set_save_color_buffer(bool val) { _save_color_buffer = val; }
00055 INLINE void set_save_depth_buffer(bool val) { _save_depth_buffer = val; }
00056 INLINE void set_clip_to_plane(bool val) { _clip_to_plane = val; }
00057 INLINE void set_plane_node(PlaneNode* p) { _plane_node = p; }
00058 INLINE void set_color(const Colorf& c) { _color = c; }
00059
00060 protected:
00061
00062 void init(PlaneNode* plane_node, const Colorf& c);
00063
00064 protected:
00065
00066 bool _save_color_buffer;
00067 bool _save_depth_buffer;
00068 bool _clip_to_plane;
00069 PT(PixelBuffer) _color_buffer;
00070 PT(PixelBuffer) _depth_buffer;
00071 PT(PlaneNode) _plane_node;
00072 Colorf _color;
00073
00074 public:
00075
00076 static TypeHandle get_class_type() {
00077 return _type_handle;
00078 }
00079 static void init_type() {
00080 CasterShader::init_type();
00081 register_type(_type_handle, "PlanarReflector",
00082 CasterShader::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
00091 static TypeHandle _type_handle;
00092 };
00093
00094 #endif