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