30class EXPCL_PANDA_EGG EggTexture :
public EggFilenameNode,
public EggRenderMode,
public EggTransform {
32 explicit EggTexture(
const std::string &tref_name,
const Filename &filename);
33 EggTexture(
const EggTexture ©);
34 EggTexture &operator = (
const EggTexture ©);
35 virtual ~EggTexture();
37 virtual void write(std::ostream &out,
int indent_level)
const;
43 E_complete_filename = 0x007,
55 TT_unspecified, TT_1d_texture,
56 TT_2d_texture, TT_3d_texture, TT_cube_map
60 F_rgba, F_rgbm, F_rgba12, F_rgba8, F_rgba4, F_rgba5,
61 F_rgb, F_rgb12, F_rgb8, F_rgb5, F_rgb332,
62 F_red, F_green, F_blue, F_alpha, F_luminance,
63 F_luminance_alpha, F_luminance_alphamask,
68 enum CompressionMode {
69 CM_default, CM_off, CM_on,
70 CM_fxt1, CM_dxt1, CM_dxt2, CM_dxt3, CM_dxt4, CM_dxt5,
73 WM_unspecified, WM_clamp, WM_repeat,
74 WM_mirror, WM_mirror_once, WM_border_color
88 FT_nearest_mipmap_nearest,
89 FT_linear_mipmap_nearest,
90 FT_nearest_mipmap_linear,
91 FT_linear_mipmap_linear,
100 ET_blend_color_scale,
114 ET___occlusion_metallic_roughness,
115 ET___metallic_roughness,
128 enum CombineChannel {
142 CS_constant_color_scale,
143 CS_last_saved_result,
145 enum CombineOperand {
148 CO_one_minus_src_color,
150 CO_one_minus_src_alpha,
176 INLINE
void set_texture_type(TextureType texture_type);
177 INLINE TextureType get_texture_type()
const;
179 INLINE
void set_format(Format format);
180 INLINE Format get_format()
const;
182 INLINE
void set_compression_mode(CompressionMode mode);
183 INLINE CompressionMode get_compression_mode()
const;
185 INLINE
void set_wrap_mode(WrapMode mode);
186 INLINE WrapMode get_wrap_mode()
const;
188 INLINE
void set_wrap_u(WrapMode mode);
192 INLINE
void set_wrap_v(WrapMode mode);
196 INLINE
void set_wrap_w(WrapMode mode);
200 INLINE
void set_minfilter(FilterType type);
201 INLINE FilterType get_minfilter()
const;
203 INLINE
void set_magfilter(FilterType type);
204 INLINE FilterType get_magfilter()
const;
211 INLINE
void set_env_type(EnvType type);
212 INLINE EnvType get_env_type()
const;
215 INLINE
void set_combine_mode(CombineChannel channel, CombineMode cm);
216 INLINE CombineMode get_combine_mode(CombineChannel channel)
const;
217 INLINE
void set_combine_source(CombineChannel channel,
int n, CombineSource cs);
218 INLINE CombineSource get_combine_source(CombineChannel channel,
int n)
const;
219 INLINE
void set_combine_operand(CombineChannel channel,
int n, CombineOperand co);
220 INLINE CombineOperand get_combine_operand(CombineChannel channel,
int n)
const;
225 INLINE
void set_tex_gen(TexGen tex_gen);
226 INLINE TexGen get_tex_gen()
const;
228 INLINE
void set_quality_level(QualityLevel quality_level);
229 INLINE QualityLevel get_quality_level()
const;
241 INLINE
void set_color(
const LColor &color);
242 INLINE
void clear_color();
246 INLINE
void set_border_color(
const LColor &border_color);
247 INLINE
void clear_border_color();
251 INLINE
void set_uv_name(
const std::string &uv_name);
267 INLINE
void clear_alpha_filename();
322 MAKE_PROPERTY(texture_type, get_texture_type, set_texture_type);
323 MAKE_PROPERTY(format, get_format, set_format);
324 MAKE_PROPERTY(compression_mode, get_compression_mode, set_compression_mode);
325 MAKE_PROPERTY(wrap_mode, get_wrap_mode, set_wrap_mode);
329 MAKE_PROPERTY(minfilter, get_minfilter, set_minfilter);
330 MAKE_PROPERTY(magfilter, get_magfilter, set_magfilter);
333 MAKE_PROPERTY(env_type, get_env_type, set_env_type);
335 MAKE_PROPERTY(tex_gen, get_tex_gen, set_tex_gen);
336 MAKE_PROPERTY(quality_level, get_quality_level, set_quality_level);
342 set_color, clear_color);
344 set_border_color, clear_border_color);
373 virtual bool egg_start_parse_body();
376 typedef pset<EggTexture *> MultiTextures;
377 bool r_min_multitexture_sort(
int sort, MultiTextures &cycle_detector);
380 F_has_alpha_filename = 0x0002,
381 F_has_anisotropic_degree = 0x0004,
382 F_has_alpha_file_channel = 0x0008,
383 F_has_stage_name = 0x0010,
384 F_has_uv_name = 0x0020,
385 F_has_priority = 0x0040,
386 F_has_color = 0x0080,
387 F_has_rgb_scale = 0x0100,
388 F_has_alpha_scale = 0x0200,
389 F_has_border_color = 0x0400,
390 F_has_num_views = 0x0800,
391 F_has_min_lod = 0x1000,
392 F_has_max_lod = 0x2000,
393 F_has_lod_bias = 0x4000,
396 TextureType _texture_type;
398 CompressionMode _compression_mode;
399 WrapMode _wrap_mode, _wrap_u, _wrap_v, _wrap_w;
400 FilterType _minfilter, _magfilter;
401 int _anisotropic_degree;
407 QualityLevel _quality_level;
408 std::string _stage_name;
411 LColor _border_color;
412 std::string _uv_name;
418 int _alpha_file_channel;
420 int _multitexture_sort;
425 class SourceAndOperand {
427 INLINE SourceAndOperand();
428 CombineSource _source;
429 CombineOperand _operand;
436 SourceAndOperand _ops[CI_num_indices];
439 Combiner _combiner[CC_num_channels];
443 MultiTextures _over_textures, _under_textures;
446 static TypeHandle get_class_type() {
449 static void init_type() {
450 EggFilenameNode::init_type();
451 EggRenderMode::init_type();
453 EggFilenameNode::get_class_type(),
454 EggRenderMode::get_class_type());
456 virtual TypeHandle get_type()
const {
457 return get_class_type();
459 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
462 static TypeHandle _type_handle;
470class EXPCL_PANDA_EGG UniqueEggTextures {
472 INLINE UniqueEggTextures(
int eq = ~0);
478INLINE std::ostream &operator << (std::ostream &out,
const EggTexture &n) {
482EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::TextureType texture_type);
483EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::Format format);
484EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::CompressionMode mode);
485EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::WrapMode mode);
486EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::FilterType type);
487EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::EnvType type);
488EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::CombineMode cm);
489EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::CombineChannel cc);
490EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::CombineSource cs);
491EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::CombineOperand co);
492EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::TexGen tex_gen);
493EXPCL_PANDA_EGG std::ostream &operator << (std::ostream &out, EggTexture::QualityLevel quality_level);
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
virtual EggTransform * as_transform()
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform,...
void write(std::ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
Defines a texture map that may be applied to geometry.
static CombineOperand string_combine_operand(const std::string &string)
Returns the CombineOperand value associated with the given string representation, or CO_unspecified i...
clear_priority
Removes the specification of multitexture priority from the texture.
get_stage_name
Returns the stage name that has been specified for this texture, or the tref name if no texture stage...
get_read_mipmaps
Returns the current setting of the read_mipmaps flag.
WrapMode determine_wrap_u() const
Determines the appropriate wrap in the U direction.
has_uv_name
Returns true if a texcoord name has been explicitly specified for this texture, false otherwise.
get_alpha_scale
Returns the alpha_scale value that has been specified for the texture, or 1 if no alpha_scale value h...
get_wrap_w
Returns the amount specified for W wrap.
get_uv_name
Returns the texcoord name that has been specified for this texture, or the empty string if no texcoor...
static EnvType string_env_type(const std::string &string)
Returns the EnvType value associated with the given string representation, or ET_unspecified if the s...
static CombineSource string_combine_source(const std::string &string)
Returns the CombineSource value associated with the given string representation, or CS_unspecified if...
get_multiview
Returns the current setting of the multiview flag.
clear_min_lod
Removes the specification of a minimum mipmap level from the texture.
get_multitexture_sort
Returns an integer that represents the depth to which this texture is layered on all other textures i...
has_num_views
Returns true if the number of views has been specified for the 3-D multiview texture,...
set_num_views
When loading a 3-D multiview texture, this parameter is necessary to specify how many views will be e...
set_stage_name
Specifies the particular TextureStage this texture will be rendered on by name.
clear_stage_name
Removes the named TextureStage specification.
get_lod_bias
Returns the maximum mipmap level that has been specified for this texture.
get_alpha_file_channel
Returns the particular channel that has been specified for the alpha-file image, or 0 if no channel h...
set_rgb_scale
Sets an additional factor that will scale all three r, g, b components after the texture has been app...
clear_num_views
Removes the specification of the number of views for a 3-D multiview texture.
static TextureType string_texture_type(const std::string &string)
Returns the Texture_ype value associated with the given string representation, or TT_unspecified if t...
has_anisotropic_degree
Returns true if a value for the anisotropic filtering degree has been specified for this texture,...
get_border_color
Returns the border color if one has been specified, or (0, 0, 0, 1) otherwise.
set_alpha_scale
Sets an additional factor that will scale the alpha component after the texture has been applied.
get_min_lod
Returns the minimum mipmap level that has been specified for this texture.
clear_lod_bias
Removes the specification of a maximum mipmap level from the texture.
clear_alpha_scale
Removes the alpha_scale from the texture and restores it to the default value of 1.
set_uv_name
Specifies the named set of texture coordinates that this texture will use when it is applied to geome...
set_min_lod
Sets the minimum mipmap level that may be sampled.
static Format string_format(const std::string &string)
Returns the Format value associated with the given string representation, or F_unspecified if the str...
get_wrap_u
Returns the amount specified for U wrap.
clear_uv_name
Removes the restriction to a particular named set of texture coordinates and restores the texture to ...
WrapMode determine_wrap_w() const
Determines the appropriate wrap in the W direction.
static QualityLevel string_quality_level(const std::string &string)
Returns the TexGen value associated with the given string representation, or ET_unspecified if the st...
set_anisotropic_degree
Sets the degree of anisotropic filtering for this texture.
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,...
has_min_lod
Returns true if a value for the minimum mipmap level has been specified for this texture,...
get_max_lod
Returns the maximum mipmap level that has been specified for this texture.
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),...
static FilterType string_filter_type(const std::string &string)
Returns the FilterType value associated with the given string representation, or FT_unspecified if th...
static CombineMode string_combine_mode(const std::string &string)
Returns the CombineMode value associated with the given string representation, or CM_unspecified if t...
bool multitexture_over(EggTexture *other)
Indicates that this texture should be layered on top of the other texture.
clear_rgb_scale
Removes the rgb_scale from the texture and restores it to the default value of 1.
set_read_mipmaps
Sets the read_mipmaps flag.
set_alpha_file_channel
If a separate alpha-file is specified, this indicates which channel number should be extracted from t...
WrapMode determine_wrap_v() const
Determines the appropriate wrap in the V direction.
clear_anisotropic_degree
Removes the specification of anisotropic filtering from the texture.
get_anisotropic_degree
Returns the anisotropic filtering degree that has been specified for this texture,...
has_color
Returns true if a blend color has been specified for the texture.
has_lod_bias
Returns true if a value for the maximum mipmap level has been specified for this texture,...
set_multiview
Sets the multiview flag.
get_alpha_filename
Returns the separate file assigned for the alpha channel.
has_alpha_file_channel
Returns true if a particular channel has been specified for the alpha-file image, false otherwise.
has_priority
Returns true if a priority value for multitexture importance has been specified for the texture,...
set_max_lod
Sets the maximum mipmap level that may be sampled.
get_alpha_fullpath
Returns the full pathname to the alpha file, if it is known; otherwise, returns the same thing as get...
bool affects_polygon_alpha() const
Returns true if this texture's environment type or combine mode allows the texture to have an effect ...
has_rgb_scale
Returns true if an rgb_scale has been specified for the texture, false otherwise.
void clear_multitexture()
Resets the multitexture flags set by multitexture_over().
bool sorts_less_than(const EggTexture &other, int eq) const
An ordering operator to compare two textures for sorting order.
has_alpha_scale
Returns true if an alpha_scale has been specified for the texture, false otherwise.
get_color
Returns the blend color if one has been specified, or (0, 0, 0, 1) otherwise.
set_lod_bias
Sets the mipmap level bias that is added to the mipmap level to be sampled.
static TexGen string_tex_gen(const std::string &string)
Returns the TexGen value associated with the given string representation, or ET_unspecified if the st...
static CompressionMode string_compression_mode(const std::string &string)
Returns the CompressionMode value associated with the given string representation,...
get_wrap_v
Returns the amount specified for V wrap.
has_max_lod
Returns true if a value for the maximum mipmap level has been specified for this texture,...
set_saved_result
Sets the saved_result flag.
set_priority
Sets the importance of this texture with respect to other textures also applied on the same geometry.
get_rgb_scale
Returns the rgb_scale value that has been specified for the texture, or 1 if no rgb_scale value has b...
clear_max_lod
Removes the specification of a maximum mipmap level from the texture.
static WrapMode string_wrap_mode(const std::string &string)
Returns the WrapMode value associated with the given string representation, or WM_unspecified if the ...
set_alpha_fullpath
Records the full pathname to the file, for the benefit of get_alpha_fullpath().
clear_alpha_file_channel
Removes the specification of a particular channel to use from the alpha- file image.
has_border_color
Returns true if a border color has been specified for the texture.
set_alpha_filename
Specifies a separate file that will be loaded in with the 1- or 3-component texture and applied as th...
get_priority
Returns the multitexture importance value that has been specified for the texture,...
has_stage_name
Returns true if a stage name has been explicitly specified for this texture, false otherwise.
has_alpha_filename
Returns true if a separate file for the alpha component has been applied, false otherwise.
get_num_views
Returns the specified number of views specified for the 3-D multiview texture.
get_saved_result
Returns the current setting of the saved_result flag.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...