31EggTexture(
const string &tref_name,
const Filename &filename)
34 _texture_type = TT_unspecified;
35 _format = F_unspecified;
36 _compression_mode = CM_default;
37 _wrap_mode = WM_unspecified;
38 _wrap_u = WM_unspecified;
39 _wrap_v = WM_unspecified;
40 _wrap_w = WM_unspecified;
41 _minfilter = FT_unspecified;
42 _magfilter = FT_unspecified;
43 _anisotropic_degree = 0;
44 _env_type = ET_unspecified;
45 _saved_result =
false;
48 _tex_gen = TG_unspecified;
49 _quality_level = QL_unspecified;
51 _color.set(0.0f, 0.0f, 0.0f, 1.0f);
52 _border_color.set(0.0f, 0.0f, 0.0f, 1.0f);
54 _alpha_file_channel = 0;
55 _read_mipmaps =
false;
56 _multitexture_sort = 0;
74 EggFilenameNode::operator = (copy);
75 EggRenderMode::operator = (copy);
76 EggTransform::operator = (copy);
78 _texture_type = copy._texture_type;
79 _format = copy._format;
80 _compression_mode = copy._compression_mode;
81 _wrap_mode = copy._wrap_mode;
82 _wrap_u = copy._wrap_u;
83 _wrap_v = copy._wrap_v;
84 _wrap_w = copy._wrap_w;
85 _minfilter = copy._minfilter;
86 _magfilter = copy._magfilter;
87 _anisotropic_degree = copy._anisotropic_degree;
88 _env_type = copy._env_type;
89 _saved_result = copy._saved_result;
90 _multiview = copy._multiview;
91 _num_views = copy._num_views;
92 _tex_gen = copy._tex_gen;
93 _quality_level = copy._quality_level;
94 _stage_name = copy._stage_name;
95 _priority = copy._priority;
97 _border_color = copy._border_color;
98 _uv_name = copy._uv_name;
101 _flags = copy._flags;
102 _alpha_filename = copy._alpha_filename;
103 _alpha_fullpath = copy._alpha_fullpath;
104 _alpha_file_channel = copy._alpha_file_channel;
105 _read_mipmaps = copy._read_mipmaps;
106 _multitexture_sort = 0;
107 _combiner[0] = copy._combiner[0];
108 _combiner[1] = copy._combiner[1];
125write(ostream &out,
int indent_level)
const {
130 indent(out, indent_level + 2)
131 <<
"<Scalar> alpha-file { ";
137 indent(out, indent_level + 2)
138 <<
"<Scalar> alpha-file-channel { "
143 indent(out, indent_level + 2)
144 <<
"<Scalar> read-mipmaps { 1 }\n";
147 if (get_texture_type() != TT_unspecified) {
148 indent(out, indent_level + 2)
149 <<
"<Scalar> type { " << get_texture_type() <<
" }\n";
152 if (get_format() != F_unspecified) {
153 indent(out, indent_level + 2)
154 <<
"<Scalar> format { " << get_format() <<
" }\n";
157 if (get_compression_mode() != CM_default) {
158 indent(out, indent_level + 2)
159 <<
"<Scalar> compression { " << get_compression_mode() <<
" }\n";
162 if (get_wrap_mode() != WM_unspecified) {
163 indent(out, indent_level + 2)
164 <<
"<Scalar> wrap { " << get_wrap_mode() <<
" }\n";
168 indent(out, indent_level + 2)
169 <<
"<Scalar> wrapu { " <<
get_wrap_u() <<
" }\n";
173 indent(out, indent_level + 2)
174 <<
"<Scalar> wrapv { " <<
get_wrap_v() <<
" }\n";
178 indent(out, indent_level + 2)
179 <<
"<Scalar> wrapw { " <<
get_wrap_w() <<
" }\n";
182 if (get_minfilter() != FT_unspecified) {
183 indent(out, indent_level + 2)
184 <<
"<Scalar> minfilter { " << get_minfilter() <<
" }\n";
187 if (get_magfilter() != FT_unspecified) {
188 indent(out, indent_level + 2)
189 <<
"<Scalar> magfilter { " << get_magfilter() <<
" }\n";
193 indent(out, indent_level + 2)
197 if (get_env_type() != ET_unspecified) {
198 indent(out, indent_level + 2)
199 <<
"<Scalar> envtype { " << get_env_type() <<
" }\n";
202 for (
int ci = 0; ci < (int)CC_num_channels; ci++) {
203 CombineChannel channel = (CombineChannel)ci;
204 if (get_combine_mode(channel) != CM_unspecified) {
205 indent(out, indent_level + 2)
206 <<
"<Scalar> combine-" << channel
207 <<
" { " << get_combine_mode(channel) <<
" }\n";
209 for (
int i = 0; i < (int)CI_num_indices; i++) {
210 if (get_combine_source(channel, i) != CS_unspecified) {
211 indent(out, indent_level + 2)
212 <<
"<Scalar> combine-" << channel <<
"-source" << i
213 <<
" { " << get_combine_source(channel, i) <<
" }\n";
215 if (get_combine_operand(channel, i) != CO_unspecified) {
216 indent(out, indent_level + 2)
217 <<
"<Scalar> combine-" << channel <<
"-operand" << i
218 <<
" { " << get_combine_operand(channel, i) <<
" }\n";
224 indent(out, indent_level + 2)
225 <<
"<Scalar> saved-result { 1 }\n";
228 if (get_tex_gen() != TG_unspecified) {
229 indent(out, indent_level + 2)
230 <<
"<Scalar> tex-gen { " << get_tex_gen() <<
" }\n";
233 if (get_quality_level() != QL_unspecified) {
234 indent(out, indent_level + 2)
235 <<
"<Scalar> quality-level { " << get_quality_level() <<
" }\n";
239 indent(out, indent_level + 2)
244 indent(out, indent_level + 2)
249 indent(out, indent_level + 2)
250 <<
"<Scalar> blendr { " << _color[0] <<
" }\n";
251 indent(out, indent_level + 2)
252 <<
"<Scalar> blendg { " << _color[1] <<
" }\n";
253 indent(out, indent_level + 2)
254 <<
"<Scalar> blendb { " << _color[2] <<
" }\n";
255 indent(out, indent_level + 2)
256 <<
"<Scalar> blenda { " << _color[3] <<
" }\n";
260 indent(out, indent_level + 2)
261 <<
"<Scalar> borderr { " << _border_color[0] <<
" }\n";
262 indent(out, indent_level + 2)
263 <<
"<Scalar> borderg { " << _border_color[1] <<
" }\n";
264 indent(out, indent_level + 2)
265 <<
"<Scalar> borderb { " << _border_color[2] <<
" }\n";
266 indent(out, indent_level + 2)
267 <<
"<Scalar> bordera { " << _border_color[3] <<
" }\n";
271 indent(out, indent_level + 2)
272 <<
"<Scalar> uv-name { " <<
get_uv_name() <<
" }\n";
276 indent(out, indent_level + 2)
281 indent(out, indent_level + 2)
286 indent(out, indent_level + 2)
287 <<
"<Scalar> multiview { 1 }\n";
291 indent(out, indent_level + 2)
301 indent(out, indent_level) <<
"}\n";
330 if ((eq & E_complete_filename) == E_complete_filename) {
340 if (eq & E_basename) {
345 if (eq & E_extension) {
350 if (eq & E_dirname) {
357 if (eq & E_transform) {
370 if (eq & E_attributes) {
372 if (_texture_type != other._texture_type ||
373 _format != other._format ||
374 _compression_mode != other._compression_mode ||
375 _wrap_mode != other._wrap_mode ||
376 _wrap_u != other._wrap_u ||
377 _wrap_v != other._wrap_v ||
378 _wrap_w != other._wrap_w ||
379 _minfilter != other._minfilter ||
380 _magfilter != other._magfilter ||
381 _env_type != other._env_type) {
384 if (EggRenderMode::operator != (other)) {
389 if (eq & E_tref_name) {
391 if (get_name() != other.get_name()) {
406 if ((eq & E_complete_filename) == E_complete_filename) {
414 if (eq & E_basename) {
419 if (eq & E_extension) {
424 if (eq & E_dirname) {
431 if (eq & E_transform) {
434 if (is_identity != other_is_identity) {
435 return (
int)is_identity < (int)other_is_identity;
446 if (eq & E_attributes) {
447 if (_texture_type != other._texture_type) {
448 return (
int)_texture_type < (int)other._texture_type;
450 if (_format != other._format) {
451 return (
int)_format < (int)other._format;
453 if (_compression_mode != other._compression_mode) {
454 return (
int)_compression_mode < (int)other._compression_mode;
456 if (_wrap_mode != other._wrap_mode) {
457 return (
int)_wrap_mode < (int)other._wrap_mode;
459 if (_wrap_u != other._wrap_u) {
460 return (
int)_wrap_u < (int)other._wrap_u;
462 if (_wrap_v != other._wrap_v) {
463 return (
int)_wrap_v < (int)other._wrap_v;
465 if (_wrap_w != other._wrap_w) {
466 return (
int)_wrap_w < (int)other._wrap_w;
468 if (_minfilter != other._minfilter) {
469 return (
int)_minfilter < (int)other._minfilter;
471 if (_magfilter != other._magfilter) {
472 return (
int)_magfilter < (int)other._magfilter;
474 if (_anisotropic_degree != other._anisotropic_degree) {
475 return _anisotropic_degree < other._anisotropic_degree;
477 if (_env_type != other._env_type) {
478 return (
int)_env_type < (int)other._env_type;
480 if (EggRenderMode::operator != (other)) {
481 return EggRenderMode::operator < (other);
485 if (eq & E_tref_name) {
486 if (get_name() != other.get_name()) {
487 return get_name() < other.get_name();
521 case F_luminance_alpha:
522 case F_luminance_alphamask:
532 return (num_components == 2 || num_components == 4);
552 case ET_blend_color_scale:
553 case ET_modulate_glow:
554 case ET_modulate_gloss:
556 case ET_normal_height:
560 case ET_normal_gloss:
568 case ET___occlusion_metallic_roughness:
569 case ET___metallic_roughness:
576 switch (_combiner[CC_alpha]._mode) {
606 _multitexture_sort = 0;
612 MultiTextures orig_over_textures, orig_under_textures;
613 orig_over_textures.swap(_over_textures);
614 orig_under_textures.swap(_under_textures);
616 MultiTextures::iterator mti;
617 for (mti = orig_over_textures.begin();
618 mti != orig_over_textures.end();
620 EggTexture *other = (*mti);
621 other->_under_textures.erase(
this);
623 for (mti = orig_under_textures.begin();
624 mti != orig_under_textures.end();
626 EggTexture *other = (*mti);
627 other->_over_textures.erase(
this);
644 MultiTextures cycle_detector;
652 if (_over_textures.insert(other).second) {
653 bool inserted_under = other->_under_textures.insert(
this).second;
654 nassertr(inserted_under,
false);
668 if (cmp_nocase_uh(
string,
"1d") == 0 ||
669 cmp_nocase_uh(
string,
"1dtexture") == 0 ||
670 cmp_nocase_uh(
string,
"1d_texture") == 0) {
671 return TT_1d_texture;
673 }
else if (cmp_nocase_uh(
string,
"2d") == 0 ||
674 cmp_nocase_uh(
string,
"2dtexture") == 0 ||
675 cmp_nocase_uh(
string,
"2d_texture") == 0) {
676 return TT_2d_texture;
678 }
else if (cmp_nocase_uh(
string,
"3d") == 0 ||
679 cmp_nocase_uh(
string,
"3dtexture") == 0 ||
680 cmp_nocase_uh(
string,
"3d_texture") == 0) {
681 return TT_3d_texture;
683 }
else if (cmp_nocase_uh(
string,
"cube") == 0 ||
684 cmp_nocase_uh(
string,
"cubemap") == 0 ||
685 cmp_nocase_uh(
string,
"cube_map") == 0) {
689 return TT_unspecified;
699 if (cmp_nocase_uh(
string,
"rgba") == 0) {
701 }
else if (cmp_nocase_uh(
string,
"srgb_alpha") == 0) {
703 }
else if (cmp_nocase_uh(
string,
"rgbm") == 0) {
705 }
else if (cmp_nocase_uh(
string,
"rgba12") == 0) {
707 }
else if (cmp_nocase_uh(
string,
"rgba8") == 0) {
709 }
else if (cmp_nocase_uh(
string,
"rgba4") == 0) {
712 }
else if (cmp_nocase_uh(
string,
"rgb") == 0) {
714 }
else if (cmp_nocase_uh(
string,
"srgb") == 0) {
716 }
else if (cmp_nocase_uh(
string,
"rgb12") == 0) {
718 }
else if (cmp_nocase_uh(
string,
"rgb8") == 0) {
720 }
else if (cmp_nocase_uh(
string,
"rgb5") == 0) {
722 }
else if (cmp_nocase_uh(
string,
"rgba5") == 0) {
724 }
else if (cmp_nocase_uh(
string,
"rgb332") == 0) {
726 }
else if (cmp_nocase_uh(
string,
"red") == 0) {
728 }
else if (cmp_nocase_uh(
string,
"green") == 0) {
730 }
else if (cmp_nocase_uh(
string,
"blue") == 0) {
732 }
else if (cmp_nocase_uh(
string,
"alpha") == 0) {
734 }
else if (cmp_nocase_uh(
string,
"luminance") == 0) {
736 }
else if (cmp_nocase_uh(
string,
"luminance_alpha") == 0) {
737 return F_luminance_alpha;
738 }
else if (cmp_nocase_uh(
string,
"luminance_alphamask") == 0) {
739 return F_luminance_alphamask;
741 return F_unspecified;
752 if (cmp_nocase_uh(
string,
"off") == 0) {
754 }
else if (cmp_nocase_uh(
string,
"on") == 0) {
756 }
else if (cmp_nocase_uh(
string,
"fxt1") == 0) {
758 }
else if (cmp_nocase_uh(
string,
"dxt1") == 0) {
760 }
else if (cmp_nocase_uh(
string,
"dxt2") == 0) {
762 }
else if (cmp_nocase_uh(
string,
"dxt3") == 0) {
764 }
else if (cmp_nocase_uh(
string,
"dxt4") == 0) {
766 }
else if (cmp_nocase_uh(
string,
"dxt5") == 0) {
779 if (cmp_nocase_uh(
string,
"repeat") == 0) {
781 }
else if (cmp_nocase_uh(
string,
"clamp") == 0) {
783 }
else if (cmp_nocase_uh(
string,
"mirror") == 0) {
785 }
else if (cmp_nocase_uh(
string,
"mirror_once") == 0) {
786 return WM_mirror_once;
787 }
else if (cmp_nocase_uh(
string,
"border_color") == 0) {
788 return WM_border_color;
790 return WM_unspecified;
802 if (cmp_nocase_uh(
string,
"point") == 0) {
804 }
else if (cmp_nocase_uh(
string,
"linear") == 0) {
806 }
else if (cmp_nocase_uh(
string,
"bilinear") == 0) {
808 }
else if (cmp_nocase_uh(
string,
"trilinear") == 0) {
809 return FT_linear_mipmap_linear;
810 }
else if (cmp_nocase_uh(
string,
"mipmap") == 0) {
811 return FT_linear_mipmap_linear;
812 }
else if (cmp_nocase_uh(
string,
"mipmap_point") == 0) {
813 return FT_nearest_mipmap_nearest;
814 }
else if (cmp_nocase_uh(
string,
"mipmap_linear") == 0) {
815 return FT_nearest_mipmap_linear;
816 }
else if (cmp_nocase_uh(
string,
"mipmap_bilinear") == 0) {
817 return FT_linear_mipmap_nearest;
818 }
else if (cmp_nocase_uh(
string,
"mipmap_trilinear") == 0) {
819 return FT_linear_mipmap_linear;
822 }
else if (cmp_nocase_uh(
string,
"nearest") == 0) {
824 }
else if (cmp_nocase_uh(
string,
"linear") == 0) {
826 }
else if (cmp_nocase_uh(
string,
"nearest_mipmap_nearest") == 0) {
827 return FT_nearest_mipmap_nearest;
828 }
else if (cmp_nocase_uh(
string,
"linear_mipmap_nearest") == 0) {
829 return FT_linear_mipmap_nearest;
830 }
else if (cmp_nocase_uh(
string,
"nearest_mipmap_linear") == 0) {
831 return FT_nearest_mipmap_linear;
832 }
else if (cmp_nocase_uh(
string,
"linear_mipmap_linear") == 0) {
833 return FT_linear_mipmap_linear;
836 return FT_unspecified;
846 if (cmp_nocase_uh(
string,
"modulate") == 0) {
849 }
else if (cmp_nocase_uh(
string,
"decal") == 0) {
852 }
else if (cmp_nocase_uh(
string,
"blend") == 0) {
855 }
else if (cmp_nocase_uh(
string,
"replace") == 0) {
858 }
else if (cmp_nocase_uh(
string,
"add") == 0) {
861 }
else if (cmp_nocase_uh(
string,
"blend_color_scale") == 0) {
862 return ET_blend_color_scale;
864 }
else if (cmp_nocase_uh(
string,
"modulate_glow") == 0) {
865 return ET_modulate_glow;
867 }
else if (cmp_nocase_uh(
string,
"modulate_gloss") == 0) {
868 return ET_modulate_gloss;
870 }
else if (cmp_nocase_uh(
string,
"normal") == 0) {
873 }
else if (cmp_nocase_uh(
string,
"normal_height") == 0) {
874 return ET_normal_height;
876 }
else if (cmp_nocase_uh(
string,
"glow") == 0) {
879 }
else if (cmp_nocase_uh(
string,
"gloss") == 0) {
882 }
else if (cmp_nocase_uh(
string,
"height") == 0) {
885 }
else if (cmp_nocase_uh(
string,
"selector") == 0) {
888 }
else if (cmp_nocase_uh(
string,
"normal_gloss") == 0) {
889 return ET_normal_gloss;
891 }
else if (cmp_nocase_uh(
string,
"emission") == 0) {
894 }
else if (cmp_nocase_uh(
string,
"occlusion") == 0) {
895 return ET___occlusion;
897 }
else if (cmp_nocase_uh(
string,
"occlusion_metallic_roughness") == 0) {
898 return ET___occlusion_metallic_roughness;
900 }
else if (cmp_nocase_uh(
string,
"metallic_roughness") == 0) {
901 return ET___metallic_roughness;
904 return ET_unspecified;
915 if (cmp_nocase_uh(
string,
"replace") == 0) {
918 }
else if (cmp_nocase_uh(
string,
"modulate") == 0) {
921 }
else if (cmp_nocase_uh(
string,
"add") == 0) {
924 }
else if (cmp_nocase_uh(
string,
"add_signed") == 0) {
925 return CM_add_signed;
927 }
else if (cmp_nocase_uh(
string,
"interpolate") == 0) {
928 return CM_interpolate;
930 }
else if (cmp_nocase_uh(
string,
"subtract") == 0) {
933 }
else if (cmp_nocase_uh(
string,
"dot3_rgb") == 0) {
936 }
else if (cmp_nocase_uh(
string,
"dot3_rgba") == 0) {
940 return CM_unspecified;
951 if (cmp_nocase_uh(
string,
"texture") == 0) {
954 }
else if (cmp_nocase_uh(
string,
"constant") == 0) {
957 }
else if (cmp_nocase_uh(
string,
"primary_color") == 0) {
958 return CS_primary_color;
960 }
else if (cmp_nocase_uh(
string,
"previous") == 0) {
963 }
else if (cmp_nocase_uh(
string,
"constant_color_scale") == 0) {
964 return CS_constant_color_scale;
966 }
else if (cmp_nocase_uh(
string,
"last_saved_result") == 0) {
967 return CS_last_saved_result;
970 return CS_unspecified;
981 if (cmp_nocase_uh(
string,
"src_color") == 0) {
984 }
else if (cmp_nocase_uh(
string,
"one_minus_src_color") == 0) {
985 return CO_one_minus_src_color;
987 }
else if (cmp_nocase_uh(
string,
"src_alpha") == 0) {
990 }
else if (cmp_nocase_uh(
string,
"one_minus_src_alpha") == 0) {
991 return CO_one_minus_src_alpha;
994 return CO_unspecified;
1004 if (cmp_nocase_uh(
string,
"unspecified") == 0) {
1005 return TG_unspecified;
1007 }
else if (cmp_nocase_uh(
string,
"sphere_map") == 0 ||
1008 cmp_nocase_uh(
string,
"eye_sphere_map") == 0) {
1009 return TG_eye_sphere_map;
1011 }
else if (cmp_nocase_uh(
string,
"world_cube_map") == 0) {
1012 return TG_world_cube_map;
1014 }
else if (cmp_nocase_uh(
string,
"cube_map") == 0 ||
1015 cmp_nocase_uh(
string,
"eye_cube_map") == 0) {
1016 return TG_eye_cube_map;
1018 }
else if (cmp_nocase_uh(
string,
"world_normal") == 0) {
1019 return TG_world_normal;
1021 }
else if (cmp_nocase_uh(
string,
"eye_normal") == 0) {
1022 return TG_eye_normal;
1024 }
else if (cmp_nocase_uh(
string,
"world_position") == 0) {
1025 return TG_world_position;
1027 }
else if (cmp_nocase_uh(
string,
"eye_position") == 0) {
1028 return TG_eye_position;
1030 }
else if (cmp_nocase_uh(
string,
"point_sprite") == 0) {
1031 return TG_point_sprite;
1034 return TG_unspecified;
1044 if (cmp_nocase_uh(
string,
"unspecified") == 0) {
1045 return QL_unspecified;
1047 }
else if (cmp_nocase_uh(
string,
"default") == 0) {
1050 }
else if (cmp_nocase_uh(
string,
"fastest") == 0) {
1053 }
else if (cmp_nocase_uh(
string,
"normal") == 0) {
1056 }
else if (cmp_nocase_uh(
string,
"best") == 0) {
1060 return QL_unspecified;
1080egg_start_parse_body() {
1081 egg_start_texture_body();
1089r_min_multitexture_sort(
int sort, EggTexture::MultiTextures &cycle_detector) {
1090 if (_multitexture_sort >= sort) {
1095 if (!cycle_detector.insert(
this).second) {
1100 _multitexture_sort = sort;
1103 bool no_cycles =
true;
1105 MultiTextures::iterator mti;
1106 for (mti = _under_textures.begin();
1107 mti != _under_textures.end();
1109 EggTexture *other = (*mti);
1110 if (!other->r_min_multitexture_sort(sort + 1, cycle_detector)) {
1123ostream &operator << (ostream &out, EggTexture::TextureType texture_type) {
1124 switch (texture_type) {
1125 case EggTexture::TT_unspecified:
1126 return out <<
"unspecified";
1128 case EggTexture::TT_1d_texture:
1131 case EggTexture::TT_2d_texture:
1134 case EggTexture::TT_3d_texture:
1137 case EggTexture::TT_cube_map:
1138 return out <<
"cube-map";
1141 nassertr(
false, out);
1142 return out <<
"(**invalid**)";
1149ostream &operator << (ostream &out, EggTexture::Format format) {
1151 case EggTexture::F_unspecified:
1152 return out <<
"unspecified";
1154 case EggTexture::F_rgba:
1155 return out <<
"rgba";
1156 case EggTexture::F_rgbm:
1157 return out <<
"rgbm";
1158 case EggTexture::F_rgba12:
1159 return out <<
"rgba12";
1160 case EggTexture::F_rgba8:
1161 return out <<
"rgba8";
1162 case EggTexture::F_rgba4:
1163 return out <<
"rgba4";
1164 case EggTexture::F_srgb_alpha:
1165 return out <<
"srgb_alpha";
1167 case EggTexture::F_rgb:
1168 return out <<
"rgb";
1169 case EggTexture::F_rgb12:
1170 return out <<
"rgb12";
1171 case EggTexture::F_rgb8:
1172 return out <<
"rgb8";
1173 case EggTexture::F_rgb5:
1174 return out <<
"rgb5";
1175 case EggTexture::F_rgba5:
1176 return out <<
"rgba5";
1177 case EggTexture::F_rgb332:
1178 return out <<
"rgb332";
1179 case EggTexture::F_srgb:
1180 return out <<
"srgb";
1182 case EggTexture::F_red:
1183 return out <<
"red";
1184 case EggTexture::F_green:
1185 return out <<
"green";
1186 case EggTexture::F_blue:
1187 return out <<
"blue";
1188 case EggTexture::F_alpha:
1189 return out <<
"alpha";
1190 case EggTexture::F_luminance:
1191 return out <<
"luminance";
1192 case EggTexture::F_luminance_alpha:
1193 return out <<
"luminance_alpha";
1194 case EggTexture::F_luminance_alphamask:
1195 return out <<
"luminance_alphamask";
1198 nassertr(
false, out);
1199 return out <<
"(**invalid**)";
1205ostream &operator << (ostream &out, EggTexture::CompressionMode mode) {
1207 case EggTexture::CM_default:
1208 return out <<
"default";
1209 case EggTexture::CM_off:
1210 return out <<
"off";
1211 case EggTexture::CM_on:
1213 case EggTexture::CM_fxt1:
1214 return out <<
"fxt1";
1215 case EggTexture::CM_dxt1:
1216 return out <<
"dxt1";
1217 case EggTexture::CM_dxt2:
1218 return out <<
"dxt2";
1219 case EggTexture::CM_dxt3:
1220 return out <<
"dxt3";
1221 case EggTexture::CM_dxt4:
1222 return out <<
"dxt4";
1223 case EggTexture::CM_dxt5:
1224 return out <<
"dxt5";
1227 nassertr(
false, out);
1228 return out <<
"(**invalid**)";
1234ostream &operator << (ostream &out, EggTexture::WrapMode mode) {
1236 case EggTexture::WM_unspecified:
1237 return out <<
"unspecified";
1238 case EggTexture::WM_repeat:
1239 return out <<
"repeat";
1240 case EggTexture::WM_clamp:
1241 return out <<
"clamp";
1242 case EggTexture::WM_mirror:
1243 return out <<
"mirror";
1244 case EggTexture::WM_mirror_once:
1245 return out <<
"mirror_once";
1246 case EggTexture::WM_border_color:
1247 return out <<
"border_color";
1250 nassertr(
false, out);
1251 return out <<
"(**invalid**)";
1257ostream &operator << (ostream &out, EggTexture::FilterType type) {
1259 case EggTexture::FT_unspecified:
1260 return out <<
"unspecified";
1262 case EggTexture::FT_nearest:
1263 return out <<
"nearest";
1264 case EggTexture::FT_linear:
1265 return out <<
"linear";
1267 case EggTexture::FT_nearest_mipmap_nearest:
1268 return out <<
"nearest_mipmap_nearest";
1269 case EggTexture::FT_linear_mipmap_nearest:
1270 return out <<
"linear_mipmap_nearest";
1271 case EggTexture::FT_nearest_mipmap_linear:
1272 return out <<
"nearest_mipmap_linear";
1273 case EggTexture::FT_linear_mipmap_linear:
1274 return out <<
"linear_mipmap_linear";
1277 nassertr(
false, out);
1278 return out <<
"(**invalid**)";
1284ostream &operator << (ostream &out, EggTexture::EnvType type) {
1286 case EggTexture::ET_unspecified:
1287 return out <<
"unspecified";
1289 case EggTexture::ET_modulate:
1290 return out <<
"modulate";
1292 case EggTexture::ET_decal:
1293 return out <<
"decal";
1295 case EggTexture::ET_blend:
1296 return out <<
"blend";
1298 case EggTexture::ET_replace:
1299 return out <<
"replace";
1301 case EggTexture::ET_add:
1302 return out <<
"add";
1304 case EggTexture::ET_blend_color_scale:
1305 return out <<
"blend_color_scale";
1307 case EggTexture::ET_modulate_glow:
1308 return out <<
"modulate_glow";
1310 case EggTexture::ET_modulate_gloss:
1311 return out <<
"modulate_gloss";
1313 case EggTexture::ET_normal:
1314 return out <<
"normal";
1316 case EggTexture::ET_normal_height:
1317 return out <<
"normal_height";
1319 case EggTexture::ET_glow:
1320 return out <<
"glow";
1322 case EggTexture::ET_gloss:
1323 return out <<
"gloss";
1325 case EggTexture::ET_height:
1326 return out <<
"height";
1328 case EggTexture::ET_selector:
1329 return out <<
"selector";
1331 case EggTexture::ET_normal_gloss:
1332 return out <<
"normal_gloss";
1334 case EggTexture::ET_emission:
1335 return out <<
"emission";
1337 case EggTexture::ET___occlusion:
1338 return out <<
"occlusion";
1340 case EggTexture::ET___occlusion_metallic_roughness:
1341 return out <<
"occlusion_metallic_roughness";
1343 case EggTexture::ET___metallic_roughness:
1344 return out <<
"metallic_roughness";
1347 nassertr(
false, out);
1348 return out <<
"(**invalid**)";
1352operator << (ostream &out, EggTexture::CombineMode cm) {
1354 case EggTexture::CM_unspecified:
1355 return out <<
"unspecified";
1357 case EggTexture::CM_replace:
1358 return out <<
"replace";
1360 case EggTexture::CM_modulate:
1361 return out <<
"modulate";
1363 case EggTexture::CM_add:
1364 return out <<
"add";
1366 case EggTexture::CM_add_signed:
1367 return out <<
"add_signed";
1369 case EggTexture::CM_interpolate:
1370 return out <<
"interpolate";
1372 case EggTexture::CM_subtract:
1373 return out <<
"subtract";
1375 case EggTexture::CM_dot3_rgb:
1376 return out <<
"dot3_rgb";
1378 case EggTexture::CM_dot3_rgba:
1379 return out <<
"dot3_rgba";
1382 return out <<
"**invalid CombineMode(" << (int)cm <<
")**";
1386operator << (ostream &out, EggTexture::CombineChannel cm) {
1388 case EggTexture::CC_rgb:
1389 return out <<
"rgb";
1391 case EggTexture::CC_alpha:
1392 return out <<
"alpha";
1394 case EggTexture::CC_num_channels:
1400 return out <<
"**invalid CombineChannel(" << (int)cm <<
")**";
1404operator << (ostream &out, EggTexture::CombineSource cs) {
1406 case EggTexture::CS_unspecified:
1407 return out <<
"unspecified";
1409 case EggTexture::CS_texture:
1410 return out <<
"texture";
1412 case EggTexture::CS_constant:
1413 return out <<
"constant";
1415 case EggTexture::CS_primary_color:
1416 return out <<
"primary_color";
1418 case EggTexture::CS_previous:
1419 return out <<
"previous";
1421 case EggTexture::CS_constant_color_scale:
1422 return out <<
"constant_color_scale";
1424 case EggTexture::CS_last_saved_result:
1425 return out <<
"last_saved_result";
1428 return out <<
"**invalid CombineSource(" << (int)cs <<
")**";
1432operator << (ostream &out, EggTexture::CombineOperand co) {
1434 case EggTexture::CO_unspecified:
1435 return out <<
"unspecified";
1437 case EggTexture::CO_src_color:
1438 return out <<
"src_color";
1440 case EggTexture::CO_one_minus_src_color:
1441 return out <<
"one_minus_src_color";
1443 case EggTexture::CO_src_alpha:
1444 return out <<
"src_alpha";
1446 case EggTexture::CO_one_minus_src_alpha:
1447 return out <<
"one_minus_src_alpha";
1450 return out <<
"**invalid CombineOperand(" << (int)co <<
")**";
1454operator << (ostream &out, EggTexture::TexGen tex_gen) {
1456 case EggTexture::TG_unspecified:
1457 return out <<
"unspecified";
1459 case EggTexture::TG_eye_sphere_map:
1460 return out <<
"eye_sphere_map";
1462 case EggTexture::TG_world_cube_map:
1463 return out <<
"world_cube_map";
1465 case EggTexture::TG_eye_cube_map:
1466 return out <<
"eye_cube_map";
1468 case EggTexture::TG_world_normal:
1469 return out <<
"world_normal";
1471 case EggTexture::TG_eye_normal:
1472 return out <<
"eye_normal";
1474 case EggTexture::TG_world_position:
1475 return out <<
"world_position";
1477 case EggTexture::TG_eye_position:
1478 return out <<
"eye_position";
1480 case EggTexture::TG_point_sprite:
1481 return out <<
"point_sprite";
1484 return out <<
"**invalid TexGen(" << (int)tex_gen <<
")**";
1488operator << (ostream &out, EggTexture::QualityLevel quality_level) {
1489 switch (quality_level) {
1490 case EggTexture::QL_unspecified:
1491 return out <<
"unspecified";
1492 case EggTexture::QL_default:
1493 return out <<
"default";
1494 case EggTexture::QL_fastest:
1495 return out <<
"fastest";
1496 case EggTexture::QL_normal:
1497 return out <<
"normal";
1498 case EggTexture::QL_best:
1499 return out <<
"best";
1502 return out <<
"**invalid QualityLevel(" << (int)quality_level <<
")**";
This is an egg node that contains a filename.
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
void write_header(std::ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
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...
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.
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.
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,...
virtual EggTransform * as_transform()
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform,...
get_alpha_file_channel
Returns the particular channel that has been specified for the alpha-file image, or 0 if no channel h...
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,...
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.
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...
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,...
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.
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.
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.
virtual void write(std::ostream &out, int indent_level) const
Writes the texture definition to the indicated output stream in Egg format.
has_priority
Returns true if a priority value for multitexture importance has been specified for the texture,...
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.
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.
get_rgb_scale
Returns the rgb_scale value that has been specified for the texture, or 1 if no rgb_scale value has b...
static WrapMode string_wrap_mode(const std::string &string)
Returns the WrapMode value associated with the given string representation, or WM_unspecified if the ...
has_border_color
Returns true if a border color has been specified for the texture.
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.
std::string get_extension() const
Returns the file extension.
std::string get_basename_wo_extension() const
Returns the basename part of the filename, without the file extension.
std::string get_dirname() const
Returns the directory part of the filename.
TypeHandle is the identifier used to differentiate C++ class types.
ostream & enquote_string(ostream &out, const string &str, int indent_level, bool always_quote)
Writes the string to the indicated output stream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.