Panda3D
 All Classes Functions Variables Enumerations
txaLine.h
1 // Filename: txaLine.h
2 // Created by: drose (30Nov00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef TXALINE_H
16 #define TXALINE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "paletteGroups.h"
21 
22 #include "globPattern.h"
23 #include "eggTexture.h"
24 #include "eggRenderMode.h"
25 
26 #include "pvector.h"
27 
28 class PNMFileType;
29 class EggFile;
30 class TextureImage;
31 
32 ////////////////////////////////////////////////////////////////////
33 // Class : TxaLine
34 // Description : This is a single matching line in the .txa file. It
35 // consists of a list of names (texture names or egg
36 // file names), followed by a colon and an optional size
37 // and a set of keywords.
38 ////////////////////////////////////////////////////////////////////
39 class TxaLine {
40 public:
41  TxaLine();
42 
43  bool parse(const string &line);
44 
45  bool match_egg(EggFile *egg_file) const;
46  bool match_texture(TextureImage *texture) const;
47 
48  void output(ostream &out) const;
49 
50 private:
52  Patterns _texture_patterns;
53  Patterns _egg_patterns;
54 
55  enum SizeType {
56  ST_none,
57  ST_scale,
58  ST_explicit_2,
59  ST_explicit_3
60  };
61 
62  SizeType _size_type;
63  PN_stdfloat _scale;
64  int _x_size;
65  int _y_size;
66  int _num_channels;
67  EggTexture::Format _format;
68  bool _force_format;
69  bool _generic_format;
70  bool _keep_format;
71  EggRenderMode::AlphaMode _alpha_mode;
72  EggTexture::WrapMode _wrap_u, _wrap_v;
73  EggTexture::QualityLevel _quality_level;
74 
75  int _aniso_degree;
76  bool _got_margin;
77  int _margin;
78  bool _got_coverage_threshold;
79  double _coverage_threshold;
80 
81  enum Keyword {
82  KW_omit,
83  KW_nearest,
84  KW_linear,
85  KW_mipmap,
86  KW_cont,
87  KW_anisotropic
88  };
89 
90  typedef pvector<Keyword> Keywords;
91  Keywords _keywords;
92 
93  PaletteGroups _palette_groups;
94 
95  PNMFileType *_color_type;
96  PNMFileType *_alpha_type;
97 };
98 
99 INLINE ostream &operator << (ostream &out, const TxaLine &line) {
100  line.output(out);
101  return out;
102 }
103 
104 #endif
105 
This is the base class of a family of classes that represent particular image file types that PNMImag...
Definition: pnmFileType.h:35
This is a single matching line in the .txa file.
Definition: txaLine.h:39
bool match_egg(EggFile *egg_file) const
Compares the patterns on the line to the indicated EggFile.
Definition: txaLine.cxx:340
A set of PaletteGroups.
Definition: paletteGroups.h:31
This represents a single source texture that is referenced by one or more egg files.
Definition: textureImage.h:51
bool match_texture(TextureImage *texture) const
Compares the patterns on the line to the indicated TextureImage.
Definition: txaLine.cxx:403
bool parse(const string &line)
Accepts a string that defines a line of the .txa file and parses it into its constinuent parts...
Definition: txaLine.cxx:63
This represents a single egg file known to the palettizer.
Definition: eggFile.h:39