Panda3D
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

EggTexture Class Reference

Defines a texture map that may be applied to geometry. More...

#include "eggTexture.h"

Inheritance diagram for EggTexture:
EggFilenameNode EggRenderMode EggTransform EggNode EggNamedObject EggObject Namable TypedReferenceCount MemoryBase TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Classes

class  Combiner
class  SourceAndOperand

Public Types

enum  CombineChannel { CC_rgb = 0, CC_alpha = 1, CC_num_channels = 2 }
enum  CombineIndex { CI_num_indices = 3 }
enum  CombineMode {
  CM_unspecified, CM_replace, CM_modulate, CM_add,
  CM_add_signed, CM_interpolate, CM_subtract, CM_dot3_rgb,
  CM_dot3_rgba
}
enum  CombineOperand {
  CO_unspecified, CO_src_color, CO_one_minus_src_color, CO_src_alpha,
  CO_one_minus_src_alpha
}
enum  CombineSource {
  CS_unspecified, CS_texture, CS_constant, CS_primary_color,
  CS_previous, CS_constant_color_scale, CS_last_saved_result
}
enum  CompressionMode {
  CM_default, CM_off, CM_on, CM_fxt1,
  CM_dxt1, CM_dxt2, CM_dxt3, CM_dxt4,
  CM_dxt5
}
enum  EnvType {
  ET_unspecified, ET_modulate, ET_decal, ET_blend,
  ET_replace, ET_add, ET_blend_color_scale, ET_modulate_glow,
  ET_modulate_gloss, ET_normal, ET_normal_height, ET_glow,
  ET_gloss, ET_height, ET_selector, ET_normal_gloss
}
enum  Equivalence {
  E_basename = 0x001, E_extension = 0x002, E_dirname = 0x004, E_complete_filename = 0x007,
  E_transform = 0x008, E_attributes = 0x010, E_tref_name = 0x020
}
enum  FilterType {
  FT_unspecified, FT_nearest, FT_linear, FT_nearest_mipmap_nearest,
  FT_linear_mipmap_nearest, FT_nearest_mipmap_linear, FT_linear_mipmap_linear
}
enum  Format {
  F_unspecified, F_rgba, F_rgbm, F_rgba12,
  F_rgba8, F_rgba4, F_rgba5, F_rgb,
  F_rgb12, F_rgb8, F_rgb5, F_rgb332,
  F_red, F_green, F_blue, F_alpha,
  F_luminance, F_luminance_alpha, F_luminance_alphamask
}
enum  QualityLevel {
  QL_unspecified, QL_default, QL_fastest, QL_normal,
  QL_best
}
enum  TexGen {
  TG_unspecified, TG_eye_sphere_map, TG_world_cube_map, TG_eye_cube_map,
  TG_world_normal, TG_eye_normal, TG_world_position, TG_eye_position,
  TG_point_sprite
}
enum  TextureType {
  TT_unspecified, TT_1d_texture, TT_2d_texture, TT_3d_texture,
  TT_cube_map
}
enum  WrapMode {
  WM_unspecified, WM_clamp, WM_repeat, WM_mirror,
  WM_mirror_once, WM_border_color
}

Public Member Functions

 EggTexture (const string &tref_name, const Filename &filename)
 EggTexture (const EggTexture &copy)
bool affects_polygon_alpha () const
 Returns true if this texture's environment type or combine mode allows the texture to have an effect on the polygon's alpha values, false otherwise.
virtual EggTransformas_transform ()
 Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.
void clear_alpha_file_channel ()
 Removes the specification of a particular channel to use from the alpha-file image.
void clear_alpha_filename ()
void clear_alpha_scale ()
 Removes the alpha_scale from the texture and restores it to the default value of 1.
void clear_anisotropic_degree ()
 Removes the specification of anisotropic filtering from the texture.
void clear_border_color ()
void clear_color ()
void clear_multitexture ()
 Resets the multitexture flags set by multitexture_over().
void clear_num_views ()
 Removes the specification of the number of views for a 3-D multiview texture.
void clear_priority ()
 Removes the specification of multitexture priority from the texture.
void clear_rgb_scale ()
 Removes the rgb_scale from the texture and restores it to the default value of 1.
void clear_stage_name ()
 Removes the named TextureStage specification.
void clear_uv_name ()
 Removes the restriction to a particular named set of texture coordinates and restores the texture to using the default texture coordinates.
WrapMode determine_wrap_u () const
 Determines the appropriate wrap in the U direction.
WrapMode determine_wrap_v () const
 Determines the appropriate wrap in the V direction.
WrapMode determine_wrap_w () const
 Determines the appropriate wrap in the W direction.
virtual TypeHandle force_init_type ()
int get_alpha_file_channel () const
 Returns the particular channel that has been specified for the alpha-file image, or 0 if no channel has been specified.
const Filenameget_alpha_filename () const
 Returns the separate file assigned for the alpha channel.
const Filenameget_alpha_fullpath () const
 Returns the full pathname to the alpha file, if it is known; otherwise, returns the same thing as get_alpha_filename().
int get_alpha_scale () const
 Returns the alpha_scale value that has been specified for the texture, or 1 if no alpha_scale value has been specified.
int get_anisotropic_degree () const
 Returns the anisotropic filtering degree that has been specified for this texture, or 0 if nothing has been specified.
const LColorget_border_color () const
 Returns the border color if one has been specified, or (0, 0, 0, 1) otherwise.
const LColorget_color () const
 Returns the blend color if one has been specified, or (0, 0, 0, 1) otherwise.
CombineMode get_combine_mode (CombineChannel channel) const
CombineOperand get_combine_operand (CombineChannel channel, int n) const
CombineSource get_combine_source (CombineChannel channel, int n) const
CompressionMode get_compression_mode () const
EnvType get_env_type () const
Format get_format () const
FilterType get_magfilter () const
FilterType get_minfilter () const
int get_multitexture_sort () const
 Returns an integer that represents the depth to which this texture is layered on all other textures in the egg file.
bool get_multiview () const
 Returns the current setting of the multiview flag.
int get_num_views () const
 Returns the specified number of views specified for the 3-D multiview texture.
int get_priority () const
 Returns the multitexture importance value that has been specified for the texture, or 0 if no priority value has been specified.
QualityLevel get_quality_level () const
bool get_read_mipmaps () const
 Returns the current setting of the read_mipmaps flag.
int get_rgb_scale () const
 Returns the rgb_scale value that has been specified for the texture, or 1 if no rgb_scale value has been specified.
bool get_saved_result () const
 Returns the current setting of the saved_result flag.
const string & get_stage_name () const
 Returns the stage name that has been specified for this texture, or the tref name if no texture stage has explicitly been specified.
TexGen get_tex_gen () const
TextureType get_texture_type () const
virtual TypeHandle get_type () const
const string & get_uv_name () const
 Returns the texcoord name that has been specified for this texture, or the empty string if no texcoord name has explicitly been specified.
WrapMode get_wrap_mode () const
WrapMode get_wrap_u () const
 Returns the amount specified for U wrap.
WrapMode get_wrap_v () const
 Returns the amount specified for V wrap.
WrapMode get_wrap_w () const
 Returns the amount specified for W wrap.
bool has_alpha_channel (int num_components) const
 Given the number of color components (channels) in the image file as actually read from the disk, return true if this texture seems to have an alpha channel or not.
bool has_alpha_file_channel () const
 Returns true if a particular channel has been specified for the alpha-file image, false otherwise.
bool has_alpha_filename () const
 Returns true if a separate file for the alpha component has been applied, false otherwise.
bool has_alpha_scale () const
 Returns true if an alpha_scale has been specified for the texture, false otherwise.
bool has_anisotropic_degree () const
 Returns true if a value for the anisotropic filtering degree has been specified for this texture, false otherwise.
bool has_border_color () const
 Returns true if a border color has been specified for the texture.
bool has_color () const
 Returns true if a blend color has been specified for the texture.
bool has_num_views () const
 Returns true if the number of views has been specified for the 3-D multiview texture, false otherwise.
bool has_priority () const
 Returns true if a priority value for multitexture importance has been specified for the texture, false otherwise.
bool has_rgb_scale () const
 Returns true if an rgb_scale has been specified for the texture, false otherwise.
bool has_stage_name () const
 Returns true if a stage name has been explicitly specified for this texture, false otherwise.
bool has_uv_name () const
 Returns true if a texcoord name has been explicitly specified for this texture, false otherwise.
bool is_equivalent_to (const EggTexture &other, int eq) const
 Returns true if the two textures are equivalent in all relevant properties (according to eq), false otherwise.
bool multitexture_over (EggTexture *other)
 Indicates that this texture should be layered on top of the other texture.
EggTextureoperator= (const EggTexture &copy)
void set_alpha_file_channel (int alpha_file_channel)
 If a separate alpha-file is specified, this indicates which channel number should be extracted from this file to derive the alpha channel for the final image.
void set_alpha_filename (const Filename &filename)
 Specifies a separate file that will be loaded in with the 1- or 3-component texture and applied as the alpha channel.
void set_alpha_fullpath (const Filename &fullpath)
 Records the full pathname to the file, for the benefit of get_alpha_fullpath().
void set_alpha_scale (int alpha_scale)
 Sets an additional factor that will scale the alpha component after the texture has been applied.
void set_anisotropic_degree (int anisotropic_degree)
 Sets the degree of anisotropic filtering for this texture.
void set_border_color (const LColor &border_color)
void set_color (const LColor &color)
void set_combine_mode (CombineChannel channel, CombineMode cm)
void set_combine_operand (CombineChannel channel, int n, CombineOperand co)
void set_combine_source (CombineChannel channel, int n, CombineSource cs)
void set_compression_mode (CompressionMode mode)
void set_env_type (EnvType type)
void set_format (Format format)
void set_magfilter (FilterType type)
void set_minfilter (FilterType type)
void set_multiview (bool multiview)
 Sets the multiview flag.
void set_num_views (int num_views)
 When loading a 3-D multiview texture, this parameter is necessary to specify how many views will be expected.
void set_priority (int priority)
 Sets the importance of this texture with respect to other textures also applied on the same geometry.
void set_quality_level (QualityLevel quality_level)
void set_read_mipmaps (bool read_mipmaps)
 Sets the read_mipmaps flag.
void set_rgb_scale (int rgb_scale)
 Sets an additional factor that will scale all three r, g, b components after the texture has been applied.
void set_saved_result (bool saved_result)
 Sets the saved_result flag.
void set_stage_name (const string &stage_name)
 Specifies the particular TextureStage this texture will be rendered on by name.
void set_tex_gen (TexGen tex_gen)
void set_texture_type (TextureType texture_type)
void set_uv_name (const string &uv_name)
 Specifies the named set of texture coordinates that this texture will use when it is applied to geometry.
void set_wrap_mode (WrapMode mode)
void set_wrap_u (WrapMode mode)
void set_wrap_v (WrapMode mode)
void set_wrap_w (WrapMode mode)
bool sorts_less_than (const EggTexture &other, int eq) const
 An ordering operator to compare two textures for sorting order.
virtual void write (ostream &out, int indent_level) const
 Writes the texture definition to the indicated output stream in Egg format.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.
static CombineMode string_combine_mode (const string &string)
 Returns the CombineMode value associated with the given string representation, or CM_unspecified if the string does not match any known CombineMode value.
static CombineOperand string_combine_operand (const string &string)
 Returns the CombineOperand value associated with the given string representation, or CO_unspecified if the string does not match any known CombineOperand value.
static CombineSource string_combine_source (const string &string)
 Returns the CombineSource value associated with the given string representation, or CS_unspecified if the string does not match any known CombineSource value.
static CompressionMode string_compression_mode (const string &string)
 Returns the CompressionMode value associated with the given string representation, or CM_default if the string does not match any known CompressionMode value.
static EnvType string_env_type (const string &string)
 Returns the EnvType value associated with the given string representation, or ET_unspecified if the string does not match any known EnvType value.
static FilterType string_filter_type (const string &string)
 Returns the FilterType value associated with the given string representation, or FT_unspecified if the string does not match any known FilterType value.
static Format string_format (const string &string)
 Returns the Format value associated with the given string representation, or F_unspecified if the string does not match any known Format value.
static QualityLevel string_quality_level (const string &string)
 Returns the TexGen value associated with the given string representation, or ET_unspecified if the string does not match any known TexGen value.
static TexGen string_tex_gen (const string &string)
 Returns the TexGen value associated with the given string representation, or ET_unspecified if the string does not match any known TexGen value.
static TextureType string_texture_type (const string &string)
 Returns the Texture_ype value associated with the given string representation, or TT_unspecified if the string does not match any known TextureType value.
static WrapMode string_wrap_mode (const string &string)
 Returns the WrapMode value associated with the given string representation, or WM_unspecified if the string does not match any known WrapMode value.

Protected Member Functions

virtual bool egg_start_parse_body ()
 This function is called within parse_egg().

Detailed Description

Defines a texture map that may be applied to geometry.

Definition at line 33 of file eggTexture.h.


Member Function Documentation

bool EggTexture::affects_polygon_alpha ( ) const

Returns true if this texture's environment type or combine mode allows the texture to have an effect on the polygon's alpha values, false otherwise.

Definition at line 571 of file eggTexture.cxx.

Referenced by EggPrimitive::determine_alpha_mode().

EggTransform * EggTexture::as_transform ( ) [virtual]

Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.

Reimplemented from EggObject.

Definition at line 1113 of file eggTexture.cxx.

void EggTexture::clear_alpha_file_channel ( ) [inline]

Removes the specification of a particular channel to use from the alpha-file image.

Definition at line 919 of file eggTexture.I.

Referenced by ImageFile::update_egg_tex().

void EggTexture::clear_alpha_scale ( ) [inline]

Removes the alpha_scale from the texture and restores it to the default value of 1.

Definition at line 782 of file eggTexture.I.

void EggTexture::clear_anisotropic_degree ( ) [inline]

Removes the specification of anisotropic filtering from the texture.

Definition at line 264 of file eggTexture.I.

void EggTexture::clear_multitexture ( )

Resets the multitexture flags set by multitexture_over().

After this call, get_multitexture() will return false, and get_multitexture_sort() will return 0.

Definition at line 630 of file eggTexture.cxx.

void EggTexture::clear_num_views ( ) [inline]

Removes the specification of the number of views for a 3-D multiview texture.

Definition at line 999 of file eggTexture.I.

void EggTexture::clear_priority ( ) [inline]

Removes the specification of multitexture priority from the texture.

The default priority value is 0.

Definition at line 535 of file eggTexture.I.

void EggTexture::clear_rgb_scale ( ) [inline]

Removes the rgb_scale from the texture and restores it to the default value of 1.

Definition at line 732 of file eggTexture.I.

void EggTexture::clear_stage_name ( ) [inline]

Removes the named TextureStage specification.

Definition at line 486 of file eggTexture.I.

void EggTexture::clear_uv_name ( ) [inline]

Removes the restriction to a particular named set of texture coordinates and restores the texture to using the default texture coordinates.

Definition at line 681 of file eggTexture.I.

Referenced by set_uv_name().

EggTexture::WrapMode EggTexture::determine_wrap_u ( ) const [inline]

Determines the appropriate wrap in the U direction.

This is different from get_wrap_u() in that if the U wrap is unspecified, it returns the overall wrap value.

Definition at line 132 of file eggTexture.I.

References get_wrap_u().

Referenced by TextureReference::from_egg().

EggTexture::WrapMode EggTexture::determine_wrap_v ( ) const [inline]

Determines the appropriate wrap in the V direction.

This is different from get_wrap_v() in that if the V wrap is unspecified, it returns the overall wrap value.

Definition at line 166 of file eggTexture.I.

References get_wrap_v().

Referenced by TextureReference::from_egg().

EggTexture::WrapMode EggTexture::determine_wrap_w ( ) const [inline]

Determines the appropriate wrap in the W direction.

This is different from get_wrap_w() in that if the W wrap is unspecified, it returns the overall wrap value.

Definition at line 200 of file eggTexture.I.

References get_wrap_w().

bool EggTexture::egg_start_parse_body ( ) [protected, virtual]

This function is called within parse_egg().

It should call the appropriate function on the lexer to initialize the parser into the state associated with this object. If the object cannot be parsed into directly, it should return false.

Reimplemented from EggNode.

Definition at line 1127 of file eggTexture.cxx.

int EggTexture::get_alpha_file_channel ( ) const [inline]

Returns the particular channel that has been specified for the alpha-file image, or 0 if no channel has been specified.

See set_alpha_file_channel().

Definition at line 944 of file eggTexture.I.

Referenced by TextureReference::from_egg(), and write().

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

Returns the separate file assigned for the alpha channel.

It is an error to call this unless has_alpha_filename() returns true. See set_alpha_filename().

Definition at line 858 of file eggTexture.I.

References has_alpha_filename().

Referenced by EggBase::convert_paths(), EggGroupNode::force_filenames(), TextureReference::from_egg(), EggGroupNode::has_absolute_pathnames(), EggGroupNode::resolve_filenames(), and write().

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

Returns the full pathname to the alpha file, if it is known; otherwise, returns the same thing as get_alpha_filename().

This function simply returns whatever was set by the last call to set_alpha_fullpath(). This string is not written to the egg file; its main purpose is to record the full path to the alpha filename if it is known, for egg structures that are generated in-memory and then immediately converted to a scene graph.

Definition at line 879 of file eggTexture.I.

int EggTexture::get_alpha_scale ( ) const [inline]

Returns the alpha_scale value that has been specified for the texture, or 1 if no alpha_scale value has been specified.

Definition at line 806 of file eggTexture.I.

Referenced by write().

int EggTexture::get_anisotropic_degree ( ) const [inline]

Returns the anisotropic filtering degree that has been specified for this texture, or 0 if nothing has been specified.

Definition at line 289 of file eggTexture.I.

Referenced by TextureReference::from_egg(), and write().

const LColor & EggTexture::get_border_color ( ) const [inline]

Returns the border color if one has been specified, or (0, 0, 0, 1) otherwise.

Definition at line 648 of file eggTexture.I.

const LColor & EggTexture::get_color ( ) const [inline]

Returns the blend color if one has been specified, or (0, 0, 0, 1) otherwise.

Definition at line 604 of file eggTexture.I.

int EggTexture::get_multitexture_sort ( ) const [inline]

Returns an integer that represents the depth to which this texture is layered on all other textures in the egg file.

In general, if texture A is layered over texture B, then sort(A) > sort(B). If texture A is never layered over any other texture, then sort(A) == 0. More than that is difficult to guarantee.

Definition at line 1071 of file eggTexture.I.

Referenced by multitexture_over().

bool EggTexture::get_multiview ( ) const [inline]

Returns the current setting of the multiview flag.

See set_multiview().

Definition at line 974 of file eggTexture.I.

Referenced by write().

int EggTexture::get_num_views ( ) const [inline]

Returns the specified number of views specified for the 3-D multiview texture.

See set_num_views().

Definition at line 1023 of file eggTexture.I.

Referenced by write().

int EggTexture::get_priority ( ) const [inline]

Returns the multitexture importance value that has been specified for the texture, or 0 if no priority value has been specified.

Definition at line 560 of file eggTexture.I.

Referenced by write().

bool EggTexture::get_read_mipmaps ( ) const [inline]

Returns the current setting of the read_mipmaps flag.

See set_read_mipmaps().

Definition at line 1056 of file eggTexture.I.

Referenced by write().

int EggTexture::get_rgb_scale ( ) const [inline]

Returns the rgb_scale value that has been specified for the texture, or 1 if no rgb_scale value has been specified.

Definition at line 756 of file eggTexture.I.

Referenced by write().

bool EggTexture::get_saved_result ( ) const [inline]

Returns the current setting of the saved_result flag.

See set_saved_result().

Definition at line 416 of file eggTexture.I.

Referenced by write().

const string & EggTexture::get_stage_name ( ) const [inline]

Returns the stage name that has been specified for this texture, or the tref name if no texture stage has explicitly been specified.

Definition at line 510 of file eggTexture.I.

References has_stage_name().

Referenced by write().

const string & EggTexture::get_uv_name ( ) const [inline]

Returns the texcoord name that has been specified for this texture, or the empty string if no texcoord name has explicitly been specified.

Definition at line 705 of file eggTexture.I.

Referenced by EggPrimitive::r_apply_texmats(), EggGroupNode::recompute_tangent_binormal_auto(), and write().

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

Returns the amount specified for U wrap.

This may be unspecified, even if there is an overall wrap value.

Definition at line 119 of file eggTexture.I.

Referenced by determine_wrap_u(), and write().

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

Returns the amount specified for V wrap.

This may be unspecified, even if there is an overall wrap value.

Definition at line 153 of file eggTexture.I.

Referenced by determine_wrap_v(), and write().

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

Returns the amount specified for W wrap.

This may be unspecified, even if there is an overall wrap value.

Definition at line 187 of file eggTexture.I.

Referenced by determine_wrap_w(), and write().

bool EggTexture::has_alpha_channel ( int  num_components) const

Given the number of color components (channels) in the image file as actually read from the disk, return true if this texture seems to have an alpha channel or not.

This depends on the EggTexture's format as well as the number of channels.

Definition at line 528 of file eggTexture.cxx.

Referenced by TextureReference::from_egg(), and TextureReference::update_egg().

bool EggTexture::has_alpha_file_channel ( ) const [inline]

Returns true if a particular channel has been specified for the alpha-file image, false otherwise.

Definition at line 931 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_alpha_filename ( ) const [inline]

Returns true if a separate file for the alpha component has been applied, false otherwise.

See set_alpha_filename().

Definition at line 846 of file eggTexture.I.

Referenced by EggBase::convert_paths(), EggGroupNode::force_filenames(), TextureReference::from_egg(), get_alpha_filename(), EggGroupNode::has_absolute_pathnames(), EggGroupNode::resolve_filenames(), and write().

bool EggTexture::has_alpha_scale ( ) const [inline]

Returns true if an alpha_scale has been specified for the texture, false otherwise.

Definition at line 794 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_anisotropic_degree ( ) const [inline]

Returns true if a value for the anisotropic filtering degree has been specified for this texture, false otherwise.

Definition at line 277 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_border_color ( ) const [inline]

Returns true if a border color has been specified for the texture.

Definition at line 637 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_color ( ) const [inline]

Returns true if a blend color has been specified for the texture.

Definition at line 593 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_num_views ( ) const [inline]

Returns true if the number of views has been specified for the 3-D multiview texture, false otherwise.

Definition at line 1012 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_priority ( ) const [inline]

Returns true if a priority value for multitexture importance has been specified for the texture, false otherwise.

Definition at line 548 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_rgb_scale ( ) const [inline]

Returns true if an rgb_scale has been specified for the texture, false otherwise.

Definition at line 744 of file eggTexture.I.

Referenced by write().

bool EggTexture::has_stage_name ( ) const [inline]

Returns true if a stage name has been explicitly specified for this texture, false otherwise.

Definition at line 498 of file eggTexture.I.

Referenced by get_stage_name(), and write().

bool EggTexture::has_uv_name ( ) const [inline]

Returns true if a texcoord name has been explicitly specified for this texture, false otherwise.

Definition at line 693 of file eggTexture.I.

Referenced by write().

static void EggTexture::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from EggFilenameNode.

Definition at line 376 of file eggTexture.h.

References EggFilenameNode::init_type().

bool EggTexture::is_equivalent_to ( const EggTexture other,
int  eq 
) const

Returns true if the two textures are equivalent in all relevant properties (according to eq), false otherwise.

The Equivalence parameter, eq, should be set to the bitwise OR of the following properties, according to what you consider relevant:

EggTexture::E_basename: The basename part of the texture filename, without the directory prefix *or* the filename extension.

EggTexture::E_extension: The extension part of the texture filename.

EggTexture::E_dirname: The directory prefix of the texture filename.

EggTexture::E_complete_filename: The union of the above three; that is, the complete filename, with directory, basename, and extension.

EggTexture::E_transform: The texture matrix.

EggTexture::E_attributes: All remaining texture attributes (mode, mipmap, etc.) except TRef name.

EggTexture::E_tref_name: The TRef name.

Definition at line 349 of file eggTexture.cxx.

References LMatrix4d::almost_equal(), Filename::get_basename_wo_extension(), Filename::get_dirname(), Filename::get_extension(), EggFilenameNode::get_filename(), EggTransform::get_transform3d(), EggTransform::has_transform(), and EggTransform::transform_is_identity().

Referenced by EggTextureCollection::create_unique_texture().

bool EggTexture::multitexture_over ( EggTexture other)

Indicates that this texture should be layered on top of the other texture.

This will guarantee that this->get_multitexture_sort() > other->get_multitexture_sort(), at least until clear_multitexture() is called on either one.

The return value is true if successful, or false if there is a failure because the other texture was already layered on top of this one (or there is a three- or more-way cycle).

Definition at line 672 of file eggTexture.cxx.

References get_multitexture_sort().

Referenced by EggTextureCollection::find_used_textures().

void EggTexture::set_alpha_file_channel ( int  alpha_file_channel) [inline]

If a separate alpha-file is specified, this indicates which channel number should be extracted from this file to derive the alpha channel for the final image.

The default is 0, which means the grayscale combination of r, g, b. Otherwise, this should be the 1-based channel number, for instance 1, 2, or 3 for r, g, or b, respectively, or 4 for the alpha channel of a four-component image.

Definition at line 907 of file eggTexture.I.

Referenced by ImageFile::update_egg_tex().

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

Specifies a separate file that will be loaded in with the 1- or 3-component texture and applied as the alpha channel.

This is useful when loading textures from file formats that do not support alpha, for instance jpg.

Definition at line 820 of file eggTexture.I.

Referenced by EggBase::convert_paths(), EggGroupNode::force_filenames(), EggGroupNode::resolve_filenames(), and ImageFile::update_egg_tex().

void EggTexture::set_alpha_fullpath ( const Filename fullpath) [inline]

Records the full pathname to the file, for the benefit of get_alpha_fullpath().

Definition at line 890 of file eggTexture.I.

Referenced by EggBase::convert_paths().

void EggTexture::set_alpha_scale ( int  alpha_scale) [inline]

Sets an additional factor that will scale the alpha component after the texture has been applied.

This is used only when a combine mode is in effect.

The only legal values are 1, 2, or 4.

Definition at line 770 of file eggTexture.I.

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

Sets the degree of anisotropic filtering for this texture.

1 is off; higher levels indicate filtering in effect.

Definition at line 252 of file eggTexture.I.

Referenced by TextureProperties::update_egg_tex().

void EggTexture::set_multiview ( bool  multiview) [inline]

Sets the multiview flag.

If multiview is true, the filename should contain a hash mark ('#'), which will be filled in with the view number; and a multiview texture will be defined with a series of images, one for each view.

A multiview texture is most often used for stereo textures, but other uses are also possible, such as for texture animation.

Definition at line 963 of file eggTexture.I.

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

When loading a 3-D multiview texture, this parameter is necessary to specify how many views will be expected.

The z size is determined implicitly from the number of images loaded.

Definition at line 987 of file eggTexture.I.

void EggTexture::set_priority ( int  priority) [inline]

Sets the importance of this texture with respect to other textures also applied on the same geometry.

This is only meaningful in the presence of multitexturing.

Definition at line 523 of file eggTexture.I.

void EggTexture::set_read_mipmaps ( bool  read_mipmaps) [inline]

Sets the read_mipmaps flag.

If read_mipmaps is true, the filename should contain a hash mark ('#'), which will be filled in with the mipmap level number; and the texture will be defined with a series of images, one for each mipmap level.

If the filename is of a type that already requires a hash mark, such as a cube map or a 3-d texture, then the filename should now require two hash marks, and the first one indicates the mipmap level number, while the second indicates the face number or 3-d level number.

Definition at line 1045 of file eggTexture.I.

void EggTexture::set_rgb_scale ( int  rgb_scale) [inline]

Sets an additional factor that will scale all three r, g, b components after the texture has been applied.

This is used only when a combine mode is in effect.

The only legal values are 1, 2, or 4.

Definition at line 720 of file eggTexture.I.

void EggTexture::set_saved_result ( bool  saved_result) [inline]

Sets the saved_result flag.

When this is true, the output of this stage is not part of the normal pipeline--that is, it will not be supplied as the "previous" source for the next texture stage--but it will instead be supplied as the "last_saved_result" source for any future stages, until the next TextureStage with a saved_result set true is encountered.

This can be used to reuse the results of this texture stage as input to more than one stage later in the pipeline.

The last texture in the pipeline (the one with the highest sort value) should not have this flag set.

Definition at line 405 of file eggTexture.I.

void EggTexture::set_stage_name ( const string &  stage_name) [inline]

Specifies the particular TextureStage this texture will be rendered on by name.

If this is omitted, the texture will be rendered on the default TextureStage, unless some other stage-specific property is specificied, in which case the texture will be rendered on a TextureStage with the same name as the tref. This is in support of multitexturing.

Each different TextureStage in the world must be uniquely named.

Definition at line 475 of file eggTexture.I.

void EggTexture::set_uv_name ( const string &  uv_name) [inline]

Specifies the named set of texture coordinates that this texture will use when it is applied to geometry.

Geometry may have multiple sets of texture coordinates defined, by name.

If this is not specified for a particular texture, the default set of texture coordinates will be used.

Definition at line 664 of file eggTexture.I.

References clear_uv_name().

bool EggTexture::sorts_less_than ( const EggTexture other,
int  eq 
) const

An ordering operator to compare two textures for sorting order.

This imposes an arbitrary ordering useful to identify unique textures, according to the indicated Equivalence factor. See is_equivalent_to().

Definition at line 429 of file eggTexture.cxx.

References LMatrix4d::compare_to(), Filename::get_basename_wo_extension(), Filename::get_dirname(), Filename::get_extension(), EggFilenameNode::get_filename(), EggTransform::get_transform3d(), EggTransform::has_transform(), and EggTransform::transform_is_identity().

Referenced by EggPolysetMaker::sorts_less().

EggTexture::CombineMode EggTexture::string_combine_mode ( const string &  string) [static]

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

Definition at line 945 of file eggTexture.cxx.

EggTexture::CombineOperand EggTexture::string_combine_operand ( const string &  string) [static]

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

Definition at line 1015 of file eggTexture.cxx.

EggTexture::CombineSource EggTexture::string_combine_source ( const string &  string) [static]

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

Definition at line 983 of file eggTexture.cxx.

EggTexture::CompressionMode EggTexture::string_compression_mode ( const string &  string) [static]

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

Definition at line 784 of file eggTexture.cxx.

EggTexture::EnvType EggTexture::string_env_type ( const string &  string) [static]

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

Definition at line 886 of file eggTexture.cxx.

EggTexture::FilterType EggTexture::string_filter_type ( const string &  string) [static]

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

Definition at line 838 of file eggTexture.cxx.

Referenced by EggTextureCards::dispatch_filter_type().

EggTexture::Format EggTexture::string_format ( const string &  string) [static]

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

Definition at line 733 of file eggTexture.cxx.

Referenced by EggTextureCards::dispatch_format(), and TxaLine::parse().

EggTexture::QualityLevel EggTexture::string_quality_level ( const string &  string) [static]

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

Definition at line 1084 of file eggTexture.cxx.

Referenced by EggTextureCards::dispatch_quality_level(), and TxaLine::parse().

EggTexture::TexGen EggTexture::string_tex_gen ( const string &  string) [static]

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

Definition at line 1041 of file eggTexture.cxx.

EggTexture::TextureType EggTexture::string_texture_type ( const string &  string) [static]

Returns the Texture_ype value associated with the given string representation, or TT_unspecified if the string does not match any known TextureType value.

Definition at line 699 of file eggTexture.cxx.

EggTexture::WrapMode EggTexture::string_wrap_mode ( const string &  string) [static]

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

Definition at line 814 of file eggTexture.cxx.

Referenced by EggTextureCards::dispatch_wrap_mode(), and TxaLine::parse().

void EggTexture::write ( ostream &  out,
int  indent_level 
) const [virtual]

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