18 #include "pandabase.h"
20 #include "eggRenderMode.h"
21 #include "eggFilenameNode.h"
22 #include "eggTransform.h"
40 virtual void write(ostream &out,
int indent_level)
const;
46 E_complete_filename = 0x007,
52 bool is_equivalent_to(
const EggTexture &other,
int eq)
const;
53 bool sorts_less_than(
const EggTexture &other,
int eq)
const;
55 bool has_alpha_channel(
int num_components)
const;
58 TT_unspecified, TT_1d_texture,
59 TT_2d_texture, TT_3d_texture, TT_cube_map
63 F_rgba, F_rgbm, F_rgba12, F_rgba8, F_rgba4, F_rgba5,
64 F_rgb, F_rgb12, F_rgb8, F_rgb5, F_rgb332,
65 F_red, F_green, F_blue, F_alpha, F_luminance,
66 F_luminance_alpha, F_luminance_alphamask
68 enum CompressionMode {
69 CM_default, CM_off, CM_on,
70 CM_fxt1, CM_dxt1, CM_dxt2, CM_dxt3, CM_dxt4, CM_dxt5,
73 WM_unspecified, WM_clamp, WM_repeat,
74 WM_mirror, WM_mirror_once, WM_border_color
88 FT_nearest_mipmap_nearest,
89 FT_linear_mipmap_nearest,
90 FT_nearest_mipmap_linear,
91 FT_linear_mipmap_linear,
100 ET_blend_color_scale,
122 enum CombineChannel {
136 CS_constant_color_scale,
137 CS_last_saved_result,
139 enum CombineOperand {
142 CO_one_minus_src_color,
144 CO_one_minus_src_alpha,
170 INLINE
void set_texture_type(TextureType texture_type);
171 INLINE TextureType get_texture_type()
const;
173 INLINE
void set_format(Format format);
174 INLINE Format get_format()
const;
176 INLINE
void set_compression_mode(CompressionMode mode);
177 INLINE CompressionMode get_compression_mode()
const;
179 INLINE
void set_wrap_mode(WrapMode mode);
180 INLINE WrapMode get_wrap_mode()
const;
182 INLINE
void set_wrap_u(WrapMode mode);
183 INLINE WrapMode get_wrap_u()
const;
184 INLINE WrapMode determine_wrap_u()
const;
186 INLINE
void set_wrap_v(WrapMode mode);
187 INLINE WrapMode get_wrap_v()
const;
188 INLINE WrapMode determine_wrap_v()
const;
190 INLINE
void set_wrap_w(WrapMode mode);
191 INLINE WrapMode get_wrap_w()
const;
192 INLINE WrapMode determine_wrap_w()
const;
194 INLINE
void set_minfilter(FilterType type);
195 INLINE FilterType get_minfilter()
const;
197 INLINE
void set_magfilter(FilterType type);
198 INLINE FilterType get_magfilter()
const;
200 INLINE
void set_anisotropic_degree(
int anisotropic_degree);
201 INLINE
void clear_anisotropic_degree();
202 INLINE
bool has_anisotropic_degree()
const;
203 INLINE
int get_anisotropic_degree()
const;
205 INLINE
void set_env_type(EnvType type);
206 INLINE EnvType get_env_type()
const;
207 bool affects_polygon_alpha()
const;
209 INLINE
void set_combine_mode(CombineChannel channel, CombineMode cm);
210 INLINE CombineMode get_combine_mode(CombineChannel channel)
const;
211 INLINE
void set_combine_source(CombineChannel channel,
int n, CombineSource cs);
212 INLINE CombineSource get_combine_source(CombineChannel channel,
int n)
const;
213 INLINE
void set_combine_operand(CombineChannel channel,
int n, CombineOperand co);
214 INLINE CombineOperand get_combine_operand(CombineChannel channel,
int n)
const;
216 INLINE
void set_saved_result(
bool saved_result);
217 INLINE
bool get_saved_result()
const;
219 INLINE
void set_tex_gen(TexGen tex_gen);
220 INLINE TexGen get_tex_gen()
const;
222 INLINE
void set_quality_level(QualityLevel quality_level);
223 INLINE QualityLevel get_quality_level()
const;
225 INLINE
void set_stage_name(
const string &stage_name);
226 INLINE
void clear_stage_name();
227 INLINE
bool has_stage_name()
const;
228 INLINE
const string &get_stage_name()
const;
230 INLINE
void set_priority(
int priority);
231 INLINE
void clear_priority();
232 INLINE
bool has_priority()
const;
233 INLINE
int get_priority()
const;
236 INLINE
void clear_color();
237 INLINE
bool has_color()
const;
238 INLINE
const LColor &get_color()
const;
240 INLINE
void set_border_color(
const LColor &border_color);
241 INLINE
void clear_border_color();
242 INLINE
bool has_border_color()
const;
243 INLINE
const LColor &get_border_color()
const;
245 INLINE
void set_uv_name(
const string &uv_name);
246 INLINE
void clear_uv_name();
247 INLINE
bool has_uv_name()
const;
248 INLINE
const string &get_uv_name()
const;
250 INLINE
void set_rgb_scale(
int rgb_scale);
251 INLINE
void clear_rgb_scale();
252 INLINE
bool has_rgb_scale()
const;
253 INLINE
int get_rgb_scale()
const;
255 INLINE
void set_alpha_scale(
int alpha_scale);
256 INLINE
void clear_alpha_scale();
257 INLINE
bool has_alpha_scale()
const;
258 INLINE
int get_alpha_scale()
const;
260 INLINE
void set_alpha_filename(
const Filename &filename);
261 INLINE
void clear_alpha_filename();
262 INLINE
bool has_alpha_filename()
const;
263 INLINE
const Filename &get_alpha_filename()
const;
265 INLINE
void set_alpha_fullpath(
const Filename &fullpath);
266 INLINE
const Filename &get_alpha_fullpath()
const;
268 INLINE
void set_alpha_file_channel(
int alpha_file_channel);
269 INLINE
void clear_alpha_file_channel();
270 INLINE
bool has_alpha_file_channel()
const;
271 INLINE
int get_alpha_file_channel()
const;
273 INLINE
void set_multiview(
bool multiview);
274 INLINE
bool get_multiview()
const;
276 INLINE
void set_num_views(
int num_views);
277 INLINE
void clear_num_views();
278 INLINE
bool has_num_views()
const;
279 INLINE
int get_num_views()
const;
281 INLINE
void set_read_mipmaps(
bool read_mipmaps);
282 INLINE
bool get_read_mipmaps()
const;
285 void clear_multitexture();
287 INLINE
int get_multitexture_sort()
const;
289 static TextureType string_texture_type(
const string &
string);
290 static Format string_format(
const string &
string);
291 static CompressionMode string_compression_mode(
const string &
string);
292 static WrapMode string_wrap_mode(
const string &
string);
293 static FilterType string_filter_type(
const string &
string);
294 static EnvType string_env_type(
const string &
string);
295 static CombineMode string_combine_mode(
const string &
string);
296 static CombineSource string_combine_source(
const string &
string);
297 static CombineOperand string_combine_operand(
const string &
string);
298 static TexGen string_tex_gen(
const string &
string);
299 static QualityLevel string_quality_level(
const string &
string);
305 virtual bool egg_start_parse_body();
309 bool r_min_multitexture_sort(
int sort,
MultiTextures &cycle_detector);
312 F_has_alpha_filename = 0x0002,
313 F_has_anisotropic_degree = 0x0004,
314 F_has_alpha_file_channel = 0x0008,
315 F_has_stage_name = 0x0010,
316 F_has_uv_name = 0x0020,
317 F_has_priority = 0x0040,
318 F_has_color = 0x0080,
319 F_has_rgb_scale = 0x0100,
320 F_has_alpha_scale = 0x0200,
321 F_has_border_color = 0x0400,
322 F_has_num_views = 0x0800,
325 TextureType _texture_type;
327 CompressionMode _compression_mode;
328 WrapMode _wrap_mode, _wrap_u, _wrap_v, _wrap_w;
329 FilterType _minfilter, _magfilter;
330 int _anisotropic_degree;
336 QualityLevel _quality_level;
347 int _alpha_file_channel;
349 int _multitexture_sort;
351 class SourceAndOperand {
353 INLINE SourceAndOperand();
354 CombineSource _source;
355 CombineOperand _operand;
362 SourceAndOperand _ops[CI_num_indices];
365 Combiner _combiner[CC_num_channels];
376 static void init_type() {
377 EggFilenameNode::init_type();
378 EggRenderMode::init_type();
379 register_type(_type_handle,
"EggTexture",
380 EggFilenameNode::get_class_type(),
381 EggRenderMode::get_class_type());
384 return get_class_type();
386 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
407 INLINE ostream &operator << (ostream &out,
const EggTexture &n) {
411 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::TextureType texture_type);
412 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::Format format);
413 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::CompressionMode mode);
414 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::WrapMode mode);
415 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::FilterType type);
416 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::EnvType type);
417 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::CombineMode cm);
418 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::CombineChannel cc);
419 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::CombineSource cs);
420 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::CombineOperand co);
421 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::TexGen tex_gen);
422 EXPCL_PANDAEGG ostream &operator << (ostream &out, EggTexture::QualityLevel quality_level);
424 #include "eggTexture.I"
This is an egg node that contains a filename.
Defines a texture map that may be applied to geometry.
This class stores miscellaneous rendering properties that is associated with geometry, and which may be set on the geometry primitive level, on the group above it, or indirectly via a texture.
virtual EggTransform * as_transform()
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.
void write(ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
The name of a file, such as a texture file or an Egg file.
An STL function object for sorting textures into order by properties.
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
This is the base class for all three-component vectors and points.
TypeHandle is the identifier used to differentiate C++ class types.