00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef EGGWRITER_H
00020 #define EGGWRITER_H
00021
00022 #include "pandatoolbase.h"
00023 #include "eggBase.h"
00024 #include "withOutputFile.h"
00025
00026 #include "filename.h"
00027 #include "luse.h"
00028
00029
00030
00031
00032
00033
00034 class EggWriter : virtual public EggBase, public WithOutputFile {
00035 public:
00036 EggWriter(bool allow_last_param = false, bool allow_stdout = true);
00037
00038 void add_normals_options();
00039 void add_transform_options();
00040
00041 virtual EggWriter *as_writer();
00042
00043 virtual void post_process_egg_file();
00044 void write_egg_file();
00045
00046 protected:
00047 virtual bool handle_args(Args &args);
00048 virtual bool post_command_line();
00049
00050 static bool dispatch_normals(ProgramBase *self, const string &opt, const string &arg, void *mode);
00051 bool ns_dispatch_normals(const string &opt, const string &arg, void *mode);
00052
00053 static bool dispatch_scale(const string &opt, const string &arg, void *var);
00054 static bool dispatch_rotate_xyz(ProgramBase *self, const string &opt, const string &arg, void *var);
00055 bool ns_dispatch_rotate_xyz(const string &opt, const string &arg, void *var);
00056 static bool dispatch_rotate_axis(ProgramBase *self, const string &opt, const string &arg, void *var);
00057 bool ns_dispatch_rotate_axis(const string &opt, const string &arg, void *var);
00058 static bool dispatch_translate(const string &opt, const string &arg, void *var);
00059
00060 protected:
00061 enum NormalsMode {
00062 NM_strip,
00063 NM_polygon,
00064 NM_vertex,
00065 NM_preserve
00066 };
00067 NormalsMode _normals_mode;
00068 double _normals_threshold;
00069
00070 bool _got_transform;
00071 LMatrix4d _transform;
00072
00073 private:
00074 ofstream _output_stream;
00075 ostream *_output_ptr;
00076 };
00077
00078 #endif
00079
00080