Go to the documentation of this file.
30 SourceTextureImage() {
35 _successfully_read_header =
false;
43 const Filename &alpha_filename,
int alpha_file_channel) :
47 _alpha_filename = alpha_filename;
48 _alpha_file_channel = alpha_file_channel;
51 _successfully_read_header =
false;
104 return _successfully_read_header;
108 _successfully_read_header =
false;
112 nout <<
"Warning: cannot read texture "
132 if (!_alpha_filename.empty() && _alpha_filename.exists()) {
135 if (num_channels == 1 || num_channels == 3) {
139 _properties.set_num_channels(num_channels);
142 _successfully_read_header =
true;
152 register_factory(get_class_type(), make_SourceTextureImage);
181 DCAST_INTO_R(_texture, p_list[pi++], pi);
197 me->fillin(scan, manager);
205 void SourceTextureImage::
207 ImageFile::fillin(scan, manager);
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...
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
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...
int get_egg_count() const
Returns the number of egg files that share this SourceTextureImage.
A class to retrieve the individual data elements previously stored in a Datagram.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
TextureImage * get_texture() const
Returns the particular texture that this image is one of the sources for.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_header(const PNMImageHeader &header)
Sets the header information associated with this image, as if it were loaded from the disk.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This is a texture image reference as it appears in an egg file: the source image of the texture.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
bool get_size()
Determines the size of the SourceTextureImage, if it is not already known.
bool read_header()
Reads the actual image header to determine the image properties, like its size.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static Filename make_user_filename(Filename filename)
Returns a new filename that's made relative to the current directory, suitable for reporting to the u...
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
This represents a single source texture that is referenced by one or more egg files.
void increment_egg_count()
Increments by one the number of egg files that are known to reference this SourceTextureImage.
The name of a file, such as a texture file or an Egg file.