Panda3D
Loading...
Searching...
No Matches
eggTexture.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggTexture.I
10 * @author drose
11 * @date 1999-01-18
12 */
13
14/**
15 *
16 */
17INLINE void EggTexture::
18set_texture_type(TextureType texture_type) {
19 _texture_type = texture_type;
20
21 bool pattern_filename =
22 (_texture_type == TT_3d_texture || _texture_type == TT_cube_map);
23
24 _filename.set_pattern(pattern_filename);
25 _fullpath.set_pattern(pattern_filename);
26}
27
28/**
29 *
30 */
31INLINE EggTexture::TextureType EggTexture::
32get_texture_type() const {
33 return _texture_type;
34}
35
36/**
37 *
38 */
39INLINE void EggTexture::
40set_format(Format format) {
41 _format = format;
42}
43
44/**
45 *
46 */
47INLINE EggTexture::Format EggTexture::
48get_format() const {
49 return _format;
50}
51
52/**
53 *
54 */
55INLINE void EggTexture::
56set_compression_mode(CompressionMode mode) {
57 _compression_mode = mode;
58}
59
60/**
61 *
62 */
63INLINE EggTexture::CompressionMode EggTexture::
64get_compression_mode() const {
65 return _compression_mode;
66}
67
68/**
69 *
70 */
71INLINE void EggTexture::
72set_wrap_mode(WrapMode mode) {
73 _wrap_mode = mode;
74}
75
76/**
77 *
78 */
79INLINE EggTexture::WrapMode EggTexture::
80get_wrap_mode() const {
81 return _wrap_mode;
82}
83
84/**
85 *
86 */
87INLINE void EggTexture::
88set_wrap_u(WrapMode mode) {
89 _wrap_u = mode;
90}
91
92/**
93 * Returns the amount specified for U wrap. This may be unspecified, even if
94 * there is an overall wrap value.
95 */
96INLINE EggTexture::WrapMode EggTexture::
97get_wrap_u() const {
98 return _wrap_u;
99}
100
101/**
102 * Determines the appropriate wrap in the U direction. This is different from
103 * get_wrap_u() in that if the U wrap is unspecified, it returns the overall
104 * wrap value.
105 */
106INLINE EggTexture::WrapMode EggTexture::
107determine_wrap_u() const {
108 return (_wrap_u == WM_unspecified) ? get_wrap_mode() : get_wrap_u();
109}
110
111/**
112 *
113 */
114INLINE void EggTexture::
115set_wrap_v(WrapMode mode) {
116 _wrap_v = mode;
117}
118
119/**
120 * Returns the amount specified for V wrap. This may be unspecified, even if
121 * there is an overall wrap value.
122 */
123INLINE EggTexture::WrapMode EggTexture::
124get_wrap_v() const {
125 return _wrap_v;
126}
127
128/**
129 * Determines the appropriate wrap in the V direction. This is different from
130 * get_wrap_v() in that if the V wrap is unspecified, it returns the overall
131 * wrap value.
132 */
133INLINE EggTexture::WrapMode EggTexture::
134determine_wrap_v() const {
135 return (_wrap_v == WM_unspecified) ? get_wrap_mode() : get_wrap_v();
136}
137
138/**
139 *
140 */
141INLINE void EggTexture::
142set_wrap_w(WrapMode mode) {
143 _wrap_w = mode;
144}
145
146/**
147 * Returns the amount specified for W wrap. This may be unspecified, even if
148 * there is an overall wrap value.
149 */
150INLINE EggTexture::WrapMode EggTexture::
151get_wrap_w() const {
152 return _wrap_w;
153}
154
155/**
156 * Determines the appropriate wrap in the W direction. This is different from
157 * get_wrap_w() in that if the W wrap is unspecified, it returns the overall
158 * wrap value.
159 */
160INLINE EggTexture::WrapMode EggTexture::
161determine_wrap_w() const {
162 return (_wrap_w == WM_unspecified) ? get_wrap_mode() : get_wrap_w();
163}
164
165/**
166 *
167 */
168INLINE void EggTexture::
169set_minfilter(FilterType type) {
170 _minfilter = type;
171}
172
173/**
174 *
175 */
176INLINE EggTexture::FilterType EggTexture::
177get_minfilter() const {
178 return _minfilter;
179}
180
181/**
182 *
183 */
184INLINE void EggTexture::
185set_magfilter(FilterType type) {
186 _magfilter = type;
187}
188
189/**
190 *
191 */
192INLINE EggTexture::FilterType EggTexture::
193get_magfilter() const {
194 return _magfilter;
195}
196
197/**
198 * Sets the degree of anisotropic filtering for this texture. 1 is off;
199 * higher levels indicate filtering in effect.
200 */
201INLINE void EggTexture::
202set_anisotropic_degree(int anisotropic_degree) {
203 _anisotropic_degree = anisotropic_degree;
204 _flags |= F_has_anisotropic_degree;
205}
206
207/**
208 * Removes the specification of anisotropic filtering from the texture.
209 */
210INLINE void EggTexture::
212 _anisotropic_degree = 0;
213 _flags &= ~F_has_anisotropic_degree;
214}
215
216/**
217 * Returns true if a value for the anisotropic filtering degree has been
218 * specified for this texture, false otherwise.
219 */
220INLINE bool EggTexture::
222 return (_flags & F_has_anisotropic_degree) != 0;
223}
224
225/**
226 * Returns the anisotropic filtering degree that has been specified for this
227 * texture, or 0 if nothing has been specified.
228 */
229INLINE int EggTexture::
231 // note: _anisotropic_degree of 0 and 1 are equivalent (no anisotropic
232 // filtering to be done by gsg)
233 return _anisotropic_degree;
234}
235
236/**
237 *
238 */
239INLINE void EggTexture::
240set_env_type(EnvType type) {
241 _env_type = type;
242}
243
244/**
245 *
246 */
247INLINE EggTexture::EnvType EggTexture::
248get_env_type() const {
249 return _env_type;
250}
251
252/**
253 *
254 */
255INLINE void EggTexture::
256set_combine_mode(CombineChannel channel, CombineMode cm) {
257 nassertv((int)channel >= 0 && (int)channel < (int)CC_num_channels);
258 _combiner[channel]._mode = cm;
259}
260
261/**
262 *
263 */
264INLINE EggTexture::CombineMode EggTexture::
265get_combine_mode(CombineChannel channel) const {
266 nassertr((int)channel >= 0 && (int)channel < (int)CC_num_channels, CM_unspecified);
267 return _combiner[channel]._mode;
268}
269
270/**
271 *
272 */
273INLINE void EggTexture::
274set_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;
278}
279
280/**
281 *
282 */
283INLINE EggTexture::CombineSource EggTexture::
284get_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;
288}
289
290/**
291 *
292 */
293INLINE void EggTexture::
294set_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;
298}
299
300/**
301 *
302 */
303INLINE EggTexture::CombineOperand EggTexture::
304get_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;
308}
309
310/**
311 * Sets the saved_result flag. When this is true, the output of this stage is
312 * not part of the normal pipeline--that is, it will not be supplied as the
313 * "previous" source for the next texture stage--but it will instead be
314 * supplied as the "last_saved_result" source for any future stages, until the
315 * next TextureStage with a saved_result set true is encountered.
316 *
317 * This can be used to reuse the results of this texture stage as input to
318 * more than one stage later in the pipeline.
319 *
320 * The last texture in the pipeline (the one with the highest sort value)
321 * should not have this flag set.
322 */
323INLINE void EggTexture::
324set_saved_result(bool saved_result) {
325 _saved_result = saved_result;
326}
327
328/**
329 * Returns the current setting of the saved_result flag. See
330 * set_saved_result().
331 */
332INLINE bool EggTexture::
333get_saved_result() const {
334 return _saved_result;
335}
336
337/**
338 *
339 */
340INLINE void EggTexture::
341set_tex_gen(TexGen tex_gen) {
342 _tex_gen = tex_gen;
343}
344
345/**
346 *
347 */
348INLINE EggTexture::TexGen EggTexture::
349get_tex_gen() const {
350 return _tex_gen;
351}
352
353/**
354 *
355 */
356INLINE void EggTexture::
357set_quality_level(QualityLevel quality_level) {
358 _quality_level = quality_level;
359}
360
361/**
362 *
363 */
364INLINE EggTexture::QualityLevel EggTexture::
365get_quality_level() const {
366 return _quality_level;
367}
368
369/**
370 * Specifies the particular TextureStage this texture will be rendered on by
371 * name. If this is omitted, the texture will be rendered on the default
372 * TextureStage, unless some other stage-specific property is specificied, in
373 * which case the texture will be rendered on a TextureStage with the same
374 * name as the tref. This is in support of multitexturing.
375 *
376 * Each different TextureStage in the world must be uniquely named.
377 */
378INLINE void EggTexture::
379set_stage_name(const std::string &stage_name) {
380 _stage_name = stage_name;
381 _flags |= F_has_stage_name;
382}
383
384/**
385 * Removes the named TextureStage specification.
386 */
387INLINE void EggTexture::
389 _stage_name = std::string();
390 _flags &= ~F_has_stage_name;
391}
392
393/**
394 * Returns true if a stage name has been explicitly specified for this
395 * texture, false otherwise.
396 */
397INLINE bool EggTexture::
398has_stage_name() const {
399 return (_flags & F_has_stage_name) != 0;
400}
401
402/**
403 * Returns the stage name that has been specified for this texture, or the
404 * tref name if no texture stage has explicitly been specified.
405 */
406INLINE const std::string &EggTexture::
407get_stage_name() const {
408 return has_stage_name() ? _stage_name : get_name();
409}
410
411/**
412 * Sets the importance of this texture with respect to other textures also
413 * applied on the same geometry. This is only meaningful in the presence of
414 * multitexturing.
415 */
416INLINE void EggTexture::
417set_priority(int priority) {
418 _priority = priority;
419 _flags |= F_has_priority;
420}
421
422/**
423 * Removes the specification of multitexture priority from the texture. The
424 * default priority value is 0.
425 */
426INLINE void EggTexture::
428 _priority = 0;
429 _flags &= ~F_has_priority;
430}
431
432/**
433 * Returns true if a priority value for multitexture importance has been
434 * specified for the texture, false otherwise.
435 */
436INLINE bool EggTexture::
437has_priority() const {
438 return (_flags & F_has_priority) != 0;
439}
440
441/**
442 * Returns the multitexture importance value that has been specified for the
443 * texture, or 0 if no priority value has been specified.
444 */
445INLINE int EggTexture::
446get_priority() const {
447 return _priority;
448}
449
450/**
451 *
452 */
453INLINE void EggTexture::
454set_color(const LColor &color) {
455 _color = color;
456 _flags |= F_has_color;
457}
458
459/**
460 *
461 */
462INLINE void EggTexture::
463clear_color() {
464 _color.set(0.0f, 0.0f, 0.0f, 1.0f);
465 _flags &= ~F_has_color;
466}
467
468/**
469 * Returns true if a blend color has been specified for the texture.
470 */
471INLINE bool EggTexture::
472has_color() const {
473 return (_flags & F_has_color) != 0;
474}
475
476/**
477 * Returns the blend color if one has been specified, or (0, 0, 0, 1)
478 * otherwise.
479 */
480INLINE const LColor &EggTexture::
481get_color() const {
482 return _color;
483}
484
485/**
486 *
487 */
488INLINE void EggTexture::
489set_border_color(const LColor &border_color) {
490 _border_color = border_color;
491 _flags |= F_has_border_color;
492}
493
494/**
495 *
496 */
497INLINE void EggTexture::
498clear_border_color() {
499 _border_color.set(0.0f, 0.0f, 0.0f, 1.0f);
500 _flags &= ~F_has_border_color;
501}
502
503/**
504 * Returns true if a border color has been specified for the texture.
505 */
506INLINE bool EggTexture::
507has_border_color() const {
508 return (_flags & F_has_border_color) != 0;
509}
510
511/**
512 * Returns the border color if one has been specified, or (0, 0, 0, 1)
513 * otherwise.
514 */
515INLINE const LColor &EggTexture::
516get_border_color() const {
517 return _border_color;
518}
519
520/**
521 * Specifies the named set of texture coordinates that this texture will use
522 * when it is applied to geometry. Geometry may have multiple sets of texture
523 * coordinates defined, by name.
524 *
525 * If this is not specified for a particular texture, the default set of
526 * texture coordinates will be used.
527 */
528INLINE void EggTexture::
529set_uv_name(const std::string &uv_name) {
530 if (uv_name == "default" || uv_name.empty()) {
532 } else {
533 _uv_name = uv_name;
534 _flags |= F_has_uv_name;
535 }
536}
537
538/**
539 * Removes the restriction to a particular named set of texture coordinates
540 * and restores the texture to using the default texture coordinates.
541 */
542INLINE void EggTexture::
544 _uv_name = std::string();
545 _flags &= ~F_has_uv_name;
546}
547
548/**
549 * Returns true if a texcoord name has been explicitly specified for this
550 * texture, false otherwise.
551 */
552INLINE bool EggTexture::
553has_uv_name() const {
554 return (_flags & F_has_uv_name) != 0;
555}
556
557/**
558 * Returns the texcoord name that has been specified for this texture, or the
559 * empty string if no texcoord name has explicitly been specified.
560 */
561INLINE const std::string &EggTexture::
562get_uv_name() const {
563 return _uv_name;
564}
565
566/**
567 * Sets an additional factor that will scale all three r, g, b components
568 * after the texture has been applied. This is used only when a combine mode
569 * is in effect.
570 *
571 * The only legal values are 1, 2, or 4.
572 */
573INLINE void EggTexture::
574set_rgb_scale(int rgb_scale) {
575 _rgb_scale = rgb_scale;
576 _flags |= F_has_rgb_scale;
577}
578
579/**
580 * Removes the rgb_scale from the texture and restores it to the default value
581 * of 1.
582 */
583INLINE void EggTexture::
585 _rgb_scale = 1;
586 _flags &= ~F_has_rgb_scale;
587}
588
589/**
590 * Returns true if an rgb_scale has been specified for the texture, false
591 * otherwise.
592 */
593INLINE bool EggTexture::
594has_rgb_scale() const {
595 return (_flags & F_has_rgb_scale) != 0;
596}
597
598/**
599 * Returns the rgb_scale value that has been specified for the texture, or 1
600 * if no rgb_scale value has been specified.
601 */
602INLINE int EggTexture::
603get_rgb_scale() const {
604 return _rgb_scale;
605}
606
607/**
608 * Sets an additional factor that will scale the alpha component after the
609 * texture has been applied. This is used only when a combine mode is in
610 * effect.
611 *
612 * The only legal values are 1, 2, or 4.
613 */
614INLINE void EggTexture::
615set_alpha_scale(int alpha_scale) {
616 _alpha_scale = alpha_scale;
617 _flags |= F_has_alpha_scale;
618}
619
620/**
621 * Removes the alpha_scale from the texture and restores it to the default
622 * value of 1.
623 */
624INLINE void EggTexture::
626 _alpha_scale = 1;
627 _flags &= ~F_has_alpha_scale;
628}
629
630/**
631 * Returns true if an alpha_scale has been specified for the texture, false
632 * otherwise.
633 */
634INLINE bool EggTexture::
635has_alpha_scale() const {
636 return (_flags & F_has_alpha_scale) != 0;
637}
638
639/**
640 * Returns the alpha_scale value that has been specified for the texture, or 1
641 * if no alpha_scale value has been specified.
642 */
643INLINE int EggTexture::
644get_alpha_scale() const {
645 return _alpha_scale;
646}
647
648/**
649 * Specifies a separate file that will be loaded in with the 1- or 3-component
650 * texture and applied as the alpha channel. This is useful when loading
651 * textures from file formats that do not support alpha, for instance jpg.
652 */
653INLINE void EggTexture::
654set_alpha_filename(const Filename &alpha_filename) {
655 _alpha_filename = alpha_filename;
656 _alpha_fullpath = alpha_filename;
657 _flags |= F_has_alpha_filename;
658}
659
660/**
661 *
662 */
663INLINE void EggTexture::
664clear_alpha_filename() {
665 _alpha_filename = Filename();
666 _alpha_fullpath = Filename();
667 _flags &= ~F_has_alpha_filename;
668}
669
670/**
671 * Returns true if a separate file for the alpha component has been applied,
672 * false otherwise. See set_alpha_filename().
673 */
674INLINE bool EggTexture::
675has_alpha_filename() const {
676 return (_flags & F_has_alpha_filename) != 0;
677}
678
679/**
680 * Returns the separate file assigned for the alpha channel. It is an error
681 * to call this unless has_alpha_filename() returns true. See
682 * set_alpha_filename().
683 */
684INLINE const Filename &EggTexture::
685get_alpha_filename() const {
686 nassertr(has_alpha_filename(), _alpha_filename);
687 return _alpha_filename;
688}
689
690/**
691 * Returns the full pathname to the alpha file, if it is known; otherwise,
692 * returns the same thing as get_alpha_filename().
693 *
694 * This function simply returns whatever was set by the last call to
695 * set_alpha_fullpath(). This string is not written to the egg file; its main
696 * purpose is to record the full path to the alpha filename if it is known,
697 * for egg structures that are generated in-memory and then immediately
698 * converted to a scene graph.
699 */
700INLINE const Filename &EggTexture::
701get_alpha_fullpath() const {
702 return _alpha_fullpath;
703}
704
705/**
706 * Records the full pathname to the file, for the benefit of
707 * get_alpha_fullpath().
708 */
709INLINE void EggTexture::
710set_alpha_fullpath(const Filename &alpha_fullpath) {
711 _alpha_fullpath = alpha_fullpath;
712}
713
714/**
715 * If a separate alpha-file is specified, this indicates which channel number
716 * should be extracted from this file to derive the alpha channel for the
717 * final image. The default is 0, which means the grayscale combination of r,
718 * g, b. Otherwise, this should be the 1-based channel number, for instance
719 * 1, 2, or 3 for r, g, or b, respectively, or 4 for the alpha channel of a
720 * four-component image.
721 */
722INLINE void EggTexture::
723set_alpha_file_channel(int alpha_file_channel) {
724 _alpha_file_channel = alpha_file_channel;
725 _flags |= F_has_alpha_file_channel;
726}
727
728/**
729 * Removes the specification of a particular channel to use from the alpha-
730 * file image.
731 */
732INLINE void EggTexture::
734 _alpha_file_channel = 0;
735 _flags &= ~F_has_alpha_file_channel;
736}
737
738/**
739 * Returns true if a particular channel has been specified for the alpha-file
740 * image, false otherwise.
741 */
742INLINE bool EggTexture::
744 return (_flags & F_has_alpha_file_channel) != 0;
745}
746
747/**
748 * Returns the particular channel that has been specified for the alpha-file
749 * image, or 0 if no channel has been specified. See
750 * set_alpha_file_channel().
751 */
752INLINE int EggTexture::
754 return _alpha_file_channel;
755}
756
757/**
758 * Sets the multiview flag.
759 *
760 * If multiview is true, the filename should contain a hash mark ('#'), which
761 * will be filled in with the view number; and a multiview texture will be
762 * defined with a series of images, one for each view.
763 *
764 * A multiview texture is most often used for stereo textures, but other uses
765 * are also possible, such as for texture animation.
766 */
767INLINE void EggTexture::
768set_multiview(bool multiview) {
769 _multiview = multiview;
770}
771
772/**
773 * Returns the current setting of the multiview flag. See set_multiview().
774 */
775INLINE bool EggTexture::
776get_multiview() const {
777 return _multiview;
778}
779
780/**
781 * When loading a 3-D multiview texture, this parameter is necessary to
782 * specify how many views will be expected. The z size is determined
783 * implicitly from the number of images loaded.
784 */
785INLINE void EggTexture::
786set_num_views(int num_views) {
787 _num_views = num_views;
788 _flags |= F_has_num_views;
789}
790
791/**
792 * Removes the specification of the number of views for a 3-D multiview
793 * texture.
794 */
795INLINE void EggTexture::
797 _num_views = 0;
798 _flags &= ~F_has_num_views;
799}
800
801/**
802 * Returns true if the number of views has been specified for the 3-D
803 * multiview texture, false otherwise.
804 */
805INLINE bool EggTexture::
806has_num_views() const {
807 return (_flags & F_has_num_views) != 0;
808}
809
810/**
811 * Returns the specified number of views specified for the 3-D multiview
812 * texture. See set_num_views().
813 */
814INLINE int EggTexture::
815get_num_views() const {
816 return _num_views;
817}
818
819/**
820 * Sets the read_mipmaps flag.
821 *
822 * If read_mipmaps is true, the filename should contain a hash mark ('#'),
823 * which will be filled in with the mipmap level number; and the texture will
824 * be defined with a series of images, one for each mipmap level.
825 *
826 * If the filename is of a type that already requires a hash mark, such as a
827 * cube map or a 3-d texture, then the filename should now require two hash
828 * marks, and the first one indicates the mipmap level number, while the
829 * second indicates the face number or 3-d level number.
830 */
831INLINE void EggTexture::
832set_read_mipmaps(bool read_mipmaps) {
833 _read_mipmaps = read_mipmaps;
834}
835
836/**
837 * Returns the current setting of the read_mipmaps flag. See
838 * set_read_mipmaps().
839 */
840INLINE bool EggTexture::
841get_read_mipmaps() const {
842 return _read_mipmaps;
843}
844
845/**
846 * Sets the minimum mipmap level that may be sampled.
847 */
848INLINE void EggTexture::
849set_min_lod(double min_lod) {
850 _min_lod = min_lod;
851 _flags |= F_has_min_lod;
852}
853
854/**
855 * Removes the specification of a minimum mipmap level from the texture.
856 */
857INLINE void EggTexture::
859 _min_lod = -1000;
860 _flags &= ~F_has_min_lod;
861}
862
863/**
864 * Returns true if a value for the minimum mipmap level has been specified for
865 * this texture, false otherwise.
866 */
867INLINE bool EggTexture::
868has_min_lod() const {
869 return (_flags & F_has_min_lod) != 0;
870}
871
872/**
873 * Returns the minimum mipmap level that has been specified for this texture.
874 */
875INLINE double EggTexture::
876get_min_lod() const {
877 return _min_lod;
878}
879
880/**
881 * Sets the maximum mipmap level that may be sampled.
882 */
883INLINE void EggTexture::
884set_max_lod(double max_lod) {
885 _max_lod = max_lod;
886 _flags |= F_has_max_lod;
887}
888
889/**
890 * Removes the specification of a maximum mipmap level from the texture.
891 */
892INLINE void EggTexture::
894 _max_lod = 1000;
895 _flags &= ~F_has_max_lod;
896}
897
898/**
899 * Returns true if a value for the maximum mipmap level has been specified for
900 * this texture, false otherwise.
901 */
902INLINE bool EggTexture::
903has_max_lod() const {
904 return (_flags & F_has_max_lod) != 0;
905}
906
907/**
908 * Returns the maximum mipmap level that has been specified for this texture.
909 */
910INLINE double EggTexture::
911get_max_lod() const {
912 return _max_lod;
913}
914
915/**
916 * Sets the mipmap level bias that is added to the mipmap level to be sampled.
917 */
918INLINE void EggTexture::
919set_lod_bias(double lod_bias) {
920 _lod_bias = lod_bias;
921 _flags |= F_has_lod_bias;
922}
923
924/**
925 * Removes the specification of a maximum mipmap level from the texture.
926 */
927INLINE void EggTexture::
929 _lod_bias = 1000;
930 _flags &= ~F_has_lod_bias;
931}
932
933/**
934 * Returns true if a value for the maximum mipmap level has been specified for
935 * this texture, false otherwise.
936 */
937INLINE bool EggTexture::
938has_lod_bias() const {
939 return (_flags & F_has_lod_bias) != 0;
940}
941
942/**
943 * Returns the maximum mipmap level that has been specified for this texture.
944 */
945INLINE double EggTexture::
946get_lod_bias() const {
947 return _lod_bias;
948}
949
950/**
951 * Returns an integer that represents the depth to which this texture is
952 * layered on all other textures in the egg file. In general, if texture A is
953 * layered over texture B, then sort(A) > sort(B). If texture A is never
954 * layered over any other texture, then sort(A) == 0. More than that is
955 * difficult to guarantee.
956 */
957INLINE int EggTexture::
958get_multitexture_sort() const {
959 return _multitexture_sort;
960}
961
962/**
963 *
964 */
965INLINE EggTexture::SourceAndOperand::
966SourceAndOperand() :
967 _source(CS_unspecified),
968 _operand(CO_unspecified)
969{
970}
971
972/**
973 *
974 */
975INLINE EggTexture::Combiner::
976Combiner() :
977 _mode(CM_unspecified)
978{
979}
980
981/**
982 *
983 */
984INLINE UniqueEggTextures::
985UniqueEggTextures(int eq) : _eq(eq) {
986}
987
988/**
989 *
990 */
991INLINE bool UniqueEggTextures::
992operator ()(const EggTexture *t1, const EggTexture *t2) const {
993 return t1->sorts_less_than(*t2, _eq);
994}
Defines a texture map that may be applied to geometry.
Definition eggTexture.h:30
clear_priority
Removes the specification of multitexture priority from the texture.
Definition eggTexture.h:335
get_stage_name
Returns the stage name that has been specified for this texture, or the tref name if no texture stage...
Definition eggTexture.h:333
get_read_mipmaps
Returns the current setting of the read_mipmaps flag.
Definition eggTexture.h:354
WrapMode determine_wrap_u() const
Determines the appropriate wrap in the U direction.
Definition eggTexture.I:107
has_uv_name
Returns true if a texcoord name has been explicitly specified for this texture, false otherwise.
Definition eggTexture.h:341
get_alpha_scale
Returns the alpha_scale value that has been specified for the texture, or 1 if no alpha_scale value h...
Definition eggTexture.h:345
get_wrap_w
Returns the amount specified for W wrap.
Definition eggTexture.h:323
get_uv_name
Returns the texcoord name that has been specified for this texture, or the empty string if no texcoor...
Definition eggTexture.h:341
get_multiview
Returns the current setting of the multiview flag.
Definition eggTexture.h:351
clear_min_lod
Removes the specification of a minimum mipmap level from the texture.
Definition eggTexture.h:356
get_multitexture_sort
Returns an integer that represents the depth to which this texture is layered on all other textures i...
Definition eggTexture.h:362
has_num_views
Returns true if the number of views has been specified for the 3-D multiview texture,...
Definition eggTexture.h:353
set_num_views
When loading a 3-D multiview texture, this parameter is necessary to specify how many views will be e...
Definition eggTexture.h:353
set_stage_name
Specifies the particular TextureStage this texture will be rendered on by name.
Definition eggTexture.h:333
clear_stage_name
Removes the named TextureStage specification.
Definition eggTexture.h:333
get_lod_bias
Returns the maximum mipmap level that has been specified for this texture.
Definition eggTexture.h:360
get_alpha_file_channel
Returns the particular channel that has been specified for the alpha-file image, or 0 if no channel h...
Definition eggTexture.h:350
set_rgb_scale
Sets an additional factor that will scale all three r, g, b components after the texture has been app...
Definition eggTexture.h:343
clear_num_views
Removes the specification of the number of views for a 3-D multiview texture.
Definition eggTexture.h:353
has_anisotropic_degree
Returns true if a value for the anisotropic filtering degree has been specified for this texture,...
Definition eggTexture.h:327
get_border_color
Returns the border color if one has been specified, or (0, 0, 0, 1) otherwise.
Definition eggTexture.h:339
set_alpha_scale
Sets an additional factor that will scale the alpha component after the texture has been applied.
Definition eggTexture.h:345
get_min_lod
Returns the minimum mipmap level that has been specified for this texture.
Definition eggTexture.h:356
clear_lod_bias
Removes the specification of a maximum mipmap level from the texture.
Definition eggTexture.h:360
clear_alpha_scale
Removes the alpha_scale from the texture and restores it to the default value of 1.
Definition eggTexture.h:345
set_uv_name
Specifies the named set of texture coordinates that this texture will use when it is applied to geome...
Definition eggTexture.h:341
set_min_lod
Sets the minimum mipmap level that may be sampled.
Definition eggTexture.h:356
get_wrap_u
Returns the amount specified for U wrap.
Definition eggTexture.h:321
clear_uv_name
Removes the restriction to a particular named set of texture coordinates and restores the texture to ...
Definition eggTexture.h:341
WrapMode determine_wrap_w() const
Determines the appropriate wrap in the W direction.
Definition eggTexture.I:161
set_anisotropic_degree
Sets the degree of anisotropic filtering for this texture.
Definition eggTexture.h:327
has_min_lod
Returns true if a value for the minimum mipmap level has been specified for this texture,...
Definition eggTexture.h:356
get_max_lod
Returns the maximum mipmap level that has been specified for this texture.
Definition eggTexture.h:358
clear_rgb_scale
Removes the rgb_scale from the texture and restores it to the default value of 1.
Definition eggTexture.h:343
set_read_mipmaps
Sets the read_mipmaps flag.
Definition eggTexture.h:354
set_alpha_file_channel
If a separate alpha-file is specified, this indicates which channel number should be extracted from t...
Definition eggTexture.h:350
WrapMode determine_wrap_v() const
Determines the appropriate wrap in the V direction.
Definition eggTexture.I:134
clear_anisotropic_degree
Removes the specification of anisotropic filtering from the texture.
Definition eggTexture.h:327
get_anisotropic_degree
Returns the anisotropic filtering degree that has been specified for this texture,...
Definition eggTexture.h:327
has_color
Returns true if a blend color has been specified for the texture.
Definition eggTexture.h:337
has_lod_bias
Returns true if a value for the maximum mipmap level has been specified for this texture,...
Definition eggTexture.h:360
set_multiview
Sets the multiview flag.
Definition eggTexture.h:351
get_alpha_filename
Returns the separate file assigned for the alpha channel.
Definition eggTexture.h:347
has_alpha_file_channel
Returns true if a particular channel has been specified for the alpha-file image, false otherwise.
Definition eggTexture.h:350
has_priority
Returns true if a priority value for multitexture importance has been specified for the texture,...
Definition eggTexture.h:335
set_max_lod
Sets the maximum mipmap level that may be sampled.
Definition eggTexture.h:358
get_alpha_fullpath
Returns the full pathname to the alpha file, if it is known; otherwise, returns the same thing as get...
Definition eggTexture.h:348
has_rgb_scale
Returns true if an rgb_scale has been specified for the texture, false otherwise.
Definition eggTexture.h:343
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.
Definition eggTexture.h:345
get_color
Returns the blend color if one has been specified, or (0, 0, 0, 1) otherwise.
Definition eggTexture.h:337
set_lod_bias
Sets the mipmap level bias that is added to the mipmap level to be sampled.
Definition eggTexture.h:360
get_wrap_v
Returns the amount specified for V wrap.
Definition eggTexture.h:322
has_max_lod
Returns true if a value for the maximum mipmap level has been specified for this texture,...
Definition eggTexture.h:358
set_saved_result
Sets the saved_result flag.
Definition eggTexture.h:329
set_priority
Sets the importance of this texture with respect to other textures also applied on the same geometry.
Definition eggTexture.h:335
get_rgb_scale
Returns the rgb_scale value that has been specified for the texture, or 1 if no rgb_scale value has b...
Definition eggTexture.h:343
clear_max_lod
Removes the specification of a maximum mipmap level from the texture.
Definition eggTexture.h:358
set_alpha_fullpath
Records the full pathname to the file, for the benefit of get_alpha_fullpath().
Definition eggTexture.h:348
clear_alpha_file_channel
Removes the specification of a particular channel to use from the alpha- file image.
Definition eggTexture.h:350
has_border_color
Returns true if a border color has been specified for the texture.
Definition eggTexture.h:339
set_alpha_filename
Specifies a separate file that will be loaded in with the 1- or 3-component texture and applied as th...
Definition eggTexture.h:347
get_priority
Returns the multitexture importance value that has been specified for the texture,...
Definition eggTexture.h:335
has_stage_name
Returns true if a stage name has been explicitly specified for this texture, false otherwise.
Definition eggTexture.h:333
has_alpha_filename
Returns true if a separate file for the alpha component has been applied, false otherwise.
Definition eggTexture.h:347
get_num_views
Returns the specified number of views specified for the 3-D multiview texture.
Definition eggTexture.h:353
get_saved_result
Returns the current setting of the saved_result flag.
Definition eggTexture.h:329
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44