Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions
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

List of all members.

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.
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.
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.
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().
void force_grayscale ()
 Sets the actual number of channels to indicate a grayscale image, presumably after discovering that the image contains no colored pixels.
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.
void fully_define ()
 If any properties remain unspecified, specify them now.
int get_num_channels () const
 Returns the number of channels (1 through 4) associated with the image.
string get_string () const
 Returns a string corresponding to the TextureProperties object.
virtual TypeHandle get_type () const
bool has_num_channels () const
 Returns true if the number of channels is known.
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.
void update_egg_tex (EggTexture *egg_tex) const
 Adjusts the texture properties of the indicated egg reference to match these properties.
void update_properties (const TextureProperties &other)
 If the indicate TextureProperties structure is more specific than this one, updates this one.
bool uses_alpha () const
 Returns true if the texture uses an alpha channel, false otherwise.
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.

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

Static Protected Member Functions

static TypedWritablemake_TextureProperties (const FactoryParams &params)
 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.

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 34 of file textureProperties.h.


Member Function Documentation

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

Definition at line 100 of file textureProperties.cxx.

Referenced by ImageFile::clear_basic_properties().

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 856 of file textureProperties.cxx.

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

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 512 of file textureProperties.cxx.

Referenced by TextureReference::is_equivalent(), and TextureImage::post_txa_file().

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 899 of file textureProperties.cxx.

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

Referenced by PalettePage::fillin(), ImageFile::fillin(), TextureReference::fillin(), and make_TextureProperties().

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

Definition at line 156 of file textureProperties.cxx.

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 171 of file textureProperties.cxx.

If any properties remain unspecified, specify them now.

Also reconcile conflicting information.

Definition at line 270 of file textureProperties.cxx.

Referenced by TextureImage::post_txa_file().

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 129 of file textureProperties.cxx.

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

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 212 of file textureProperties.cxx.

Returns true if the number of channels is known.

Definition at line 117 of file textureProperties.cxx.

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

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

Definition at line 107 of file textureProperties.h.

TypedWritable * TextureProperties::make_TextureProperties ( 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 881 of file textureProperties.cxx.

References fillin().

Referenced by register_with_read_factory().

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

Definition at line 816 of file textureProperties.cxx.

References BamReader::get_factory(), and make_TextureProperties().

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 142 of file textureProperties.cxx.

Referenced by TextureImage::post_txa_file(), and SourceTextureImage::set_header().

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 495 of file textureProperties.cxx.

References EggTexture::set_anisotropic_degree().

Referenced by ImageFile::update_egg_tex().

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

Definition at line 237 of file textureProperties.cxx.

Referenced by ImageFile::update_properties().

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

Definition at line 184 of file textureProperties.cxx.

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

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 829 of file textureProperties.cxx.

References Datagram::add_bool(), Datagram::add_int32(), 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:
 All Classes Functions Variables Enumerations