00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef OCCLUDERNODE_H
00016 #define OCCLUDERNODE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "pandaNode.h"
00021 #include "nodePath.h"
00022 #include "pvector.h"
00023 #include "geom.h"
00024 #include "texture.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class EXPCL_PANDA_PGRAPH OccluderNode : public PandaNode {
00036 PUBLISHED:
00037 OccluderNode(const string &name);
00038
00039 protected:
00040 OccluderNode(const OccluderNode ©);
00041
00042 public:
00043 virtual ~OccluderNode();
00044 virtual PandaNode *make_copy() const;
00045 virtual bool preserve_name() const;
00046 virtual void xform(const LMatrix4 &mat);
00047
00048 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00049 virtual bool is_renderable() const;
00050
00051 virtual void output(ostream &out) const;
00052
00053 PUBLISHED:
00054 INLINE void set_double_sided(bool value);
00055 INLINE bool is_double_sided();
00056 INLINE void set_min_coverage(PN_stdfloat value);
00057 INLINE PN_stdfloat get_min_coverage();
00058 INLINE void set_vertices(const LPoint3 &v0, const LPoint3 &v1,
00059 const LPoint3 &v2, const LPoint3 &v3);
00060 INLINE int get_num_vertices() const;
00061 INLINE const LPoint3 &get_vertex(int n) const;
00062 MAKE_SEQ(get_vertices, get_num_vertices, get_vertex);
00063
00064 protected:
00065 virtual void compute_internal_bounds(CPT(BoundingVolume) &internal_bounds,
00066 int &internal_vertices,
00067 int pipeline_stage,
00068 Thread *current_thread) const;
00069 PT(Geom) get_occluder_viz(CullTraverser *trav, CullTraverserData &data);
00070 CPT(RenderState) get_occluder_viz_state(CullTraverser *trav, CullTraverserData &data);
00071 CPT(RenderState) get_frame_viz_state(CullTraverser *trav, CullTraverserData &data);
00072
00073 private:
00074 bool _double_sided;
00075 PN_stdfloat _min_coverage;
00076 typedef pvector<LPoint3> Vertices;
00077 Vertices _vertices;
00078
00079 PT(Geom) _occluder_viz, _frame_viz;
00080 static PT(Texture) _viz_tex;
00081
00082 public:
00083 static void register_with_read_factory();
00084 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00085 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
00086
00087 protected:
00088 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00089 void fillin(DatagramIterator &scan, BamReader *manager);
00090
00091 public:
00092 static TypeHandle get_class_type() {
00093 return _type_handle;
00094 }
00095 static void init_type() {
00096 PandaNode::init_type();
00097 register_type(_type_handle, "OccluderNode",
00098 PandaNode::get_class_type());
00099 }
00100 virtual TypeHandle get_type() const {
00101 return get_class_type();
00102 }
00103 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00104
00105 private:
00106 static TypeHandle _type_handle;
00107 };
00108
00109 #include "occluderNode.I"
00110
00111 #endif