00001 // Filename: txaLine.h 00002 // Created by: drose (30Nov00) 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 TXALINE_H 00020 #define TXALINE_H 00021 00022 #include "pandatoolbase.h" 00023 00024 #include "paletteGroups.h" 00025 00026 #include "globPattern.h" 00027 #include "eggTexture.h" 00028 #include "eggRenderMode.h" 00029 00030 #include "pvector.h" 00031 00032 class PNMFileType; 00033 class EggFile; 00034 class TextureImage; 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Class : TxaLine 00038 // Description : This is a single matching line in the .txa file. It 00039 // consists of a list of names (texture names or egg 00040 // file names), followed by a colon and an optional size 00041 // and a set of keywords. 00042 //////////////////////////////////////////////////////////////////// 00043 class TxaLine { 00044 public: 00045 TxaLine(); 00046 00047 bool parse(const string &line); 00048 00049 bool match_egg(EggFile *egg_file) const; 00050 bool match_texture(TextureImage *texture) const; 00051 00052 void output(ostream &out) const; 00053 00054 private: 00055 typedef pvector<GlobPattern> Patterns; 00056 Patterns _texture_patterns; 00057 Patterns _egg_patterns; 00058 00059 enum SizeType { 00060 ST_none, 00061 ST_scale, 00062 ST_explicit_2, 00063 ST_explicit_3 00064 }; 00065 00066 SizeType _size_type; 00067 float _scale; 00068 int _x_size; 00069 int _y_size; 00070 int _num_channels; 00071 EggTexture::Format _format; 00072 bool _force_format; 00073 bool _generic_format; 00074 EggRenderMode::AlphaMode _alpha_mode; 00075 00076 int _aniso_degree; 00077 bool _got_margin; 00078 int _margin; 00079 bool _got_coverage_threshold; 00080 double _coverage_threshold; 00081 00082 enum Keyword { 00083 KW_omit, 00084 KW_nearest, 00085 KW_linear, 00086 KW_mipmap, 00087 KW_cont, 00088 KW_anisotropic 00089 }; 00090 00091 typedef pvector<Keyword> Keywords; 00092 Keywords _keywords; 00093 00094 PaletteGroups _palette_groups; 00095 00096 PNMFileType *_color_type; 00097 PNMFileType *_alpha_type; 00098 }; 00099 00100 INLINE ostream &operator << (ostream &out, const TxaLine &line) { 00101 line.output(out); 00102 return out; 00103 } 00104 00105 #endif 00106