Panda3D
|
This is a texture image reference as it appears in an egg file: the source image of the texture. More...
#include "sourceTextureImage.h"
Public Member Functions | |
SourceTextureImage (TextureImage *texture, const Filename &filename, const Filename &alpha_filename, int alpha_file_channel) | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written. | |
int | get_egg_count () const |
Returns the number of egg files that share this SourceTextureImage. | |
bool | get_size () |
Determines the size of the SourceTextureImage, if it is not already known. | |
TextureImage * | get_texture () const |
Returns the particular texture that this image is one of the sources for. | |
virtual TypeHandle | get_type () const |
void | increment_egg_count () |
Increments by one the number of egg files that are known to reference this SourceTextureImage. | |
bool | read_header () |
Reads the actual image header to determine the image properties, like its size. | |
void | set_header (const PNMImageHeader &header) |
Sets the header information associated with this image, as if it were loaded from the disk. | |
virtual void | write_datagram (BamWriter *writer, Datagram &datagram) |
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
static void | register_with_read_factory () |
Registers the current object as something that can be read from a Bam file. | |
Protected Member Functions | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram(). | |
Static Protected Member Functions | |
static TypedWritable * | make_SourceTextureImage (const FactoryParams ¶ms) |
This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read. |
This is a texture image reference as it appears in an egg file: the source image of the texture.
Definition at line 30 of file sourceTextureImage.h.
int SourceTextureImage::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) | [virtual] |
Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written.
The return value is the number of pointers processed from the list.
Reimplemented from ImageFile.
Definition at line 213 of file sourceTextureImage.cxx.
void SourceTextureImage::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().
Reimplemented from ImageFile.
Definition at line 247 of file sourceTextureImage.cxx.
References BamReader::read_pointer().
Referenced by make_SourceTextureImage().
int SourceTextureImage::get_egg_count | ( | ) | const |
Returns the number of egg files that share this SourceTextureImage.
Definition at line 89 of file sourceTextureImage.cxx.
Referenced by TextureImage::get_preferred_source(), and TextureImage::write_source_pathnames().
bool SourceTextureImage::get_size | ( | ) |
Determines the size of the SourceTextureImage, if it is not already known.
Returns true if the size was successfully determined (or if was already known), or false if the size could not be determined (for instance, because the image file is missing). After this call returns true, get_x_size() etc. may be safely called to return the size.
Definition at line 105 of file sourceTextureImage.cxx.
References read_header().
Referenced by TextureReference::from_egg(), TextureImage::get_preferred_source(), TxaLine::match_texture(), and TextureImage::post_txa_file().
TextureImage * SourceTextureImage::get_texture | ( | ) | const |
Returns the particular texture that this image is one of the sources for.
Definition at line 67 of file sourceTextureImage.cxx.
Referenced by TextureReference::get_texture().
Increments by one the number of egg files that are known to reference this SourceTextureImage.
Definition at line 78 of file sourceTextureImage.cxx.
Referenced by EggFile::build_cross_links().
static void SourceTextureImage::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from ImageFile.
Definition at line 68 of file sourceTextureImage.h.
TypedWritable * SourceTextureImage::make_SourceTextureImage | ( | const FactoryParams & | params | ) | [static, protected] |
This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.
Definition at line 229 of file sourceTextureImage.cxx.
References fillin().
Referenced by register_with_read_factory().
bool SourceTextureImage::read_header | ( | ) |
Reads the actual image header to determine the image properties, like its size.
Returns true if the image header is successfully read (or if has previously been successfully read this session), false otherwise. After this call returns true, get_x_size() etc. may be safely called to return the newly determined size.
Definition at line 124 of file sourceTextureImage.cxx.
References FilenameUnifier::make_user_filename(), PNMImageHeader::read_header(), and set_header().
Referenced by get_size(), and TextureImage::read_header().
void SourceTextureImage::register_with_read_factory | ( | ) | [static] |
Registers the current object as something that can be read from a Bam file.
Definition at line 177 of file sourceTextureImage.cxx.
References BamReader::get_factory(), and make_SourceTextureImage().
void SourceTextureImage::set_header | ( | const PNMImageHeader & | header | ) |
Sets the header information associated with this image, as if it were loaded from the disk.
Definition at line 151 of file sourceTextureImage.cxx.
References PNMImageHeader::get_num_channels(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), and TextureProperties::set_num_channels().
Referenced by read_header().
void SourceTextureImage::write_datagram | ( | BamWriter * | writer, |
Datagram & | datagram | ||
) | [virtual] |
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
Reimplemented from ImageFile.
Definition at line 190 of file sourceTextureImage.cxx.
References BamWriter::write_pointer().