Panda3D
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
Texture Class Reference

Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-d texture image, or the six 2-d faces of a cube map texture. More...

#include "texture.h"

Inheritance diagram for Texture:
TypedWritableReferenceCount Namable TypedWritable ReferenceCount MemoryBase TypedObject MemoryBase MemoryBase VideoTexture WebBrowserTexture

List of all members.

Classes

class  CData
class  RamImage

Public Types

enum  ComponentType { T_unsigned_byte, T_unsigned_short, T_float, T_unsigned_int_24_8 }
enum  CompressionMode {
  CM_default, CM_off, CM_on, CM_fxt1,
  CM_dxt1, CM_dxt2, CM_dxt3, CM_dxt4,
  CM_dxt5, CM_pvr1_2bpp, CM_pvr1_4bpp
}
enum  FilterType {
  FT_nearest, FT_linear, FT_nearest_mipmap_nearest, FT_linear_mipmap_nearest,
  FT_nearest_mipmap_linear, FT_linear_mipmap_linear, FT_shadow, FT_default,
  FT_invalid
}
enum  Format {
  F_depth_stencil = 1, F_color_index, F_red, F_green,
  F_blue, F_alpha, F_rgb, F_rgb5,
  F_rgb8, F_rgb12, F_rgb332, F_rgba,
  F_rgbm, F_rgba4, F_rgba5, F_rgba8,
  F_rgba12, F_luminance, F_luminance_alpha, F_luminance_alphamask,
  F_rgba16, F_rgba32, F_depth_component, F_depth_component16,
  F_depth_component24, F_depth_component32
}
enum  QualityLevel { QL_default, QL_fastest, QL_normal, QL_best }
enum  TextureType {
  TT_1d_texture, TT_2d_texture, TT_3d_texture, TT_2d_texture_array,
  TT_cube_map
}
enum  WrapMode {
  WM_clamp, WM_repeat, WM_mirror, WM_mirror_once,
  WM_border_color, WM_invalid
}

Public Member Functions

 Texture (const string &name=string())
 Constructs an empty texture.
bool adjust_this_size (int &x_size, int &y_size, const string &name, bool for_padding) const
 Works like adjust_size, but also considers the texture class.
void clear ()
 Reinitializes the texture to its default, empty state (except for the name).
void clear_alpha_filename ()
 Removes the alpha filename, if it was previously set.
void clear_alpha_fullpath ()
 Removes the alpha fullpath, if it was previously set.
void clear_aux_data (const string &key)
 Removes a record previously recorded via set_aux_data().
void clear_filename ()
 Removes the alpha filename, if it was previously set.
void clear_fullpath ()
 Removes the alpha fullpath, if it was previously set.
void clear_ram_image ()
 Discards the current system-RAM image.
void clear_ram_mipmap_image (int n)
 Discards the current system-RAM image for the nth mipmap level.
void clear_ram_mipmap_images ()
 Discards the current system-RAM image for all mipmap levels, except level 0 (the base image).
void clear_simple_ram_image ()
 Discards the current "simple" image.
bool compress_ram_image (CompressionMode compression=CM_on, QualityLevel quality_level=QL_default, GraphicsStateGuardianBase *gsg=NULL)
 Attempts to compress the texture's RAM image internally, to a format supported by the indicated GSG.
void consider_rescale (PNMImage &pnmimage)
 Asks the PNMImage to change its scale when it reads the image, according to the whims of the Config.prc file.
virtual bool cull_callback (CullTraverser *trav, const CullTraverserData &data) const
 If has_cull_callback() returns true, this function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
size_t estimate_texture_memory () const
 Estimates the amount of texture memory that will be consumed by loading this texture.
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.
virtual TypeHandle force_init_type ()
void generate_alpha_scale_map ()
 Generates a special 256x1 1-d texture that can be used to apply an arbitrary alpha scale to objects by judicious use of texture matrix.
void generate_normalization_cube_map (int size)
 Generates a special cube map image in the texture that can be used to apply bump mapping effects: for each texel in the cube map that is indexed by the 3-d texture coordinates (x, y, z), the resulting value is the normalized vector (x, y, z) (compressed from.
void generate_ram_mipmap_images ()
 Automatically fills in the n mipmap levels of the Texture, based on the texture's source image.
void generate_simple_ram_image ()
 Computes the "simple" ram image by loading the main RAM image, if it is not already available, and reducing it to 16x16 or smaller.
bool get_active (PreparedGraphicsObjects *prepared_objects) const
 Returns true if this Texture was rendered in the most recent frame within the indicated GSG.
const Filenameget_alpha_filename () const
 Returns the alpha_filename that has been set.
const Filenameget_alpha_fullpath () const
 Returns the alpha_fullpath that has been set.
int get_anisotropic_degree () const
 Returns the degree of anisotropic filtering that should be applied to the texture.
AutoTextureScale get_auto_texture_scale () const
 Returns the power-of-2 texture-scaling mode that will be applied to this particular texture when it is next loaded from disk.
TypedReferenceCountget_aux_data (const string &key) const
 Returns a record previously recorded via set_aux_data().
LColor get_border_color () const
 Returns the solid color of the texture's border.
ComponentType get_component_type () const
 Returns the numeric interpretation of each component of the texture.
int get_component_width () const
 Returns the number of bytes stored for each color component of a texel.
CompressionMode get_compression () const
 Returns the compression mode requested for this particular texture, or CM_off if the texture is not to be compressed.
size_t get_data_size_bytes (PreparedGraphicsObjects *prepared_objects) const
 Returns the number of bytes which the texture is reported to consume within graphics memory, for the indicated GSG.
int get_effective_anisotropic_degree () const
 Returns the degree of anisotropic filtering that should be applied to the texture.
FilterType get_effective_magfilter () const
 Returns the filter mode of the texture for magnification, with special treatment for FT_default.
FilterType get_effective_minfilter () const
 Returns the filter mode of the texture for minification, with special treatment for FT_default.
QualityLevel get_effective_quality_level () const
 Returns the current quality_level hint, or the global default quality_level if this texture doesn't specify a quality level.
int get_expected_mipmap_num_pages (int n) const
 Returns the total number of pages that the nth mipmap level should have, based on the texture's size.
int get_expected_mipmap_x_size (int n) const
 Returns the x_size that the nth mipmap level should have, based on the texture's size.
int get_expected_mipmap_y_size (int n) const
 Returns the y_size that the nth mipmap level should have, based on the texture's size.
int get_expected_mipmap_z_size (int n) const
 Returns the z_size that the nth mipmap level should have, based on the texture's size.
int get_expected_num_mipmap_levels () const
 Returns the number of mipmap levels that should be defined for this texture, given the texture's size.
size_t get_expected_ram_image_size () const
 Returns the number of bytes that *ought* to be used by the in-memory image, based on the texture parameters.
size_t get_expected_ram_mipmap_image_size (int n) const
 Returns the number of bytes that *ought* to be used by the in-memory image for mipmap level n, based on the texture parameters.
size_t get_expected_ram_mipmap_page_size (int n) const
 Returns the number of bytes that should be used per each Z page of the 3-d texture, for mipmap level n.
size_t get_expected_ram_mipmap_view_size (int n) const
 Returns the number of bytes that *ought* to be used by each view of the in-memory image for mipmap level n, based on the texture parameters.
size_t get_expected_ram_page_size () const
 Returns the number of bytes that should be used per each Z page of the 3-d texture.
const Filenameget_filename () const
 Returns the filename that has been set.
Format get_format () const
 Returns the format of the texture, which represents both the semantic meaning of the texels and, to some extent, their storage information.
const Filenameget_fullpath () const
 Returns the fullpath that has been set.
UpdateSeq get_image_modified () const
 Returns a sequence number which is guaranteed to change at least every time the texture image data (including mipmap levels) are modified.
virtual bool get_keep_ram_image () const
 Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering.
bool get_loaded_from_image () const
 Returns the flag that indicates the texture has been loaded from a disk file or PNMImage.
bool get_loaded_from_txo () const
 Returns the flag that indicates the texture has been loaded from a txo file.
FilterType get_magfilter () const
 Returns the filter mode of the texture for magnification.
bool get_match_framebuffer_format () const
 Returns true if the special flag was set that indicates to the GSG that the Texture's format should be chosen to exactly match the framebuffer's format, presumably because the application intends to copy image data from the framebuffer into the Texture (or vice-versa).
FilterType get_minfilter () const
 Returns the filter mode of the texture for minification.
int get_num_components () const
 Returns the number of color components for each texel of the texture image.
int get_num_loadable_ram_mipmap_images () const
 Returns the number of contiguous mipmap levels that exist in RAM, up until the first gap in the sequence.
int get_num_pages () const
 Returns the total number of pages in the texture.
int get_num_ram_mipmap_images () const
 Returns the maximum number of mipmap level images available in system memory.
int get_num_views () const
 Returns the number of "views" in the texture.
int get_orig_file_x_size () const
 Returns the X size of the original disk image that this Texture was loaded from (if it came from a disk file), before any automatic rescaling by Panda.
int get_orig_file_y_size () const
 Returns the Y size of the original disk image that this Texture was loaded from (if it came from a disk file), before any automatic rescaling by Panda.
int get_orig_file_z_size () const
 Returns the Z size of the original disk image that this Texture was loaded from (if it came from a disk file), before any automatic rescaling by Panda.
int get_pad_x_size () const
 Returns size of the pad region.
int get_pad_y_size () const
 Returns size of the pad region.
int get_pad_z_size () const
 Returns size of the pad region.
bool get_post_load_store_cache () const
 Returns the setting of the post_load_store_cache flag.
UpdateSeq get_properties_modified () const
 Returns a sequence number which is guaranteed to change at least every time the texture properties (unrelated to the image) are modified.
QualityLevel get_quality_level () const
 Returns the current quality_level hint.
CPTA_uchar get_ram_image ()
 Returns the system-RAM image data associated with the texture.
CPTA_uchar get_ram_image_as (const string &requested_format)
 Returns the uncompressed system-RAM image data associated with the texture.
CompressionMode get_ram_image_compression () const
 Returns the compression mode in which the ram image is already stored pre-compressed.
size_t get_ram_image_size () const
 Returns the total number of bytes used by the in-memory image, across all pages and views, or 0 if there is no in-memory image.
CPTA_uchar get_ram_mipmap_image (int n) const
 Returns the system-RAM image data associated with the nth mipmap level, if present.
size_t get_ram_mipmap_image_size (int n) const
 Returns the number of bytes used by the in-memory image for mipmap level n, or 0 if there is no in-memory image for this mipmap level.
size_t get_ram_mipmap_page_size (int n) const
 Returns the number of bytes used by the in-memory image per page for mipmap level n, or 0 if there is no in-memory image for this mipmap level.
void * get_ram_mipmap_pointer (int n) const
 Similiar to get_ram_mipmap_image(), however, in this case the void pointer for the given ram image is returned.
size_t get_ram_mipmap_view_size (int n) const
 Returns the number of bytes used by the in-memory image per view for mipmap level n, or 0 if there is no in-memory image for this mipmap level.
size_t get_ram_page_size () const
 Returns the number of bytes used by the in-memory image per page, or 0 if there is no in-memory image.
size_t get_ram_view_size () const
 Returns the number of bytes used by the in-memory image per view, or 0 if there is no in-memory image.
bool get_render_to_texture () const
 Returns a flag on the texture that indicates whether the texture is intended to be used as a direct-render target, by binding a framebuffer to a texture and rendering directly into the texture.
bool get_resident (PreparedGraphicsObjects *prepared_objects) const
 Returns true if this Texture is reported to be resident within graphics memory for the indicated GSG.
UpdateSeq get_simple_image_modified () const
 Returns a sequence number which is guaranteed to change at least every time the texture's "simple" image data is modified.
CPTA_uchar get_simple_ram_image () const
 Returns the image data associated with the "simple" texture image.
size_t get_simple_ram_image_size () const
 Returns the number of bytes used by the "simple" image, or 0 if there is no simple image.
int get_simple_x_size () const
 Returns the width of the "simple" image in texels.
int get_simple_y_size () const
 Returns the height of the "simple" image in texels.
LVecBase2 get_tex_scale () const
 Returns a scale pair that is suitable for applying to geometry via NodePath::set_tex_scale(), which will convert texture coordinates on the geometry from the range 0..1 into the appropriate range to render the video part of the texture.
TextureType get_texture_type () const
 Returns the overall interpretation of the texture.
virtual TypeHandle get_type () const
CPTA_uchar get_uncompressed_ram_image ()
 Returns the system-RAM image associated with the texture, in an uncompressed form if at all possible.
WrapMode get_wrap_u () const
 Returns the wrap mode of the texture in the U direction.
WrapMode get_wrap_v () const
 Returns the wrap mode of the texture in the V direction.
WrapMode get_wrap_w () const
 Returns the wrap mode of the texture in the W direction.
int get_x_size () const
 Returns the width of the texture image in texels.
int get_y_size () const
 Returns the height of the texture image in texels.
int get_z_size () const
 Returns the depth of the texture image in texels.
bool has_all_ram_mipmap_images () const
 Returns true if all expected mipmap levels have been defined and exist in the system RAM, or false if even one mipmap level is missing.
bool has_alpha_filename () const
 Returns true if the alpha_filename has been set and is available.
bool has_alpha_fullpath () const
 Returns true if the alpha_fullpath has been set and is available.
bool has_auto_texture_scale () const
 Returns true if set_auto_texture_scale() has been set to something other than ATS_unspecified for this particular texture.
bool has_compression () const
 Returns true if the texture indicates it wants to be compressed, either with CM_on or higher, or CM_default and compressed-textures is true.
virtual bool has_cull_callback () const
 Should be overridden by derived classes to return true if cull_callback() has been defined.
bool has_filename () const
 Returns true if the filename has been set and is available.
bool has_fullpath () const
 Returns true if the fullpath has been set and is available.
bool has_ram_image () const
 Returns true if the Texture has its image contents available in main RAM, false if it exists only in texture memory or in the prepared GSG context.
bool has_ram_mipmap_image (int n) const
 Returns true if the Texture has the nth mipmap level available in system memory, false otherwise.
bool has_simple_ram_image () const
 Returns true if the Texture has a "simple" image available in main RAM.
bool has_uncompressed_ram_image () const
 Returns true if the Texture has its image contents available in main RAM and is uncompressed, false otherwise.
virtual bool is_cacheable () const
 Returns true if there is enough information in this Texture object to write it to the bam cache successfully, false otherwise.
bool is_prepared (PreparedGraphicsObjects *prepared_objects) const
 Returns true if the texture has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.
bool load (const PNMImage &pnmimage, const LoaderOptions &options=LoaderOptions())
 Replaces the texture with the indicated image.
bool load (const PNMImage &pnmimage, int z, int n, const LoaderOptions &options=LoaderOptions())
 Stores the indicated image in the given page and mipmap level.
Textureload_related (const InternalName *suffix) const
 Loads a texture whose filename is derived by concatenating a suffix to the filename of this texture.
PTA_uchar make_ram_image ()
 Discards the current system-RAM image for the texture, if any, and allocates a new buffer of the appropriate size.
PTA_uchar make_ram_mipmap_image (int n)
 Discards the current system-RAM image for the nth mipmap level, if any, and allocates a new buffer of the appropriate size.
bool might_have_ram_image () const
 Returns true if the texture's image contents are currently available in main RAM, or there is reason to believe it can be loaded on demand.
PTA_uchar modify_ram_image ()
 Returns a modifiable pointer to the system-RAM image.
PTA_uchar modify_ram_mipmap_image (int n)
 Returns a modifiable pointer to the system-RAM image for the nth mipmap level.
PTA_uchar modify_simple_ram_image ()
 Returns a modifiable pointer to the internal "simple" texture image.
PTA_uchar new_simple_ram_image (int x_size, int y_size)
 Creates an empty array for the simple ram image of the indicated size, and returns a modifiable pointer to the new array.
void prepare (PreparedGraphicsObjects *prepared_objects)
 Indicates that the texture should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.
TextureContextprepare_now (int view, PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg)
 Creates a context for the texture on the particular GSG, if it does not already exist.
typedef PT (Texture) MakeTextureFunc()
 PT (Texture) make_copy() const
 PT (TexturePeeker) peek()
bool read (const Filename &fullpath, const LoaderOptions &options=LoaderOptions())
 Reads the named filename into the texture.
bool read (const Filename &fullpath, const Filename &alpha_fullpath, int primary_file_num_channels, int alpha_file_channel, const LoaderOptions &options=LoaderOptions())
 Combine a 3-component image with a grayscale image to get a 4-component image.
bool read (const Filename &fullpath, int z, int n, bool read_pages, bool read_mipmaps, const LoaderOptions &options=LoaderOptions())
 Reads a single file into a single page or mipmap level, or automatically reads a series of files into a series of pages and/or mipmap levels.
bool read (const Filename &fullpath, const Filename &alpha_fullpath, int primary_file_num_channels, int alpha_file_channel, int z, int n, bool read_pages, bool read_mipmaps, BamCacheRecord *record=NULL, const LoaderOptions &options=LoaderOptions())
 Reads the texture from the indicated filename.
bool read_dds (istream &in, const string &filename="", bool header_only=false)
 Reads the texture from a DDS file object.
bool read_txo (istream &in, const string &filename="")
 Reads the texture from a Panda texture object.
bool release (PreparedGraphicsObjects *prepared_objects)
 Frees the texture context only on the indicated object, if it exists there.
int release_all ()
 Frees the context allocated on all objects for which the texture has been declared.
bool reload ()
 Re-reads the Texture from its disk file.
bool rescale_texture ()
 This method is similar to consider_rescale(), but instead of scaling a separate PNMImage, it will ask the Texture to rescale its own internal image to a power of 2, according to the config file requirements.
void set_alpha_filename (const Filename &alpha_filename)
 Sets the name of the file that contains the image's alpha channel contents.
void set_alpha_fullpath (const Filename &alpha_fullpath)
 Sets the full pathname to the file that contains the image's alpha channel contents, as found along the search path.
void set_anisotropic_degree (int anisotropic_degree)
 Specifies the level of anisotropic filtering to apply to the texture.
void set_auto_texture_scale (AutoTextureScale scale)
 Specifies the power-of-2 texture-scaling mode that will be applied to this particular texture when it is next loaded from disk.
void set_aux_data (const string &key, TypedReferenceCount *aux_data)
 Records an arbitrary object in the Texture, associated with a specified key.
void set_border_color (const LColor &color)
 Specifies the solid color of the texture's border.
void set_component_type (ComponentType component_type)
 Changes the data value for the texture components.
void set_compression (CompressionMode compression)
 Requests that this particular Texture be compressed when it is loaded into texture memory.
void set_filename (const Filename &filename)
 Sets the name of the file that contains the image's contents.
void set_format (Format format)
 Changes the format value for the texture components.
void set_fullpath (const Filename &fullpath)
 Sets the full pathname to the file that contains the image's contents, as found along the search path.
void set_keep_ram_image (bool keep_ram_image)
 Sets the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering.
void set_loaded_from_image ()
 Sets the flag that indicates the texture has been loaded from a disk file or PNMImage.
void set_loaded_from_txo ()
 Sets the flag that indicates the texture has been loaded from a txo file.
void set_magfilter (FilterType filter)
void set_match_framebuffer_format (bool flag)
 Sets the special flag that, if true, indicates to the GSG that the Texture's format should be chosen to exactly match the framebuffer's format, presumably because the application intends to copy image data from the framebuffer into the Texture (or vice-versa).
void set_minfilter (FilterType filter)
void set_num_views (int num_views)
 Sets the number of "views" within a texture.
void set_orig_file_size (int x, int y, int z=1)
 Specifies the size of the texture as it exists in its original disk file, before any Panda scaling.
void set_pad_size (int x=0, int y=0, int z=0)
 Sets the size of the pad region.
void set_post_load_store_cache (bool flag)
 Sets the post_load_store_cache flag.
void set_quality_level (QualityLevel quality_level)
 Sets a hint to the renderer about the desired performance / quality tradeoff for this particular texture.
void set_ram_image (CPTA_uchar image, CompressionMode compression=CM_off, size_t page_size=0)
 Replaces the current system-RAM image with the new data.
void set_ram_image_as (CPTA_uchar image, const string &provided_format)
 Replaces the current system-RAM image with the new data, converting it first if necessary from the indicated component-order format.
void set_ram_mipmap_image (int n, CPTA_uchar image, size_t page_size=0)
 Replaces the current system-RAM image for the indicated mipmap level with the new data.
void set_ram_mipmap_pointer (int n, void *image, size_t page_size=0)
 Sets an explicit void pointer as the texture's mipmap image for the indicated level.
void set_ram_mipmap_pointer_from_int (long long pointer, int n, int page_size)
 Accepts a raw pointer cast as an int, which is then passed to set_ram_mipmap_pointer(); see the documentation for that method.
void set_render_to_texture (bool render_to_texture)
 Sets a flag on the texture that indicates whether the texture is intended to be used as a direct-render target, by binding a framebuffer to a texture and rendering directly into the texture.
void set_simple_ram_image (CPTA_uchar image, int x_size, int y_size)
 Replaces the internal "simple" texture image.
void set_size_padded (int x=1, int y=1, int z=1)
 Changes the size of the texture, padding if necessary, and setting the pad region as well.
void set_wrap_u (WrapMode wrap)
void set_wrap_v (WrapMode wrap)
void set_wrap_w (WrapMode wrap)
 The W wrap direction is only used for 3-d textures.
void set_x_size (int x_size)
 Changes the x size indicated for the texture.
void set_y_size (int y_size)
 Changes the y size indicated for the texture.
void set_z_size (int z_size)
 Changes the z size indicated for the texture.
void setup_1d_texture ()
 Sets the texture as an empty 1-d texture with no dimensions.
void setup_1d_texture (int x_size, ComponentType component_type, Format format)
 Sets the texture as an empty 1-d texture with the specified dimensions and properties.
void setup_2d_texture ()
 Sets the texture as an empty 2-d texture with no dimensions.
void setup_2d_texture (int x_size, int y_size, ComponentType component_type, Format format)
 Sets the texture as an empty 2-d texture with the specified dimensions and properties.
void setup_2d_texture_array (int z_size=1)
 Sets the texture as an empty 2-d texture array with no dimensions (though if you know the depth ahead of time, it saves a bit of reallocation later).
void setup_2d_texture_array (int x_size, int y_size, int z_size, ComponentType component_type, Format format)
 Sets the texture as an empty 2-d texture array with the specified dimensions and properties.
void setup_3d_texture (int z_size=1)
 Sets the texture as an empty 3-d texture with no dimensions (though if you know the depth ahead of time, it saves a bit of reallocation later).
void setup_3d_texture (int x_size, int y_size, int z_size, ComponentType component_type, Format format)
 Sets the texture as an empty 3-d texture with the specified dimensions and properties.
void setup_cube_map ()
 Sets the texture as an empty cube map texture with no dimensions.
void setup_cube_map (int size, ComponentType component_type, Format format)
 Sets the texture as an empty cube map texture with the specified dimensions and properties.
void setup_texture (TextureType texture_type, int x_size, int y_size, int z_size, ComponentType component_type, Format format)
 Sets the texture to the indicated type and dimensions, presumably in preparation for calling read() or load(), or set_ram_image() or modify_ram_image().
bool store (PNMImage &pnmimage) const
 Saves the texture to the indicated PNMImage, but does not write it to disk.
bool store (PNMImage &pnmimage, int z, int n) const
 Saves the indicated page and mipmap level of the texture to the PNMImage.
void texture_uploaded ()
 This method is called by the GraphicsEngine at the beginning of the frame *after* a texture has been successfully uploaded to graphics memory.
bool uncompress_ram_image ()
 Attempts to uncompress the texture's RAM image internally.
bool uses_mipmaps () const
 Returns true if the minfilter settings on this texture indicate the use of mipmapping, false otherwise.
bool was_image_modified (PreparedGraphicsObjects *prepared_objects) const
 Returns true if the texture needs to be re-loaded onto the indicated GSG, either because its image data is out-of-date, or because it's not fully prepared now.
bool write (const Filename &fullpath)
 Writes the texture to the named filename.
bool write (const Filename &fullpath, int z, int n, bool write_pages, bool write_mipmaps)
 Writes a single page or mipmap level to a single file, or automatically writes a series of pages and/or mipmap levels to a numbered series of files.
void write (ostream &out, int indent_level) const
 Not to be confused with write(Filename), this method simply describes the texture properties.
virtual void write_datagram (BamWriter *manager, Datagram &me)
 Function to write the important information in the particular object to a Datagram.
bool write_txo (ostream &out, const string &filename="") const
 Writes the texture to a Panda texture object.

Static Public Member Functions

static bool adjust_size (int &x_size, int &y_size, const string &name, bool for_padding, AutoTextureScale auto_texture_scale=ATS_unspecified)
 Computes the proper size of the texture, based on the original size, the filename, and the resizing whims of the config file.
static void consider_rescale (PNMImage &pnmimage, const string &name, AutoTextureScale auto_texture_scale=ATS_unspecified)
 Asks the PNMImage to change its scale when it reads the image, according to the whims of the Config.prc file.
static int down_to_power_2 (int value)
 Returns the largest power of 2 less than or equal to value.
static string format_component_type (ComponentType ct)
 Returns the indicated ComponentType converted to a string word.
static string format_compression_mode (CompressionMode cm)
 Returns the indicated CompressionMode converted to a string word.
static string format_filter_type (FilterType ft)
 Returns the indicated FilterType converted to a string word.
static string format_format (Format f)
 Returns the indicated Format converted to a string word.
static string format_quality_level (QualityLevel tql)
 Returns the indicated QualityLevel converted to a string word.
static string format_texture_type (TextureType tt)
 Returns the indicated TextureType converted to a string word.
static string format_wrap_mode (WrapMode wm)
 Returns the indicated WrapMode converted to a string word.
static TypeHandle get_class_type ()
static AutoTextureScale get_textures_power_2 ()
 This flag returns ATS_none, ATS_up, or ATS_down and controls the scaling of textures in general.
static bool has_alpha (Format format)
 Returns true if the indicated format includes alpha, false otherwise.
static bool has_binary_alpha (Format format)
 Returns true if the indicated format includes a binary alpha only, false otherwise.
static bool has_textures_power_2 ()
 If true, then get_textures_power_2 has been set using set_textures_power_2.
static void init_type ()
static bool is_mipmap (FilterType type)
 Returns true if the indicated filter type requires the use of mipmaps, or false if it does not.
static bool is_specific (CompressionMode compression)
 Returns true if the indicated compression mode is one of the specific compression types, false otherwise.
static PT (Texture) make_from_txo(istream &in
static PT (Texture) make_texture()
static void register_with_read_factory ()
 Factory method to generate a Texture object.
static void set_textures_power_2 (AutoTextureScale scale)
 Set this flag to ATS_none, ATS_up, ATS_down, or ATS_pad to control the scaling of textures in general, if a particular texture does not override this.
static ComponentType string_component_type (const string &str)
 Returns the ComponentType corresponding to the indicated string word.
static CompressionMode string_compression_mode (const string &str)
 Returns the CompressionMode value associated with the given string representation.
static FilterType string_filter_type (const string &str)
 Returns the FilterType value associated with the given string representation, or FT_invalid if the string does not match any known FilterType value.
static Format string_format (const string &str)
 Returns the Format corresponding to the indicated string word.
static QualityLevel string_quality_level (const string &str)
 Returns the QualityLevel value associated with the given string representation.
static TextureType string_texture_type (const string &str)
 Returns the TextureType corresponding to the indicated string word.
static WrapMode string_wrap_mode (const string &str)
 Returns the WrapMode value associated with the given string representation, or WM_invalid if the string does not match any known WrapMode value.
static int up_to_power_2 (int value)
 Returns the smallest power of 2 greater than or equal to value.

Public Attributes

static const string & filename = "")

Protected Types

typedef CycleDataLockedReader
< CData
CDLockedReader
typedef CycleDataReader< CDataCDReader
typedef CycleDataStageReader
< CData
CDStageReader
typedef CycleDataStageWriter
< CData
CDStageWriter
typedef CycleDataWriter< CDataCDWriter
typedef pmap< int,
TextureContext * > 
Contexts
typedef pmap
< PreparedGraphicsObjects
*, Contexts > 
PreparedViews
typedef pvector< RamImageRamImages
typedef pmap< CPT(InternalName),
PT(Texture)> 
RelatedTextures

Protected Member Functions

 Texture (const Texture &copy)
 Use Texture::make_copy() to make a duplicate copy of an existing Texture.
bool consider_auto_process_ram_image (bool generate_mipmaps, bool allow_compression)
 Should be called after a texture has been loaded into RAM, this considers generating mipmaps and/or compressing the RAM image.
virtual bool do_adjust_this_size (const CData *cdata, int &x_size, int &y_size, const string &name, bool for_padding) const
 Works like adjust_size, but also considers the texture class.
virtual void do_allocate_pages (CData *cdata)
 Called internally by do_reconsider_z_size() to allocate new memory in _ram_images[0] for the new number of pages.
void do_assign (CData *cdata, const Texture *copy, const CData *cdata_copy)
 The internal implementation of operator =().
virtual bool do_can_reload (const CData *cdata) const
 Returns true if we can safely call do_reload_ram_image() in order to make the image available, or false if we shouldn't do this (because we know from a priori knowledge that it wouldn't work anyway).
virtual void do_clear (CData *cdata)
 The protected implementation of clear().
void do_clear_ram_image (CData *cdata)
void do_clear_ram_mipmap_images (CData *cdata)
void do_clear_simple_ram_image (CData *cdata)
bool do_compress_ram_image (CData *cdata, CompressionMode compression, QualityLevel quality_level, GraphicsStateGuardianBase *gsg)
bool do_consider_auto_process_ram_image (CData *cdata, bool generate_mipmaps, bool allow_compression)
 Should be called after a texture has been loaded into RAM, this considers generating mipmaps and/or compressing the RAM image.
virtual void do_fillin_body (CData *cdata, DatagramIterator &scan, BamReader *manager)
 Reads in the part of the Texture that was written with do_write_datagram_body().
virtual void do_fillin_from (CData *cdata, const Texture *dummy)
 Called in make_from_bam(), this method properly copies the attributes from the bam stream (as stored in dummy) into this texture, updating the modified flags appropriately.
virtual void do_fillin_rawdata (CData *cdata, DatagramIterator &scan, BamReader *manager)
 Reads in the part of the Texture that was written with do_write_datagram_rawdata().
void do_generate_ram_mipmap_images (CData *cdata)
AutoTextureScale do_get_auto_texture_scale (const CData *cdata) const
virtual void do_get_bam_rawdata (CData *cdata)
 If do_has_bam_rawdata() returned false, this attempts to reload the rawdata image if possible.
int do_get_expected_mipmap_num_pages (const CData *cdata, int n) const
int do_get_expected_mipmap_x_size (const CData *cdata, int n) const
int do_get_expected_mipmap_y_size (const CData *cdata, int n) const
int do_get_expected_mipmap_z_size (const CData *cdata, int n) const
int do_get_expected_num_mipmap_levels (const CData *cdata) const
size_t do_get_expected_ram_image_size (const CData *cdata) const
size_t do_get_expected_ram_mipmap_image_size (const CData *cdata, int n) const
size_t do_get_expected_ram_mipmap_page_size (const CData *cdata, int n) const
size_t do_get_expected_ram_mipmap_view_size (const CData *cdata, int n) const
size_t do_get_expected_ram_page_size (const CData *cdata) const
size_t do_get_expected_ram_view_size (const CData *cdata) const
CPTA_uchar do_get_ram_image (CData *cdata)
size_t do_get_ram_image_size (const CData *cdata) const
size_t do_get_ram_mipmap_page_size (const CData *cdata, int n) const
CPTA_uchar do_get_uncompressed_ram_image (CData *cdata)
bool do_has_all_ram_mipmap_images (const CData *cdata) const
virtual bool do_has_bam_rawdata (const CData *cdata) const
 Returns true if there is a rawdata image that we have available to write to the bam stream.
bool do_has_compression (const CData *cdata) const
virtual bool do_has_ram_image (const CData *cdata) const
 The protected implementation of has_ram_image().
bool do_has_ram_mipmap_image (const CData *cdata, int n) const
virtual bool do_has_uncompressed_ram_image (const CData *cdata) const
 The protected implementation of has_uncompressed_ram_image().
virtual bool do_load_one (CData *cdata, const PNMImage &pnmimage, const string &name, int z, int n, const LoaderOptions &options)
 Internal method to load a single page or mipmap level.
PTA_uchar do_make_ram_image (CData *cdata)
 This is called internally to make a new ram image without updating cdata->_image_modified.
PTA_uchar do_make_ram_mipmap_image (CData *cdata, int n)
PTA_uchar do_modify_ram_image (CData *cdata)
 This is called internally to uniquify the ram image pointer without updating cdata->_image_modified.
PTA_uchar do_modify_ram_mipmap_image (CData *cdata, int n)
 This is called internally to uniquify the nth mipmap image pointer without updating cdata->_image_modified.
virtual bool do_read (CData *cdata, const Filename &fullpath, const Filename &alpha_fullpath, int primary_file_num_channels, int alpha_file_channel, int z, int n, bool read_pages, bool read_mipmaps, const LoaderOptions &options, BamCacheRecord *record)
 The internal implementation of the various read() methods.
bool do_read_dds (CData *cdata, istream &in, const string &filename, bool header_only)
bool do_read_dds_file (CData *cdata, const Filename &fullpath, bool header_only)
 Called internally when read() detects a DDS file.
virtual bool do_read_one (CData *cdata, const Filename &fullpath, const Filename &alpha_fullpath, int z, int n, int primary_file_num_channels, int alpha_file_channel, const LoaderOptions &options, bool header_only, BamCacheRecord *record)
 Called only from do_read(), this method reads a single image file, either one page or one mipmap level.
bool do_read_txo (CData *cdata, istream &in, const string &filename)
bool do_read_txo_file (CData *cdata, const Filename &fullpath)
 Called internally when read() detects a txo file.
bool do_reconsider_image_properties (CData *cdata, int x_size, int y_size, int num_components, ComponentType component_type, int z, const LoaderOptions &options)
 Resets the internal Texture properties when a new image file is loaded.
bool do_reconsider_z_size (CData *cdata, int z, const LoaderOptions &options)
 Considers whether the z_size (or num_views) should automatically be adjusted when the user loads a new page.
bool do_reload (CData *cdata)
virtual void do_reload_ram_image (CData *cdata, bool allow_compression)
 Called when the Texture image is required but the ram image is not available, this will reload it from disk or otherwise do whatever is required to make it available, if possible.
bool do_rescale_texture (CData *cdata)
void do_set_anisotropic_degree (CData *cdata, int anisotropic_degree)
void do_set_border_color (CData *cdata, const LColor &color)
void do_set_component_type (CData *cdata, ComponentType component_type)
void do_set_compression (CData *cdata, CompressionMode compression)
void do_set_format (CData *cdata, Format format)
void do_set_magfilter (CData *cdata, FilterType filter)
void do_set_minfilter (CData *cdata, FilterType filter)
void do_set_num_views (CData *cdata, int num_views)
void do_set_pad_size (CData *cdata, int x, int y, int z)
void do_set_quality_level (CData *cdata, QualityLevel quality_level)
void do_set_ram_image (CData *cdata, CPTA_uchar image, CompressionMode compression=CM_off, size_t page_size=0)
 Replaces the current system-RAM image with the new data.
void do_set_ram_mipmap_image (CData *cdata, int n, CPTA_uchar image, size_t page_size)
void do_set_simple_ram_image (CData *cdata, CPTA_uchar image, int x_size, int y_size)
void do_set_wrap_u (CData *cdata, WrapMode wrap)
void do_set_wrap_v (CData *cdata, WrapMode wrap)
void do_set_wrap_w (CData *cdata, WrapMode wrap)
void do_set_x_size (CData *cdata, int x_size)
void do_set_y_size (CData *cdata, int y_size)
void do_set_z_size (CData *cdata, int z_size)
 Changes the z size indicated for the texture.
void do_setup_texture (CData *cdata, TextureType texture_type, int x_size, int y_size, int z_size, ComponentType component_type, Format format)
bool do_store_one (CData *cdata, PNMImage &pnmimage, int z, int n)
 Internal method to copy a page and/or mipmap level to a PNMImage.
bool do_uncompress_ram_image (CData *cdata)
bool do_write (CData *cdata, const Filename &fullpath, int z, int n, bool write_pages, bool write_mipmaps)
 Internal method to write a series of pages and/or mipmap levels to disk files.
virtual void do_write_datagram_body (CData *cdata, BamWriter *manager, Datagram &me)
 Writes the body part of the texture to the Datagram.
void do_write_datagram_header (CData *cdata, BamWriter *manager, Datagram &me, bool &has_rawdata)
 Writes the header part of the texture to the Datagram.
virtual void do_write_datagram_rawdata (CData *cdata, BamWriter *manager, Datagram &me)
 Writes the rawdata part of the texture to the Datagram.
bool do_write_one (CData *cdata, const Filename &fullpath, int z, int n)
 Internal method to write the indicated page and mipmap level to a disk image file.
bool do_write_txo (const CData *cdata, ostream &out, const string &filename) const
bool do_write_txo_file (const CData *cdata, const Filename &fullpath) const
 Called internally when write() detects a txo filename.
virtual TypedWritablemake_this_from_bam (const FactoryParams &params)
 Called by make_from_bam() once the particular subclass of Texture is known.
void operator= (const Texture &copy)
 Use Texture::make_copy() to make a duplicate copy of an existing Texture.
virtual PT (Texture) make_copy_impl() const
 PT (Texture) do_make_copy(const CData *cdata) const
virtual void reconsider_dirty ()
 Called by TextureContext to give the Texture a chance to mark itself dirty before rendering, if necessary.
virtual CDataunlocked_ensure_ram_image (bool allow_compression)
 If the texture has a ram image already, this acquires the CData write lock and returns it.

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 Factory method to generate a Texture object.

Protected Attributes

ConditionVarFull _cvar
PipelineCycler< CData_cycler
Mutex _lock
PreparedViews _prepared_views
RelatedTextures _related_textures
bool _reloading
Filename _texture_pool_key

Friends

class PreparedGraphicsObjects
class TextureContext
class TexturePeeker
class TexturePool

Detailed Description

Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-d texture image, or the six 2-d faces of a cube map texture.

A texture's image data might be stored in system RAM (see get_ram_image()) or its image may be represented in texture memory on one or more GraphicsStateGuardians (see prepare()), or both. The typical usage pattern is that a texture is loaded from an image file on disk, which copies its image data into system RAM; then the first time the texture is rendered its image data is copied to texture memory (actually, to the graphics API), and the system RAM image is automatically freed.

Definition at line 71 of file texture.h.


Constructor & Destructor Documentation

Texture::Texture ( const string &  name = string())

Constructs an empty texture.

The default is to set up the texture as an empty 2-d texture; follow up with one of the variants of setup_texture() if this is not what you want.

Definition at line 171 of file texture.cxx.

Referenced by make_from_bam().

Texture::Texture ( const Texture copy) [protected]

Use Texture::make_copy() to make a duplicate copy of an existing Texture.

Definition at line 190 of file texture.cxx.


Member Function Documentation

bool Texture::adjust_size ( int &  x_size,
int &  y_size,
const string &  name,
bool  for_padding,
AutoTextureScale  auto_texture_scale = ATS_unspecified 
) [static]

Computes the proper size of the texture, based on the original size, the filename, and the resizing whims of the config file.

x_size and y_size should be loaded with the texture image's original size on disk. On return, they will be loaded with the texture's in-memory target size. The return value is true if the size has been adjusted, or false if it is the same.

Definition at line 2525 of file texture.cxx.

References down_to_power_2(), GraphicsStateGuardianBase::get_default_gsg(), ConfigVariableList::get_num_unique_values(), get_textures_power_2(), ConfigVariableList::get_unique_value(), and up_to_power_2().

Referenced by consider_rescale(), VideoTexture::do_adjust_this_size(), and do_adjust_this_size().

bool Texture::adjust_this_size ( int &  x_size,
int &  y_size,
const string &  name,
bool  for_padding 
) const [inline]

Works like adjust_size, but also considers the texture class.

Movie textures, for instance, always pad outwards, regardless of textures-power-2.

Definition at line 2317 of file texture.I.

References do_adjust_this_size().

Referenced by MovieVideoCursor::setup_texture().

void Texture::clear ( ) [inline]

Reinitializes the texture to its default, empty state (except for the name).

Definition at line 47 of file texture.I.

void Texture::clear_alpha_filename ( ) [inline]

Removes the alpha filename, if it was previously set.

See set_alpha_filename().

Definition at line 2026 of file texture.I.

void Texture::clear_alpha_fullpath ( ) [inline]

Removes the alpha fullpath, if it was previously set.

See set_alpha_fullpath().

Definition at line 2079 of file texture.I.

void Texture::clear_aux_data ( const string &  key)

Removes a record previously recorded via set_aux_data().

Definition at line 604 of file texture.cxx.

void Texture::clear_filename ( ) [inline]

Removes the alpha filename, if it was previously set.

See set_filename().

Definition at line 1992 of file texture.I.

void Texture::clear_fullpath ( ) [inline]

Removes the alpha fullpath, if it was previously set.

See set_fullpath().

Definition at line 2052 of file texture.I.

void Texture::clear_ram_image ( ) [inline]

Discards the current system-RAM image.

Definition at line 1423 of file texture.I.

Referenced by GraphicsOutput::add_render_texture(), DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

Discards the current system-RAM image for the nth mipmap level.

Definition at line 1139 of file texture.cxx.

Discards the current system-RAM image for all mipmap levels, except level 0 (the base image).

Definition at line 1710 of file texture.I.

Discards the current "simple" image.

Definition at line 1838 of file texture.I.

bool Texture::compress_ram_image ( Texture::CompressionMode  compression = CM_on,
Texture::QualityLevel  quality_level = QL_default,
GraphicsStateGuardianBase gsg = NULL 
) [inline]

Attempts to compress the texture's RAM image internally, to a format supported by the indicated GSG.

In order for this to work, the squish library must have been compiled into Panda.

If compression is CM_on, then an appropriate compression method that is supported by the indicated GSG is automatically chosen. If the GSG pointer is NULL, any of the standard DXT1/3/5 compression methods will be used, regardless of whether it is supported.

If compression is any specific compression method, that method is used regardless of whether the GSG supports it.

quality_level determines the speed/quality tradeoff of the compression. If it is QL_default, the texture's own quality_level parameter is used.

Returns true if successful, false otherwise.

Definition at line 1475 of file texture.I.

bool Texture::consider_auto_process_ram_image ( bool  generate_mipmaps,
bool  allow_compression 
) [protected]

Should be called after a texture has been loaded into RAM, this considers generating mipmaps and/or compressing the RAM image.

Returns true if the image was modified by this operation, false if it wasn't.

Definition at line 4165 of file texture.cxx.

References do_consider_auto_process_ram_image().

Referenced by load().

void Texture::consider_rescale ( PNMImage pnmimage)

Asks the PNMImage to change its scale when it reads the image, according to the whims of the Config.prc file.

This method should be called after pnmimage.read_header() has been called, but before pnmimage.read(). Also see rescale_texture().

Definition at line 1886 of file texture.cxx.

References get_auto_texture_scale().

Referenced by do_read_one().

void Texture::consider_rescale ( PNMImage pnmimage,
const string &  name,
AutoTextureScale  auto_texture_scale = ATS_unspecified 
) [static]

Asks the PNMImage to change its scale when it reads the image, according to the whims of the Config.prc file.

This method should be called after pnmimage.read_header() has been called, but before pnmimage.read(). Also see rescale_texture().

Definition at line 1902 of file texture.cxx.

References adjust_size(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), and PNMImage::set_read_size().

bool Texture::cull_callback ( CullTraverser trav,
const CullTraverserData data 
) const [virtual]

If has_cull_callback() returns true, this function will be called during the cull traversal to perform any additional operations that should be performed at cull time.

This is called each time the Texture is discovered applied to a Geom in the traversal. It should return true if the Geom is visible, false if it should be omitted.

Reimplemented in WebBrowserTexture, and VideoTexture.

Definition at line 2433 of file texture.cxx.

Referenced by TextureAttrib::cull_callback().

bool Texture::do_adjust_this_size ( const CData cdata,
int &  x_size,
int &  y_size,
const string &  name,
bool  for_padding 
) const [protected, virtual]

Works like adjust_size, but also considers the texture class.

Movie textures, for instance, always pad outwards, regardless of textures-power-2.

Reimplemented in VideoTexture.

Definition at line 2639 of file texture.cxx.

References adjust_size().

Referenced by adjust_this_size(), do_read_one(), and do_reload_ram_image().

void Texture::do_allocate_pages ( CData cdata) [protected, virtual]

Called internally by do_reconsider_z_size() to allocate new memory in _ram_images[0] for the new number of pages.

Assumes the lock is already held.

Definition at line 4461 of file texture.cxx.

Referenced by do_reconsider_z_size().

void Texture::do_assign ( CData cdata,
const Texture copy,
const CData cdata_copy 
) [protected]

The internal implementation of operator =().

Assumes the lock is already held on both Textures.

Definition at line 4656 of file texture.cxx.

References do_assign().

Referenced by do_assign(), and do_clear().

bool Texture::do_can_reload ( const CData cdata) const [protected, virtual]

Returns true if we can safely call do_reload_ram_image() in order to make the image available, or false if we shouldn't do this (because we know from a priori knowledge that it wouldn't work anyway).

Reimplemented in VideoTexture.

Definition at line 5525 of file texture.cxx.

Referenced by unlocked_ensure_ram_image().

void Texture::do_clear ( CData cdata) [protected, virtual]

The protected implementation of clear().

Assumes the lock is already held.

Definition at line 4667 of file texture.cxx.

References do_assign(), and ReferenceCount::local_object().

Referenced by load(), and read().

bool Texture::do_consider_auto_process_ram_image ( CData cdata,
bool  generate_mipmaps,
bool  allow_compression 
) [protected]

Should be called after a texture has been loaded into RAM, this considers generating mipmaps and/or compressing the RAM image.

Returns true if the image was modified by this operation, false if it wasn't.

Definition at line 4181 of file texture.cxx.

References GraphicsStateGuardianBase::get_default_gsg().

Referenced by consider_auto_process_ram_image(), do_read(), and do_reload_ram_image().

void Texture::do_fillin_body ( CData cdata,
DatagramIterator scan,
BamReader manager 
) [protected, virtual]
void Texture::do_fillin_from ( CData cdata,
const Texture dummy 
) [protected, virtual]

Called in make_from_bam(), this method properly copies the attributes from the bam stream (as stored in dummy) into this texture, updating the modified flags appropriately.

Definition at line 7448 of file texture.cxx.

Referenced by make_this_from_bam().

void Texture::do_fillin_rawdata ( CData cdata,
DatagramIterator scan,
BamReader manager 
) [protected, virtual]
void Texture::do_get_bam_rawdata ( CData cdata) [protected, virtual]

If do_has_bam_rawdata() returned false, this attempts to reload the rawdata image if possible.

Definition at line 5572 of file texture.cxx.

Referenced by do_write(), and do_write_datagram_header().

bool Texture::do_has_bam_rawdata ( const CData cdata) const [protected, virtual]

Returns true if there is a rawdata image that we have available to write to the bam stream.

For a normal Texture, this is the same thing as do_has_ram_image(), but a movie texture might define it differently.

Definition at line 5561 of file texture.cxx.

References do_has_ram_image().

Referenced by do_write(), do_write_datagram_header(), and is_cacheable().

bool Texture::do_has_ram_image ( const CData cdata) const [protected, virtual]

The protected implementation of has_ram_image().

Assumes the lock is already held.

Reimplemented in VideoTexture.

Definition at line 5036 of file texture.cxx.

Referenced by do_has_bam_rawdata(), do_reload_ram_image(), has_ram_image(), might_have_ram_image(), unlocked_ensure_ram_image(), and write().

bool Texture::do_has_uncompressed_ram_image ( const CData cdata) const [protected, virtual]

The protected implementation of has_uncompressed_ram_image().

Assumes the lock is already held.

Definition at line 5048 of file texture.cxx.

Referenced by do_write(), and has_uncompressed_ram_image().

bool Texture::do_load_one ( CData cdata,
const PNMImage pnmimage,
const string &  name,
int  z,
int  n,
const LoaderOptions options 
) [protected, virtual]
PTA_uchar Texture::do_make_ram_image ( CData cdata) [protected]

This is called internally to make a new ram image without updating cdata->_image_modified.

Definition at line 4049 of file texture.cxx.

Referenced by do_modify_ram_image(), generate_alpha_scale_map(), generate_normalization_cube_map(), and make_ram_image().

PTA_uchar Texture::do_modify_ram_image ( CData cdata) [protected]

This is called internally to uniquify the ram image pointer without updating cdata->_image_modified.

Definition at line 4032 of file texture.cxx.

References do_make_ram_image().

Referenced by do_load_one(), and modify_ram_image().

PTA_uchar Texture::do_modify_ram_mipmap_image ( CData cdata,
int  n 
) [protected]

This is called internally to uniquify the nth mipmap image pointer without updating cdata->_image_modified.

Definition at line 4100 of file texture.cxx.

Referenced by do_load_one(), and modify_ram_mipmap_image().

bool Texture::do_read ( CData cdata,
const Filename fullpath,
const Filename alpha_fullpath,
int  primary_file_num_channels,
int  alpha_file_channel,
int  z,
int  n,
bool  read_pages,
bool  read_mipmaps,
const LoaderOptions options,
BamCacheRecord record 
) [protected, virtual]
bool Texture::do_read_dds_file ( CData cdata,
const Filename fullpath,
bool  header_only 
) [protected]

Called internally when read() detects a DDS file.

Assumes the lock is already held.

Definition at line 3258 of file texture.cxx.

References VirtualFileSystem::close_read_file(), Filename::get_basename_wo_extension(), VirtualFileSystem::get_global_ptr(), and Namable::has_name().

Referenced by do_read().

bool Texture::do_read_one ( CData cdata,
const Filename fullpath,
const Filename alpha_fullpath,
int  z,
int  n,
int  primary_file_num_channels,
int  alpha_file_channel,
const LoaderOptions options,
bool  header_only,
BamCacheRecord record 
) [protected, virtual]
bool Texture::do_read_txo_file ( CData cdata,
const Filename fullpath 
) [protected]

Called internally when read() detects a txo file.

Assumes the lock is already held.

Definition at line 3199 of file texture.cxx.

References VirtualFileSystem::close_read_file(), and VirtualFileSystem::get_global_ptr().

Referenced by do_read().

bool Texture::do_reconsider_image_properties ( CData cdata,
int  x_size,
int  y_size,
int  num_components,
Texture::ComponentType  component_type,
int  z,
const LoaderOptions options 
) [protected]

Resets the internal Texture properties when a new image file is loaded.

Returns true if the new image is valid, false otherwise.

Assumes the lock is already held.

Definition at line 4481 of file texture.cxx.

Referenced by do_load_one().

bool Texture::do_reconsider_z_size ( CData cdata,
int  z,
const LoaderOptions options 
) [protected]

Considers whether the z_size (or num_views) should automatically be adjusted when the user loads a new page.

Returns true if the z size is valid, false otherwise.

Assumes the lock is already held.

Definition at line 4411 of file texture.cxx.

References do_allocate_pages(), and LoaderOptions::get_texture_num_views().

Referenced by do_load_one().

void Texture::do_reload_ram_image ( CData cdata,
bool  allow_compression 
) [protected, virtual]

Called when the Texture image is required but the ram image is not available, this will reload it from disk or otherwise do whatever is required to make it available, if possible.

Assumes the lock is already held. The lock will be held during the duration of this operation.

Reimplemented in VideoTexture.

Definition at line 3906 of file texture.cxx.

References BamCacheRecord::add_dependent_file(), do_adjust_this_size(), do_consider_auto_process_ram_image(), do_has_ram_image(), do_read(), Filename::get_basename(), BamCache::get_cache_compressed_textures(), BamCache::get_cache_textures(), BamCacheRecord::get_data(), BamCache::get_global_ptr(), BamCacheRecord::has_data(), BamCacheRecord::set_data(), BamCache::store(), and uses_mipmaps().

void Texture::do_set_ram_image ( CData cdata,
CPTA_uchar  image,
Texture::CompressionMode  compression = CM_off,
size_t  page_size = 0 
) [protected]

Replaces the current system-RAM image with the new data.

If compression is not CM_off, it indicates that the new data is already pre-compressed in the indicated format.

This does *not* affect keep_ram_image.

Definition at line 4070 of file texture.cxx.

References ConstPointerToArray< Element >::cast_non_const().

Referenced by set_ram_image(), and set_ram_image_as().

void Texture::do_set_z_size ( CData cdata,
int  z_size 
) [protected]

Changes the z size indicated for the texture.

This also implicitly unloads the texture if it has already been loaded.

Definition at line 4858 of file texture.cxx.

Referenced by do_read(), set_size_padded(), and set_z_size().

bool Texture::do_store_one ( CData cdata,
PNMImage pnmimage,
int  z,
int  n 
) [protected]

Internal method to copy a page and/or mipmap level to a PNMImage.

Definition at line 3698 of file texture.cxx.

Referenced by do_write_one(), and generate_simple_ram_image().

bool Texture::do_write ( CData cdata,
const Filename fullpath,
int  z,
int  n,
bool  write_pages,
bool  write_mipmaps 
) [protected]

Internal method to write a series of pages and/or mipmap levels to disk files.

Definition at line 3579 of file texture.cxx.

References do_get_bam_rawdata(), do_has_bam_rawdata(), do_has_uncompressed_ram_image(), do_write_one(), do_write_txo_file(), Filename::has_hash(), and Filename::pattern_filename().

Referenced by write().

void Texture::do_write_datagram_body ( CData cdata,
BamWriter manager,
Datagram me 
) [protected, virtual]

Writes the body part of the texture to the Datagram.

This is generally all of the texture parameters except for the header and the rawdata.

Definition at line 7107 of file texture.cxx.

References Datagram::add_bool(), Datagram::add_int16(), Datagram::add_int32(), Datagram::add_uint32(), Datagram::add_uint8(), Datagram::append_data(), has_simple_ram_image(), and LVecBase4f::write_datagram().

Referenced by write_datagram().

void Texture::do_write_datagram_header ( CData cdata,
BamWriter manager,
Datagram me,
bool &  has_rawdata 
) [protected]

Writes the header part of the texture to the Datagram.

This is the common part that is shared by all Texture subclasses, and contains the filename and rawdata flags. This method is not virtual because all Texture subclasses must write the same data at this step.

This part must be read first before calling do_fillin_body() to determine whether to load the Texture from the TexturePool or directly from the bam stream.

After this call, has_rawdata will be filled with either true or false, according to whether we expect to write the texture rawdata to the bam stream following the texture body.

Definition at line 7016 of file texture.cxx.

References Datagram::add_bool(), Datagram::add_string(), Datagram::add_uint8(), do_get_bam_rawdata(), do_has_bam_rawdata(), Filename::get_basename(), VirtualFileSystem::get_cwd(), Filename::get_dirname(), BamWriter::get_file_texture_mode(), BamWriter::get_filename(), and VirtualFileSystem::get_global_ptr().

Referenced by write_datagram().

void Texture::do_write_datagram_rawdata ( CData cdata,
BamWriter manager,
Datagram me 
) [protected, virtual]

Writes the rawdata part of the texture to the Datagram.

Definition at line 7145 of file texture.cxx.

References Datagram::add_uint32(), Datagram::add_uint8(), and Datagram::append_data().

Referenced by write_datagram().

bool Texture::do_write_one ( CData cdata,
const Filename fullpath,
int  z,
int  n 
) [protected]

Internal method to write the indicated page and mipmap level to a disk image file.

Definition at line 3671 of file texture.cxx.

References do_store_one(), and PNMImage::write().

Referenced by do_write().

bool Texture::do_write_txo_file ( const CData cdata,
const Filename fullpath 
) const [protected]

Called internally when write() detects a txo filename.

Definition at line 3724 of file texture.cxx.

References VirtualFileSystem::close_write_file(), VirtualFileSystem::get_global_ptr(), and VirtualFileSystem::open_write_file().

Referenced by do_write().

int Texture::down_to_power_2 ( int  value) [static]

Returns the largest power of 2 less than or equal to value.

Definition at line 1866 of file texture.cxx.

Referenced by adjust_size(), generate_simple_ram_image(), and ParasiteBuffer::set_size_and_recalc().

Estimates the amount of texture memory that will be consumed by loading this texture.

This returns a value that is not specific to any particular graphics card or driver; it tries to make a reasonable assumption about how a driver will load the texture. It does not account for texture compression or anything fancy. This is mainly useful for debugging and reporting purposes.

Returns a value in bytes.

Definition at line 516 of file texture.cxx.

References uses_mipmaps().

Referenced by DXTextureContext8::create_texture().

void Texture::finalize ( BamReader manager) [virtual]

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.

Reimplemented from TypedWritable.

Definition at line 6982 of file texture.cxx.

References ReferenceCount::get_ref_count(), and ReferenceCount::unref().

string Texture::format_component_type ( ComponentType  ct) [static]

Returns the indicated ComponentType converted to a string word.

Definition at line 1965 of file texture.cxx.

string Texture::format_compression_mode ( CompressionMode  cm) [static]

Returns the indicated CompressionMode converted to a string word.

Definition at line 2263 of file texture.cxx.

string Texture::format_filter_type ( FilterType  ft) [static]

Returns the indicated FilterType converted to a string word.

Definition at line 2142 of file texture.cxx.

string Texture::format_format ( Format  f) [static]

Returns the indicated Format converted to a string word.

Definition at line 2010 of file texture.cxx.

string Texture::format_quality_level ( QualityLevel  tql) [static]

Returns the indicated QualityLevel converted to a string word.

Definition at line 2337 of file texture.cxx.

string Texture::format_texture_type ( TextureType  tt) [static]

Returns the indicated TextureType converted to a string word.

Definition at line 1917 of file texture.cxx.

string Texture::format_wrap_mode ( WrapMode  wm) [static]

Returns the indicated WrapMode converted to a string word.

Definition at line 2209 of file texture.cxx.

Generates a special 256x1 1-d texture that can be used to apply an arbitrary alpha scale to objects by judicious use of texture matrix.

The texture is a gradient, with an alpha of 0 on the left (U = 0), and 255 on the right (U = 1).

Definition at line 338 of file texture.cxx.

References do_make_ram_image().

Generates a special cube map image in the texture that can be used to apply bump mapping effects: for each texel in the cube map that is indexed by the 3-d texture coordinates (x, y, z), the resulting value is the normalized vector (x, y, z) (compressed from.

-1..1 into 0..1).

Definition at line 233 of file texture.cxx.

References do_make_ram_image(), LVecBase3f::normalize(), and LMatrix4f::xform_point().

Automatically fills in the n mipmap levels of the Texture, based on the texture's source image.

This requires the texture's uncompressed ram image to be available in system memory. If it is not already, it will be fetched if possible.

This call is not normally necessary, since the mipmap levels will be generated automatically if needed. But there may be certain cases in which you would like to call this explicitly.

Definition at line 1731 of file texture.I.

References unlocked_ensure_ram_image().

Computes the "simple" ram image by loading the main RAM image, if it is not already available, and reducing it to 16x16 or smaller.

This may be an expensive operation.

Definition at line 1194 of file texture.cxx.

References do_store_one(), down_to_power_2(), PNMImageHeader::get_num_channels(), ConfigVariableInt::get_word(), and PNMImage::quick_filter_from().

bool Texture::get_active ( PreparedGraphicsObjects prepared_objects) const

Returns true if this Texture was rendered in the most recent frame within the indicated GSG.

Definition at line 1408 of file texture.cxx.

References BufferContext::get_active().

const Filename & Texture::get_alpha_filename ( ) const [inline]

Returns the alpha_filename that has been set.

If this is set, it represents the name of the alpha component, which is stored in a separate file. See also get_filename(), and get_alpha_fullpath().

Definition at line 404 of file texture.I.

const Filename & Texture::get_alpha_fullpath ( ) const [inline]

Returns the alpha_fullpath that has been set.

This is the full path to the alpha part of the image file as it was found along the texture search path.

Definition at line 455 of file texture.I.

int Texture::get_anisotropic_degree ( ) const [inline]

Returns the degree of anisotropic filtering that should be applied to the texture.

This value may return 0, indicating the default value; see also get_effective_anisotropic_degree.

Definition at line 929 of file texture.I.

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), and MultitexReducer::flatten().

AutoTextureScale Texture::get_auto_texture_scale ( ) const [inline]

Returns the power-of-2 texture-scaling mode that will be applied to this particular texture when it is next loaded from disk.

See set_textures_power_2().

Definition at line 1903 of file texture.I.

Referenced by consider_rescale().

TypedReferenceCount * Texture::get_aux_data ( const string &  key) const

Returns a record previously recorded via set_aux_data().

Returns NULL if there was no record associated with the indicated key.

Definition at line 617 of file texture.cxx.

LColor Texture::get_border_color ( ) const [inline]

Returns the solid color of the texture's border.

Some OpenGL implementations use a border for tiling textures; in Panda, it is only used for specifying the clamp color.

Definition at line 960 of file texture.I.

Referenced by DXGraphicsStateGuardian8::apply_texture(), DXGraphicsStateGuardian9::apply_texture(), and TinyGraphicsStateGuardian::framebuffer_copy_to_texture().

Texture::ComponentType Texture::get_component_type ( ) const [inline]
int Texture::get_component_width ( ) const [inline]
Texture::CompressionMode Texture::get_compression ( ) const [inline]

Returns the compression mode requested for this particular texture, or CM_off if the texture is not to be compressed.

If a value other than CM_off is returned, this is not a guarantee that the texture is actually successfully compressed on the GSG. It may be that the GSG does not support the requested compression mode, in which case the texture may actually be stored uncompressed in texture memory.

Definition at line 980 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

size_t Texture::get_data_size_bytes ( PreparedGraphicsObjects prepared_objects) const

Returns the number of bytes which the texture is reported to consume within graphics memory, for the indicated GSG.

This may return a nonzero value even if the texture is not currently resident; you should also check get_resident() if you want to know how much space the texture is actually consuming right now.

Definition at line 1379 of file texture.cxx.

References BufferContext::get_data_size_bytes().

Returns the degree of anisotropic filtering that should be applied to the texture.

This value will normally not return 0, unless there is an error in the config file.

Definition at line 943 of file texture.I.

Referenced by DXGraphicsStateGuardian8::apply_texture(), and DXGraphicsStateGuardian9::apply_texture().

Texture::FilterType Texture::get_effective_magfilter ( ) const

Returns the filter mode of the texture for magnification, with special treatment for FT_default.

This will normally not return FT_default, unless there is an error in the config file.

Definition at line 840 of file texture.cxx.

Referenced by DXGraphicsStateGuardian8::apply_texture(), and DXGraphicsStateGuardian9::apply_texture().

Texture::FilterType Texture::get_effective_minfilter ( ) const

Returns the filter mode of the texture for minification, with special treatment for FT_default.

This will normally not return FT_default, unless there is an error in the config file.

Definition at line 819 of file texture.cxx.

Referenced by DXGraphicsStateGuardian8::apply_texture(), DXGraphicsStateGuardian9::apply_texture(), and uses_mipmaps().

Texture::QualityLevel Texture::get_effective_quality_level ( ) const [inline]

Returns the current quality_level hint, or the global default quality_level if this texture doesn't specify a quality level.

This value will not normally return QL_default (unless there is an error in the config file)

Definition at line 1074 of file texture.I.

int Texture::get_expected_mipmap_num_pages ( int  n) const [inline]

Returns the total number of pages that the nth mipmap level should have, based on the texture's size.

This is usually the same as get_expected_mipmap_z_size(), except for a multiview texture, in which case it is get_expected_mipmap_z_size() * get_num_views().

Definition at line 1144 of file texture.I.

int Texture::get_expected_mipmap_x_size ( int  n) const [inline]

Returns the x_size that the nth mipmap level should have, based on the texture's size.

Definition at line 1105 of file texture.I.

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

int Texture::get_expected_mipmap_y_size ( int  n) const [inline]

Returns the y_size that the nth mipmap level should have, based on the texture's size.

Definition at line 1117 of file texture.I.

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

int Texture::get_expected_mipmap_z_size ( int  n) const [inline]

Returns the z_size that the nth mipmap level should have, based on the texture's size.

Definition at line 1129 of file texture.I.

Returns the number of mipmap levels that should be defined for this texture, given the texture's size.

Note that this returns a number appropriate for mipmapping, even if the texture does not currently have mipmapping enabled.

Definition at line 1093 of file texture.I.

size_t Texture::get_expected_ram_image_size ( ) const [inline]

Returns the number of bytes that *ought* to be used by the in-memory image, based on the texture parameters.

Definition at line 1273 of file texture.I.

size_t Texture::get_expected_ram_mipmap_image_size ( int  n) const [inline]

Returns the number of bytes that *ought* to be used by the in-memory image for mipmap level n, based on the texture parameters.

Definition at line 1619 of file texture.I.

size_t Texture::get_expected_ram_mipmap_page_size ( int  n) const [inline]

Returns the number of bytes that should be used per each Z page of the 3-d texture, for mipmap level n.

For a 2-d or 1-d texture, this is the same as get_expected_ram_mipmap_view_size(n).

Definition at line 1648 of file texture.I.

size_t Texture::get_expected_ram_mipmap_view_size ( int  n) const [inline]

Returns the number of bytes that *ought* to be used by each view of the in-memory image for mipmap level n, based on the texture parameters.

For a normal, non-multiview texture, this is the same as get_expected_ram_mipmap_image_size(n).

Definition at line 1634 of file texture.I.

size_t Texture::get_expected_ram_page_size ( ) const [inline]
const Filename & Texture::get_filename ( ) const [inline]

Returns the filename that has been set.

This is the name of the file as it was requested. Also see get_fullpath().

Definition at line 378 of file texture.I.

Referenced by SpriteParticleRenderer::add_texture(), and SpriteParticleRenderer::set_texture().

Texture::Format Texture::get_format ( ) const [inline]
const Filename & Texture::get_fullpath ( ) const [inline]

Returns the fullpath that has been set.

This is the full path to the file as it was found along the texture search path.

Definition at line 429 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

Returns a sequence number which is guaranteed to change at least every time the texture image data (including mipmap levels) are modified.

Definition at line 1864 of file texture.I.

Referenced by TextureContext::mark_loaded(), GraphicsEngine::texture_uploaded(), and TextureContext::was_image_modified().

bool Texture::get_keep_ram_image ( ) const [virtual]

Returns the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering.

See set_keep_ram_image().

Reimplemented in WebBrowserTexture, and VideoTexture.

Definition at line 987 of file texture.cxx.

bool Texture::get_loaded_from_image ( ) const [inline]

Returns the flag that indicates the texture has been loaded from a disk file or PNMImage.

See set_loaded_from_image().

Definition at line 2193 of file texture.I.

bool Texture::get_loaded_from_txo ( ) const [inline]

Returns the flag that indicates the texture has been loaded from a txo file.

Definition at line 2219 of file texture.I.

Texture::FilterType Texture::get_magfilter ( ) const [inline]

Returns the filter mode of the texture for magnification.

The mipmap constants are invalid here. This may return FT_default; see also get_effective_minfilter().

Definition at line 915 of file texture.I.

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), MultitexReducer::flatten(), and StaticTextFont::StaticTextFont().

bool Texture::get_match_framebuffer_format ( ) const [inline]

Returns true if the special flag was set that indicates to the GSG that the Texture's format should be chosen to exactly match the framebuffer's format, presumably because the application intends to copy image data from the framebuffer into the Texture (or vice-versa).

Definition at line 2235 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

Texture::FilterType Texture::get_minfilter ( ) const [inline]

Returns the filter mode of the texture for minification.

If this is one of the mipmap constants, then the texture requires mipmaps. This may return FT_default; see also get_effective_minfilter().

Definition at line 901 of file texture.I.

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), MultitexReducer::flatten(), and StaticTextFont::StaticTextFont().

int Texture::get_num_components ( ) const [inline]

Returns the number of contiguous mipmap levels that exist in RAM, up until the first gap in the sequence.

It is guaranteed that at least mipmap levels [0, get_num_ram_mipmap_images()) exist.

The number returned will never exceed the number of required mipmap images based on the size of the texture and its filter mode.

This method is different from get_num_ram_mipmap_images() in that it returns only the number of mipmap levels that can actually be usefully loaded, regardless of the actual number that may be stored.

Definition at line 1025 of file texture.cxx.

References uses_mipmaps().

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

int Texture::get_num_pages ( ) const [inline]

Returns the total number of pages in the texture.

Each "page" is a 2-d texture image within the larger image--a face of a cube map, or a level of a 3-d texture. Normally, get_num_pages() is the same as get_z_size(). However, in a multiview texture, this returns get_z_size() * get_num_views().

Definition at line 528 of file texture.I.

References get_num_views(), and get_z_size().

int Texture::get_num_ram_mipmap_images ( ) const [inline]

Returns the maximum number of mipmap level images available in system memory.

The actual number may be less than this (that is, there might be gaps in the sequence); use has_ram_mipmap_image() to verify each level.

Also see get_num_loadable_ram_mipmap_images().

Definition at line 1519 of file texture.I.

int Texture::get_num_views ( ) const [inline]

Returns the number of "views" in the texture.

A view is a completely separate image stored within the Texture object. Most textures have only one view, but a stereo texture, for instance, may have two views, a left and a right image. Other uses for multiple views are not yet defined.

If this value is greater than one, the additional views are accessed as additional pages beyond get_z_size().

Definition at line 512 of file texture.I.

Referenced by PreparedGraphicsObjects::begin_frame(), DXGraphicsStateGuardian9::extract_texture_data(), and get_num_pages().

int Texture::get_orig_file_x_size ( ) const [inline]

Returns the X size of the original disk image that this Texture was loaded from (if it came from a disk file), before any automatic rescaling by Panda.

Definition at line 621 of file texture.I.

int Texture::get_orig_file_y_size ( ) const [inline]

Returns the Y size of the original disk image that this Texture was loaded from (if it came from a disk file), before any automatic rescaling by Panda.

Definition at line 634 of file texture.I.

int Texture::get_orig_file_z_size ( ) const [inline]

Returns the Z size of the original disk image that this Texture was loaded from (if it came from a disk file), before any automatic rescaling by Panda.

Definition at line 647 of file texture.I.

int Texture::get_pad_x_size ( ) const [inline]

Returns size of the pad region.

See set_pad_size.

Definition at line 538 of file texture.I.

Referenced by GraphicsStateGuardian::fetch_specified_part(), and CardMaker::set_uv_range().

int Texture::get_pad_y_size ( ) const [inline]

Returns size of the pad region.

See set_pad_size.

Definition at line 549 of file texture.I.

Referenced by GraphicsStateGuardian::fetch_specified_part(), and CardMaker::set_uv_range().

int Texture::get_pad_z_size ( ) const [inline]

Returns size of the pad region.

See set_pad_size.

Definition at line 560 of file texture.I.

Referenced by GraphicsStateGuardian::fetch_specified_part().

bool Texture::get_post_load_store_cache ( ) const [inline]

Returns the setting of the post_load_store_cache flag.

See set_post_load_store_cache().

Definition at line 2267 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

Returns a sequence number which is guaranteed to change at least every time the texture properties (unrelated to the image) are modified.

Definition at line 1851 of file texture.I.

Referenced by TextureContext::mark_loaded(), TextureContext::mark_simple_loaded(), and TextureContext::was_properties_modified().

Texture::QualityLevel Texture::get_quality_level ( ) const [inline]

Returns the current quality_level hint.

See set_quality_level(). This value may return QL_default; see get_effective_quality_level().

Definition at line 1059 of file texture.I.

Referenced by StaticTextFont::StaticTextFont().

Returns the system-RAM image data associated with the texture.

If the texture does not currently have an associated RAM image, and the texture was generated by loading an image from a disk file (the most common case), this forces the reload of the same texture. This can happen if keep_texture_ram is configured to false, and we have previously prepared this texture with a GSG.

Note that it is not correct to call has_ram_image() first to test whether this function will fail. A false return value from has_ram_image() indicates only that get_ram_image() may need to reload the texture from disk, which it will do automatically. However, you can call might_have_ram_image(), which will return true if the ram image exists, or there is a reasonable reason to believe it can be loaded.

On the other hand, it is possible that the texture cannot be found on disk or is otherwise unavailable. If that happens, this function will return NULL. There is no way to predict with 100% accuracy whether get_ram_image() will return NULL without calling it first; might_have_ram_image() is the closest.

Definition at line 1321 of file texture.I.

References unlocked_ensure_ram_image().

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

CPTA_uchar Texture::get_ram_image_as ( const string &  requested_format)

Returns the uncompressed system-RAM image data associated with the texture.

Rather than just returning a pointer to the data, like get_uncompressed_ram_image, this function first processes the data and reorders the components using the specified format string, and places these into a new char array. The 'format' argument should specify in which order the components of the texture must be. For example, valid format strings are "RGBA", "GA", "ABRG" or "AAA". A component can also be written as "0" or "1", which means an empty/black or a full/white channel, respectively. This function is particularly useful to copy an image in-memory to a different library (for example, PIL or wxWidgets) that require a different component order than Panda's internal format, BGRA. Note, however, that this conversion can still be too slow if you want to do it every frame, and should thus be avoided for that purpose. The only requirement for the reordering is that an uncompressed image must be available. If the RAM image is compressed, it will attempt to re-load the texture from disk, if it doesn't find an uncompressed image there, it will return NULL.

Definition at line 5146 of file texture.cxx.

Texture::CompressionMode Texture::get_ram_image_compression ( ) const [inline]

Returns the compression mode in which the ram image is already stored pre-compressed.

If this is other than CM_off, you cannot rely on the contents of the ram image to be anything predicatable (it will not be an array of x by y pixels, and it probably won't have the same length as get_expected_ram_image_size()).

Definition at line 1337 of file texture.I.

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), DXGraphicsStateGuardian8::prepare_texture(), DXGraphicsStateGuardian9::prepare_texture(), DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().

size_t Texture::get_ram_image_size ( ) const [inline]

Returns the total number of bytes used by the in-memory image, across all pages and views, or 0 if there is no in-memory image.

Definition at line 1220 of file texture.I.

Referenced by TinyGraphicsStateGuardian::framebuffer_copy_to_ram().

Returns the system-RAM image data associated with the nth mipmap level, if present.

Returns NULL if the nth mipmap level is not present.

Definition at line 1062 of file texture.cxx.

size_t Texture::get_ram_mipmap_image_size ( int  n) const [inline]

Returns the number of bytes used by the in-memory image for mipmap level n, or 0 if there is no in-memory image for this mipmap level.

Definition at line 1561 of file texture.I.

size_t Texture::get_ram_mipmap_page_size ( int  n) const [inline]

Returns the number of bytes used by the in-memory image per page for mipmap level n, or 0 if there is no in-memory image for this mipmap level.

For a non-compressed texture, this is the same as get_expected_ram_mipmap_page_size(). For a compressed texture, this may be a smaller value. (We do assume that all pages will be the same size on a compressed texture).

Definition at line 1606 of file texture.I.

void * Texture::get_ram_mipmap_pointer ( int  n) const

Similiar to get_ram_mipmap_image(), however, in this case the void pointer for the given ram image is returned.

This will be NULL unless it has been explicitly set.

Definition at line 1079 of file texture.cxx.

size_t Texture::get_ram_mipmap_view_size ( int  n) const [inline]

Returns the number of bytes used by the in-memory image per view for mipmap level n, or 0 if there is no in-memory image for this mipmap level.

A "view" is a collection of z_size pages for each mipmap level. Most textures have only one view, except for multiview or stereo textures.

For a non-compressed texture, this is the same as get_expected_ram_mipmap_view_size(). For a compressed texture, this may be a smaller value. (We do assume that all pages will be the same size on a compressed texture).

Definition at line 1587 of file texture.I.

size_t Texture::get_ram_page_size ( ) const [inline]

Returns the number of bytes used by the in-memory image per page, or 0 if there is no in-memory image.

For a non-compressed texture, this is the same as get_expected_ram_page_size(). For a compressed texture, this may be a smaller value. (We do assume that all pages will be the same size on a compressed texture).

Definition at line 1256 of file texture.I.

size_t Texture::get_ram_view_size ( ) const [inline]

Returns the number of bytes used by the in-memory image per view, or 0 if there is no in-memory image.

Since each view is a stack of z_size pages, this is get_z_size() * get_ram_page_size().

Definition at line 1234 of file texture.I.

bool Texture::get_render_to_texture ( ) const [inline]

Returns a flag on the texture that indicates whether the texture is intended to be used as a direct-render target, by binding a framebuffer to a texture and rendering directly into the texture.

Normally, a user should not need to set this flag directly; it is set automatically by the low-level display code when a texture is bound to a framebuffer.

Definition at line 1019 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

bool Texture::get_resident ( PreparedGraphicsObjects prepared_objects) const

Returns true if this Texture is reported to be resident within graphics memory for the indicated GSG.

Definition at line 1438 of file texture.cxx.

References BufferContext::get_resident().

Returns a sequence number which is guaranteed to change at least every time the texture's "simple" image data is modified.

Definition at line 1877 of file texture.I.

Referenced by TextureContext::mark_simple_loaded(), and TextureContext::was_simple_image_modified().

Returns the image data associated with the "simple" texture image.

This is provided for some textures as an option to display while the main texture image is being loaded from disk.

Unlike get_ram_image(), this function will always return immediately. Either the simple image is available, or it is not.

The "simple" image is always 4 components, 1 byte each, regardless of the parameters of the full texture. The simple image is only supported for ordinary 2-d textures.

Definition at line 1801 of file texture.I.

size_t Texture::get_simple_ram_image_size ( ) const [inline]

Returns the number of bytes used by the "simple" image, or 0 if there is no simple image.

Definition at line 1778 of file texture.I.

int Texture::get_simple_x_size ( ) const [inline]

Returns the width of the "simple" image in texels.

Definition at line 1743 of file texture.I.

int Texture::get_simple_y_size ( ) const [inline]

Returns the height of the "simple" image in texels.

Definition at line 1754 of file texture.I.

LVecBase2 Texture::get_tex_scale ( ) const [inline]

Returns a scale pair that is suitable for applying to geometry via NodePath::set_tex_scale(), which will convert texture coordinates on the geometry from the range 0..1 into the appropriate range to render the video part of the texture.

This is necessary only if a padding size has been set via set_pad_size() (or implicitly via something like "textures-power-2 pad" in the config.prc file). In this case, this is a convenient way to generate UV's that reflect the built-in padding size.

Definition at line 581 of file texture.I.

Texture::TextureType Texture::get_texture_type ( ) const [inline]
AutoTextureScale Texture::get_textures_power_2 ( ) [inline, static]

This flag returns ATS_none, ATS_up, or ATS_down and controls the scaling of textures in general.

It is initialized from the config variable of the same name, but it can be subsequently adjusted. See also get_auto_texture_scale().

Definition at line 1945 of file texture.I.

Referenced by adjust_size().

Returns the system-RAM image associated with the texture, in an uncompressed form if at all possible.

If get_ram_image_compression() is CM_off, then the system-RAM image is already uncompressed, and this returns the same thing as get_ram_image().

If get_ram_image_compression() is anything else, then the system-RAM image is compressed. In this case, the image will be reloaded from the *original* file (not from the cache), in the hopes that an uncompressed image will be found there.

If an uncompressed image cannot be found, returns NULL.

Definition at line 1379 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

Texture::WrapMode Texture::get_wrap_u ( ) const [inline]

Returns the wrap mode of the texture in the U direction.

Definition at line 861 of file texture.I.

Referenced by DXGraphicsStateGuardian8::apply_texture(), and DXGraphicsStateGuardian9::apply_texture().

Texture::WrapMode Texture::get_wrap_v ( ) const [inline]

Returns the wrap mode of the texture in the V direction.

Definition at line 873 of file texture.I.

Referenced by DXGraphicsStateGuardian8::apply_texture(), and DXGraphicsStateGuardian9::apply_texture().

Texture::WrapMode Texture::get_wrap_w ( ) const [inline]

Returns the wrap mode of the texture in the W direction.

This is the depth direction of 3-d textures.

Definition at line 886 of file texture.I.

Referenced by DXGraphicsStateGuardian8::apply_texture(), and DXGraphicsStateGuardian9::apply_texture().

int Texture::get_x_size ( ) const [inline]
int Texture::get_y_size ( ) const [inline]
int Texture::get_z_size ( ) const [inline]

Returns the depth of the texture image in texels.

For a 1-d texture or 2-d texture, this will be 1. For a cube map texture, this will be 6.

Definition at line 492 of file texture.I.

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), DXGraphicsStateGuardian8::do_framebuffer_copy_to_ram(), DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram(), GraphicsStateGuardian::fetch_specified_part(), TinyGraphicsStateGuardian::framebuffer_copy_to_ram(), and get_num_pages().

bool Texture::has_all_ram_mipmap_images ( ) const [inline]

Returns true if all expected mipmap levels have been defined and exist in the system RAM, or false if even one mipmap level is missing.

Definition at line 1548 of file texture.I.

bool Texture::has_alpha ( Format  format) [static]

Returns true if the indicated format includes alpha, false otherwise.

Definition at line 2474 of file texture.cxx.

Referenced by EggRenderState::fill_state().

bool Texture::has_alpha_filename ( ) const [inline]

Returns true if the alpha_filename has been set and is available.

See set_alpha_filename().

Definition at line 390 of file texture.I.

bool Texture::has_alpha_fullpath ( ) const [inline]

Returns true if the alpha_fullpath has been set and is available.

See set_alpha_fullpath().

Definition at line 441 of file texture.I.

bool Texture::has_auto_texture_scale ( ) const [inline]

Returns true if set_auto_texture_scale() has been set to something other than ATS_unspecified for this particular texture.

Definition at line 1916 of file texture.I.

bool Texture::has_binary_alpha ( Format  format) [static]

Returns true if the indicated format includes a binary alpha only, false otherwise.

Definition at line 2501 of file texture.cxx.

Referenced by EggRenderState::fill_state().

bool Texture::has_compression ( ) const [inline]

Returns true if the texture indicates it wants to be compressed, either with CM_on or higher, or CM_default and compressed-textures is true.

If true returned, this is not a guarantee that the texture is actually successfully compressed on the GSG. It may be that the GSG does not support the requested compression mode, in which case the texture may actually be stored uncompressed in texture memory.

Definition at line 1000 of file texture.I.

bool Texture::has_cull_callback ( ) const [virtual]

Should be overridden by derived classes to return true if cull_callback() has been defined.

Otherwise, returns false to indicate cull_callback() does not need to be called for this node during the cull traversal.

Reimplemented in WebBrowserTexture, and VideoTexture.

Definition at line 2415 of file texture.cxx.

Referenced by TextureAttrib::has_cull_callback().

bool Texture::has_filename ( ) const [inline]

Returns true if the filename has been set and is available.

See set_filename().

Definition at line 365 of file texture.I.

bool Texture::has_fullpath ( ) const [inline]

Returns true if the fullpath has been set and is available.

See set_fullpath().

Definition at line 416 of file texture.I.

bool Texture::has_ram_image ( ) const [inline]

Returns true if the Texture has its image contents available in main RAM, false if it exists only in texture memory or in the prepared GSG context.

Note that this has nothing to do with whether get_ram_image() will fail or not. Even if has_ram_image() returns false, get_ram_image() may still return a valid RAM image, because get_ram_image() will automatically load the texture from disk if necessary. The only thing has_ram_image() tells you is whether the texture is available right now without hitting the disk first.

Note also that if an application uses only one GSG, it may appear that has_ram_image() returns true if the texture has not yet been loaded by the GSG, but this correlation is not true in general and should not be depended on. Specifically, if an application ever uses multiple GSG's in its lifetime (for instance, by opening more than one window, or by closing its window and opening another one later), then has_ram_image() may well return false on textures that have never been loaded on the current GSG.

Definition at line 1178 of file texture.I.

References do_has_ram_image().

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), DXGraphicsStateGuardian8::do_framebuffer_copy_to_ram(), DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram(), unlocked_ensure_ram_image(), DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().

bool Texture::has_ram_mipmap_image ( int  n) const [inline]

Returns true if the Texture has the nth mipmap level available in system memory, false otherwise.

If the texture's minfilter mode requires mipmapping (see uses_mipmaps()), and all the texture's mipmap levels are not available when the texture is rendered, they will be generated automatically.

Definition at line 1535 of file texture.I.

bool Texture::has_simple_ram_image ( ) const [inline]

Returns true if the Texture has a "simple" image available in main RAM.

Definition at line 1766 of file texture.I.

Referenced by do_fillin_body(), do_write_datagram_body(), DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().

bool Texture::has_textures_power_2 ( ) [inline, static]

If true, then get_textures_power_2 has been set using set_textures_power_2.

If false, then get_textures_power_2 simply returns the config variable of the same name.

Definition at line 1962 of file texture.I.

bool Texture::has_uncompressed_ram_image ( ) const [inline]

Returns true if the Texture has its image contents available in main RAM and is uncompressed, false otherwise.

See has_ram_image().

Definition at line 1191 of file texture.I.

References do_has_uncompressed_ram_image().

Referenced by DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().

bool Texture::is_cacheable ( ) const [virtual]

Returns true if there is enough information in this Texture object to write it to the bam cache successfully, false otherwise.

For most textures, this is the same as has_ram_image().

Definition at line 1001 of file texture.cxx.

References do_has_bam_rawdata().

bool Texture::is_mipmap ( FilterType  type) [static]

Returns true if the indicated filter type requires the use of mipmaps, or false if it does not.

Definition at line 1791 of file texture.cxx.

Referenced by uses_mipmaps().

bool Texture::is_prepared ( PreparedGraphicsObjects prepared_objects) const

Returns true if the texture has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.

Definition at line 1324 of file texture.cxx.

References PreparedGraphicsObjects::is_texture_queued().

Referenced by PreparedGraphicsObjects::is_texture_prepared().

bool Texture::is_specific ( Texture::CompressionMode  compression) [static]

Returns true if the indicated compression mode is one of the specific compression types, false otherwise.

Definition at line 2455 of file texture.cxx.

bool Texture::load ( const PNMImage pnmimage,
const LoaderOptions options = LoaderOptions() 
) [inline]

Replaces the texture with the indicated image.

Definition at line 288 of file texture.I.

References consider_auto_process_ram_image(), do_clear(), do_load_one(), and uses_mipmaps().

bool Texture::load ( const PNMImage pnmimage,
int  z,
int  n,
const LoaderOptions options = LoaderOptions() 
) [inline]

Stores the indicated image in the given page and mipmap level.

See read().

Definition at line 308 of file texture.I.

References do_load_one().

Texture * Texture::load_related ( const InternalName suffix) const

Loads a texture whose filename is derived by concatenating a suffix to the filename of this texture.

May return NULL, for example, if this texture doesn't have a filename.

Definition at line 765 of file texture.cxx.

References VirtualFileSystem::exists(), Filename::get_basename_wo_extension(), VirtualFileSystem::get_global_ptr(), InternalName::get_name(), and TexturePool::load_texture().

TypedWritable * Texture::make_from_bam ( const FactoryParams params) [static, protected]

Factory method to generate a Texture object.

Definition at line 7172 of file texture.cxx.

References Texture().

Referenced by register_with_read_factory().

PTA_uchar Texture::make_ram_image ( ) [inline]

Discards the current system-RAM image for the texture, if any, and allocates a new buffer of the appropriate size.

Returns the new buffer.

This does *not* affect keep_ram_image.

Definition at line 1394 of file texture.I.

References do_make_ram_image().

PTA_uchar Texture::make_ram_mipmap_image ( int  n) [inline]

Discards the current system-RAM image for the nth mipmap level, if any, and allocates a new buffer of the appropriate size.

Returns the new buffer.

This does *not* affect keep_ram_image.

Definition at line 1680 of file texture.I.

TypedWritable * Texture::make_this_from_bam ( const FactoryParams params) [protected, virtual]
bool Texture::might_have_ram_image ( ) const [inline]

Returns true if the texture's image contents are currently available in main RAM, or there is reason to believe it can be loaded on demand.

That is, this function returns a "best guess" as to whether get_ram_image() will succeed without actually calling it first.

Definition at line 1207 of file texture.I.

References do_has_ram_image().

Referenced by DXGraphicsStateGuardian8::apply_texture(), DXGraphicsStateGuardian9::apply_texture(), DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().

PTA_uchar Texture::modify_ram_image ( ) [inline]

Returns a modifiable pointer to the system-RAM image.

This assumes the RAM image should be uncompressed. If the RAM image has been dumped, or is stored compressed, creates a new one.

This does *not* affect keep_ram_image.

Definition at line 1353 of file texture.I.

References do_modify_ram_image().

Referenced by MovieVideoCursor::apply_to_texture(), MovieVideoCursor::apply_to_texture_alpha(), MovieVideoCursor::apply_to_texture_rgb(), DXTextureContext8::d3d_surface_to_texture(), DXTextureContext9::d3d_surface_to_texture(), and TinyGraphicsStateGuardian::framebuffer_copy_to_ram().

PTA_uchar Texture::modify_ram_mipmap_image ( int  n) [inline]

Returns a modifiable pointer to the system-RAM image for the nth mipmap level.

This assumes the RAM image is uncompressed; if this is not the case, raises an assertion.

This does *not* affect keep_ram_image.

Definition at line 1664 of file texture.I.

References do_modify_ram_mipmap_image().

Returns a modifiable pointer to the internal "simple" texture image.

See set_simple_ram_image().

Definition at line 1156 of file texture.cxx.

PTA_uchar Texture::new_simple_ram_image ( int  x_size,
int  y_size 
)

Creates an empty array for the simple ram image of the indicated size, and returns a modifiable pointer to the new array.

See set_simple_ram_image().

Definition at line 1170 of file texture.cxx.

void Texture::operator= ( const Texture copy) [protected]

Use Texture::make_copy() to make a duplicate copy of an existing Texture.

Definition at line 206 of file texture.cxx.

void Texture::prepare ( PreparedGraphicsObjects prepared_objects)

Indicates that the texture should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.

This will ensure the texture is already loaded into texture memory if it is expected to be rendered soon.

Use this function instead of prepare_now() to preload textures from a user interface standpoint.

Definition at line 1312 of file texture.cxx.

References PreparedGraphicsObjects::enqueue_texture().

Referenced by GeomNode::r_prepare_scene().

TextureContext * Texture::prepare_now ( int  view,
PreparedGraphicsObjects prepared_objects,
GraphicsStateGuardianBase gsg 
)

Creates a context for the texture on the particular GSG, if it does not already exist.

Returns the new (or old) TextureContext. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new textures. If this is not necessarily the case, you should use prepare() instead.

Normally, this is not called directly except by the GraphicsStateGuardian; a texture does not need to be explicitly prepared by the user before it may be rendered.

Definition at line 1821 of file texture.cxx.

References PreparedGraphicsObjects::prepare_texture_now().

Referenced by PreparedGraphicsObjects::begin_frame(), DXGraphicsStateGuardian8::extract_texture_data(), DXGraphicsStateGuardian9::extract_texture_data(), TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), DXGraphicsStateGuardian8::framebuffer_copy_to_texture(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), wdxGraphicsBuffer9::select_cube_map(), and wdxGraphicsBuffer8::select_cube_map().

bool Texture::read ( const Filename fullpath,
const LoaderOptions options = LoaderOptions() 
)

Reads the named filename into the texture.

Definition at line 364 of file texture.cxx.

References do_clear(), and do_read().

bool Texture::read ( const Filename fullpath,
const Filename alpha_fullpath,
int  primary_file_num_channels,
int  alpha_file_channel,
const LoaderOptions options = LoaderOptions() 
)

Combine a 3-component image with a grayscale image to get a 4-component image.

See the description of the full-parameter read() method for the meaning of the primary_file_num_channels and alpha_file_channel parameters.

Definition at line 385 of file texture.cxx.

References do_clear(), and do_read().

bool Texture::read ( const Filename fullpath,
int  z,
int  n,
bool  read_pages,
bool  read_mipmaps,
const LoaderOptions options = LoaderOptions() 
)

Reads a single file into a single page or mipmap level, or automatically reads a series of files into a series of pages and/or mipmap levels.

See the description of the full-parameter read() method for the meaning of the various parameters.

Definition at line 408 of file texture.cxx.

References do_read().

bool Texture::read ( const Filename fullpath,
const Filename alpha_fullpath,
int  primary_file_num_channels,
int  alpha_file_channel,
int  z,
int  n,
bool  read_pages,
bool  read_mipmaps,
BamCacheRecord record = NULL,
const LoaderOptions options = LoaderOptions() 
)

Reads the texture from the indicated filename.

If primary_file_num_channels is not 0, it specifies the number of components to downgrade the image to if it is greater than this number.

If the filename has the extension .txo, this implicitly reads a texture object instead of a filename (which replaces all of the texture properties). In this case, all the rest of the parameters are ignored, and the filename should not contain any hash marks; just the one named file will be read, since a single .txo file can contain all pages and mipmaps necessary to define a texture.

If alpha_fullpath is not empty, it specifies the name of a file from which to retrieve the alpha. In this case, alpha_file_channel represents the numeric channel of this image file to use as the resulting texture's alpha channel; usually, this is 0 to indicate the grayscale combination of r, g, b; or it may be a one-based channel number, e.g. 1 for the red channel, 2 for the green channel, and so on.

If read pages is false, then z indicates the page number into which this image will be assigned. Normally this is 0 for the first (or only) page of the texture. 3-D textures have one page for each level of depth, and cube map textures always have six pages.

If read_pages is true, multiple images will be read at once, one for each page of a cube map or a 3-D texture. In this case, the filename should contain a sequence of one or more hash marks ("#") which will be filled in with the z value of each page, zero-based. In this case, the z parameter indicates the maximum z value that will be loaded, or 0 to load all filenames that exist.

If read_mipmaps is false, then n indicates the mipmap level to which this image will be assigned. Normally this is 0 for the base texture image, but it is possible to load custom mipmap levels into the later images. After the base texture image is loaded (thus defining the size of the texture), you can call get_expected_num_mipmap_levels() to determine the maximum sensible value for n.

If read_mipmaps is true, multiple images will be read as above, but this time the images represent the different mipmap levels of the texture image. In this case, the n parameter indicates the maximum n value that will be loaded, or 0 to load all filenames that exist (up to the expected number of mipmap levels).

If both read_pages and read_mipmaps is true, then both sequences will be read; the filename should contain two sequences of hash marks, separated by some character such as a hyphen, underscore, or dot. The first hash mark sequence will be filled in with the mipmap level, while the second hash mark sequence will be the page index.

This method implicitly sets keep_ram_image to false.

Definition at line 488 of file texture.cxx.

References do_read().

bool Texture::read_dds ( istream &  in,
const string &  filename = "",
bool  header_only = false 
)

Reads the texture from a DDS file object.

This is a Microsoft-defined file format; it is similar in principle to a txo object, in that it is designed to contain the texture image in a form as similar as possible to its runtime image, and it can contain mipmaps, pre-compressed textures, and so on.

As with read_txo, the filename is just for reference.

Definition at line 749 of file texture.cxx.

bool Texture::read_txo ( istream &  in,
const string &  filename = "" 
)

Reads the texture from a Panda texture object.

This defines the complete Texture specification, including the image data as well as all texture properties. This only works if the txo file contains a static Texture image, as opposed to a subclass of Texture such as a movie texture.

Pass a real filename if it is available, or empty string if it is not.

Definition at line 641 of file texture.cxx.

void Texture::reconsider_dirty ( ) [protected, virtual]

Called by TextureContext to give the Texture a chance to mark itself dirty before rendering, if necessary.

Reimplemented in VideoTexture.

Definition at line 2628 of file texture.cxx.

Factory method to generate a Texture object.

Definition at line 6949 of file texture.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

bool Texture::release ( PreparedGraphicsObjects prepared_objects)

Frees the texture context only on the indicated object, if it exists there.

Returns true if it was released, false if it had not been prepared.

Definition at line 1468 of file texture.cxx.

References PreparedGraphicsObjects::dequeue_texture(), and PreparedGraphicsObjects::release_texture().

Referenced by PreparedGraphicsObjects::release_texture().

Frees the context allocated on all objects for which the texture has been declared.

Returns the number of contexts which have been freed.

Definition at line 1497 of file texture.cxx.

References PreparedGraphicsObjects::release_texture().

bool Texture::reload ( ) [inline]

Re-reads the Texture from its disk file.

Useful when you know the image on disk has recently changed, and you want to update the Texture image.

Returns true on success, false on failure (in which case, the Texture may or may not still be valid).

Definition at line 353 of file texture.I.

bool Texture::rescale_texture ( ) [inline]

This method is similar to consider_rescale(), but instead of scaling a separate PNMImage, it will ask the Texture to rescale its own internal image to a power of 2, according to the config file requirements.

This may be useful after loading a Texture image by hand, instead of reading it from a disk file. Returns true if the texture is changed, false if it was not.

Definition at line 2304 of file texture.I.

void Texture::set_alpha_filename ( const Filename alpha_filename) [inline]

Sets the name of the file that contains the image's alpha channel contents.

Normally, this is set automatically when the image is loaded, for instance via Texture::read().

The Texture's get_filename() function returns the name of the image file that was loaded into the buffer. In the case where a texture specified two separate files to load, a 1- or 3-channel color image and a 1-channel alpha image, this Filename is update to contain the name of the image file that was loaded into the buffer's alpha channel.

Definition at line 2014 of file texture.I.

void Texture::set_alpha_fullpath ( const Filename alpha_fullpath) [inline]

Sets the full pathname to the file that contains the image's alpha channel contents, as found along the search path.

Normally, this is set automatically when the image is loaded, for instance via Texture::read().

Definition at line 2067 of file texture.I.

void Texture::set_anisotropic_degree ( int  anisotropic_degree) [inline]

Specifies the level of anisotropic filtering to apply to the texture.

Set this 0 to indicate the default value, which is specified in the texture-anisotropic-degree config variable.

To explicitly disable anisotropic filtering, set this value to 1. To explicitly enable anisotropic filtering, set it to a value higher than 1; larger numbers indicate greater degrees of filtering.

Definition at line 787 of file texture.I.

Referenced by DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), and MultitexReducer::flatten().

void Texture::set_auto_texture_scale ( AutoTextureScale  scale) [inline]

Specifies the power-of-2 texture-scaling mode that will be applied to this particular texture when it is next loaded from disk.

See set_textures_power_2().

Definition at line 1890 of file texture.I.

void Texture::set_aux_data ( const string &  key,
TypedReferenceCount aux_data 
)

Records an arbitrary object in the Texture, associated with a specified key.

The object may later be retrieved by calling get_aux_data() with the same key.

These data objects are not recorded to a bam or txo file.

Definition at line 592 of file texture.cxx.

void Texture::set_border_color ( const LColor color) [inline]

Specifies the solid color of the texture's border.

Some OpenGL implementations use a border for tiling textures; in Panda, it is only used for specifying the clamp color.

Definition at line 801 of file texture.I.

void Texture::set_component_type ( Texture::ComponentType  component_type) [inline]

Changes the data value for the texture components.

This implicitly sets component_width as well.

Definition at line 2165 of file texture.I.

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::set_compression ( Texture::CompressionMode  compression) [inline]

Requests that this particular Texture be compressed when it is loaded into texture memory.

This refers to the internal compression of the texture image within texture memory; it is not related to jpeg or png compression, which are disk file compression formats. The actual disk file that generated this texture may be stored in a compressed or uncompressed format supported by Panda; it will be decompressed on load, and then recompressed by the graphics API if this parameter is not CM_off.

If the GSG does not support this texture compression mode, the texture will silently be loaded uncompressed.

Definition at line 826 of file texture.I.

Referenced by GraphicsOutput::add_render_texture(), and StaticTextFont::StaticTextFont().

void Texture::set_filename ( const Filename filename) [inline]

Sets the name of the file that contains the image's contents.

Normally, this is set automatically when the image is loaded, for instance via Texture::read().

The Texture's get_name() function used to return the filename, but now returns just the basename (without the extension), which is a more useful name for identifying an image in show code.

Definition at line 1980 of file texture.I.

void Texture::set_format ( Texture::Format  format) [inline]

Changes the format value for the texture components.

This implicitly sets num_components as well.

Definition at line 2153 of file texture.I.

Referenced by GraphicsOutput::add_render_texture(), DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::set_fullpath ( const Filename fullpath) [inline]

Sets the full pathname to the file that contains the image's contents, as found along the search path.

Normally, this is set automatically when the image is loaded, for instance via Texture::read().

Definition at line 2040 of file texture.I.

void Texture::set_keep_ram_image ( bool  keep_ram_image) [inline]

Sets the flag that indicates whether this Texture is eligible to have its main RAM copy of the texture memory dumped when the texture is prepared for rendering.

This will be false for most textures, which can reload their images if needed by rereading the input file. However, textures that were generated dynamically and cannot be easily reloaded will want to set this flag to true, so that the texture will always keep its image copy around.

Definition at line 1444 of file texture.I.

Referenced by MovieVideoCursor::apply_to_texture(), MovieVideoCursor::apply_to_texture_alpha(), and MovieVideoCursor::apply_to_texture_rgb().

void Texture::set_loaded_from_image ( ) [inline]

Sets the flag that indicates the texture has been loaded from a disk file or PNMImage.

You should also ensure the filename has been set correctly. When this flag is true, the texture may be automatically reloaded when its ram image needs to be replaced.

Definition at line 2180 of file texture.I.

void Texture::set_loaded_from_txo ( ) [inline]

Sets the flag that indicates the texture has been loaded from a txo file.

You probably shouldn't be setting this directly; it is set automatically when a Texture is loaded.

Definition at line 2207 of file texture.I.

void Texture::set_match_framebuffer_format ( bool  flag) [inline]

Sets the special flag that, if true, indicates to the GSG that the Texture's format should be chosen to exactly match the framebuffer's format, presumably because the application intends to copy image data from the framebuffer into the Texture (or vice-versa).

This sets only the graphics card's idea of the texture format; it is not related to the system-memory format.

Definition at line 2255 of file texture.I.

Referenced by GraphicsOutput::add_render_texture().

void Texture::set_num_views ( int  num_views) [inline]

Sets the number of "views" within a texture.

A view is a completely separate image stored within the Texture object. Most textures have only one view, but a stereo texture, for instance, may have two views, a left and a right image. Other uses for multiple views are not yet defined.

If this value is greater than one, the additional views are accessed as additional pages beyond get_z_size().

This also implicitly unloads the texture if it has already been loaded.

Definition at line 2141 of file texture.I.

void Texture::set_orig_file_size ( int  x,
int  y,
int  z = 1 
)

Specifies the size of the texture as it exists in its original disk file, before any Panda scaling.

Definition at line 1776 of file texture.cxx.

Referenced by VideoTexture::set_video_size().

void Texture::set_pad_size ( int  x = 0,
int  y = 0,
int  z = 0 
) [inline]

Sets the size of the pad region.

Sometimes, when a video card demands power-of-two textures, it is necessary to create a big texture and then only use a portion of it. The pad region indicates which portion of the texture is not really in use. All operations use the texture as a whole, including the pad region, unless they explicitly state that they use only the non-pad region.

Changing the texture's size clears the pad region.

Definition at line 608 of file texture.I.

Referenced by MovieVideoCursor::setup_texture().

void Texture::set_post_load_store_cache ( bool  flag) [inline]

Sets the post_load_store_cache flag.

When this is set, the next time the texture is loaded on a GSG, it will automatically extract its RAM image from the GSG and save it to the global BamCache.

This is used to store compressed RAM images in the BamCache. This flag should not be set explicitly; it is set automatically by the TexturePool when model-cache-compressed-textures is set true.

Definition at line 2286 of file texture.I.

Referenced by DXTextureContext8::create_texture(), and DXTextureContext9::create_texture().

void Texture::set_quality_level ( Texture::QualityLevel  quality_level) [inline]

Sets a hint to the renderer about the desired performance / quality tradeoff for this particular texture.

This is most useful for the tinydisplay software renderer; for normal, hardware-accelerated renderers, this may have little or no effect.

Definition at line 1046 of file texture.I.

Referenced by StaticTextFont::StaticTextFont().

void Texture::set_ram_image ( CPTA_uchar  image,
Texture::CompressionMode  compression = CM_off,
size_t  page_size = 0 
) [inline]

Replaces the current system-RAM image with the new data.

If compression is not CM_off, it indicates that the new data is already pre-compressed in the indicated format.

This does *not* affect keep_ram_image.

Definition at line 1411 of file texture.I.

References do_set_ram_image().

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::set_ram_image_as ( CPTA_uchar  image,
const string &  supplied_format 
)

Replaces the current system-RAM image with the new data, converting it first if necessary from the indicated component-order format.

See get_ram_image_as() for specifications about the format. This method cannot support compressed image data or sub-pages; use set_ram_image() for that.

Definition at line 863 of file texture.cxx.

References do_set_ram_image().

void Texture::set_ram_mipmap_image ( int  n,
CPTA_uchar  image,
size_t  page_size = 0 
) [inline]

Replaces the current system-RAM image for the indicated mipmap level with the new data.

If compression is not CM_off, it indicates that the new data is already pre-compressed in the indicated format.

This does *not* affect keep_ram_image.

Definition at line 1698 of file texture.I.

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::set_ram_mipmap_pointer ( int  n,
void *  image,
size_t  page_size = 0 
)

Sets an explicit void pointer as the texture's mipmap image for the indicated level.

This is a special call to direct a texture to reference some external image location, for instance from a webcam input.

The texture will henceforth reference this pointer directly, instead of its own internal storage; the user is responsible for ensuring the data at this address remains allocated and valid, and in the correct format, during the lifetime of the texture.

Definition at line 1102 of file texture.cxx.

Referenced by set_ram_mipmap_pointer_from_int().

void Texture::set_ram_mipmap_pointer_from_int ( long long  pointer,
int  n,
int  page_size 
)

Accepts a raw pointer cast as an int, which is then passed to set_ram_mipmap_pointer(); see the documentation for that method.

This variant is particularly useful to set an external pointer from a language like Python, which doesn't support void pointers directly.

Definition at line 1128 of file texture.cxx.

References set_ram_mipmap_pointer().

void Texture::set_render_to_texture ( bool  render_to_texture) [inline]

Sets a flag on the texture that indicates whether the texture is intended to be used as a direct-render target, by binding a framebuffer to a texture and rendering directly into the texture.

This controls some low-level choices made about the texture object itself. For instance, compressed textures are disallowed when this flag is set true.

Normally, a user should not need to set this flag directly; it is set automatically by the low-level display code when a texture is bound to a framebuffer.

Definition at line 849 of file texture.I.

Referenced by GraphicsOutput::add_render_texture(), and DXGraphicsStateGuardian9::framebuffer_copy_to_texture().

void Texture::set_simple_ram_image ( CPTA_uchar  image,
int  x_size,
int  y_size 
) [inline]

Replaces the internal "simple" texture image.

This can be used as an option to display while the main texture image is being loaded from disk. It is normally a very small image, 16x16 or smaller (and maybe even 1x1), that is designed to give just enough sense of color to serve as a placeholder until the full texture is available.

The "simple" image is always 4 components, 1 byte each, regardless of the parameters of the full texture. The simple image is only supported for ordinary 2-d textures.

Also see generate_simple_ram_image(), modify_simple_ram_image(), and new_simple_ram_image().

Definition at line 1827 of file texture.I.

void Texture::set_size_padded ( int  x = 1,
int  y = 1,
int  z = 1 
)

Changes the size of the texture, padding if necessary, and setting the pad region as well.

Definition at line 1752 of file texture.cxx.

References do_set_z_size(), and up_to_power_2().

Referenced by GraphicsOutput::add_render_texture(), DXGraphicsStateGuardian8::framebuffer_copy_to_texture(), and DXGraphicsStateGuardian9::framebuffer_copy_to_texture().

void Texture::set_textures_power_2 ( AutoTextureScale  scale) [inline, static]

Set this flag to ATS_none, ATS_up, ATS_down, or ATS_pad to control the scaling of textures in general, if a particular texture does not override this.

See also set_auto_texture_scale() for the per-texture override.

Definition at line 1931 of file texture.I.

void Texture::set_wrap_w ( Texture::WrapMode  wrap) [inline]

The W wrap direction is only used for 3-d textures.

Definition at line 746 of file texture.I.

void Texture::set_x_size ( int  x_size) [inline]

Changes the x size indicated for the texture.

This also implicitly unloads the texture if it has already been loaded.

Definition at line 2092 of file texture.I.

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::set_y_size ( int  y_size) [inline]

Changes the y size indicated for the texture.

This also implicitly unloads the texture if it has already been loaded.

Definition at line 2105 of file texture.I.

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::set_z_size ( int  z_size) [inline]

Changes the z size indicated for the texture.

This also implicitly unloads the texture if it has already been loaded.

Definition at line 2118 of file texture.I.

References do_set_z_size().

Referenced by DXTextureContext8::extract_texture_data(), and DXTextureContext9::extract_texture_data().

void Texture::setup_1d_texture ( ) [inline]

Sets the texture as an empty 1-d texture with no dimensions.

Follow up with read() or load() to fill the texture properties and image data.

Definition at line 77 of file texture.I.

void Texture::setup_1d_texture ( int  x_size,
ComponentType  component_type,
Format  format 
) [inline]

Sets the texture as an empty 1-d texture with the specified dimensions and properties.

Follow up with set_ram_image() or modify_ram_image() to fill the image data.

Definition at line 90 of file texture.I.

References setup_texture().

void Texture::setup_2d_texture ( ) [inline]

Sets the texture as an empty 2-d texture with no dimensions.

Follow up with read() or load() to fill the texture properties and image data.

Definition at line 102 of file texture.I.

Referenced by TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), and RocketRenderInterface::GenerateTexture().

void Texture::setup_2d_texture ( int  x_size,
int  y_size,
ComponentType  component_type,
Format  format 
) [inline]

Sets the texture as an empty 2-d texture with the specified dimensions and properties.

Follow up with set_ram_image() or modify_ram_image() to fill the image data.

Definition at line 115 of file texture.I.

References setup_texture().

void Texture::setup_2d_texture_array ( int  z_size = 1) [inline]

Sets the texture as an empty 2-d texture array with no dimensions (though if you know the depth ahead of time, it saves a bit of reallocation later).

Follow up with read() or load() to fill the texture properties and image data.

Definition at line 158 of file texture.I.

void Texture::setup_2d_texture_array ( int  x_size,
int  y_size,
int  z_size,
ComponentType  component_type,
Format  format 
) [inline]

Sets the texture as an empty 2-d texture array with the specified dimensions and properties.

Follow up with set_ram_image() or modify_ram_image() to fill the image data.

Definition at line 171 of file texture.I.

References setup_texture().

void Texture::setup_3d_texture ( int  z_size = 1) [inline]

Sets the texture as an empty 3-d texture with no dimensions (though if you know the depth ahead of time, it saves a bit of reallocation later).

Follow up with read() or load() to fill the texture properties and image data.

Definition at line 130 of file texture.I.

void Texture::setup_3d_texture ( int  x_size,
int  y_size,
int  z_size,
ComponentType  component_type,
Format  format 
) [inline]

Sets the texture as an empty 3-d texture with the specified dimensions and properties.

Follow up with set_ram_image() or modify_ram_image() to fill the image data.

Definition at line 143 of file texture.I.

References setup_texture().

void Texture::setup_cube_map ( ) [inline]

Sets the texture as an empty cube map texture with no dimensions.

Follow up with read() or load() to fill the texture properties and image data.

Definition at line 184 of file texture.I.

void Texture::setup_cube_map ( int  size,
ComponentType  component_type,
Format  format 
) [inline]

Sets the texture as an empty cube map texture with the specified dimensions and properties.

Follow up with set_ram_image() or modify_ram_image() to fill the image data.

Note that a cube map should always consist of six square images, so x_size and y_size will be the same, and z_size is always 6.

Definition at line 201 of file texture.I.

References setup_texture().

void Texture::setup_texture ( Texture::TextureType  texture_type,
int  x_size,
int  y_size,
int  z_size,
Texture::ComponentType  component_type,
Texture::Format  format 
) [inline]
bool Texture::store ( PNMImage pnmimage) const [inline]

Saves the texture to the indicated PNMImage, but does not write it to disk.

Definition at line 325 of file texture.I.

bool Texture::store ( PNMImage pnmimage,
int  z,
int  n 
) const [inline]

Saves the indicated page and mipmap level of the texture to the PNMImage.

Definition at line 337 of file texture.I.

Texture::ComponentType Texture::string_component_type ( const string &  str) [static]

Returns the ComponentType corresponding to the indicated string word.

Definition at line 1987 of file texture.cxx.

Texture::CompressionMode Texture::string_compression_mode ( const string &  str) [static]

Returns the CompressionMode value associated with the given string representation.

Definition at line 2299 of file texture.cxx.

Texture::FilterType Texture::string_filter_type ( const string &  str) [static]

Returns the FilterType value associated with the given string representation, or FT_invalid if the string does not match any known FilterType value.

Definition at line 2178 of file texture.cxx.

Texture::Format Texture::string_format ( const string &  str) [static]

Returns the Format corresponding to the indicated string word.

Definition at line 2075 of file texture.cxx.

Texture::QualityLevel Texture::string_quality_level ( const string &  str) [static]

Returns the QualityLevel value associated with the given string representation.

Definition at line 2359 of file texture.cxx.

Texture::TextureType Texture::string_texture_type ( const string &  str) [static]

Returns the TextureType corresponding to the indicated string word.

Definition at line 1940 of file texture.cxx.

Texture::WrapMode Texture::string_wrap_mode ( const string &  str) [static]

Returns the WrapMode value associated with the given string representation, or WM_invalid if the string does not match any known WrapMode value.

Definition at line 2237 of file texture.cxx.

This method is called by the GraphicsEngine at the beginning of the frame *after* a texture has been successfully uploaded to graphics memory.

It is intended as a callback so the texture can release its RAM image, if _keep_ram_image is false.

This is called indirectly when the GSG calls GraphicsEngine::texture_uploaded().

Definition at line 2388 of file texture.cxx.

bool Texture::uncompress_ram_image ( ) [inline]

Attempts to uncompress the texture's RAM image internally.

In order for this to work, the squish library must have been compiled into Panda, and the ram image must be compressed in a format supported by squish.

Returns true if successful, false otherwise.

Definition at line 1498 of file texture.I.

Texture::CData * Texture::unlocked_ensure_ram_image ( bool  allow_compression) [protected, virtual]

If the texture has a ram image already, this acquires the CData write lock and returns it.

If the texture lacks a ram image, this performs do_reload_ram_image(), but without holding the lock on this particular Texture object, to avoid holding the lock across what might be a slow operation. Instead, the reload is performed in a copy of the texture object, and then the lock is acquired and the data is copied in.

In any case, the return value is a locked CData object, which must be released with an explicit call to release_write(). The CData object will have a ram image unless for some reason do_reload_ram_image() fails.

Reimplemented in VideoTexture.

Definition at line 3801 of file texture.cxx.

References MutexDirect::acquire(), do_can_reload(), do_has_ram_image(), PipelineCycler< CycleDataType >::elevate_read_upstream(), Thread::get_current_thread(), has_ram_image(), ConditionVarFullDirect::notify_all(), PipelineCycler< CycleDataType >::read(), MutexDirect::release(), PipelineCyclerTrivialImpl::release_read(), ConditionVarFullDirect::wait(), and PipelineCycler< CycleDataType >::write_upstream().

Referenced by generate_ram_mipmap_images(), and get_ram_image().

int Texture::up_to_power_2 ( int  value) [static]

Returns the smallest power of 2 greater than or equal to value.

Definition at line 1851 of file texture.cxx.

Referenced by adjust_size(), GeomVertexArrayDataHandle::copy_subdata_from(), osxGraphicsBuffer::open_buffer(), set_size_padded(), and GeomVertexArrayDataHandle::set_subdata().

bool Texture::uses_mipmaps ( ) const [inline]

Returns true if the minfilter settings on this texture indicate the use of mipmapping, false otherwise.

Definition at line 1032 of file texture.I.

References get_effective_minfilter(), and is_mipmap().

Referenced by do_read(), do_reload_ram_image(), estimate_texture_memory(), get_num_loadable_ram_mipmap_images(), load(), and make_this_from_bam().

bool Texture::was_image_modified ( PreparedGraphicsObjects prepared_objects) const

Returns true if the texture needs to be re-loaded onto the indicated GSG, either because its image data is out-of-date, or because it's not fully prepared now.

Definition at line 1343 of file texture.cxx.

References TextureContext::was_image_modified().

bool Texture::write ( const Filename fullpath) [inline]

Writes the texture to the named filename.

Definition at line 211 of file texture.I.

References do_write().

bool Texture::write ( const Filename fullpath,
int  z,
int  n,
bool  write_pages,
bool  write_mipmaps 
) [inline]

Writes a single page or mipmap level to a single file, or automatically writes a series of pages and/or mipmap levels to a numbered series of files.

If the filename ends in the extension .txo, this implicitly writes a Panda texture object (.txo) instead of an image file. In this case, the remaining parameters are ignored, and only one file is written, which will contain all of the pages and resident mipmap levels in the texture.

If write_pages is false, then z indicates the page number to write. 3-D textures have one page number for each level of depth; cube maps have six pages number 0 through 5. Other kinds of textures have only one page, numbered 0. If there are multiple views, the range of z is increased; the total range is [0, get_num_pages()).

If write_pages is true, then all pages of the texture will be written. In this case z is ignored, and the filename should contain a sequence of hash marks ("#") which will be filled in with the page index number.

If write_mipmaps is false, then n indicates the mipmap level number to write. Normally, this is 0, for the base texture image. Normally, the mipmap levels of a texture are not available in RAM (they are generated automatically by the graphics card). However, if you have the mipmap levels available, for instance because you called generate_ram_mipmap_images() to generate them internally, or you called GraphicsEngine::extract_texture_data() to retrieve them from the graphics card, then you may write out each mipmap level with this parameter.

If write_mipmaps is true, then all mipmap levels of the texture will be written. In this case n is ignored, and the filename should contain a sequence of hash marks ("#") which will be filled in with the mipmap level number.

If both write_pages and write_mipmaps is true, then all pages and all mipmap levels will be written. In this case, the filename should contain two different sequences of hash marks, separated by a character such as a hyphen, underscore, or dot. The first hash mark sequence will be filled in with the mipmap level, while the second hash mark sequence will be the page index.

Definition at line 276 of file texture.I.

References do_write().

void Texture::write ( ostream &  out,
int  indent_level 
) const

Not to be confused with write(Filename), this method simply describes the texture properties.

Definition at line 1532 of file texture.cxx.

References do_has_ram_image().

void Texture::write_datagram ( BamWriter manager,
Datagram me 
) [virtual]

Function to write the important information in the particular object to a Datagram.

Reimplemented from TypedWritable.

Definition at line 6960 of file texture.cxx.

References do_write_datagram_body(), do_write_datagram_header(), and do_write_datagram_rawdata().

bool Texture::write_txo ( ostream &  out,
const string &  filename = "" 
) const

Writes the texture to a Panda texture object.

This defines the complete Texture specification, including the image data as well as all texture properties.

The filename is just for reference.

Definition at line 731 of file texture.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations