Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TextureProperties Class Reference

This is the set of characteristics of a texture that, if different from another texture, prevent the two textures from sharing a PaletteImage. More...

#include "textureProperties.h"

Inheritance diagram for TextureProperties:
TypedWritable TypedObject MemoryBase

Public Member Functions

 TextureProperties (const TextureProperties &copy)
 
void clear_basic ()
 Resets only the properties that might be changed by update_properties() to a neutral state. More...
 
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. More...
 
bool egg_properties_match (const TextureProperties &other) const
 Returns true if all of the properties that are reflected directly in an egg file match between this TextureProperties object and the other, or false if any of them differ. More...
 
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(). More...
 
void force_grayscale ()
 Sets the actual number of channels to indicate a grayscale image, presumably after discovering that the image contains no colored pixels. More...
 
void force_nonalpha ()
 Sets the actual number of channels to indicate an image with no alpha channel, presumably after discovering that the alpha channel contains no meaningful pixels. More...
 
void fully_define ()
 If any properties remain unspecified, specify them now. More...
 
int get_num_channels () const
 Returns the number of channels (1 through 4) associated with the image. More...
 
std::string get_string () const
 Returns a string corresponding to the TextureProperties object. More...
 
virtual TypeHandle get_type () const
 
bool has_num_channels () const
 Returns true if the number of channels is known. More...
 
bool operator != (const TextureProperties &other) const
 
bool operator< (const TextureProperties &other) const
 
void operator= (const TextureProperties &copy)
 
bool operator== (const TextureProperties &other) const
 
void set_num_channels (int num_channels)
 Sets the number of channels (1 through 4) associated with the image, presumably after reading this information from the image header. More...
 
void update_egg_tex (EggTexture *egg_tex) const
 Adjusts the texture properties of the indicated egg reference to match these properties. More...
 
void update_properties (const TextureProperties &other)
 If the indicate TextureProperties structure is more specific than this one, updates this one. More...
 
bool uses_alpha () const
 Returns true if the texture uses an alpha channel, false otherwise. More...
 
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. More...
 
- Public Member Functions inherited from TypedWritable
 TypedWritable (const TypedWritable &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
vector_uchar encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
virtual void finalize (BamReader *manager)
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
 
virtual TypeHandle force_init_type ()
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
void operator= (const TypedWritable &copy)
 
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
 
virtual void update_bam_nested (BamWriter *manager)
 Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
static void register_with_read_factory ()
 Registers the current object as something that can be read from a Bam file. More...
 
- Static Public Member Functions inherited from TypedWritable
static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
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. More...
 

Public Attributes

PNMFileType_alpha_type
 
int _anisotropic_degree
 
PNMFileType_color_type
 
bool _force_format
 
EggTexture::Format _format
 
bool _generic_format
 
bool _keep_format
 
EggTexture::FilterType _magfilter
 
EggTexture::FilterType _minfilter
 
EggTexture::QualityLevel _quality_level
 
- Public Attributes inherited from TypedObject
 get_type
 

Additional Inherited Members

- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = nullptr
 

Detailed Description

This is the set of characteristics of a texture that, if different from another texture, prevent the two textures from sharing a PaletteImage.

It includes properties such as mipmapping, number of channels, etc.

Definition at line 30 of file textureProperties.h.

Member Function Documentation

◆ clear_basic()

void TextureProperties::clear_basic ( )

Resets only the properties that might be changed by update_properties() to a neutral state.

Definition at line 93 of file textureProperties.cxx.

Referenced by ImageFile::clear_basic_properties().

◆ complete_pointers()

int TextureProperties::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 TypedWritable.

Definition at line 783 of file textureProperties.cxx.

References TypedWritable::complete_pointers().

◆ egg_properties_match()

bool TextureProperties::egg_properties_match ( const TextureProperties other) const

Returns true if all of the properties that are reflected directly in an egg file match between this TextureProperties object and the other, or false if any of them differ.

Definition at line 475 of file textureProperties.cxx.

Referenced by TextureReference::is_equivalent().

◆ fillin()

void TextureProperties::fillin ( DatagramIterator scan,
BamReader manager 
)
virtual

Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().

Reimplemented from TypedWritable.

Definition at line 820 of file textureProperties.cxx.

References TypedWritable::fillin(), DatagramIterator::get_bool(), DatagramIterator::get_int32(), and BamReader::read_pointer().

◆ force_grayscale()

void TextureProperties::force_grayscale ( )

Sets the actual number of channels to indicate a grayscale image, presumably after discovering that the image contains no colored pixels.

Definition at line 138 of file textureProperties.cxx.

◆ force_nonalpha()

void TextureProperties::force_nonalpha ( )

Sets the actual number of channels to indicate an image with no alpha channel, presumably after discovering that the alpha channel contains no meaningful pixels.

Definition at line 150 of file textureProperties.cxx.

◆ fully_define()

void TextureProperties::fully_define ( )

If any properties remain unspecified, specify them now.

Also reconcile conflicting information.

Definition at line 238 of file textureProperties.cxx.

◆ get_num_channels()

int TextureProperties::get_num_channels ( ) const

Returns the number of channels (1 through 4) associated with the image.

It is an error to call this unless has_num_channels() returns true.

Definition at line 117 of file textureProperties.cxx.

Referenced by ImageFile::get_num_channels(), and TextureImage::write_source_pathnames().

◆ get_string()

string TextureProperties::get_string ( ) const

Returns a string corresponding to the TextureProperties object.

Each unique set of TextureProperties will generate a unique string. This is used to generate unique palette image filenames.

Definition at line 184 of file textureProperties.cxx.

◆ has_num_channels()

bool TextureProperties::has_num_channels ( ) const

Returns true if the number of channels is known.

Definition at line 108 of file textureProperties.cxx.

Referenced by ImageFile::has_num_channels(), and TextureImage::write_source_pathnames().

◆ register_with_read_factory()

void TextureProperties::register_with_read_factory ( )
static

Registers the current object as something that can be read from a Bam file.

Definition at line 749 of file textureProperties.cxx.

References BamReader::get_factory().

Referenced by init_palettizer().

◆ set_num_channels()

void TextureProperties::set_num_channels ( int  num_channels)

Sets the number of channels (1 through 4) associated with the image, presumably after reading this information from the image header.

Definition at line 127 of file textureProperties.cxx.

◆ update_egg_tex()

void TextureProperties::update_egg_tex ( EggTexture egg_tex) const

Adjusts the texture properties of the indicated egg reference to match these properties.

Definition at line 461 of file textureProperties.cxx.

References EggTexture::set_anisotropic_degree.

◆ update_properties()

void TextureProperties::update_properties ( const TextureProperties other)

If the indicate TextureProperties structure is more specific than this one, updates this one.

Definition at line 207 of file textureProperties.cxx.

Referenced by ImageFile::update_properties().

◆ uses_alpha()

bool TextureProperties::uses_alpha ( ) const

Returns true if the texture uses an alpha channel, false otherwise.

Definition at line 160 of file textureProperties.cxx.

Referenced by ImageFile::exists(), and ImageFile::output_filename().

◆ write_datagram()

void TextureProperties::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 TypedWritable.

Definition at line 759 of file textureProperties.cxx.

References Datagram::add_bool(), Datagram::add_int32(), TypedWritable::write_datagram(), and BamWriter::write_pointer().

Referenced by PalettePage::write_datagram(), ImageFile::write_datagram(), and TextureReference::write_datagram().


The documentation for this class was generated from the following files: