Panda3D
Loading...
Searching...
No Matches
txaFile.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 txaFile.h
10 * @author drose
11 * @date 2000-11-30
12 */
13
14#ifndef TXAFILE_H
15#define TXAFILE_H
16
17#include "pandatoolbase.h"
18
19#include "txaLine.h"
20
21#include "filename.h"
22#include "vector_string.h"
23
24#include "pvector.h"
25
26/**
27 * This represents the .txa file (usually textures.txa) that contains the user
28 * instructions for resizing, grouping, etc. the various textures.
29 */
30class TxaFile {
31public:
32 TxaFile();
33
34 bool read(std::istream &in, const std::string &filename);
35
36 bool match_egg(EggFile *egg_file) const;
37 bool match_texture(TextureImage *texture) const;
38
39 void write(std::ostream &out) const;
40
41private:
42 static int get_line_or_semicolon(std::istream &in, std::string &line);
43
44 bool parse_group_line(const vector_string &words);
45 bool parse_palette_line(const vector_string &words);
46 bool parse_margin_line(const vector_string &words);
47 bool parse_background_line(const vector_string &words);
48 bool parse_coverage_line(const vector_string &words);
49 bool parse_powertwo_line(const vector_string &words);
50 bool parse_imagetype_line(const vector_string &words);
51 bool parse_shadowtype_line(const vector_string &words);
52 bool parse_round_line(const vector_string &words);
53 bool parse_remap_line(const vector_string &words);
54 bool parse_cutout_line(const vector_string &words);
55 bool parse_textureswap_line(const vector_string &words);
56
57 typedef pvector<TxaLine> Lines;
58 Lines _lines;
59};
60
61#endif
This represents a single egg file known to the palettizer.
Definition eggFile.h:36
This represents a single source texture that is referenced by one or more egg files.
This represents the .txa file (usually textures.txa) that contains the user instructions for resizing...
Definition txaFile.h:30
bool read(std::istream &in, const std::string &filename)
Reads the indicated stream, and returns true if successful, or false if there is an error.
Definition txaFile.cxx:37
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:149
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:131
void write(std::ostream &out) const
Outputs a representation of the lines that were read in to the indicated output stream.
Definition txaFile.cxx:165
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.