00001 // Filename: eggJointPointer.h 00002 // Created by: drose (26Feb01) 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 EGGJOINTPOINTER_H 00020 #define EGGJOINTPOINTER_H 00021 00022 #include "pandatoolbase.h" 00023 00024 #include "eggBackPointer.h" 00025 00026 #include "luse.h" 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : EggJointPointer 00030 // Description : This is a base class for EggJointNodePointer and 00031 // EggMatrixTablePointer. It stores a back pointer to 00032 // either a <Joint> entry or an xform <Table> data, and 00033 // thus presents an interface that returns 1-n matrices, 00034 // one for each frame. (<Joint> entries, for model 00035 // files, appear the same as one-frame animations.) 00036 //////////////////////////////////////////////////////////////////// 00037 class EggJointPointer : public EggBackPointer { 00038 public: 00039 virtual int get_num_frames() const=0; 00040 virtual LMatrix4d get_frame(int n) const=0; 00041 virtual void set_frame(int n, const LMatrix4d &mat)=0; 00042 virtual bool add_frame(const LMatrix4d &mat); 00043 00044 void begin_rebuild(); 00045 virtual bool add_rebuild_frame(const LMatrix4d &mat); 00046 virtual bool do_rebuild(); 00047 00048 virtual void optimize(); 00049 00050 protected: 00051 typedef pvector<LMatrix4d> RebuildFrames; 00052 RebuildFrames _rebuild_frames; 00053 00054 public: 00055 static TypeHandle get_class_type() { 00056 return _type_handle; 00057 } 00058 static void init_type() { 00059 EggBackPointer::init_type(); 00060 register_type(_type_handle, "EggJointPointer", 00061 EggBackPointer::get_class_type()); 00062 } 00063 virtual TypeHandle get_type() const { 00064 return get_class_type(); 00065 } 00066 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00067 00068 private: 00069 static TypeHandle _type_handle; 00070 }; 00071 00072 #endif 00073 00074