Panda3D
|
00001 // Filename: eggXfmSAnim.h 00002 // Created by: drose (19Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef EGGXFMSANIM_H 00016 #define EGGXFMSANIM_H 00017 00018 00019 #include "pandabase.h" 00020 #include "eggGroupNode.h" 00021 #include "config_linmath.h" // for temp_hpr_fix 00022 00023 class EggXfmAnimData; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : EggXfmSAnim 00027 // Description : This corresponds to an <Xfm$Anim_S$> entry, which is 00028 // a collection of up to nine <S$Anim> entries that 00029 // specify the nine components of a transformation. 00030 // It's implemented as a group that can contain 00031 // any number of EggSAnimData children. 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_PANDAEGG EggXfmSAnim : public EggGroupNode { 00034 PUBLISHED: 00035 INLINE EggXfmSAnim(const string &name = "", 00036 CoordinateSystem cs = CS_default); 00037 EggXfmSAnim(const EggXfmAnimData &convert_from); 00038 00039 INLINE EggXfmSAnim(const EggXfmSAnim ©); 00040 INLINE EggXfmSAnim &operator = (const EggXfmSAnim ©); 00041 00042 INLINE void set_fps(double fps); 00043 INLINE void clear_fps(); 00044 INLINE bool has_fps() const; 00045 INLINE double get_fps() const; 00046 00047 INLINE void set_order(const string &order); 00048 INLINE void clear_order(); 00049 INLINE bool has_order() const; 00050 INLINE const string &get_order() const; 00051 INLINE static const string &get_standard_order(); 00052 00053 INLINE CoordinateSystem get_coordinate_system() const; 00054 00055 void optimize(); 00056 void optimize_to_standard_order(); 00057 void normalize(); 00058 00059 int get_num_rows() const; 00060 void get_value(int row, LMatrix4d &mat) const; 00061 bool set_value(int row, const LMatrix4d &mat); 00062 00063 INLINE void clear_data(); 00064 bool add_data(const LMatrix4d &mat); 00065 void add_component_data(const string &component_name, double value); 00066 void add_component_data(int component, double value); 00067 00068 virtual bool is_anim_matrix() const; 00069 virtual void write(ostream &out, int indent_level) const; 00070 00071 static void compose_with_order(LMatrix4d &mat, 00072 const LVecBase3d &scale, 00073 const LVecBase3d &shear, 00074 const LVecBase3d &hpr, 00075 const LVecBase3d &trans, 00076 const string &order, 00077 CoordinateSystem cs); 00078 00079 protected: 00080 virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, 00081 CoordinateSystem to_cs); 00082 virtual void r_mark_coordsys(CoordinateSystem cs); 00083 00084 private: 00085 void normalize_by_rebuilding(); 00086 void normalize_by_expanding(); 00087 00088 00089 private: 00090 double _fps; 00091 bool _has_fps; 00092 string _order; 00093 CoordinateSystem _coordsys; 00094 00095 static const string _standard_order_legacy; 00096 static const string _standard_order_hpr_fix; 00097 00098 public: 00099 00100 static TypeHandle get_class_type() { 00101 return _type_handle; 00102 } 00103 static void init_type() { 00104 EggGroupNode::init_type(); 00105 register_type(_type_handle, "EggXfmSAnim", 00106 EggGroupNode::get_class_type()); 00107 } 00108 virtual TypeHandle get_type() const { 00109 return get_class_type(); 00110 } 00111 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00112 00113 private: 00114 static TypeHandle _type_handle; 00115 }; 00116 00117 #include "eggXfmSAnim.I" 00118 00119 #endif 00120 00121