Panda3D
 All Classes Functions Variables Enumerations
txaFile.h
1 // Filename: txaFile.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 TXAFILE_H
16 #define TXAFILE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "txaLine.h"
21 
22 #include "filename.h"
23 #include "vector_string.h"
24 
25 #include "pvector.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : TxaFile
29 // Description : This represents the .txa file (usually textures.txa)
30 // that contains the user instructions for resizing,
31 // grouping, etc. the various textures.
32 ////////////////////////////////////////////////////////////////////
33 class TxaFile {
34 public:
35  TxaFile();
36 
37  bool read(istream &in, const string &filename);
38 
39  bool match_egg(EggFile *egg_file) const;
40  bool match_texture(TextureImage *texture) const;
41 
42  void write(ostream &out) const;
43 
44 private:
45  static int get_line_or_semicolon(istream &in, string &line);
46 
47  bool parse_group_line(const vector_string &words);
48  bool parse_palette_line(const vector_string &words);
49  bool parse_margin_line(const vector_string &words);
50  bool parse_background_line(const vector_string &words);
51  bool parse_coverage_line(const vector_string &words);
52  bool parse_powertwo_line(const vector_string &words);
53  bool parse_imagetype_line(const vector_string &words);
54  bool parse_shadowtype_line(const vector_string &words);
55  bool parse_round_line(const vector_string &words);
56  bool parse_remap_line(const vector_string &words);
57  bool parse_cutout_line(const vector_string &words);
58  bool parse_textureswap_line(const vector_string &words);
59 
60  typedef pvector<TxaLine> Lines;
61  Lines _lines;
62 };
63 
64 #endif
65 
bool match_egg(EggFile *egg_file) const
Searches for a matching line in the .txa file for the given egg file and applies its specifications...
Definition: txaFile.cxx:137
bool read(istream &in, const string &filename)
Reads the indicated stream, and returns true if successful, or false if there is an error...
Definition: txaFile.cxx:40
This represents a single source texture that is referenced by one or more egg files.
Definition: textureImage.h:51
void write(ostream &out) const
Outputs a representation of the lines that were read in to the indicated output stream.
Definition: txaFile.cxx:177
This represents a single egg file known to the palettizer.
Definition: eggFile.h:39
This represents the .txa file (usually textures.txa) that contains the user instructions for resizing...
Definition: txaFile.h:33
bool match_texture(TextureImage *texture) const
Searches for a matching line in the .txa file for the given texture and applies its specifications...
Definition: txaFile.cxx:158