21 INLINE
void EggTexture::
22 set_texture_type(TextureType texture_type) {
23 _texture_type = texture_type;
25 bool pattern_filename =
26 (_texture_type == TT_3d_texture || _texture_type == TT_cube_map);
28 _filename.set_pattern(pattern_filename);
29 _fullpath.set_pattern(pattern_filename);
37 INLINE EggTexture::TextureType EggTexture::
38 get_texture_type()
const {
47 INLINE
void EggTexture::
48 set_format(Format format) {
57 INLINE EggTexture::Format EggTexture::
67 INLINE
void EggTexture::
68 set_compression_mode(CompressionMode mode) {
69 _compression_mode = mode;
77 INLINE EggTexture::CompressionMode EggTexture::
78 get_compression_mode()
const {
79 return _compression_mode;
87 INLINE
void EggTexture::
88 set_wrap_mode(WrapMode mode) {
97 INLINE EggTexture::WrapMode EggTexture::
98 get_wrap_mode()
const {
107 INLINE
void EggTexture::
108 set_wrap_u(WrapMode mode) {
133 return (_wrap_u == WM_unspecified) ? get_wrap_mode() :
get_wrap_u();
141 INLINE
void EggTexture::
142 set_wrap_v(WrapMode mode) {
167 return (_wrap_v == WM_unspecified) ? get_wrap_mode() :
get_wrap_v();
175 INLINE
void EggTexture::
176 set_wrap_w(WrapMode mode) {
201 return (_wrap_w == WM_unspecified) ? get_wrap_mode() :
get_wrap_w();
209 INLINE
void EggTexture::
210 set_minfilter(FilterType type) {
219 INLINE EggTexture::FilterType EggTexture::
220 get_minfilter()
const {
229 INLINE
void EggTexture::
230 set_magfilter(FilterType type) {
239 INLINE EggTexture::FilterType EggTexture::
240 get_magfilter()
const {
253 _anisotropic_degree = anisotropic_degree;
254 _flags |= F_has_anisotropic_degree;
265 _anisotropic_degree = 0;
266 _flags &= ~F_has_anisotropic_degree;
278 return (_flags & F_has_anisotropic_degree) != 0;
292 return _anisotropic_degree;
300 INLINE
void EggTexture::
301 set_env_type(EnvType type) {
310 INLINE EggTexture::EnvType EggTexture::
311 get_env_type()
const {
320 INLINE
void EggTexture::
321 set_combine_mode(CombineChannel channel, CombineMode cm) {
322 nassertv((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels);
323 _combiner[channel]._mode = cm;
331 INLINE EggTexture::CombineMode EggTexture::
332 get_combine_mode(CombineChannel channel)
const {
333 nassertr((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels, CM_unspecified);
334 return _combiner[channel]._mode;
342 INLINE
void EggTexture::
343 set_combine_source(CombineChannel channel,
int n, CombineSource cs) {
344 nassertv((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels);
345 nassertv(n >= 0 && n < (
int)CI_num_indices);
346 _combiner[channel]._ops[n]._source = cs;
354 INLINE EggTexture::CombineSource EggTexture::
355 get_combine_source(CombineChannel channel,
int n)
const {
356 nassertr((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels, CS_unspecified);
357 nassertr(n >= 0 && n < (
int)CI_num_indices, CS_unspecified);
358 return _combiner[channel]._ops[n]._source;
366 INLINE
void EggTexture::
367 set_combine_operand(CombineChannel channel,
int n, CombineOperand co) {
368 nassertv((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels);
369 nassertv(n >= 0 && n < (
int)CI_num_indices);
370 _combiner[channel]._ops[n]._operand = co;
378 INLINE EggTexture::CombineOperand EggTexture::
379 get_combine_operand(CombineChannel channel,
int n)
const {
380 nassertr((
int)channel >= 0 && (
int)channel < (
int)CC_num_channels, CO_unspecified);
381 nassertr(n >= 0 && n < (
int)CI_num_indices, CO_unspecified);
382 return _combiner[channel]._ops[n]._operand;
406 _saved_result = saved_result;
417 return _saved_result;
425 INLINE
void EggTexture::
426 set_tex_gen(TexGen tex_gen) {
435 INLINE EggTexture::TexGen EggTexture::
436 get_tex_gen()
const {
445 INLINE
void EggTexture::
446 set_quality_level(QualityLevel quality_level) {
447 _quality_level = quality_level;
455 INLINE EggTexture::QualityLevel EggTexture::
456 get_quality_level()
const {
457 return _quality_level;
476 _stage_name = stage_name;
477 _flags |= F_has_stage_name;
487 _stage_name = string();
488 _flags &= ~F_has_stage_name;
499 return (_flags & F_has_stage_name) != 0;
524 _priority = priority;
525 _flags |= F_has_priority;
537 _flags &= ~F_has_priority;
549 return (_flags & F_has_priority) != 0;
569 INLINE
void EggTexture::
570 set_color(
const LColor &color) {
572 _flags |= F_has_color;
580 INLINE
void EggTexture::
582 _color.set(0.0f, 0.0f, 0.0f, 1.0f);
583 _flags &= ~F_has_color;
594 return (_flags & F_has_color) != 0;
613 INLINE
void EggTexture::
614 set_border_color(
const LColor &border_color) {
615 _border_color = border_color;
616 _flags |= F_has_border_color;
624 INLINE
void EggTexture::
625 clear_border_color() {
626 _border_color.set(0.0f, 0.0f, 0.0f, 1.0f);
627 _flags &= ~F_has_border_color;
638 return (_flags & F_has_border_color) != 0;
649 return _border_color;
665 if (uv_name ==
"default" || uv_name.empty()) {
669 _flags |= F_has_uv_name;
683 _flags &= ~F_has_uv_name;
694 return (_flags & F_has_uv_name) != 0;
721 _rgb_scale = rgb_scale;
722 _flags |= F_has_rgb_scale;
734 _flags &= ~F_has_rgb_scale;
745 return (_flags & F_has_rgb_scale) != 0;
771 _alpha_scale = alpha_scale;
772 _flags |= F_has_alpha_scale;
784 _flags &= ~F_has_alpha_scale;
795 return (_flags & F_has_alpha_scale) != 0;
821 _alpha_filename = alpha_filename;
822 _alpha_fullpath = alpha_filename;
823 _flags |= F_has_alpha_filename;
831 INLINE
void EggTexture::
832 clear_alpha_filename() {
835 _flags &= ~F_has_alpha_filename;
847 return (_flags & F_has_alpha_filename) != 0;
860 return _alpha_filename;
880 return _alpha_fullpath;
891 _alpha_fullpath = alpha_fullpath;
908 _alpha_file_channel = alpha_file_channel;
909 _flags |= F_has_alpha_file_channel;
920 _alpha_file_channel = 0;
921 _flags &= ~F_has_alpha_file_channel;
932 return (_flags & F_has_alpha_file_channel) != 0;
945 return _alpha_file_channel;
964 _multiview = multiview;
988 _num_views = num_views;
989 _flags |= F_has_num_views;
1001 _flags &= ~F_has_num_views;
1013 return (_flags & F_has_num_views) != 0;
1046 _read_mipmaps = read_mipmaps;
1057 return _read_mipmaps;
1072 return _multitexture_sort;
1080 INLINE EggTexture::SourceAndOperand::
1081 SourceAndOperand() :
1082 _source(CS_unspecified),
1083 _operand(CO_unspecified)
1092 INLINE EggTexture::Combiner::
1094 _mode(CM_unspecified)
1103 INLINE UniqueEggTextures::
1104 UniqueEggTextures(
int eq) : _eq(eq) {
1112 INLINE
bool UniqueEggTextures::
bool has_color() const
Returns true if a blend color has been specified for the texture.
const LColor & get_border_color() const
Returns the border color if one has been specified, or (0, 0, 0, 1) otherwise.
void set_stage_name(const string &stage_name)
Specifies the particular TextureStage this texture will be rendered on by name.
bool has_alpha_scale() const
Returns true if an alpha_scale has been specified for the texture, false otherwise.
bool has_num_views() const
Returns true if the number of views has been specified for the 3-D multiview texture, false otherwise.
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 t...
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 b...
bool get_read_mipmaps() const
Returns the current setting of the read_mipmaps flag.
void set_multiview(bool multiview)
Sets the multiview flag.
int get_alpha_file_channel() const
Returns the particular channel that has been specified for the alpha-file image, or 0 if no channel h...
Defines a texture map that may be applied to geometry.
void clear_priority()
Removes the specification of multitexture priority from the texture.
void set_alpha_fullpath(const Filename &fullpath)
Records the full pathname to the file, for the benefit of get_alpha_fullpath().
bool has_stage_name() const
Returns true if a stage name has been explicitly specified for this texture, false otherwise...
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 th...
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.
WrapMode determine_wrap_w() const
Determines the appropriate wrap in the W direction.
const string & get_uv_name() const
Returns the texcoord name that has been specified for this texture, or the empty string if no texcoor...
void set_read_mipmaps(bool read_mipmaps)
Sets the read_mipmaps flag.
WrapMode determine_wrap_v() const
Determines the appropriate wrap in the V direction.
void set_anisotropic_degree(int anisotropic_degree)
Sets the degree of anisotropic filtering for this texture.
bool has_rgb_scale() const
Returns true if an rgb_scale has been specified for the texture, false otherwise. ...
int get_num_views() const
Returns the specified number of views specified for the 3-D multiview texture.
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...
The name of a file, such as a texture file or an Egg file.
void clear_num_views()
Removes the specification of the number of views for a 3-D multiview texture.
const Filename & get_alpha_filename() const
Returns the separate file assigned for the alpha channel.
WrapMode get_wrap_v() const
Returns the amount specified for V wrap.
WrapMode get_wrap_w() const
Returns the amount specified for W wrap.
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 geome...
bool sorts_less_than(const EggTexture &other, int eq) const
An ordering operator to compare two textures for sorting order.
void clear_alpha_scale()
Removes the alpha_scale from the texture and restores it to the default value of 1.
int get_alpha_scale() const
Returns the alpha_scale value that has been specified for the texture, or 1 if no alpha_scale value h...
void clear_alpha_file_channel()
Removes the specification of a particular channel to use from the alpha-file image.
bool get_saved_result() const
Returns the current setting of the saved_result flag.
const LColor & get_color() const
Returns the blend color if one has been specified, or (0, 0, 0, 1) otherwise.
void clear_rgb_scale()
Removes the rgb_scale from the texture and restores it to the default value of 1. ...
bool has_alpha_file_channel() const
Returns true if a particular channel has been specified for the alpha-file image, false otherwise...
This is the base class for all three-component vectors and points.
void clear_anisotropic_degree()
Removes the specification of anisotropic filtering from the texture.
bool has_priority() const
Returns true if a priority value for multitexture importance has been specified for the texture...
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 Filename & get_alpha_fullpath() const
Returns the full pathname to the alpha file, if it is known; otherwise, returns the same thing as get...
void set_priority(int priority)
Sets the importance of this texture with respect to other textures also applied on the same geometry...
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 app...
WrapMode determine_wrap_u() const
Determines the appropriate wrap in the U direction.
bool get_multiview() const
Returns the current setting of the multiview flag.
WrapMode get_wrap_u() const
Returns the amount specified for U wrap.
void clear_uv_name()
Removes the restriction to a particular named set of texture coordinates and restores the texture to ...
bool has_border_color() const
Returns true if a border color has been specified for the texture.
void set_alpha_scale(int alpha_scale)
Sets an additional factor that will scale the alpha component after the texture has been applied...
bool has_anisotropic_degree() const
Returns true if a value for the anisotropic filtering degree has been specified for this texture...
void set_saved_result(bool saved_result)
Sets the saved_result 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 e...
int get_multitexture_sort() const
Returns an integer that represents the depth to which this texture is layered on all other textures i...
bool has_uv_name() const
Returns true if a texcoord name has been explicitly specified for this texture, false otherwise...
void clear_stage_name()
Removes the named TextureStage specification.
bool has_alpha_filename() const
Returns true if a separate file for the alpha component has been applied, false otherwise.