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

pandatool/src/flt/fltTexture.h

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

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