00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef EGGDATA_H
00020 #define EGGDATA_H
00021
00022 #include <pandabase.h>
00023
00024 #include "eggGroupNode.h"
00025 #include <filename.h>
00026 #include <coordinateSystem.h>
00027 #include <notify.h>
00028 #include <dSearchPath.h>
00029
00030 #include <string>
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class EXPCL_PANDAEGG EggData : public EggGroupNode {
00047 public:
00048 INLINE EggData();
00049 INLINE EggData(const EggData ©);
00050 INLINE EggData &operator = (const EggData ©);
00051
00052 static bool resolve_egg_filename(Filename &egg_filename,
00053 const DSearchPath &searchpath = DSearchPath());
00054
00055 bool read(Filename filename);
00056 bool read(istream &in);
00057 void merge(EggData &other);
00058
00059 bool load_externals(const DSearchPath &searchpath = DSearchPath());
00060 int collapse_equivalent_textures();
00061 int collapse_equivalent_materials();
00062
00063 bool write_egg(Filename filename);
00064 bool write_egg(ostream &out);
00065
00066 INLINE void set_auto_resolve_externals(bool resolve);
00067 INLINE bool get_auto_resolve_externals() const;
00068
00069 void set_coordinate_system(CoordinateSystem coordsys);
00070 INLINE CoordinateSystem get_coordinate_system() const;
00071
00072 INLINE void set_egg_filename(const Filename &egg_filenamea);
00073 INLINE const Filename &get_egg_filename() const;
00074
00075 INLINE void recompute_vertex_normals(double threshold);
00076 INLINE void recompute_polygon_normals();
00077 INLINE void strip_normals();
00078
00079 protected:
00080 virtual void write(ostream &out, int indent_level = 0) const;
00081
00082 private:
00083 void post_read();
00084 void pre_write();
00085
00086 bool _auto_resolve_externals;
00087 CoordinateSystem _coordsys;
00088 Filename _egg_filename;
00089
00090 public:
00091 static TypeHandle get_class_type() {
00092 return _type_handle;
00093 }
00094 static void init_type() {
00095 EggGroupNode::init_type();
00096 register_type(_type_handle, "EggData",
00097 EggGroupNode::get_class_type());
00098 }
00099 virtual TypeHandle get_type() const {
00100 return get_class_type();
00101 }
00102 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00103
00104 private:
00105 static TypeHandle _type_handle;
00106 };
00107
00108 #include "eggData.I"
00109
00110 #endif