Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/char/characterJoint.h

Go to the documentation of this file.
00001 // Filename: characterJoint.h
00002 // Created by:  drose (23Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef CHARACTERJOINT_H
00020 #define CHARACTERJOINT_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "movingPartMatrix.h"
00025 #include "pandaNode.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : CharacterJoint
00029 // Description : This represents one joint of the character's
00030 //               animation, containing an animating transform matrix.
00031 ////////////////////////////////////////////////////////////////////
00032 class EXPCL_PANDA CharacterJoint : public MovingPartMatrix {
00033 protected:
00034   CharacterJoint();
00035   CharacterJoint(const CharacterJoint &copy);
00036 
00037 public:
00038   CharacterJoint(PartGroup *parent, const string &name,
00039                  const LMatrix4f &initial_value);
00040 
00041   virtual PartGroup *make_copy() const;
00042 
00043   virtual bool update_internals(PartGroup *parent, bool self_changed,
00044                                 bool parent_changed);
00045 
00046 PUBLISHED:
00047   bool add_net_transform(PandaNode *node);
00048   bool remove_net_transform(PandaNode *node);
00049   bool has_net_transform(PandaNode *node) const;
00050   void clear_net_transforms();
00051 
00052   bool add_local_transform(PandaNode *node);
00053   bool remove_local_transform(PandaNode *node);
00054   bool has_local_transform(PandaNode *node) const;
00055   void clear_local_transforms();
00056 
00057   void get_transform(LMatrix4f &transform) const;
00058 
00059 private:
00060   typedef pset< PT(PandaNode) > NodeList;
00061   NodeList _net_transform_nodes;
00062   NodeList _local_transform_nodes;
00063 
00064 public:
00065   static void register_with_read_factory(void);
00066   virtual void write_datagram(BamWriter* manager, Datagram &me);
00067   virtual int complete_pointers(TypedWritable **p_list,
00068                                 BamReader *manager);
00069 
00070   static TypedWritable *make_CharacterJoint(const FactoryParams &params);
00071 
00072 protected:
00073   void fillin(DatagramIterator& scan, BamReader* manager);
00074 
00075 private:
00076   int _num_net_nodes, _num_local_nodes;
00077 
00078 public:
00079   // The _geom_node member just holds a temporary pointer to a node
00080   // for the CharacterMaker's convenenience while creating the
00081   // character.  It does not store any meaningful value after
00082   // creation is complete.
00083   PT(PandaNode) _geom_node;
00084 
00085   // These are filled in as the joint animates.
00086   LMatrix4f _net_transform;
00087   LMatrix4f _initial_net_transform_inverse;
00088 
00089 public:
00090   virtual TypeHandle get_type() const {
00091     return get_class_type();
00092   }
00093   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00094   static TypeHandle get_class_type() {
00095     return _type_handle;
00096   }
00097   static void init_type() {
00098     MovingPartMatrix::init_type();
00099     register_type(_type_handle, "CharacterJoint",
00100                   MovingPartMatrix::get_class_type());
00101   }
00102 
00103 private:
00104   static TypeHandle _type_handle;
00105 
00106   friend class Character;
00107 };
00108 
00109 #endif
00110 
00111 

Generated on Fri May 2 00:35:22 2003 for Panda by doxygen1.3