Panda3D
|
00001 // Filename: somethingToEggConverter.h 00002 // Created by: drose (17Apr01) 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 SOMETHINGTOEGGCONVERTER_H 00016 #define SOMETHINGTOEGGCONVERTER_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "filename.h" 00021 #include "config_util.h" // for get_model_path() 00022 #include "animationConvert.h" 00023 #include "pathReplace.h" 00024 #include "pointerTo.h" 00025 #include "distanceUnit.h" 00026 00027 class EggData; 00028 class EggGroupNode; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : SomethingToEggConverter 00032 // Description : This is a base class for a family of converter 00033 // classes that manage a conversion from some file type 00034 // to egg format. 00035 // 00036 // Classes of this type can be used to implement xxx2egg 00037 // converter programs, as well as LoaderFileTypeXXX 00038 // run-time loaders. 00039 //////////////////////////////////////////////////////////////////// 00040 class SomethingToEggConverter { 00041 public: 00042 SomethingToEggConverter(); 00043 SomethingToEggConverter(const SomethingToEggConverter ©); 00044 virtual ~SomethingToEggConverter(); 00045 00046 virtual SomethingToEggConverter *make_copy()=0; 00047 00048 INLINE void clear_error(); 00049 INLINE bool had_error() const; 00050 00051 INLINE void set_path_replace(PathReplace *path_replace); 00052 INLINE PathReplace *get_path_replace(); 00053 INLINE const PathReplace *get_path_replace() const; 00054 00055 // These methods dealing with animation and frame rate are only 00056 // relevant to converter types that understand animation. 00057 INLINE void set_animation_convert(AnimationConvert animation_convert); 00058 INLINE AnimationConvert get_animation_convert() const; 00059 00060 INLINE void set_character_name(const string &character_name); 00061 INLINE const string &get_character_name() const; 00062 00063 INLINE void set_start_frame(double start_frame); 00064 INLINE bool has_start_frame() const; 00065 INLINE double get_start_frame() const; 00066 INLINE void clear_start_frame(); 00067 00068 INLINE void set_end_frame(double end_frame); 00069 INLINE bool has_end_frame() const; 00070 INLINE double get_end_frame() const; 00071 INLINE void clear_end_frame(); 00072 00073 INLINE void set_frame_inc(double frame_inc); 00074 INLINE bool has_frame_inc() const; 00075 INLINE double get_frame_inc() const; 00076 INLINE void clear_frame_inc(); 00077 00078 INLINE void set_neutral_frame(double neutral_frame); 00079 INLINE bool has_neutral_frame() const; 00080 INLINE double get_neutral_frame() const; 00081 INLINE void clear_neutral_frame(); 00082 00083 INLINE void set_input_frame_rate(double input_frame_rate); 00084 INLINE bool has_input_frame_rate() const; 00085 INLINE double get_input_frame_rate() const; 00086 INLINE void clear_input_frame_rate(); 00087 00088 INLINE void set_output_frame_rate(double output_frame_rate); 00089 INLINE bool has_output_frame_rate() const; 00090 INLINE double get_output_frame_rate() const; 00091 INLINE void clear_output_frame_rate(); 00092 00093 INLINE static double get_default_frame_rate(); 00094 00095 INLINE void set_merge_externals(bool merge_externals); 00096 INLINE bool get_merge_externals() const; 00097 00098 void set_egg_data(EggData *egg_data); 00099 INLINE void clear_egg_data(); 00100 INLINE EggData *get_egg_data(); 00101 00102 virtual string get_name() const=0; 00103 virtual string get_extension() const=0; 00104 virtual string get_additional_extensions() const; 00105 virtual bool supports_compressed() const; 00106 00107 virtual bool convert_file(const Filename &filename)=0; 00108 virtual DistanceUnit get_input_units(); 00109 00110 bool handle_external_reference(EggGroupNode *egg_parent, 00111 const Filename &ref_filename); 00112 00113 INLINE Filename convert_model_path(const Filename &orig_filename); 00114 00115 // Set this true to treat errors as warnings and generate output 00116 // anyway. 00117 bool _allow_errors; 00118 00119 protected: 00120 PT(PathReplace) _path_replace; 00121 00122 AnimationConvert _animation_convert; 00123 string _character_name; 00124 double _start_frame; 00125 double _end_frame; 00126 double _frame_inc; 00127 double _neutral_frame; 00128 double _input_frame_rate; // frames per second 00129 double _output_frame_rate; // frames per second 00130 enum ControlFlags { 00131 CF_start_frame = 0x0001, 00132 CF_end_frame = 0x0002, 00133 CF_frame_inc = 0x0004, 00134 CF_neutral_frame = 0x0008, 00135 CF_input_frame_rate = 0x0010, 00136 CF_output_frame_rate = 0x0020, 00137 }; 00138 int _control_flags; 00139 00140 bool _merge_externals; 00141 00142 PT(EggData) _egg_data; 00143 00144 bool _error; 00145 }; 00146 00147 #include "somethingToEggConverter.I" 00148 00149 #endif 00150 00151