Panda3D
Loading...
Searching...
No Matches
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
27class PNMFileType;
28class EggFile;
29class 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 */
36class TxaLine {
37public:
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
47private:
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
88 Keywords _keywords;
89
90 PaletteGroups _palette_groups;
91
92 PNMFileType *_color_type;
93 PNMFileType *_alpha_type;
94};
95
96INLINE std::ostream &operator << (std::ostream &out, const TxaLine &line) {
97 line.output(out);
98 return out;
99}
100
101#endif
This represents a single egg file known to the palettizer.
Definition eggFile.h:36
This is the base class of a family of classes that represent particular image file types that PNMImag...
Definition pnmFileType.h:32
A set of PaletteGroups.
This represents a single source texture that is referenced by one or more egg files.
This is a single matching line in the .txa file.
Definition txaLine.h:36
bool match_egg(EggFile *egg_file) const
Compares the patterns on the line to the indicated EggFile.
Definition txaLine.cxx:330
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
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.