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

Texture Class Reference

#include <texture.h>

Inheritance diagram for Texture:

ImageBuffer ReferenceCount WritableConfigurable Namable TypedWritable TypedObject List of all members.

Public Types

enum  DirtyFlags { DF_image = 0x001, DF_wrap = 0x002, DF_filter = 0x004, DF_mipmap = 0x008 }

Public Member Functions

bool load (const PNMImage &pnmimage)
bool store (PNMImage &pnmimage) const
TextureContextprepare (GraphicsStateGuardianBase *gsg)
void unprepare ()
void unprepare (GraphicsStateGuardianBase *gsg)
void clear_gsg (GraphicsStateGuardianBase *gsg)
INLINE bool has_ram_image () const
PixelBufferget_ram_image ()
INLINE void set_keep_ram_image (bool keep_ram_image)
INLINE bool get_keep_ram_image () const
INLINE 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)
 PT (PixelBuffer) _pbuffer
virtual void write_datagram (BamWriter *manager, Datagram &me)
virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()

Static Public Member Functions

bool is_mipmap (FilterType type)
WrapMode string_wrap_mode (const string &string)
FilterType string_filter_type (const string &string)
void register_with_read_factory (void)
TypedWritablemake_Texture (const FactoryParams &params)
TypeHandle get_class_type ()
void init_type ()

Protected Member Functions

void fillin (DatagramIterator &scan, BamReader *manager)

Private Types

typedef pmap< GraphicsStateGuardianBase *,
TextureContext * > 
Contexts
enum  WrapMode {
  WM_clamp, WM_repeat, WM_mirror, WM_mirror_once,
  WM_border_color, WM_invalid
}

Private Member Functions

 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)
bool read (const Filename &fullpath, const Filename &alpha_fullpath, int primary_file_num_channels=0, int alpha_file_channel=0)
bool write (const Filename &fullpath="") const
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)
void set_border_color (const Colorf &color)
INLINE WrapMode get_wrapu () const
INLINE WrapMode get_wrapv () const
INLINE FilterType get_minfilter () const
INLINE FilterType get_magfilter () const
INLINE int get_anisotropic_degree () const
INLINE bool uses_mipmaps () const

Private Attributes

PUBLISHED __pad0__: enum FilterType { FT_nearest
PUBLISHED FT_linear
PUBLISHED FT_nearest_mipmap_nearest
PUBLISHED FT_linear_mipmap_nearest
PUBLISHED FT_nearest_mipmap_linear
PUBLISHED FT_linear_mipmap_linear
PUBLISHED FT_invalid
PUBLISHED __pad1__: Texture()
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

Member Typedef Documentation

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

Definition at line 151 of file texture.h.

Referenced by unprepare().


Member Enumeration Documentation

enum Texture::DirtyFlags
 

Enumeration values:
DF_image 
DF_wrap 
DF_filter 
DF_mipmap 

Definition at line 126 of file texture.h.

enum Texture::WrapMode [private]
 

Enumeration values:
WM_clamp 
WM_repeat 
WM_mirror 
WM_mirror_once 
WM_border_color 
WM_invalid 

Definition at line 66 of file texture.h.

Referenced by DXGraphicsStateGuardian8::apply_texture(), fillin(), and DXGraphicsStateGuardian7::prepare_texture().


Constructor & Destructor Documentation

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

Definition at line 154 of file texture.cxx.

References _all_dirty_flags, _anisotropic_degree, _border_color, _keep_ram_image, _magfilter, _minfilter, _wrapu, _wrapv, Colorf, format, and type.

Texture::~Texture  )  [private]
 

Definition at line 174 of file texture.cxx.

References unprepare().


Member Function Documentation

INLINE void Texture::apply GraphicsStateGuardianBase gsg  ) 
 

Referenced by GLGraphicsStateGuardian::issue_texture(), DXGraphicsStateGuardian8::issue_texture(), CRGraphicsStateGuardian::issue_texture(), and DXGraphicsStateGuardian7::prepare_texture().

void Texture::clear_gsg GraphicsStateGuardianBase gsg  ) 
 

Definition at line 552 of file texture.cxx.

References _contexts.

Referenced by DXGraphicsStateGuardian7::prepare_texture(), RIBGraphicsStateGuardian::release_texture(), GLGraphicsStateGuardian::release_texture(), DXGraphicsStateGuardian8::release_texture(), and CRGraphicsStateGuardian::release_texture().

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

Implements ImageBuffer.

Definition at line 613 of file texture.cxx.

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

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

Implements ImageBuffer.

Definition at line 609 of file texture.cxx.

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

Referenced by SpheretexReflector::pre_apply().

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

Reimplemented from ImageBuffer.

Definition at line 791 of file texture.cxx.

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

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

Reimplemented from ImageBuffer.

Definition at line 197 of file texture.h.

References ImageBuffer::get_class_type(), and ImageBuffer::init_type().

INLINE int Texture::get_anisotropic_degree  )  const [private]
 

Referenced by DXGraphicsStateGuardian8::apply_texture(), DXTextureContext8::CreateTexture(), DXTextureContext7::DXTextureContext7(), DXTextureContext8::DXTextureContext8(), and DXGraphicsStateGuardian7::prepare_texture().

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

Reimplemented from ImageBuffer.

Definition at line 186 of file texture.h.

Referenced by register_with_read_factory().

INLINE bool Texture::get_keep_ram_image  )  const
 

INLINE FilterType Texture::get_magfilter  )  const [private]
 

Referenced by DXGraphicsStateGuardian8::apply_texture(), DXTextureContext8::CreateTexture(), DXTextureContext7::DXTextureContext7(), DXTextureContext8::DXTextureContext8(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::specify_texture(), and CRGraphicsStateGuardian::specify_texture().

INLINE FilterType Texture::get_minfilter  )  const [private]
 

Referenced by DXGraphicsStateGuardian8::apply_texture(), DXTextureContext8::CreateTexture(), DXTextureContext7::DXTextureContext7(), DXTextureContext8::DXTextureContext8(), TextureContext::estimate_texture_memory(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::specify_texture(), and CRGraphicsStateGuardian::specify_texture().

PixelBuffer * Texture::get_ram_image  ) 
 

Definition at line 589 of file texture.cxx.

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

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), CRGraphicsStateGuardian::apply_texture_immediate(), DXTextureContext8::FillDDSurfTexturePixels(), DXTextureContext7::FillDDSurfTexturePixels(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::save_mipmap_images(), and CRGraphicsStateGuardian::save_mipmap_images().

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

Reimplemented from ImageBuffer.

Definition at line 194 of file texture.h.

References ImageBuffer::get_class_type().

INLINE WrapMode Texture::get_wrapu  )  const [private]
 

Referenced by DXGraphicsStateGuardian8::apply_texture(), RIBGraphicsStateGuardian::define_texture(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::specify_texture(), and CRGraphicsStateGuardian::specify_texture().

INLINE WrapMode Texture::get_wrapv  )  const [private]
 

Referenced by DXGraphicsStateGuardian8::apply_texture(), RIBGraphicsStateGuardian::define_texture(), DXGraphicsStateGuardian7::prepare_texture(), GLGraphicsStateGuardian::specify_texture(), and CRGraphicsStateGuardian::specify_texture().

INLINE bool Texture::has_ram_image  )  const
 

Referenced by DXTextureContext8::CreateTexture(), SomeViz::DisplayTexture(), BaseViz::DisplayTexture(), get_ram_image(), and write().

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

Reimplemented from ImageBuffer.

Definition at line 189 of file texture.h.

References ImageBuffer::get_class_type(), ImageBuffer::init_type(), and register_type().

Referenced by ConfigureFn().

bool Texture::is_mipmap FilterType  type  )  [static]
 

Definition at line 448 of file texture.cxx.

References FT_linear_mipmap_linear, FT_linear_mipmap_nearest, FT_nearest_mipmap_linear, and FT_nearest_mipmap_nearest.

Referenced by set_minfilter().

bool Texture::load const PNMImage pnmimage  ) 
 

Definition at line 421 of file texture.cxx.

References DF_image, and mark_dirty().

Referenced by event_T(), and read().

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

Definition at line 720 of file texture.cxx.

References BamReader::get_file_minor_ver(), DatagramIterator::get_string(), DatagramIterator::get_uint8(), TexturePool::load_texture(), NULL, params, parse_params(), and PT().

Referenced by register_with_read_factory().

void Texture::mark_dirty int  flags_to_set  ) 
 

Definition at line 635 of file texture.cxx.

References _all_dirty_flags, and _contexts.

Referenced by load(), set_anisotropic_degree(), set_magfilter(), set_minfilter(), set_wrapu(), and set_wrapv().

TextureContext * Texture::prepare GraphicsStateGuardianBase gsg  ) 
 

Definition at line 469 of file texture.cxx.

References _all_dirty_flags, _contexts, _keep_ram_image, Namable::get_name(), keep_texture_ram, GraphicsStateGuardianBase::prepare_texture(), and tc.

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

Texture::PT PixelBuffer   ) 
 

Referenced by make_Texture().

bool Texture::read const Filename &  fullpath,
const Filename &  alpha_fullpath,
int  primary_file_num_channels = 0,
int  alpha_file_channel = 0
[private]
 

Definition at line 224 of file texture.cxx.

References ImageBuffer::_alpha_file_channel, ImageBuffer::_primary_file_num_channels, consider_downgrade(), consider_rescale(), PNMImage::get_alpha(), PNMImage::get_channel_val(), PNMImage::get_gray(), PNMImageHeader::get_maxval(), Namable::get_name(), PNMImageHeader::get_num_channels(), PNMImageHeader::get_type(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), Namable::has_name(), image, load(), PNMImage::quick_filter_from(), PNMImage::read(), ImageBuffer::set_alpha_filename(), ImageBuffer::set_alpha_fullpath(), ImageBuffer::set_filename(), ImageBuffer::set_fullpath(), Namable::set_name(), x, and y.

bool Texture::read const Filename &  fullpath,
int  primary_file_num_channels = 0
[private]
 

Definition at line 187 of file texture.cxx.

References ImageBuffer::_alpha_file_channel, ImageBuffer::_primary_file_num_channels, ImageBuffer::clear_alpha_filename(), ImageBuffer::clear_alpha_fullpath(), consider_downgrade(), consider_rescale(), Namable::get_name(), Namable::has_name(), image, load(), ImageBuffer::set_filename(), ImageBuffer::set_fullpath(), and Namable::set_name().

Referenced by get_ram_image(), herc_keys(), TexturePool::ns_load_texture(), PT(), shader_keys(), and text_keys().

void Texture::register_with_read_factory void   )  [static]
 

Definition at line 710 of file texture.cxx.

References get_class_type(), BamReader::get_factory(), make_Texture(), and Factory< TypedWritable >::register_factory().

Referenced by ConfigureFn().

void Texture::set_anisotropic_degree int  anisotropic_degree  )  [private]
 

Definition at line 398 of file texture.cxx.

References _anisotropic_degree, DF_filter, and mark_dirty().

Referenced by EggLoader::apply_texture_attributes(), and DXTextureContext8::CreateTexture().

void Texture::set_border_color const Colorf color  )  [private]
 

Definition at line 411 of file texture.cxx.

References _border_color, and Colorf.

INLINE void Texture::set_keep_ram_image bool  keep_ram_image  ) 
 

void Texture::set_magfilter FilterType  filter  )  [private]
 

Definition at line 381 of file texture.cxx.

References _magfilter, DF_filter, filter, and mark_dirty().

Referenced by EggLoader::apply_texture_attributes(), DXTextureContext8::CreateTexture(), herc_keys(), WindowFramework::load_default_model(), min_shader_keys(), PT(), and text_keys().

void Texture::set_minfilter FilterType  filter  )  [private]
 

Definition at line 364 of file texture.cxx.

References _minfilter, DF_filter, DF_mipmap, filter, is_mipmap(), and mark_dirty().

Referenced by EggLoader::apply_texture_attributes(), DXTextureContext8::CreateTexture(), event_T(), herc_keys(), WindowFramework::load_default_model(), min_shader_keys(), PT(), and text_keys().

void Texture::set_wrapu WrapMode  wrap  )  [private]
 

Definition at line 338 of file texture.cxx.

References _wrapu, DF_wrap, and mark_dirty().

Referenced by EggLoader::apply_texture_attributes(), herc_keys(), and min_shader_keys().

void Texture::set_wrapv WrapMode  wrap  )  [private]
 

Definition at line 351 of file texture.cxx.

References _wrapv, DF_wrap, and mark_dirty().

Referenced by EggLoader::apply_texture_attributes(), herc_keys(), and min_shader_keys().

bool Texture::store PNMImage pnmimage  )  const
 

Definition at line 437 of file texture.cxx.

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

Definition at line 683 of file texture.cxx.

References cmp_nocase_uh(), FT_invalid, FT_linear, FT_linear_mipmap_linear, FT_linear_mipmap_nearest, FT_nearest_mipmap_linear, and FT_nearest_mipmap_nearest.

Referenced by init_libtext().

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

Definition at line 659 of file texture.cxx.

References cmp_nocase_uh(), WM_border_color, WM_clamp, and WM_invalid.

void Texture::unprepare GraphicsStateGuardianBase gsg  ) 
 

Definition at line 533 of file texture.cxx.

References _contexts, GraphicsStateGuardianBase::release_texture(), and tc.

void Texture::unprepare  ) 
 

Definition at line 507 of file texture.cxx.

References _contexts, Contexts, GraphicsStateGuardianBase::release_texture(), and tc.

Referenced by ~Texture().

INLINE bool Texture::uses_mipmaps  )  const [private]
 

Referenced by GLGraphicsStateGuardian::apply_texture_immediate(), and CRGraphicsStateGuardian::apply_texture_immediate().

bool Texture::write const Filename &  fullpath = ""  )  const [private]
 

Definition at line 317 of file texture.cxx.

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

Referenced by RIBGraphicsStateGuardian::define_texture().

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

Reimplemented from ImageBuffer.

Definition at line 829 of file texture.cxx.

References _anisotropic_degree, _magfilter, _minfilter, _wrapu, _wrapv, Datagram::add_bool(), Datagram::add_int16(), Datagram::add_uint8(), NULL, and ImageBuffer::write_datagram().


Friends And Related Function Documentation

friend class TextureContext [friend]
 

Definition at line 203 of file texture.h.


Member Data Documentation

PUBLISHED Texture::__pad0__ [private]
 

Reimplemented from ImageBuffer.

Definition at line 42 of file texture.h.

PUBLISHED Texture::__pad1__ [private]
 

Reimplemented from ImageBuffer.

Definition at line 77 of file texture.h.

int Texture::_all_dirty_flags [private]
 

Definition at line 157 of file texture.h.

Referenced by mark_dirty(), prepare(), and Texture().

int Texture::_anisotropic_degree [private]
 

Definition at line 143 of file texture.h.

Referenced by fillin(), set_anisotropic_degree(), Texture(), and write_datagram().

Colorf Texture::_border_color [private]
 

Definition at line 145 of file texture.h.

Referenced by set_border_color(), and Texture().

Contexts Texture::_contexts [private]
 

Definition at line 152 of file texture.h.

Referenced by clear_gsg(), mark_dirty(), prepare(), and unprepare().

bool Texture::_keep_ram_image [private]
 

Definition at line 144 of file texture.h.

Referenced by prepare(), and Texture().

FilterType Texture::_magfilter [private]
 

Definition at line 142 of file texture.h.

Referenced by fillin(), set_magfilter(), Texture(), and write_datagram().

FilterType Texture::_minfilter [private]
 

Definition at line 141 of file texture.h.

Referenced by fillin(), set_minfilter(), Texture(), and write_datagram().

TypeHandle Texture::_type_handle [static, private]
 

Reimplemented from ImageBuffer.

Definition at line 33 of file texture.cxx.

WrapMode Texture::_wrapu [private]
 

Definition at line 139 of file texture.h.

Referenced by fillin(), set_wrapu(), Texture(), and write_datagram().

WrapMode Texture::_wrapv [private]
 

Definition at line 140 of file texture.h.

Referenced by fillin(), set_wrapv(), Texture(), and write_datagram().

PUBLISHED Texture::FT_invalid [private]
 

Definition at line 42 of file texture.h.

Referenced by GLGraphicsStateGuardian::get_texture_filter_type(), CRGraphicsStateGuardian::get_texture_filter_type(), init_libtext(), and string_filter_type().

PUBLISHED Texture::FT_linear [private]
 

Definition at line 42 of file texture.h.

Referenced by DXGraphicsStateGuardian8::apply_texture(), EggLoader::apply_texture_attributes(), SpheretexShader::config(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), GLGraphicsStateGuardian::get_texture_filter_type(), CRGraphicsStateGuardian::get_texture_filter_type(), herc_keys(), init_libtext(), WindowFramework::load_default_model(), min_shader_keys(), DXGraphicsStateGuardian7::prepare_texture(), ProjtexShadower::ProjtexShadower(), PT(), NonlinearImager::recompute_screen(), SpheretexHighlighter::SpheretexHighlighter(), SpheretexReflector::SpheretexReflector(), SpotlightShader::SpotlightShader(), string_filter_type(), and text_keys().

PUBLISHED Texture::FT_linear_mipmap_linear [private]
 

Definition at line 42 of file texture.h.

Referenced by DXGraphicsStateGuardian8::apply_texture(), EggLoader::apply_texture_attributes(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), TextureContext::estimate_texture_memory(), event_T(), GLGraphicsStateGuardian::get_texture_filter_type(), CRGraphicsStateGuardian::get_texture_filter_type(), is_mipmap(), DXGraphicsStateGuardian7::prepare_texture(), PT(), and string_filter_type().

PUBLISHED Texture::FT_linear_mipmap_nearest [private]
 

Definition at line 42 of file texture.h.

Referenced by EggLoader::apply_texture_attributes(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), TextureContext::estimate_texture_memory(), GLGraphicsStateGuardian::get_texture_filter_type(), CRGraphicsStateGuardian::get_texture_filter_type(), is_mipmap(), and string_filter_type().

PUBLISHED Texture::FT_nearest_mipmap_linear [private]
 

Definition at line 42 of file texture.h.

Referenced by EggLoader::apply_texture_attributes(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), TextureContext::estimate_texture_memory(), GLGraphicsStateGuardian::get_texture_filter_type(), CRGraphicsStateGuardian::get_texture_filter_type(), is_mipmap(), and string_filter_type().

PUBLISHED Texture::FT_nearest_mipmap_nearest [private]
 

Definition at line 42 of file texture.h.

Referenced by EggLoader::apply_texture_attributes(), DXTextureContext8::CreateTexture(), DXTextureContext7::CreateTexture(), TextureContext::estimate_texture_memory(), GLGraphicsStateGuardian::get_texture_filter_type(), CRGraphicsStateGuardian::get_texture_filter_type(), is_mipmap(), and string_filter_type().


The documentation for this class was generated from the following files:
Generated on Fri Apr 18 00:13:41 2003 for Panda by doxygen1.3