Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Texture Class Reference

2D texture class More...

#include <texture.h>

Inheritance diagram for Texture:

ImageBuffer ReferenceCount WritableConfigurable Namable TypedWritable TypedObject List of all members.

Public Types

enum  FilterType {
  FT_nearest, FT_linear, FT_nearest_mipmap_nearest, FT_linear_mipmap_nearest,
  FT_nearest_mipmap_linear, FT_linear_mipmap_linear, FT_invalid
}
enum  WrapMode {
  WM_clamp, WM_repeat, WM_mirror, WM_mirror_once,
  WM_border_color, WM_invalid
}
enum  DirtyFlags { DF_image = 0x001, DF_wrap = 0x002, DF_filter = 0x004, DF_mipmap = 0x008 }

Public Member Functions

 Texture ()
 Texture (int xsize, int ysize, int components, int component_width, PixelBuffer::Type type, PixelBuffer::Format format, bool bAllocateRAM)
 ~Texture ()
bool read (const Filename &fullpath, int primary_file_num_channels=0)
 Reads the texture from the indicated filename.

bool read (const Filename &fullpath, const Filename &alpha_fullpath, int primary_file_num_channels=0, int alpha_file_channel=0)
 Combine a 3-component image with a grayscale image to get a 4-component image.

bool write (const Filename &fullpath="") const
 Writes the texture to the indicated filename.

void set_wrapu (WrapMode wrap)
void set_wrapv (WrapMode wrap)
void set_minfilter (FilterType filter)
void set_magfilter (FilterType filter)
void set_anisotropic_degree (int anisotropic_degree)
 Specifies the level of anisotropic filtering to apply to the texture.

void set_border_color (const Colorf &color)
WrapMode get_wrapu () const
WrapMode get_wrapv () const
FilterType get_minfilter () const
FilterType get_magfilter () const
int get_anisotropic_degree () const
 Returns the degree of anisotropic filtering that should be applied to the texture.

bool uses_mipmaps () const
 Returns true if the minfilter settings on this texture require the use of mipmapping, false otherwise.

bool load (const PNMImage &pnmimage)
 Creates the texture from the already-read PNMImage.

bool store (PNMImage &pnmimage) const
 Saves the texture to the indicated PNMImage, but does not write it to disk.

TextureContextprepare (GraphicsStateGuardianBase *gsg)
 Creates a context for the texture on the particular GSG, if it does not already exist.

void unprepare ()
 Frees the context allocated on all GSG's for which the texture has been declared.

void unprepare (GraphicsStateGuardianBase *gsg)
 Frees the texture context only on the indicated GSG, if it exists there.

void clear_gsg (GraphicsStateGuardianBase *gsg)
 Removes the indicated GSG from the Texture's known GSG's, without actually releasing the texture on that GSG.

bool has_ram_image () const
PixelBufferget_ram_image ()
 Returns the PixelBuffer associated with the texture.

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.

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.

void apply (GraphicsStateGuardianBase *gsg)
virtual void copy (GraphicsStateGuardianBase *gsg, const DisplayRegion *dr)
virtual void copy (GraphicsStateGuardianBase *gsg, const DisplayRegion *dr, const RenderBuffer &rb)
void mark_dirty (int flags_to_set)
 Sets the indicated dirty bits on for all texture contexts that share this Texture.

virtual void write_datagram (BamWriter *manager, Datagram &me)
 Function to write the important information in the particular object to a Datagram.

virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()
virtual void config (void)
bool has_filename () const
 Returns true if the filename has been set and is available.

const Filenameget_filename () const
 Returns the filename that has been set.

bool has_alpha_filename () const
 Returns true if the alpha_filename has been set and is available.

const Filenameget_alpha_filename () const
 Returns the alpha_filename that has been set.

bool has_fullpath () const
 Returns true if the fullpath has been set and is available.

const Filenameget_fullpath () const
 Returns the fullpath that has been set.

bool has_alpha_fullpath () const
 Returns true if the alpha_fullpath has been set and is available.

const Filenameget_alpha_fullpath () const
 Returns the alpha_fullpath that has been set.

void set_filename (const Filename &filename)
 Sets the name of the file that contains the image's contents.

void clear_filename ()
 Removes the alpha filename, if it was previously set.

void set_alpha_filename (const Filename &alpha_filename)
 Sets the name of the file that contains the image's alpha channel contents.

void clear_alpha_filename ()
 Removes the alpha filename, if it was previously set.

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 clear_fullpath ()
 Removes the alpha fullpath, if it was previously set.

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 clear_alpha_fullpath ()
 Removes the alpha fullpath, if it was previously set.

int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.

void check_config () const
bool is_dirty (void) const
void make_dirty (void)
virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

virtual void finalize ()
 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.

int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.

bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.

void set_name (const string &name)
void clear_name ()
 Resets the Namable's name to empty.

bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty.

const string & get_name () const
void output (ostream &out) const
 Outputs the Namable.


Static Public Member Functions

bool is_mipmap (FilterType type)
 Returns true if the indicated filter type requires the use of mipmaps, or false if it does not.

WrapMode string_wrap_mode (const string &string)
 Returns the WrapMode value associated with the given string representation, or WM_invalid if the string does not match any known WrapMode value.

FilterType string_filter_type (const string &string)
 Returns the FilterType value associated with the given string representation, or FT_invalid if the string does not match any known FilterType value.

void register_with_read_factory (void)
 Factory method to generate a Texture object.

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

TypeHandle get_class_type ()
void init_type ()

Public Attributes

PointerTo< PixelBuffer_pbuffer

Static Public Attributes

TypedWritable *const Null = (TypedWritable*)0L

Protected Member Functions

void fillin (DatagramIterator &scan, BamReader *manager)
 Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.


Protected Attributes

int _primary_file_num_channels
int _alpha_file_channel

Private Types

typedef pmap< GraphicsStateGuardianBase *,
TextureContext * > 
Contexts

Private Attributes

WrapMode _wrapu
WrapMode _wrapv
FilterType _minfilter
FilterType _magfilter
int _anisotropic_degree
bool _keep_ram_image
Colorf _border_color
Contexts _contexts
int _all_dirty_flags

Static Private Attributes

TypeHandle _type_handle

Friends

class TextureContext

Detailed Description

2D texture class

Definition at line 42 of file texture.h.


Member Typedef Documentation

typedef pmap<GraphicsStateGuardianBase *, TextureContext *> Texture::Contexts [private]
 

Definition at line 157 of file texture.h.


Member Enumeration Documentation

enum Texture::DirtyFlags
 

Enumeration values:
DF_image 
DF_wrap 
DF_filter 
DF_mipmap 

Definition at line 132 of file texture.h.

enum Texture::FilterType
 

Enumeration values:
FT_nearest 
FT_linear 
FT_nearest_mipmap_nearest 
FT_linear_mipmap_nearest 
FT_nearest_mipmap_linear 
FT_linear_mipmap_linear 
FT_invalid 

Definition at line 44 of file texture.h.

Referenced by DXGraphicsStateGuardian8::draw_sphere(), get_minfilter(), get_wrapv(), and string_wrap_mode().

enum Texture::WrapMode
 

Enumeration values:
WM_clamp 
WM_repeat 
WM_mirror 
WM_mirror_once 
WM_border_color 
WM_invalid 

Definition at line 72 of file texture.h.

Referenced by DXGraphicsStateGuardian8::draw_sphere(), get_wrapu(), and string_wrap_mode().


Constructor & Destructor Documentation

Texture::Texture  ) 
 

Definition at line 155 of file texture.cxx.

References _all_dirty_flags, _anisotropic_degree, _border_color, _keep_ram_image, _magfilter, _minfilter, _pbuffer, _wrapu, _wrapv, Colorf, FT_nearest, and WM_repeat.

Texture::Texture int  xsize,
int  ysize,
int  components,
int  component_width,
PixelBuffer::Type  type,
PixelBuffer::Format  format,
bool  bAllocateRAM
 

Definition at line 177 of file texture.cxx.

References Filename::get_basename_wo_extension(), Namable::has_name(), PNMImage::read(), and Namable::set_name().

Texture::~Texture  ) 
 

Definition at line 199 of file texture.cxx.

References ImageBuffer::clear_alpha_filename(), and ImageBuffer::set_filename().


Member Function Documentation

void Texture::apply GraphicsStateGuardianBase gsg  )  [inline]
 

Definition at line 211 of file texture.I.

void WritableConfigurable::check_config  )  const [inline, inherited]
 

Definition at line 70 of file writableConfigurable.h.

References PUBLISHED.

Referenced by Geom::set_lengths().

void ImageBuffer::clear_alpha_filename  )  [inline, inherited]
 

Removes the alpha filename, if it was previously set.

See set_alpha_filename().

Definition at line 247 of file imageBuffer.I.

Referenced by ~Texture().

void ImageBuffer::clear_alpha_fullpath  )  [inline, inherited]
 

Removes the alpha fullpath, if it was previously set.

See set_alpha_fullpath().

Definition at line 317 of file imageBuffer.I.

void ImageBuffer::clear_filename  )  [inline, inherited]
 

Removes the alpha filename, if it was previously set.

See set_filename().

Definition at line 196 of file imageBuffer.I.

References ImageBuffer::_fullpath, and INLINE.

void ImageBuffer::clear_fullpath  )  [inline, inherited]
 

Removes the alpha fullpath, if it was previously set.

See set_fullpath().

Definition at line 281 of file imageBuffer.I.

void Texture::clear_gsg GraphicsStateGuardianBase gsg  ) 
 

Removes the indicated GSG from the Texture's known GSG's, without actually releasing the texture on that GSG.

This is intended to be called only from GSG::release_texture(); it should never be called by user code.

Definition at line 638 of file texture.cxx.

void Namable::clear_name  )  [inline, inherited]
 

Resets the Namable's name to empty.

Definition at line 82 of file namable.I.

References Namable::_name, and INLINE.

int TypedWritable::complete_pointers TypedWritable **  p_list,
BamReader manager
[virtual, inherited]
 

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

This is the callback function that is made by the BamReader at some later point, after all of the required pointers have been filled in. It is necessary because there might be forward references in a bam file; when we call read_pointer() in fillin(), the object may not have been read from the file yet, so we do not have a pointer available at that time. Thus, instead of returning a pointer, read_pointer() simply reserves a later callback. This function provides that callback. The calling object is responsible for keeping track of the number of times it called read_pointer() and extracting the same number of pointers out of the supplied vector, and storing them appropriately within the object.

Reimplemented in AnimBundleNode, AnimGroup, PartBundleNode, PartGroup, Character, CharacterJoint, CollisionNode, GeomSprite, PiecewiseCurve, ClipPlaneAttrib, FogAttrib, LensNode, LightAttrib, MaterialAttrib, RenderEffects, RenderState, TextureAttrib, Person, and Child.

Definition at line 94 of file typedWritable.cxx.

Referenced by RenderState::do_invert_compose().

virtual void ImageBuffer::config void   )  [inline, virtual, inherited]
 

Reimplemented from WritableConfigurable.

Reimplemented in PixelBuffer.

Definition at line 49 of file imageBuffer.h.

References INLINE, and PUBLISHED.

Referenced by PixelBuffer::operator=().

void Texture::copy GraphicsStateGuardianBase gsg,
const DisplayRegion dr,
const RenderBuffer rb
[virtual]
 

Implements ImageBuffer.

Definition at line 721 of file texture.cxx.

void Texture::copy GraphicsStateGuardianBase gsg,
const DisplayRegion dr
[virtual]
 

Implements ImageBuffer.

Definition at line 717 of file texture.cxx.

void Texture::fillin DatagramIterator scan,
BamReader manager
[protected]
 

Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.

Reimplemented from ImageBuffer.

Definition at line 935 of file texture.cxx.

void TypedWritable::finalize void   )  [virtual, inherited]
 

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 in PartBundle, RenderAttrib, RenderEffect, RenderEffects, RenderState, and TransformState.

Definition at line 112 of file typedWritable.cxx.

Referenced by BamReader::skip_pointer().

virtual TypeHandle Texture::force_init_type void   )  [inline, virtual]
 

Reimplemented from ImageBuffer.

Definition at line 203 of file texture.h.

const Filename & ImageBuffer::get_alpha_filename  )  const [inline, inherited]
 

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 85 of file imageBuffer.I.

References ImageBuffer::_fullpath, and INLINE.

Referenced by EggGroupNode::remove_child(), and ImageBuffer::~ImageBuffer().

const Filename & ImageBuffer::get_alpha_fullpath  )  const [inline, inherited]
 

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 151 of file imageBuffer.I.

References ImageBuffer::_alpha_filename, and INLINE.

Referenced by unprepare(), and ImageBuffer::~ImageBuffer().

int Texture::get_anisotropic_degree  )  const [inline]
 

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

Normally, this is 1, to indicate that anisotropic filtering should be disabled. If this is a number higher than 1, anisotropic filtering should be enabled (if the rendering backend supports it).

Definition at line 90 of file texture.I.

Referenced by DXGraphicsStateGuardian8::draw_sphere().

TypeHandle Texture::get_class_type void   )  [inline, static]
 

Reimplemented from ImageBuffer.

Definition at line 192 of file texture.h.

const Filename & ImageBuffer::get_filename  )  const [inline, inherited]
 

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 51 of file imageBuffer.I.

References ImageBuffer::_alpha_filename.

Referenced by TexturePool::ns_add_texture(), PixelBuffer::read(), EggGroupNode::remove_child(), and ImageBuffer::~ImageBuffer().

const Filename & ImageBuffer::get_fullpath  )  const [inline, inherited]
 

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 117 of file imageBuffer.I.

References ImageBuffer::_filename, and INLINE.

Referenced by unprepare(), and ImageBuffer::~ImageBuffer().

bool Texture::get_keep_ram_image  )  const [inline]
 

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().

Definition at line 199 of file texture.I.

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

Definition at line 67 of file texture.I.

References _anisotropic_degree, and INLINE.

Referenced by DXGraphicsStateGuardian8::draw_sphere(), and CRGraphicsStateGuardian::get_internal_coordinate_system().

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

Definition at line 55 of file texture.I.

References _magfilter, FilterType, and INLINE.

Referenced by CRGraphicsStateGuardian::get_internal_coordinate_system().

const string & Namable::get_name  )  const [inline, inherited]
 

Definition at line 109 of file namable.I.

Referenced by ComputedVerticesMaker::add_normal(), GLGraphicsStateGuardian::begin_bind_clip_planes(), GLGraphicsStateGuardian::begin_bind_lights(), BuilderBucket::BuilderBucket(), EggVertex::clear_grefs(), AnimBundleMaker::create_xfm_channel(), SceneGraphReducer::do_flatten_siblings(), BuilderBucket::done_geom(), DXTextureContext8::DXTextureContext8(), PartGroup::find_child(), EggLoader::find_collision_geometry(), EggGroupUniquifier::get_category(), PartBundle::get_control_effect(), PartGroup::get_num_children(), EggMorph< Parameter >::get_offset(), AnimChannelBase::has_changed(), Namable::has_name(), EggMaterial::is_equivalent_to(), load(), EggLoader::make_node(), AnimBundleMaker::make_node(), FindApproxPath::Component::matches(), LineSegs::move_to(), MovingPartBase::MovingPartBase(), NodeMap::NodeMap(), EggMorph< Parameter >::operator<(), operator<<(), MouseWatcherRegion::output(), AnimGroup::output(), EggXfmSAnim::r_transform(), read(), MouseWatcherGroup::remove_region(), EggLoader::reparent_decals(), CRGraphicsStateGuardian::set_blend_mode(), NodePath::set_color(), GLGraphicsStateGuardian::set_draw_buffer(), AnimChannelScalarTable::set_table(), NodePath::set_transparency(), NodePathComponent::uncollapse(), unprepare(), TextNode::wordwrap_to(), MovingPartBase::write(), CollisionNode::xform(), and EggVertex::~EggVertex().

PixelBuffer * Texture::get_ram_image  ) 
 

Returns the PixelBuffer associated with the texture.

If the PixelBuffer 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.

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

Definition at line 697 of file texture.cxx.

References FT_linear_mipmap_linear.

Referenced by GLGraphicsStateGuardian::begin_bind_clip_planes(), CRGraphicsStateGuardian::set_blend_mode(), GLGraphicsStateGuardian::set_draw_buffer(), and CRGraphicsStateGuardian::set_read_buffer().

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

virtual TypeHandle Texture::get_type void   )  const [inline, virtual]
 

Reimplemented from ImageBuffer.

Definition at line 200 of file texture.h.

int TypedObject::get_type_index  )  const [inline, inherited]
 

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 71 of file typedObject.I.

References TypeHandle::get_name(), TypedObject::get_type(), and INLINE.

Texture::WrapMode Texture::get_wrapu  )  const [inline]
 

Definition at line 31 of file texture.I.

References _wrapv, INLINE, and WrapMode.

Referenced by DXGraphicsStateGuardian8::draw_sphere(), and CRGraphicsStateGuardian::get_internal_coordinate_system().

Texture::WrapMode Texture::get_wrapv  )  const [inline]
 

Definition at line 43 of file texture.I.

References _minfilter, FilterType, and INLINE.

Referenced by DXGraphicsStateGuardian8::draw_sphere(), and CRGraphicsStateGuardian::get_internal_coordinate_system().

bool ImageBuffer::has_alpha_filename  )  const [inline, inherited]
 

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

See set_alpha_filename().

Definition at line 66 of file imageBuffer.I.

References ImageBuffer::_fullpath, Filename::empty(), and INLINE.

Referenced by EggGroupNode::remove_child().

bool ImageBuffer::has_alpha_fullpath  )  const [inline, inherited]
 

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

See set_alpha_fullpath().

Definition at line 132 of file imageBuffer.I.

References ImageBuffer::_filename, and INLINE.

Referenced by unprepare().

bool ImageBuffer::has_filename  )  const [inline, inherited]
 

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

See set_filename().

Definition at line 34 of file imageBuffer.I.

References ImageBuffer::_filename, and INLINE.

Referenced by read(), and unprepare().

bool ImageBuffer::has_fullpath  )  const [inline, inherited]
 

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

See set_fullpath().

Definition at line 100 of file imageBuffer.I.

References ImageBuffer::_alpha_fullpath, and INLINE.

bool Namable::has_name  )  const [inline, inherited]
 

Returns true if the Namable has a nonempty name set, false if the name is empty.

Definition at line 97 of file namable.I.

References Namable::get_name(), and INLINE.

Referenced by EggGroupUniquifier::EggGroupUniquifier(), read(), and Texture().

bool Texture::has_ram_image  )  const [inline]
 

Referenced by unprepare().

void Texture::init_type void   )  [inline, static]
 

Reimplemented from ImageBuffer.

Definition at line 195 of file texture.h.

bool WritableConfigurable::is_dirty void   )  const [inline, inherited]
 

Definition at line 82 of file writableConfigurable.h.

Referenced by Geom::get_texcoords(), and dDrawable::~dDrawable().

bool TypedObject::is_exact_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is the indicated type exactly.

Definition at line 101 of file typedObject.I.

Referenced by PT(), and CollisionNode::xform().

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 514 of file texture.cxx.

bool TypedObject::is_of_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is or derives from the indicated type.

Definition at line 86 of file typedObject.I.

Referenced by EggMaterialCollection::collapse_equivalent_materials(), EggTextureCollection::collapse_equivalent_textures(), DeferredNodeProperty::compose(), AnimBundleMaker::create_s_channel(), CharacterMaker::create_slider(), ProjectionScreen::cull_callback(), DataNode::define_output(), EggNode::determine_draw_order(), CharacterMaker::egg_to_index(), EggGroupUniquifier::EggGroupUniquifier(), EggPoolUniquifier::EggPoolUniquifier(), EggGroupNode::find_textures(), StaticTextFont::get_glyph(), EggMaterialCollection::insert_materials(), EggTextureCollection::insert_textures(), CharacterJoint::make_copy(), PT(), EggGroupNode::r_flatten_transforms(), EggGroupNode::r_transform_vertices(), EggGroupNode::recompute_polygon_normals(), CollisionLevelState::reserve(), PandaFramework::reset_frame_rate(), PandaFramework::set_texture(), EggGroupNode::steal_children(), and DataGraphTraverser::traverse().

bool Texture::load const PNMImage pnmimage  ) 
 

Creates the texture from the already-read PNMImage.

Definition at line 479 of file texture.cxx.

References _all_dirty_flags, _keep_ram_image, _pbuffer, PointerTo< PixelBuffer >::clear(), Namable::get_name(), and keep_texture_ram.

void WritableConfigurable::make_dirty void   )  [inline, inherited]
 

Definition at line 83 of file writableConfigurable.h.

Referenced by GeomSphere::draw_immediate(), Geom::get_coords_index(), GeomTri::get_tris(), PixelBuffer::set_size(), PixelBuffer::set_xorg(), PixelBuffer::set_ysize(), PixelBuffer::stencil_buffer(), Geom::transform_vertices(), and GeomLine::write_datagram().

TypedWritable * Texture::make_Texture const FactoryParams params  )  [static]
 

Factory method to generate a Texture object.

Definition at line 858 of file texture.cxx.

void Texture::mark_dirty int  flags_to_set  ) 
 

Sets the indicated dirty bits on for all texture contexts that share this Texture.

Does not change the bits that are not on. This presumably will inform the GSG that the texture properties have changed. See also TextureContext::mark_dirty().

Normally, this does not need to be called directly; changing the properties on the texture will automatically call this. However, if you fiddle with the texture image directly, for instance by meddling with the _pbuffer member, you may need to explicitly call mark_dirty(Texture::DF_image).

Definition at line 757 of file texture.cxx.

Referenced by set_wrapu(), and set_wrapv().

void Namable::output ostream &  out  )  const [inline, inherited]
 

Outputs the Namable.

This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

Reimplemented in BuilderBucket, AnimBundle, AnimChannelBase, AnimChannelFixed< SwitchType >, AnimGroup, PartBundle, CollisionNode, ButtonNode, HermiteCurve, RopeNode, Fog, GeomNode, LensNode, LightLensNode, LightNode, LODNode, PandaNode, PlaneNode, MouseWatcher, and MouseWatcherRegion.

Definition at line 126 of file namable.I.

TextureContext * Texture::prepare GraphicsStateGuardianBase gsg  ) 
 

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

Returns the new (or old) TextureContext.

Definition at line 540 of file texture.cxx.

Referenced by SomeViz::DisplayTexture(), BaseViz::DisplayTexture(), and unprepare().

bool Texture::read const Filename fullpath,
const Filename alpha_fullpath,
int  primary_file_num_channels = 0,
int  alpha_file_channel = 0
 

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

Definition at line 259 of file texture.cxx.

bool Texture::read const Filename fullpath,
int  primary_file_num_channels = 0
 

Reads the texture from the indicated filename.

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

Definition at line 218 of file texture.cxx.

References consider_rescale(), Filename::get_basename(), Filename::get_basename_wo_extension(), Namable::get_name(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), ImageBuffer::has_filename(), Namable::has_name(), PNMImage::read(), ImageBuffer::set_alpha_filename(), ImageBuffer::set_alpha_fullpath(), ImageBuffer::set_filename(), ImageBuffer::set_fullpath(), and Namable::set_name().

Referenced by WindowFramework::set_background_type(), and unprepare().

int ReferenceCount::ref  )  const [inline, inherited]
 

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void Texture::register_with_read_factory void   )  [static]
 

Factory method to generate a Texture object.

Definition at line 845 of file texture.cxx.

References _pbuffer, and Datagram::add_uint8().

void ImageBuffer::set_alpha_filename const Filename alpha_filename  )  [inline, inherited]
 

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 ImageBuffer'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 232 of file imageBuffer.I.

Referenced by read(), and EggGroupNode::remove_child().

void ImageBuffer::set_alpha_fullpath const Filename alpha_fullpath  )  [inline, inherited]
 

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 302 of file imageBuffer.I.

Referenced by read().

void Texture::set_anisotropic_degree int  anisotropic_degree  ) 
 

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

Normally, this is 1, to indicate anisotropic filtering is disabled. This may be set to a number higher than one to enable anisotropic filtering, if the rendering backend supports this.

Definition at line 451 of file texture.cxx.

References FT_linear_mipmap_linear, FT_linear_mipmap_nearest, and FT_nearest_mipmap_linear.

void Texture::set_border_color const Colorf color  ) 
 

Definition at line 466 of file texture.cxx.

References _contexts, and GraphicsStateGuardianBase::prepare_texture().

void ImageBuffer::set_filename const Filename filename  )  [inline, inherited]
 

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 ImageBuffer'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 181 of file imageBuffer.I.

References ImageBuffer::_fullpath, and INLINE.

Referenced by read(), EggGroupNode::remove_child(), and ~Texture().

void ImageBuffer::set_fullpath const Filename fullpath  )  [inline, inherited]
 

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 266 of file imageBuffer.I.

Referenced by read().

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 true 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 _pbuffer member will always keep its image copy around.

Definition at line 180 of file texture.I.

void Texture::set_magfilter Texture::FilterType  filter  ) 
 

Definition at line 427 of file texture.cxx.

Referenced by WindowFramework::set_background_type().

void Texture::set_minfilter Texture::FilterType  filter  ) 
 

Definition at line 408 of file texture.cxx.

References _border_color, and Colorf.

Referenced by WindowFramework::set_background_type().

void Namable::set_name const string &  name  )  [inline, inherited]
 

Definition at line 69 of file namable.I.

References Namable::_name.

Referenced by BuilderBucket::BuilderBucket(), SceneGraphReducer::do_flatten_siblings(), read(), PandaNode::reparent(), and Texture().

void Texture::set_wrapu Texture::WrapMode  wrap  ) 
 

Definition at line 378 of file texture.cxx.

References _magfilter, DF_filter, and mark_dirty().

void Texture::set_wrapv Texture::WrapMode  wrap  ) 
 

Definition at line 393 of file texture.cxx.

References _anisotropic_degree, DF_filter, and mark_dirty().

Referenced by EggLoader::apply_texture_attributes().

bool Texture::store PNMImage pnmimage  )  const
 

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

Definition at line 499 of file texture.cxx.

References _contexts.

Texture::FilterType Texture::string_filter_type const string &  string  )  [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 815 of file texture.cxx.

References _pbuffer.

Texture::WrapMode Texture::string_wrap_mode const string &  string  )  [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 786 of file texture.cxx.

References _anisotropic_degree, _magfilter, _minfilter, _pbuffer, _wrapu, _wrapv, FilterType, PixelBuffer::Format, DatagramIterator::get_bool(), DatagramIterator::get_int16(), DatagramIterator::get_uint8(), NULL, and WrapMode.

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

Does some easy checks to make sure that the reference count isn't completely bogus.

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

void Texture::unprepare GraphicsStateGuardianBase gsg  ) 
 

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

Definition at line 612 of file texture.cxx.

References GraphicsStateGuardianBase::copy_texture(), and prepare().

void Texture::unprepare  ) 
 

Frees the context allocated on all GSG's for which the texture has been declared.

Definition at line 582 of file texture.cxx.

References _pbuffer, ImageBuffer::get_alpha_fullpath(), ImageBuffer::get_fullpath(), Namable::get_name(), ImageBuffer::has_alpha_fullpath(), ImageBuffer::has_filename(), has_ram_image(), NULL, and read().

int ReferenceCount::unref  )  const [inline, inherited]
 

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().

bool Texture::uses_mipmaps  )  const [inline]
 

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

Definition at line 107 of file texture.I.

References _pbuffer, and INLINE.

Referenced by CRGraphicsStateGuardian::bind_texture(), and GLGraphicsStateGuardian::set_draw_buffer().

bool Texture::write const Filename fullpath = ""  )  const
 

Writes the texture to the indicated filename.

Definition at line 355 of file texture.cxx.

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

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

Reimplemented from ImageBuffer.

Definition at line 977 of file texture.cxx.


Friends And Related Function Documentation

friend class TextureContext [friend]
 

Definition at line 209 of file texture.h.


Member Data Documentation

int Texture::_all_dirty_flags [private]
 

Definition at line 163 of file texture.h.

Referenced by load(), and Texture().

int ImageBuffer::_alpha_file_channel [protected, inherited]
 

Definition at line 93 of file imageBuffer.h.

int Texture::_anisotropic_degree [private]
 

Definition at line 149 of file texture.h.

Referenced by get_magfilter(), set_wrapv(), string_wrap_mode(), and Texture().

Colorf Texture::_border_color [private]
 

Definition at line 151 of file texture.h.

Referenced by set_minfilter(), and Texture().

Contexts Texture::_contexts [private]
 

Definition at line 158 of file texture.h.

Referenced by set_border_color(), and store().

bool Texture::_keep_ram_image [private]
 

Definition at line 150 of file texture.h.

Referenced by load(), and Texture().

FilterType Texture::_magfilter [private]
 

Definition at line 148 of file texture.h.

Referenced by get_minfilter(), set_wrapu(), string_wrap_mode(), and Texture().

FilterType Texture::_minfilter [private]
 

Definition at line 147 of file texture.h.

Referenced by get_wrapv(), string_wrap_mode(), and Texture().

PointerTo< PixelBuffer > Texture::_pbuffer
 

Definition at line 168 of file texture.h.

Referenced by GLGraphicsStateGuardian::begin_bind_lights(), load(), motion_display_func(), TexturePool::ns_garbage_collect(), register_with_read_factory(), CRGraphicsStateGuardian::release_geom_node(), string_filter_type(), string_wrap_mode(), Texture(), unprepare(), uses_mipmaps(), and Spotlight::write().

int ImageBuffer::_primary_file_num_channels [protected, inherited]
 

Definition at line 87 of file imageBuffer.h.

TypeHandle Texture::_type_handle [static, private]
 

Reimplemented from ImageBuffer.

Definition at line 36 of file texture.cxx.

WrapMode Texture::_wrapu [private]
 

Definition at line 145 of file texture.h.

Referenced by string_wrap_mode(), and Texture().

WrapMode Texture::_wrapv [private]
 

Definition at line 146 of file texture.h.

Referenced by get_wrapu(), string_wrap_mode(), and Texture().

TypedWritable *const TypedWritable::Null = (TypedWritable*)0L [static, inherited]
 

Definition at line 25 of file typedWritable.cxx.

Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), PartGroup::pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:55:34 2003 for Panda by doxygen1.3