00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PROJECTIONSCREEN_H
00020 #define PROJECTIONSCREEN_H
00021
00022 #include "pandabase.h"
00023
00024 #include "pandaNode.h"
00025 #include "lensNode.h"
00026 #include "geomNode.h"
00027 #include "nodePath.h"
00028
00029 class Geom;
00030 class WorkingNodePath;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 class EXPCL_PANDAFX ProjectionScreen : public PandaNode {
00051 PUBLISHED:
00052 ProjectionScreen(const string &name = "");
00053 virtual ~ProjectionScreen();
00054
00055 protected:
00056 ProjectionScreen(const ProjectionScreen ©);
00057
00058 public:
00059 virtual PandaNode *make_copy() const;
00060 virtual bool has_cull_callback() const;
00061 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00062
00063 PUBLISHED:
00064 void set_projector(const NodePath &projector);
00065 INLINE const NodePath &get_projector() const;
00066
00067 PT(GeomNode) generate_screen(const NodePath &projector,
00068 const string &screen_name,
00069 int num_x_verts, int num_y_verts,
00070 float distance);
00071 void regenerate_screen(const NodePath &projector, const string &screen_name,
00072 int num_x_verts, int num_y_verts, float distance);
00073 PT(PandaNode) make_flat_mesh(const NodePath &camera);
00074
00075 INLINE void set_invert_uvs(bool invert_uvs);
00076 INLINE bool get_invert_uvs() const;
00077
00078 INLINE void set_vignette_on(bool vignette_on);
00079 INLINE bool get_vignette_on() const;
00080
00081 INLINE void set_vignette_color(const Colorf &vignette_color);
00082 INLINE const Colorf &get_vignette_color() const;
00083 INLINE void set_frame_color(const Colorf &frame_color);
00084 INLINE const Colorf &get_frame_color() const;
00085
00086 void recompute();
00087
00088 public:
00089 INLINE const UpdateSeq &get_last_screen() const;
00090 void recompute_if_stale();
00091
00092 private:
00093 void do_recompute(const NodePath &this_np);
00094 void recompute_node(const WorkingNodePath &np, LMatrix4f &rel_mat, bool &computed_rel_mat);
00095 void recompute_child(const WorkingNodePath &np, LMatrix4f &rel_mat, bool &computed_rel_mat);
00096 void recompute_geom_node(const WorkingNodePath &np, LMatrix4f &rel_mat, bool &computed_rel_mat);
00097 void recompute_geom(Geom *geom, const LMatrix4f &rel_mat);
00098
00099 PandaNode *
00100 make_mesh_node(PandaNode *result_parent, const WorkingNodePath &np,
00101 const NodePath &camera,
00102 LMatrix4f &rel_mat, bool &computed_rel_mat);
00103 void make_mesh_children(PandaNode *new_node, const WorkingNodePath &np,
00104 const NodePath &camera,
00105 LMatrix4f &rel_mat, bool &computed_rel_mat);
00106 PT(GeomNode) make_mesh_geom_node(const WorkingNodePath &np,
00107 const NodePath &camera,
00108 LMatrix4f &rel_mat,
00109 bool &computed_rel_mat);
00110 PT(Geom) make_mesh_geom(Geom *geom, Lens *lens, LMatrix4f &rel_mat);
00111
00112
00113 NodePath _projector;
00114 PT(LensNode) _projector_node;
00115 bool _invert_uvs;
00116 bool _vignette_on;
00117 Colorf _vignette_color;
00118 Colorf _frame_color;
00119
00120 PTA_Colorf _colors;
00121 LMatrix4f _rel_top_mat;
00122 bool _computed_rel_top_mat;
00123 bool _stale;
00124 UpdateSeq _projector_lens_change;
00125 UpdateSeq _last_screen;
00126
00127 public:
00128 static TypeHandle get_class_type() {
00129 return _type_handle;
00130 }
00131 static void init_type() {
00132 PandaNode::init_type();
00133 register_type(_type_handle, "ProjectionScreen",
00134 PandaNode::get_class_type());
00135 }
00136 virtual TypeHandle get_type() const {
00137 return get_class_type();
00138 }
00139 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00140
00141 private:
00142 static TypeHandle _type_handle;
00143 };
00144
00145 #include "projectionScreen.I"
00146
00147 #endif