00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef RIGIDBODYCOMBINER_H
00016 #define RIGIDBODYCOMBINER_H
00017
00018 #include "pandabase.h"
00019
00020 #include "pandaNode.h"
00021 #include "nodeVertexTransform.h"
00022 #include "pvector.h"
00023
00024 class NodePath;
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 class EXPCL_PANDA_GRUTIL RigidBodyCombiner : public PandaNode {
00053 PUBLISHED:
00054 RigidBodyCombiner(const string &name);
00055 protected:
00056 RigidBodyCombiner(const RigidBodyCombiner ©);
00057 virtual PandaNode *make_copy() const;
00058
00059 PUBLISHED:
00060 void collect();
00061
00062 NodePath get_internal_scene();
00063
00064 public:
00065
00066 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00067
00068 private:
00069 void r_collect(PandaNode *node, const RenderState *state,
00070 const VertexTransform *transform);
00071 PT(GeomVertexData) convert_vd(const VertexTransform *transform,
00072 const GeomVertexData *orig);
00073
00074 PT(PandaNode) _internal_root;
00075
00076 typedef pvector< PT(NodeVertexTransform) > Transforms;
00077 Transforms _internal_transforms;
00078
00079 class VDUnifier {
00080 public:
00081 INLINE VDUnifier(const VertexTransform *transform,
00082 const GeomVertexData *orig);
00083 INLINE bool operator < (const VDUnifier &other) const;
00084
00085 const VertexTransform *_transform;
00086 const GeomVertexData *_orig;
00087 };
00088
00089 typedef pmap<VDUnifier, PT(GeomVertexData) > VDTable;
00090 VDTable _vd_table;
00091
00092
00093 public:
00094 static TypeHandle get_class_type() {
00095 return _type_handle;
00096 }
00097 static void init_type() {
00098 PandaNode::init_type();
00099 register_type(_type_handle, "RigidBodyCombiner",
00100 PandaNode::get_class_type());
00101 }
00102 virtual TypeHandle get_type() const {
00103 return get_class_type();
00104 }
00105 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00106
00107 private:
00108 static TypeHandle _type_handle;
00109 };
00110
00111 #include "rigidBodyCombiner.I"
00112
00113 #endif