00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TEXPROJECTOREFFECT_H
00016 #define TEXPROJECTOREFFECT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "renderEffect.h"
00021 #include "luse.h"
00022 #include "nodePath.h"
00023
00024 class LensNode;
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 class EXPCL_PANDA_PGRAPH TexProjectorEffect : public RenderEffect {
00060 protected:
00061 INLINE TexProjectorEffect();
00062 INLINE TexProjectorEffect(const TexProjectorEffect ©);
00063
00064 public:
00065 virtual ~TexProjectorEffect();
00066
00067 PUBLISHED:
00068 static CPT(RenderEffect) make();
00069
00070 CPT(RenderEffect) add_stage(TextureStage *stage, const NodePath &from, const NodePath &to) const;
00071 CPT(RenderEffect) remove_stage(TextureStage *stage) const;
00072
00073 bool is_empty() const;
00074 bool has_stage(TextureStage *stage) const;
00075
00076 NodePath get_from(TextureStage *stage) const;
00077 NodePath get_to(TextureStage *stage) const;
00078
00079 public:
00080 virtual void output(ostream &out) const;
00081
00082 virtual bool has_cull_callback() const;
00083 virtual void cull_callback(CullTraverser *trav, CullTraverserData &data,
00084 CPT(TransformState) &node_transform,
00085 CPT(RenderState) &node_state) const;
00086
00087 protected:
00088 virtual int compare_to_impl(const RenderEffect *other) const;
00089
00090 private:
00091 class StageDef {
00092 public:
00093 INLINE StageDef();
00094 INLINE void set_from(const NodePath &from);
00095 void set_to(const NodePath &to);
00096
00097 INLINE int compare_to(const StageDef &other) const;
00098
00099 NodePath _from;
00100 NodePath _to;
00101 LensNode *_to_lens_node;
00102 };
00103
00104 typedef pmap<PT(TextureStage), StageDef> Stages;
00105 Stages _stages;
00106
00107 static CPT(RenderEffect) _empty_effect;
00108
00109 public:
00110 static void register_with_read_factory();
00111 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00112 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
00113
00114 protected:
00115 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00116 void fillin(DatagramIterator &scan, BamReader *manager);
00117
00118 public:
00119 static TypeHandle get_class_type() {
00120 return _type_handle;
00121 }
00122 static void init_type() {
00123 RenderEffect::init_type();
00124 register_type(_type_handle, "TexProjectorEffect",
00125 RenderEffect::get_class_type());
00126 }
00127 virtual TypeHandle get_type() const {
00128 return get_class_type();
00129 }
00130 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00131
00132 private:
00133 static TypeHandle _type_handle;
00134 };
00135
00136 #include "texProjectorEffect.I"
00137
00138 #endif
00139