00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef FLTTEXTURE_H
00016 #define FLTTEXTURE_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "fltRecord.h"
00021
00022 #include "filename.h"
00023 #include "luse.h"
00024
00025
00026
00027
00028
00029 class FltTexture : public FltRecord {
00030 public:
00031 FltTexture(FltHeader *header);
00032
00033 virtual void apply_converted_filenames();
00034
00035 string _orig_filename;
00036 Filename _converted_filename;
00037 int _pattern_index;
00038 int _x_location;
00039 int _y_location;
00040
00041 Filename get_texture_filename() const;
00042 void set_texture_filename(const Filename &filename);
00043 Filename get_attr_filename() const;
00044 FltError read_attr_data();
00045 FltError write_attr_data() const;
00046 FltError write_attr_data(Filename attr_filename) const;
00047
00048
00049 enum FileFormat {
00050 FF_none = -1,
00051 FF_att_8_pattern = 0,
00052 FF_att_8_template = 1,
00053 FF_sgi_i = 2,
00054 FF_sgi_ia = 3,
00055 FF_sgi_rgb = 4,
00056 FF_sgi_rgba = 5
00057 };
00058
00059 enum Minification {
00060 MN_point = 0,
00061 MN_bilinear = 1,
00062 MN_OB_mipmap = 2,
00063 MN_mipmap_point = 3,
00064 MN_mipmap_linear = 4,
00065 MN_mipmap_bilinear = 5,
00066 MN_mipmap_trilinear = 6,
00067 MN_bicubic = 8,
00068 MN_bilinear_gequal = 9,
00069 MN_bilinear_lequal = 10,
00070 MN_bicubic_gequal = 11,
00071 MN_bicubic_lequal = 12
00072 };
00073
00074 enum Magnification {
00075 MG_point = 0,
00076 MG_bilinear = 1,
00077 MG_bicubic = 3,
00078 MG_sharpen = 4,
00079 MG_add_detail = 5,
00080 MG_modulate_detail = 6,
00081 MG_bilinear_gequal = 7,
00082 MG_bilinear_lequal = 8,
00083 MG_bicubic_gequal = 9,
00084 MG_bicubic_lequal = 10
00085 };
00086
00087 enum RepeatType {
00088 RT_repeat = 0,
00089 RT_clamp = 1
00090 };
00091
00092 enum EnvironmentType {
00093 ET_modulate = 0,
00094 ET_blend = 1,
00095 ET_decal = 2,
00096 ET_color = 3
00097 };
00098
00099 enum InternalFormat {
00100 IF_default = 0,
00101 IF_i_12a_4 = 1,
00102 IF_ia_8 = 2,
00103 IF_rgb_5 = 3,
00104 IF_rgba_4 = 4,
00105 IF_ia_12 = 5,
00106 IF_rgba_8 = 6,
00107 IF_rgba_12 = 7,
00108 IF_i_16 = 8,
00109 IF_rgb_12 = 9
00110 };
00111
00112 enum ExternalFormat {
00113 EF_default = 0,
00114 EF_pack_8 = 1,
00115 EF_pack_16 = 2
00116 };
00117
00118 enum ProjectionType {
00119 PT_flat_earth = 0,
00120 PT_lambert = 3,
00121 PT_utm = 4,
00122 PT_undefined = 7
00123 };
00124
00125 enum EarthModel {
00126 EM_wgs84 = 0,
00127 EM_wgs72 = 1,
00128 EM_bessel = 2,
00129 EM_clarke_1866 = 3,
00130 EM_nad27 = 4
00131 };
00132
00133 enum ImageOrigin {
00134 IO_lower_left = 0,
00135 IO_upper_left = 1
00136 };
00137
00138 enum PointsUnits {
00139 PU_degrees = 0,
00140 PU_meters = 1,
00141 PU_pixels = 2
00142 };
00143
00144 enum Hemisphere {
00145 H_southern = 0,
00146 H_northern = 1,
00147 };
00148
00149 struct LODScale {
00150 PN_stdfloat _lod;
00151 PN_stdfloat _scale;
00152 };
00153
00154 struct GeospecificControlPoint {
00155 LPoint2d _uv;
00156 LPoint2d _real_earth;
00157 };
00158
00159 typedef pvector<GeospecificControlPoint> GeospecificControlPoints;
00160
00161 struct SubtextureDef {
00162 string _name;
00163 int _left;
00164 int _bottom;
00165 int _right;
00166 int _top;
00167 };
00168 typedef pvector<SubtextureDef> SubtextureDefs;
00169
00170 int _num_texels_u;
00171 int _num_texels_v;
00172 int _real_world_size_u;
00173 int _real_world_size_v;
00174 int _up_vector_x;
00175 int _up_vector_y;
00176 FileFormat _file_format;
00177 Minification _min_filter;
00178 Magnification _mag_filter;
00179 RepeatType _repeat;
00180 RepeatType _repeat_u;
00181 RepeatType _repeat_v;
00182 int _modify_flag;
00183 int _x_pivot_point;
00184 int _y_pivot_point;
00185 EnvironmentType _env_type;
00186 bool _intensity_is_alpha;
00187
00188 double _float_real_world_size_u;
00189 double _float_real_world_size_v;
00190 int _imported_origin_code;
00191 int _kernel_version;
00192 InternalFormat _internal_format;
00193 ExternalFormat _external_format;
00194 bool _use_mipmap_kernel;
00195 PN_stdfloat _mipmap_kernel[8];
00196 bool _use_lod_scale;
00197 LODScale _lod_scale[8];
00198 PN_stdfloat _clamp;
00199 Magnification _mag_filter_alpha;
00200 Magnification _mag_filter_color;
00201 double _lambert_conic_central_meridian;
00202 double _lambert_conic_upper_latitude;
00203 double _lambert_conic_lower_latitude;
00204 bool _use_detail;
00205 int _detail_j;
00206 int _detail_k;
00207 int _detail_m;
00208 int _detail_n;
00209 int _detail_scramble;
00210 bool _use_tile;
00211 PN_stdfloat _tile_lower_left_u;
00212 PN_stdfloat _tile_lower_left_v;
00213 PN_stdfloat _tile_upper_right_u;
00214 PN_stdfloat _tile_upper_right_v;
00215 ProjectionType _projection;
00216 EarthModel _earth_model;
00217 int _utm_zone;
00218 ImageOrigin _image_origin;
00219 PointsUnits _geospecific_points_units;
00220 Hemisphere _geospecific_hemisphere;
00221 string _comment;
00222 int _file_version;
00223 GeospecificControlPoints _geospecific_control_points;
00224 SubtextureDefs _subtexture_defs;
00225
00226 protected:
00227 virtual bool extract_record(FltRecordReader &reader);
00228 virtual bool build_record(FltRecordWriter &writer) const;
00229
00230 private:
00231 FltError unpack_attr(const Datagram &datagram);
00232 FltError pack_attr(Datagram &datagram) const;
00233
00234 public:
00235 virtual TypeHandle get_type() const {
00236 return get_class_type();
00237 }
00238 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00239 static TypeHandle get_class_type() {
00240 return _type_handle;
00241 }
00242 static void init_type() {
00243 FltRecord::init_type();
00244 register_type(_type_handle, "FltTexture",
00245 FltRecord::get_class_type());
00246 }
00247
00248 private:
00249 static TypeHandle _type_handle;
00250
00251 friend class FltHeader;
00252 };
00253
00254 #endif
00255
00256