15 #include "sourceTextureImage.h" 16 #include "textureImage.h" 17 #include "filenameUnifier.h" 19 #include "pnmImageHeader.h" 21 #include "datagramIterator.h" 22 #include "bamReader.h" 23 #include "bamWriter.h" 34 SourceTextureImage() {
39 _successfully_read_header =
false;
49 const Filename &alpha_filename,
int alpha_file_channel) :
53 _alpha_filename = alpha_filename;
54 _alpha_file_channel = alpha_file_channel;
57 _successfully_read_header =
false;
126 return _successfully_read_header;
130 _successfully_read_header =
false;
134 nout <<
"Warning: cannot read texture " 156 if (!_alpha_filename.empty() && _alpha_filename.exists()) {
159 if (num_channels == 1 || num_channels == 3) {
163 _properties.set_num_channels(num_channels);
166 _successfully_read_header =
true;
179 register_factory(get_class_type(), make_SourceTextureImage);
216 DCAST_INTO_R(_texture, p_list[pi++], pi);
234 parse_params(params, scan, manager);
235 me->fillin(scan, manager);
246 void SourceTextureImage::
248 ImageFile::fillin(scan, manager);
void increment_egg_count()
Increments by one the number of egg files that are known to reference this SourceTextureImage.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
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.
Base class for objects that can be written to and read from Bam files.
TextureImage * get_texture() const
Returns the particular texture that this image is one of the sources for.
bool read_header()
Reads the actual image header to determine the image properties, like its size.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
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.
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 Filename make_user_filename(Filename filename)
Returns a new filename that's made relative to the current directory, suitable for reporting to the u...
The name of a file, such as a texture file or an Egg file.
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...
void set_header(const PNMImageHeader &header)
Sets the header information associated with this image, as if it were loaded from the disk...
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.
This is a texture image reference as it appears in an egg file: the source image of the texture...
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
A class to retrieve the individual data elements previously stored in a Datagram. ...
This represents a single source texture that is referenced by one or more egg files.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
void read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.