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

pandatool/src/converter/somethingToEggConverter.h

Go to the documentation of this file.
00001 // Filename: somethingToEggConverter.h
00002 // Created by:  drose (17Apr01)
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 SOMETHINGTOEGGCONVERTER_H
00020 #define SOMETHINGTOEGGCONVERTER_H
00021 
00022 #include "pandatoolbase.h"
00023 
00024 #include "filename.h"
00025 #include "config_util.h"  // for get_texture_path() and get_model_path()
00026 #include "animationConvert.h"
00027 #include "pathReplace.h"
00028 #include "pointerTo.h"
00029 
00030 class EggData;
00031 class EggGroupNode;
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : SomethingToEggConverter
00035 // Description : This is a base class for a family of converter
00036 //               classes that manage a conversion from some file type
00037 //               to egg format.
00038 //
00039 //               Classes of this type can be used to implement xxx2egg
00040 //               converter programs, as well as LoaderFileTypeXXX
00041 //               run-time loaders.
00042 ////////////////////////////////////////////////////////////////////
00043 class SomethingToEggConverter {
00044 public:
00045   SomethingToEggConverter();
00046   SomethingToEggConverter(const SomethingToEggConverter &copy);
00047   virtual ~SomethingToEggConverter();
00048 
00049   virtual SomethingToEggConverter *make_copy()=0;
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, bool owns_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 
00105   virtual bool convert_file(const Filename &filename)=0;
00106 
00107   bool handle_external_reference(EggGroupNode *egg_parent,
00108                                  const Filename &ref_filename);
00109 
00110   INLINE Filename convert_texture_path(const Filename &orig_filename);
00111   INLINE Filename convert_model_path(const Filename &orig_filename);
00112 
00113   // Set this true to treat errors as warnings and generate output
00114   // anyway.
00115   bool _allow_errors;
00116 
00117 protected:
00118   PT(PathReplace) _path_replace;
00119 
00120   AnimationConvert _animation_convert;
00121   string _character_name;
00122   double _start_frame;
00123   double _end_frame;
00124   double _frame_inc;
00125   double _neutral_frame;
00126   double _input_frame_rate;   // frames per second
00127   double _output_frame_rate;  // frames per second
00128   enum ControlFlags {
00129     CF_start_frame        = 0x0001,
00130     CF_end_frame          = 0x0002,
00131     CF_frame_inc          = 0x0004,
00132     CF_neutral_frame      = 0x0008,
00133     CF_input_frame_rate   = 0x0010,
00134     CF_output_frame_rate  = 0x0020,
00135   };
00136   int _control_flags;
00137 
00138   bool _merge_externals;
00139 
00140   EggData *_egg_data;
00141   bool _owns_egg_data;
00142 
00143   bool _error;
00144 };
00145 
00146 #include "somethingToEggConverter.I"
00147 
00148 #endif
00149 
00150 

Generated on Fri May 2 03:16:56 2003 for Panda-Tool by doxygen1.3