00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #if 0 // temporarily disabled until we can port to new scene graph.
00020
00021 #ifndef LENSFLARENODE_H
00022 #define LENSFLARENODE_H
00023
00024 #include <pandabase.h>
00025
00026 #include <namedNode.h>
00027 #include <texture.h>
00028 #include <luse.h>
00029 #include <pta_Colorf.h>
00030 #include <pta_float.h>
00031 #include <renderRelation.h>
00032 #include "pmap.h"
00033
00034 class GraphicsStateGuardian;
00035 class ClockObject;
00036
00037 class EXPCL_PANDAFX LensFlareNode : public Node
00038 {
00039 PUBLISHED:
00040 INLINE LensFlareNode(void);
00041
00042 void add_flare(PT(Texture) flare, PTA_float scales, PTA_float offsets,
00043 PTA_float angle_scales, PTA_Colorf colors);
00044 void add_blind(PT(Texture) blind);
00045
00046 INLINE void set_texel_scale(float texel_to_world);
00047 INLINE void set_global_scale(float scale);
00048
00049 INLINE void set_blind_falloff(float fall_off);
00050 INLINE void set_flare_falloff(float fall_off);
00051
00052 INLINE void set_light_source(PT_Node source);
00053
00054 public:
00055 virtual bool sub_render(const AllTransitionsWrapper &input_trans,
00056 AllTransitionsWrapper &modify_trans,
00057 RenderTraverser *trav);
00058 virtual bool has_sub_render() const;
00059
00060 private:
00061 typedef pvector<PTA_float> vector_Vfloat;
00062 typedef pvector<PTA_Colorf> vector_Vcolorf;
00063 typedef pvector< PT(RenderRelation) > vector_relation;
00064 typedef pvector< PT(Texture) > vector_texture;
00065
00066 vector_texture _flares;
00067 PT(Texture) _blind;
00068
00069 vector_relation _flare_arcs;
00070 PT(RenderRelation) _blind_arc;
00071
00072 vector_Vfloat _flare_scales;
00073 vector_Vfloat _flare_angle_scales;
00074 vector_Vfloat _flare_offsets;
00075 vector_Vcolorf _flare_colors;
00076
00077 float _global_scale;
00078 float _texel_scale;
00079
00080 float _blind_fall_off;
00081 float _flare_fall_off;
00082
00083 PT_Node _light_node;
00084
00085
00086
00087
00088 void prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle);
00089 void prepare_blind(const float &angle, const float &tnear);
00090
00091
00092
00093
00094
00095 void set_geometry(GeomSprite *sprite, const PTA_float &geom_scales,
00096 const PTA_float &geom_offsets, const PTA_float &geom_angle_scales,
00097 const PTA_Colorf &geom_colors, const LVector3f &delta,
00098 const LPoint3f &light, const float &angle);
00099
00100
00101 void render_child(RenderRelation *arc,
00102 const AllTransitionsWrapper &trans,
00103 GraphicsStateGuardian *gsg);
00104 void render_children(const vector_relation &arcs,
00105 const AllTransitionsWrapper &trans,
00106 GraphicsStateGuardian *gsg);
00107
00108 public:
00109 static void register_with_read_factory();
00110 virtual void write_datagram(BamWriter *manager, Datagram &me);
00111 virtual int complete_pointers(TypedWritable **plist,
00112 BamReader *manager);
00113
00114 static TypedWritable *make_LensFlareNode(const FactoryParams ¶ms);
00115
00116 protected:
00117 void fillin(DatagramIterator &scan, BamReader *manager);
00118
00119 private:
00120 int _num_flares, _num_arcs;
00121
00122 public:
00123 static TypeHandle get_class_type( void ) {
00124 return _type_handle;
00125 }
00126 static void init_type( void ) {
00127 NamedNode::init_type();
00128 register_type( _type_handle, "LensFlareNode",
00129 NamedNode::get_class_type() );
00130 }
00131 virtual TypeHandle get_type( void ) const {
00132 return get_class_type();
00133 }
00134 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00135
00136 private:
00137 static TypeHandle _type_handle;
00138 };
00139
00140 #include "lensFlareNode.I"
00141
00142 #endif
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 #endif // temporarily disabled until we can port to new scene graph.