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