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

panda/src/chan/animChannelMatrixXfmTable.h

Go to the documentation of this file.
00001 // Filename: animChannelMatrixXfmTable.h
00002 // Created by:  drose (20Feb99)
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 ANIMCHANNELMATRIXXFMTABLE_H
00020 #define ANIMCHANNELMATRIXXFMTABLE_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "animChannel.h"
00025 
00026 #include <pointerToArray.h>
00027 #include <pta_float.h>
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : AnimChannelMatrixXfmTable
00031 // Description : An animation channel that issues a matrix each frame,
00032 //               read from a table such as might have been read from
00033 //               an egg file.  The table actually consists of nine
00034 //               sub-tables, each representing one component of the
00035 //               transform: scale, rotate, translate.
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDA AnimChannelMatrixXfmTable : public AnimChannelMatrix {
00038 public:
00039   AnimChannelMatrixXfmTable(AnimGroup *parent, const string &name);
00040 
00041   virtual bool has_changed(int last_frame, int this_frame);
00042   virtual void get_value(int frame, LMatrix4f &mat);
00043   virtual void get_value_no_scale(int frame, LMatrix4f &value);
00044   virtual void get_scale(int frame, float scale[3]);
00045 
00046   static INLINE bool is_valid_id(char table_id);
00047 
00048   void clear_all_tables();
00049   void set_table(char table_id, const CPTA_float &table);
00050   INLINE bool has_table(char table_id) const;
00051   INLINE CPTA_float get_table(char table_id) const;
00052   INLINE void clear_table(char table_id);
00053 
00054   virtual void write(ostream &out, int indent_level) const;
00055 
00056 protected:
00057   AnimChannelMatrixXfmTable(void);
00058   INLINE static char get_table_id(int table_index);
00059   static int get_table_index(char table_id);
00060   INLINE static float get_default_value(int table_index);
00061 
00062   enum { num_tables = 9 };
00063 
00064   CPTA_float _tables[num_tables];
00065 
00066 private:
00067   static const char _table_ids[num_tables];
00068   static const float _default_values[num_tables];
00069 
00070 public:
00071   static void register_with_read_factory(void);
00072   virtual void write_datagram(BamWriter* manager, Datagram &me);
00073 
00074   static TypedWritable *make_AnimChannelMatrixXfmTable(const FactoryParams &params);
00075 
00076 protected:
00077   void fillin(DatagramIterator& scan, BamReader* manager);
00078 
00079 public:
00080   virtual TypeHandle get_type() const {
00081     return get_class_type();
00082   }
00083   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00084   static TypeHandle get_class_type() {
00085     return _type_handle;
00086   }
00087   static void init_type() {
00088     AnimChannelMatrix::init_type();
00089     register_type(_type_handle, "AnimChannelMatrixXfmTable",
00090                   AnimChannelMatrix::get_class_type());
00091   }
00092 
00093 private:
00094   static TypeHandle _type_handle;
00095 };
00096 
00097 #include "animChannelMatrixXfmTable.I"
00098 
00099 #endif

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