25 NotifyCategoryDeclNoExport(txafile);
26 NotifyCategoryDef(txafile,
"");
30 Configure(config_txaFileFilter);
31 ConfigureFn(config_txaFileFilter) {
32 TxaFileFilter::init_type();
38 TxaFile *TxaFileFilter::_txa_file;
39 bool TxaFileFilter::_got_txa_file;
55 std::string name = tex->
get_filename().get_basename_wo_extension();
56 tex_image.set_name(name);
61 tex->
store(pnm_image);
68 if (txafile_cat.is_debug()) {
71 <<
"Not matched: " << name <<
"\n";
74 <<
"Matched: " << name <<
"\n";
94 egg_tex->set_format(props._format);
95 egg_tex->set_minfilter(props._minfilter);
96 egg_tex->set_minfilter(props._magfilter);
97 egg_tex->set_anisotropic_degree(props._anisotropic_degree);
114 if (pal ==
nullptr) {
119 _got_txa_file =
true;
122 (
"txa-file",
Filename(
"textures.txa"),
123 PRC_DESC(
"Specify the name of the txa file to load when the txafile texture filter" 129 if (!vfs->
exists(filename)) {
130 txafile_cat.warning()
131 <<
"Filename " << filename <<
" not found.\n";
135 if (ifile ==
nullptr) {
136 txafile_cat.warning()
137 <<
"Filename " << filename <<
" cannot be read.\n";
139 if (!_txa_file->
read(*ifile, filename)) {
140 txafile_cat.warning()
141 <<
"Syntax errors in " << filename <<
"\n";
144 <<
"Read " << filename <<
"\n";
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_filename
Returns the filename that has been set.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_fullpath
Returns the fullpath that has been set.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
void pre_txa_file()
Updates any internal state prior to reading the .txa file.
This is the main engine behind egg-palettize.
This is a convenience class to specialize ConfigVariable as a Filename type.
A hierarchy of directories and files that appears to be one continuous file system,...
std::istream * open_read_file(const Filename &filename, bool auto_unwrap) const
Convenience function; returns a newly allocated istream if the file exists and can be read,...
SourceTextureImage * get_source(const Filename &filename, const Filename &alpha_filename, int alpha_file_channel)
Returns the SourceTextureImage corresponding to the given filename(s).
Defines a texture map that may be applied to geometry.
int get_y_size() const
Returns the size of the image file in pixels in the Y direction.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
void set_text()
Indicates that the filename represents a text file.
bool store(PNMImage &pnmimage) const
Saves the texture to the indicated PNMImage, but does not write it to disk.
bool resolve_filename(Filename &filename, const DSearchPath &searchpath, const std::string &default_extension=std::string()) const
Searches the given search path for the filename.
void register_filter(TexturePoolFilter *filter)
Records a TexturePoolFilter object that may operate on texture images as they are loaded from disk.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void quick_filter_from(const PNMImage ©, int xborder=0, int yborder=0)
Resizes from the given image, with a fixed radius of 0.5.
This is an abstract base class, a placeholder for any number of different classes that may wish to im...
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.
static void close_read_file(std::istream *stream)
Closes a file opened by a previous call to open_read_file().
PT(Texture) TxaFileFilter
This method is called after each texture has been loaded from disk, via the TexturePool,...
const TextureProperties & get_properties() const
Returns the grouping properties of the image.
bool exists(const Filename &filename) const
Convenience function; returns true if the named file exists.
EggRenderMode::AlphaMode get_alpha_mode() const
Returns the alpha mode that should be used to render objects with this texture, as specified by the u...
The name of a file, such as a texture file or an Egg file.
int get_x_size() const
Returns the size of the image file in pixels in the X direction.
get_alpha_fullpath
Returns the alpha_fullpath that has been set.
void set_header(const PNMImageHeader &header)
Sets the header information associated with this image, as if it were loaded from the disk.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
int get_num_channels() const
Returns the number of channels of the image.
This is a texture image reference as it appears in an egg file: the source image of the texture.
set_aux_data
Records an arbitrary object in the Texture, associated with a specified key.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static TexturePool * get_global_ptr()
Initializes and/or returns the global pointer to the one TexturePool object in the system.
bool load(const PNMImage &pnmimage, const LoaderOptions &options=LoaderOptions())
Replaces the texture with the indicated image.
void set_source_image(const PNMImage &image)
Accepts the indicated source image as if it had been read from disk.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This represents a single source texture that is referenced by one or more egg files.
void post_txa_file()
Once the .txa file has been read and the TextureImage matched against it, considers applying the requ...
This is the preferred interface for loading textures from image files.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This represents the .txa file (usually textures.txa) that contains the user instructions for resizing...
bool match_texture(TextureImage *texture) const
Searches for a matching line in the .txa file for the given texture and applies its specifications.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the set of characteristics of a texture that, if different from another texture,...