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

panda/src/char/computedVertices.h

Go to the documentation of this file.
00001 // Filename: computedVertices.h
00002 // Created by:  drose (01Mar99)
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 COMPUTEDVERTICES_H
00020 #define COMPUTEDVERTICES_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "dynamicVertices.h"
00025 #include "computedVerticesMorph.h"
00026 
00027 #include "vector_ushort.h"
00028 #include "typedWritableReferenceCount.h"
00029 
00030 class Character;
00031 class CharacterJoint;
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : ComputedVertices
00035 // Description : These are the vertices that must be animated as part
00036 //               of the normal character animation.  This includes
00037 //               vertices animated into one or more joints, as well as
00038 //               morph vertices.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDA ComputedVertices : public TypedWritableReferenceCount {
00041 public:
00042   INLINE ComputedVertices();
00043 
00044   void update(Character *character);
00045   void make_orig(Character *character);
00046 
00047   void write(ostream &out, Character *character) const;
00048 
00049 private:
00050   typedef vector_ushort Vertices;
00051 
00052   class EXPCL_PANDA VertexTransform {
00053   public:
00054     INLINE VertexTransform();
00055     VertexTransform(const VertexTransform &copy);
00056 
00057     short _joint_index;
00058     float _effect;
00059     Vertices _vindex;
00060     Vertices _nindex;
00061     INLINE bool operator < (const VertexTransform &other) const;
00062   public:
00063     void write_datagram(Datagram &dest);
00064     void read_datagram(DatagramIterator &source);
00065   };
00066 
00067   typedef pvector<VertexTransform> VertexTransforms;
00068 
00069   VertexTransforms _transforms;
00070 
00071   typedef pvector<ComputedVerticesMorphVertex> VertexMorphs;
00072   typedef pvector<ComputedVerticesMorphNormal> NormalMorphs;
00073   typedef pvector<ComputedVerticesMorphTexCoord> TexCoordMorphs;
00074   typedef pvector<ComputedVerticesMorphColor> ColorMorphs;
00075   VertexMorphs _vertex_morphs;
00076   NormalMorphs _normal_morphs;
00077   TexCoordMorphs _texcoord_morphs;
00078   ColorMorphs _color_morphs;
00079 
00080   PTA_Vertexf _orig_coords;
00081   PTA_Normalf _orig_norms;
00082   PTA_Colorf _orig_colors;
00083   PTA_TexCoordf _orig_texcoords;
00084 
00085 public:
00086   static void register_with_read_factory(void);
00087   virtual void write_datagram(BamWriter* manager, Datagram &me);
00088 
00089   static TypedWritable *make_ComputedVertices(const FactoryParams &params);
00090 
00091 protected:
00092   void fillin(DatagramIterator& scan, BamReader* manager);
00093 
00094 public:
00095   virtual TypeHandle get_type() const {
00096     return get_class_type();
00097   }
00098   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00099   static TypeHandle get_class_type() {
00100     return _type_handle;
00101   }
00102   static void init_type() {
00103     TypedWritableReferenceCount::init_type();
00104     register_type(_type_handle, "ComputedVertices",
00105                   TypedWritableReferenceCount::get_class_type());
00106   }
00107 
00108 private:
00109   static TypeHandle _type_handle;
00110   friend class ComputedVerticesMaker;
00111 };
00112 
00113 #include "computedVertices.I"
00114 
00115 #endif

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