Panda3D
|
00001 // Filename: txaLine.h 00002 // Created by: drose (30Nov00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef TXALINE_H 00016 #define TXALINE_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "paletteGroups.h" 00021 00022 #include "globPattern.h" 00023 #include "eggTexture.h" 00024 #include "eggRenderMode.h" 00025 00026 #include "pvector.h" 00027 00028 class PNMFileType; 00029 class EggFile; 00030 class TextureImage; 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Class : TxaLine 00034 // Description : This is a single matching line in the .txa file. It 00035 // consists of a list of names (texture names or egg 00036 // file names), followed by a colon and an optional size 00037 // and a set of keywords. 00038 //////////////////////////////////////////////////////////////////// 00039 class TxaLine { 00040 public: 00041 TxaLine(); 00042 00043 bool parse(const string &line); 00044 00045 bool match_egg(EggFile *egg_file) const; 00046 bool match_texture(TextureImage *texture) const; 00047 00048 void output(ostream &out) const; 00049 00050 private: 00051 typedef pvector<GlobPattern> Patterns; 00052 Patterns _texture_patterns; 00053 Patterns _egg_patterns; 00054 00055 enum SizeType { 00056 ST_none, 00057 ST_scale, 00058 ST_explicit_2, 00059 ST_explicit_3 00060 }; 00061 00062 SizeType _size_type; 00063 PN_stdfloat _scale; 00064 int _x_size; 00065 int _y_size; 00066 int _num_channels; 00067 EggTexture::Format _format; 00068 bool _force_format; 00069 bool _generic_format; 00070 bool _keep_format; 00071 EggRenderMode::AlphaMode _alpha_mode; 00072 EggTexture::WrapMode _wrap_u, _wrap_v; 00073 EggTexture::QualityLevel _quality_level; 00074 00075 int _aniso_degree; 00076 bool _got_margin; 00077 int _margin; 00078 bool _got_coverage_threshold; 00079 double _coverage_threshold; 00080 00081 enum Keyword { 00082 KW_omit, 00083 KW_nearest, 00084 KW_linear, 00085 KW_mipmap, 00086 KW_cont, 00087 KW_anisotropic 00088 }; 00089 00090 typedef pvector<Keyword> Keywords; 00091 Keywords _keywords; 00092 00093 PaletteGroups _palette_groups; 00094 00095 PNMFileType *_color_type; 00096 PNMFileType *_alpha_type; 00097 }; 00098 00099 INLINE ostream &operator << (ostream &out, const TxaLine &line) { 00100 line.output(out); 00101 return out; 00102 } 00103 00104 #endif 00105