17 INLINE
void EggTexture::
18 set_texture_type(TextureType texture_type) {
19 _texture_type = texture_type;
21 bool pattern_filename =
22 (_texture_type == TT_3d_texture || _texture_type == TT_cube_map);
24 _filename.set_pattern(pattern_filename);
25 _fullpath.set_pattern(pattern_filename);
31 INLINE EggTexture::TextureType EggTexture::
32 get_texture_type()
const {
39 INLINE
void EggTexture::
40 set_format(Format format) {
47 INLINE EggTexture::Format EggTexture::
55 INLINE
void EggTexture::
56 set_compression_mode(CompressionMode mode) {
57 _compression_mode = mode;
63 INLINE EggTexture::CompressionMode EggTexture::
64 get_compression_mode()
const {
65 return _compression_mode;
71 INLINE
void EggTexture::
72 set_wrap_mode(WrapMode mode) {
79 INLINE EggTexture::WrapMode EggTexture::
80 get_wrap_mode()
const {
87 INLINE
void EggTexture::
88 set_wrap_u(WrapMode mode) {
108 return (_wrap_u == WM_unspecified) ? get_wrap_mode() :
get_wrap_u();
114 INLINE
void EggTexture::
115 set_wrap_v(WrapMode mode) {
135 return (_wrap_v == WM_unspecified) ? get_wrap_mode() :
get_wrap_v();
141 INLINE
void EggTexture::
142 set_wrap_w(WrapMode mode) {
162 return (_wrap_w == WM_unspecified) ? get_wrap_mode() :
get_wrap_w();
168 INLINE
void EggTexture::
169 set_minfilter(FilterType type) {
176 INLINE EggTexture::FilterType EggTexture::
177 get_minfilter()
const {
184 INLINE
void EggTexture::
185 set_magfilter(FilterType type) {
192 INLINE EggTexture::FilterType EggTexture::
193 get_magfilter()
const {
203 _anisotropic_degree = anisotropic_degree;
204 _flags |= F_has_anisotropic_degree;
212 _anisotropic_degree = 0;
213 _flags &= ~F_has_anisotropic_degree;
222 return (_flags & F_has_anisotropic_degree) != 0;
233 return _anisotropic_degree;
239 INLINE
void EggTexture::
240 set_env_type(EnvType type) {
247 INLINE EggTexture::EnvType EggTexture::
248 get_env_type()
const {
255 INLINE
void EggTexture::
256 set_combine_mode(CombineChannel channel, CombineMode cm) {
257 nassertv((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels);
258 _combiner[channel]._mode = cm;
264 INLINE EggTexture::CombineMode EggTexture::
265 get_combine_mode(CombineChannel channel)
const {
266 nassertr((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels, CM_unspecified);
267 return _combiner[channel]._mode;
273 INLINE
void EggTexture::
274 set_combine_source(CombineChannel channel,
int n, CombineSource cs) {
275 nassertv((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels);
276 nassertv(n >= 0 && n < (
int)CI_num_indices);
277 _combiner[channel]._ops[n]._source = cs;
283 INLINE EggTexture::CombineSource EggTexture::
284 get_combine_source(CombineChannel channel,
int n)
const {
285 nassertr((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels, CS_unspecified);
286 nassertr(n >= 0 && n < (
int)CI_num_indices, CS_unspecified);
287 return _combiner[channel]._ops[n]._source;
293 INLINE
void EggTexture::
294 set_combine_operand(CombineChannel channel,
int n, CombineOperand co) {
295 nassertv((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels);
296 nassertv(n >= 0 && n < (
int)CI_num_indices);
297 _combiner[channel]._ops[n]._operand = co;
303 INLINE EggTexture::CombineOperand EggTexture::
304 get_combine_operand(CombineChannel channel,
int n)
const {
305 nassertr((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels, CO_unspecified);
306 nassertr(n >= 0 && n < (
int)CI_num_indices, CO_unspecified);
307 return _combiner[channel]._ops[n]._operand;
325 _saved_result = saved_result;
334 return _saved_result;
340 INLINE
void EggTexture::
341 set_tex_gen(TexGen tex_gen) {
348 INLINE EggTexture::TexGen EggTexture::
349 get_tex_gen()
const {
356 INLINE
void EggTexture::
357 set_quality_level(QualityLevel quality_level) {
358 _quality_level = quality_level;
364 INLINE EggTexture::QualityLevel EggTexture::
365 get_quality_level()
const {
366 return _quality_level;
380 _stage_name = stage_name;
381 _flags |= F_has_stage_name;
389 _stage_name = std::string();
390 _flags &= ~F_has_stage_name;
399 return (_flags & F_has_stage_name) != 0;
418 _priority = priority;
419 _flags |= F_has_priority;
429 _flags &= ~F_has_priority;
438 return (_flags & F_has_priority) != 0;
453 INLINE
void EggTexture::
454 set_color(
const LColor &color) {
456 _flags |= F_has_color;
462 INLINE
void EggTexture::
464 _color.set(0.0f, 0.0f, 0.0f, 1.0f);
465 _flags &= ~F_has_color;
473 return (_flags & F_has_color) != 0;
488 INLINE
void EggTexture::
489 set_border_color(
const LColor &border_color) {
490 _border_color = border_color;
491 _flags |= F_has_border_color;
497 INLINE
void EggTexture::
498 clear_border_color() {
499 _border_color.set(0.0f, 0.0f, 0.0f, 1.0f);
500 _flags &= ~F_has_border_color;
508 return (_flags & F_has_border_color) != 0;
517 return _border_color;
530 if (uv_name ==
"default" || uv_name.empty()) {
534 _flags |= F_has_uv_name;
544 _uv_name = std::string();
545 _flags &= ~F_has_uv_name;
554 return (_flags & F_has_uv_name) != 0;
575 _rgb_scale = rgb_scale;
576 _flags |= F_has_rgb_scale;
586 _flags &= ~F_has_rgb_scale;
595 return (_flags & F_has_rgb_scale) != 0;
616 _alpha_scale = alpha_scale;
617 _flags |= F_has_alpha_scale;
627 _flags &= ~F_has_alpha_scale;
636 return (_flags & F_has_alpha_scale) != 0;
655 _alpha_filename = alpha_filename;
656 _alpha_fullpath = alpha_filename;
657 _flags |= F_has_alpha_filename;
663 INLINE
void EggTexture::
664 clear_alpha_filename() {
667 _flags &= ~F_has_alpha_filename;
676 return (_flags & F_has_alpha_filename) != 0;
687 return _alpha_filename;
702 return _alpha_fullpath;
711 _alpha_fullpath = alpha_fullpath;
724 _alpha_file_channel = alpha_file_channel;
725 _flags |= F_has_alpha_file_channel;
734 _alpha_file_channel = 0;
735 _flags &= ~F_has_alpha_file_channel;
744 return (_flags & F_has_alpha_file_channel) != 0;
754 return _alpha_file_channel;
769 _multiview = multiview;
787 _num_views = num_views;
788 _flags |= F_has_num_views;
798 _flags &= ~F_has_num_views;
807 return (_flags & F_has_num_views) != 0;
833 _read_mipmaps = read_mipmaps;
842 return _read_mipmaps;
851 _flags |= F_has_min_lod;
860 _flags &= ~F_has_min_lod;
869 return (_flags & F_has_min_lod) != 0;
886 _flags |= F_has_max_lod;
895 _flags &= ~F_has_max_lod;
904 return (_flags & F_has_max_lod) != 0;
920 _lod_bias = lod_bias;
921 _flags |= F_has_lod_bias;
930 _flags &= ~F_has_lod_bias;
939 return (_flags & F_has_lod_bias) != 0;
959 return _multitexture_sort;
965 INLINE EggTexture::SourceAndOperand::
967 _source(CS_unspecified),
968 _operand(CO_unspecified)
975 INLINE EggTexture::Combiner::
977 _mode(CM_unspecified)
984 INLINE UniqueEggTextures::
985 UniqueEggTextures(
int eq) : _eq(eq) {
991 INLINE
bool UniqueEggTextures::
Defines a texture map that may be applied to geometry.
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...
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.
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.
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.
set_anisotropic_degree
Sets the degree of anisotropic filtering for this texture.
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.
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...
has_rgb_scale
Returns true if an rgb_scale has been specified for the texture, false otherwise.
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.
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.
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.