Panda3D
 All Classes Functions Variables Enumerations
eggRenderState.cxx
1 // Filename: eggRenderState.cxx
2 // Created by: drose (12Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "eggRenderState.h"
16 #include "eggRenderMode.h"
17 #include "eggLine.h"
18 #include "eggPoint.h"
19 #include "textureAttrib.h"
20 #include "renderAttrib.h"
21 #include "eggTexture.h"
22 #include "texGenAttrib.h"
23 #include "internalName.h"
24 #include "eggCurve.h"
25 #include "eggSurface.h"
26 #include "cullBinAttrib.h"
27 #include "cullFaceAttrib.h"
28 #include "shadeModelAttrib.h"
29 #include "transparencyAttrib.h"
30 #include "depthWriteAttrib.h"
31 #include "depthTestAttrib.h"
32 #include "depthOffsetAttrib.h"
33 #include "texMatrixAttrib.h"
34 #include "renderModeAttrib.h"
35 #include "material.h"
36 #include "materialAttrib.h"
37 #include "materialPool.h"
38 #include "config_gobj.h"
39 #include "config_egg2pg.h"
40 
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: EggRenderState::fill_state
44 // Access: Public
45 // Description: Sets up the state as appropriate for the indicated
46 // primitive.
47 ////////////////////////////////////////////////////////////////////
50  // The various EggRenderMode properties can be defined directly at
51  // the primitive, at a group above the primitive, or an a texture
52  // applied to the primitive. The EggNode::determine_*() functions
53  // can find the right pointer to the level at which this is actually
54  // defined for a given primitive.
55  EggRenderMode::AlphaMode am = EggRenderMode::AM_unspecified;
56  EggRenderMode::DepthWriteMode dwm = EggRenderMode::DWM_unspecified;
57  EggRenderMode::DepthTestMode dtm = EggRenderMode::DTM_unspecified;
58  EggRenderMode::VisibilityMode vm = EggRenderMode::VM_unspecified;
59  bool implicit_alpha = false;
60  bool binary_alpha_only = true; // true if all alpha sources are binary alpha.
61  bool has_draw_order = false;
62  int draw_order = 0;
63  bool has_depth_offset = false;
64  int depth_offset = 0;
65  bool has_bin = false;
66  string bin;
67 
68  EggRenderMode *render_mode;
69  render_mode = egg_prim->determine_alpha_mode();
70  if (render_mode != (EggRenderMode *)NULL) {
71  am = render_mode->get_alpha_mode();
72  }
73  render_mode = egg_prim->determine_depth_write_mode();
74  if (render_mode != (EggRenderMode *)NULL) {
75  dwm = render_mode->get_depth_write_mode();
76  }
77  render_mode = egg_prim->determine_depth_test_mode();
78  if (render_mode != (EggRenderMode *)NULL) {
79  dtm = render_mode->get_depth_test_mode();
80  }
81  render_mode = egg_prim->determine_visibility_mode();
82  if (render_mode != (EggRenderMode *)NULL) {
83  vm = render_mode->get_visibility_mode();
84  }
85  render_mode = egg_prim->determine_draw_order();
86  if (render_mode != (EggRenderMode *)NULL) {
87  has_draw_order = true;
88  draw_order = render_mode->get_draw_order();
89  }
90  render_mode = egg_prim->determine_depth_offset();
91  if (render_mode != (EggRenderMode *)NULL) {
92  has_depth_offset = true;
93  depth_offset = render_mode->get_depth_offset();
94  }
95  render_mode = egg_prim->determine_bin();
96  if (render_mode != (EggRenderMode *)NULL) {
97  has_bin = true;
98  bin = render_mode->get_bin();
99  }
100 
101  // add_attrib(TextureAttrib::make_off());
102  int num_textures = egg_prim->get_num_textures();
103  CPT(RenderAttrib) texture_attrib = NULL;
104  CPT(RenderAttrib) tex_gen_attrib = NULL;
105  CPT(RenderAttrib) tex_mat_attrib = NULL;
106  TexMats tex_mats;
107 
108  for (int i = 0; i < num_textures; i++) {
109  PT_EggTexture egg_tex = egg_prim->get_texture(i);
110 
111  const TextureDef &def = _loader._textures[egg_tex];
112  if (def._texture != (const RenderAttrib *)NULL) {
113  if (texture_attrib == (RenderAttrib *)NULL) {
114  texture_attrib = def._texture;
115  } else {
116  texture_attrib = texture_attrib->compose(def._texture);
117  }
118 
119  if (egg_tex->affects_polygon_alpha()) {
120  const TextureAttrib *tex_attrib = DCAST(TextureAttrib, def._texture);
121  Texture *tex = tex_attrib->get_texture();
122  nassertv(tex != (Texture *)NULL);
123 
124  Texture::Format format = tex->get_format();
125  if (Texture::has_alpha(format) && !Texture::has_binary_alpha(format)) {
126  // This texture specifies a gradient alpha format.
127  binary_alpha_only = false;
128  }
129 
130  if (am == EggRenderMode::AM_unspecified) {
131  // If neither the primitive nor the texture specified an
132  // alpha mode, assume it should be alpha'ed if the texture
133  // has an alpha channel (unless the texture environment type
134  // is one that doesn't apply its alpha to the result).
135  int num_components = tex->get_num_components();
136  if (egg_tex->has_alpha_channel(num_components)) {
137  implicit_alpha = true;
138  }
139  }
140  }
141 
142  // Check for a texgen attrib.
143  bool has_tex_gen = false;
144  if (egg_tex->get_tex_gen() != EggTexture::TG_unspecified) {
145  has_tex_gen = true;
146  if (tex_gen_attrib == (const RenderAttrib *)NULL) {
147  tex_gen_attrib = TexGenAttrib::make();
148  }
149  tex_gen_attrib = DCAST(TexGenAttrib, tex_gen_attrib)->
150  add_stage(def._stage, get_tex_gen(egg_tex));
151  }
152 
153  // Record the texture's associated texture matrix, so we can see
154  // if we can safely bake it into the UV's. (We need to get the
155  // complete list of textures that share this same set of UV's
156  // per each unique texture matrix. Whew!)
157  CPT(InternalName) uv_name;
158  if (egg_tex->has_uv_name() && egg_tex->get_uv_name() != string("default")) {
159  uv_name = InternalName::get_texcoord_name(egg_tex->get_uv_name());
160  } else {
161  uv_name = InternalName::get_texcoord();
162  }
163 
164  if (has_tex_gen) {
165  // If the texture has a texgen mode, we will always apply its
166  // texture transform, never bake it in. In fact, we don't
167  // even care about its UV's in this case, since we won't be
168  // using them.
169  tex_mat_attrib = apply_tex_mat(tex_mat_attrib, def._stage, egg_tex);
170 
171  } else {
172  // Otherwise, we need to record that there is at least one
173  // texture on this particular UV name and with this particular
174  // texture matrix. If there are no other textures, or if all
175  // of the other textures use the same texture matrix, then
176  // tex_mats[uv_name].size() will remain 1 (which tells us we
177  // can bake in the texture matrix to the UV's). On the other
178  // hand, if there is another texture on the same uv name but
179  // with a different transform, it will increase
180  // tex_mats[uv_name].size() to at least 2, indicating we can't
181  // bake in the texture matrix.
182  tex_mats[uv_name][egg_tex->get_transform3d()].push_back(&def);
183  }
184  }
185  }
186 
187  // These parametric primitive types can't have their UV's baked in,
188  // so if we have one of these we always need to apply the texture
189  // matrix as a separate attribute, regardless of how many textures
190  // share the particular UV set.
191  bool needs_tex_mat = (egg_prim->is_of_type(EggCurve::get_class_type()) ||
192  egg_prim->is_of_type(EggSurface::get_class_type()));
193 
194  // Now that we've visited all of the textures in the above loop, we
195  // can go back and see how many of them share the same UV name and
196  // texture matrix.
197  TexMats::const_iterator tmi;
198  for (tmi = tex_mats.begin(); tmi != tex_mats.end(); ++tmi) {
199  const InternalName *uv_name = (*tmi).first;
200  const TexMatTransforms &tmt = (*tmi).second;
201 
202  if (tmt.size() == 1 && !needs_tex_mat) {
203  // Only one unique transform sharing this set of UV's. We can
204  // bake in the transform!
205  const TexMatTextures &tmtex = (*tmt.begin()).second;
206 
207  // The first EggTexture on the list is sufficient, since we know
208  // they all have the same transform.
209  nassertv(!tmtex.empty());
210  TexMatTextures::const_iterator tmtexi = tmtex.begin();
211  const EggTexture *egg_tex = (*tmtexi)->_egg_tex;
212  if (egg_tex->has_transform()) {
213  // If there's no transform, it's an identity matrix; don't
214  // bother recording it. Of course, it would do no harm to
215  // record it if we felt like it.
216  _bake_in_uvs[uv_name] = egg_tex;
217  }
218 
219  } else {
220  // Multiple transforms on this UV set, or a geometry type that
221  // doesn't support baking in UV's. We have to apply the
222  // texture matrix to each stage.
223  TexMatTransforms::const_iterator tmti;
224  for (tmti = tmt.begin(); tmti != tmt.end(); ++tmti) {
225  const TexMatTextures &tmtex = (*tmti).second;
226  TexMatTextures::const_iterator tmtexi;
227  for (tmtexi = tmtex.begin(); tmtexi != tmtex.end(); ++tmtexi) {
228  const EggTexture *egg_tex = (*tmtexi)->_egg_tex;
229  TextureStage *stage = (*tmtexi)->_stage;
230 
231  tex_mat_attrib = apply_tex_mat(tex_mat_attrib, stage, egg_tex);
232  }
233  }
234  }
235  }
236 
237  if (texture_attrib != (RenderAttrib *)NULL) {
238  add_attrib(texture_attrib);
239  }
240 
241  if (tex_gen_attrib != (RenderAttrib *)NULL) {
242  add_attrib(tex_gen_attrib);
243  }
244 
245  if (tex_mat_attrib != (RenderAttrib *)NULL) {
246  add_attrib(tex_mat_attrib);
247  }
248 
249  if (egg_prim->has_material()) {
250  PT(EggMaterial) material = egg_prim->get_material();
251  CPT(RenderAttrib) mt =
252  get_material_attrib(material, egg_prim->get_bface_flag());
253  add_attrib(mt);
254 
255  if (material->has_diff() && material->get_diff()[3] != 1.0) {
256  implicit_alpha = true;
257  binary_alpha_only = false;
258  }
259  }
260 
261 
262  // Also check the color of the primitive to see if we should assume
263  // alpha based on the alpha values specified in the egg file.
264  if (am == EggRenderMode::AM_unspecified) {
265  if (egg_prim->has_color()) {
266  if (egg_prim->get_color()[3] != 1.0) {
267  implicit_alpha = true;
268  binary_alpha_only = false;
269  }
270  }
271  EggPrimitive::const_iterator vi;
272  for (vi = egg_prim->begin();
273  !implicit_alpha && vi != egg_prim->end();
274  ++vi) {
275  if ((*vi)->has_color()) {
276  if ((*vi)->get_color()[3] != 1.0) {
277  implicit_alpha = true;
278  binary_alpha_only = false;
279  }
280  }
281  }
282 
283  if (implicit_alpha) {
284  am = EggRenderMode::AM_on;
285  }
286  }
287 
288  switch (am) {
289  case EggRenderMode::AM_on:
290  // Alpha type "on" means to get the default transparency type.
291  if (binary_alpha_only) {
292  am = EggRenderMode::AM_binary;
293  } else if (egg_alpha_mode != EggRenderMode::AM_unspecified) {
294  am = egg_alpha_mode;
295  }
296  break;
297 
298  case EggRenderMode::AM_blend:
299  case EggRenderMode::AM_ms:
300  case EggRenderMode::AM_ms_mask:
301  case EggRenderMode::AM_dual:
302  if (egg_implicit_alpha_binary) {
303  // Any of these modes gets implicitly downgraded to AM_binary, if
304  // all of the alpha sources only contribute a binary value to
305  // alpha.
306  if (binary_alpha_only) {
307  am = EggRenderMode::AM_binary;
308  }
309  }
310  break;
311 
312  default:
313  break;
314  }
315 
316  switch (am) {
317  case EggRenderMode::AM_on:
318  case EggRenderMode::AM_blend:
319  add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_alpha));
320  break;
321 
322  case EggRenderMode::AM_blend_no_occlude:
323  add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_alpha));
324  add_attrib(DepthWriteAttrib::make(DepthWriteAttrib::M_off));
325  break;
326 
327  case EggRenderMode::AM_ms:
328  add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_multisample));
329  break;
330 
331  case EggRenderMode::AM_ms_mask:
332  add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_multisample_mask));
333  break;
334 
335  case EggRenderMode::AM_binary:
336  add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_binary));
337  break;
338 
339  case EggRenderMode::AM_dual:
340  add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_dual));
341  break;
342 
343  default:
344  break;
345  }
346 
347  switch (dwm) {
348  case EggRenderMode::DWM_on:
349  add_attrib(DepthWriteAttrib::make(DepthWriteAttrib::M_on));
350  break;
351 
352  case EggRenderMode::DWM_off:
353  add_attrib(DepthWriteAttrib::make(DepthWriteAttrib::M_off));
354  break;
355 
356  default:
357  break;
358  }
359 
360  switch (dtm) {
361  case EggRenderMode::DTM_on:
362  add_attrib(DepthTestAttrib::make(DepthTestAttrib::M_less));
363  break;
364 
365  case EggRenderMode::DTM_off:
366  add_attrib(DepthTestAttrib::make(DepthTestAttrib::M_none));
367  break;
368 
369  default:
370  break;
371  }
372 
373  switch (vm) {
374  case EggRenderMode::VM_hidden:
375  _hidden = true;
376  break;
377 
378  case EggRenderMode::VM_normal:
379  default:
380  break;
381  }
382 
383  _flat_shaded =
384  (egg_flat_shading &&
385  egg_prim->get_connected_shading() == EggPrimitive::S_per_face);
386 
387  if (_flat_shaded) {
388  add_attrib(ShadeModelAttrib::make(ShadeModelAttrib::M_flat));
389  }
390 
391  if (egg_prim->is_of_type(EggLine::get_class_type())) {
392  _primitive_type = Geom::PT_lines;
393  EggLine *egg_line = DCAST(EggLine, egg_prim);
394  if (egg_line->get_thick() != 1.0) {
395  add_attrib(RenderModeAttrib::make(RenderModeAttrib::M_unchanged,
396  egg_line->get_thick()));
397  }
398  } else if (egg_prim->is_of_type(EggPoint::get_class_type())) {
399  _primitive_type = Geom::PT_points;
400  EggPoint *egg_point = DCAST(EggPoint, egg_prim);
401  if (egg_point->get_thick() != 1.0 || egg_point->get_perspective()) {
402  add_attrib(RenderModeAttrib::make(RenderModeAttrib::M_unchanged,
403  egg_point->get_thick(),
404  egg_point->get_perspective()));
405  }
406  } else {
407  _primitive_type = Geom::PT_polygons;
408  }
409 
410  if (has_bin) {
411  add_attrib(CullBinAttrib::make(bin, draw_order));
412 
413  } else if (has_draw_order) {
414  add_attrib(CullBinAttrib::make("fixed", draw_order));
415  }
416  if (has_depth_offset) {
417  add_attrib(DepthOffsetAttrib::make(depth_offset));
418  }
419 
420 
421  if (egg_prim->get_bface_flag()) {
422  // The primitive is marked with backface culling disabled--we want
423  // to see both sides.
424  add_attrib(CullFaceAttrib::make(CullFaceAttrib::M_cull_none));
425  }
426 }
427 
428 ////////////////////////////////////////////////////////////////////
429 // Function: EggRenderState::int compare_to
430 // Access: Public
431 // Description: Provides a unique ordering for different
432 // EggRenderState objects, so that primitives of similar
433 // state can be grouped together by the EggBinner.
434 ////////////////////////////////////////////////////////////////////
436 compare_to(const EggRenderState &other) const {
437  if (_state != other._state) {
438  int c = _state->compare_to(*other._state);
439  if (c != 0) {
440  return c;
441  }
442  }
443  if (_hidden != other._hidden) {
444  return (int)_hidden - (int)other._hidden;
445  }
446  if (_flat_shaded != other._flat_shaded) {
447  return (int)_flat_shaded - (int)other._flat_shaded;
448  }
449  if (_primitive_type != other._primitive_type) {
450  return (int)_primitive_type - (int)other._primitive_type;
451  }
452 
453  if (_bake_in_uvs.size() != other._bake_in_uvs.size()) {
454  return (int)_bake_in_uvs.size() - (int)other._bake_in_uvs.size();
455  }
456 
457  BakeInUVs::const_iterator ai, bi;
458  ai = _bake_in_uvs.begin();
459  bi = other._bake_in_uvs.begin();
460  while (ai != _bake_in_uvs.end()) {
461  nassertr(bi != other._bake_in_uvs.end(), false);
462  if ((*ai).first != (*bi).first) {
463  return (*ai).first < (*bi).first ? -1 : 1;
464  }
465  if ((*ai).second != (*bi).second) {
466  return (*ai).second < (*bi).second ? -1 : 1;
467  }
468  ++ai;
469  ++bi;
470  }
471  nassertr(bi == other._bake_in_uvs.end(), false);
472 
473  return 0;
474 }
475 
476 ////////////////////////////////////////////////////////////////////
477 // Function: EggRenderState::get_material_attrib
478 // Access: Private
479 // Description: Returns a RenderAttrib suitable for enabling the
480 // material indicated by the given EggMaterial, and with
481 // the indicated backface flag.
482 ////////////////////////////////////////////////////////////////////
484 get_material_attrib(const EggMaterial *egg_mat, bool bface) {
485  Materials &materials =
486  bface ? _loader._materials_bface : _loader._materials;
487 
488  // First, check whether we've seen this material before.
489  Materials::const_iterator mi;
490  mi = materials.find(egg_mat);
491  if (mi != materials.end()) {
492  return (*mi).second;
493  }
494 
495  // Ok, this is the first time we've seen this particular
496  // EggMaterial. Create a new Material that matches it.
497  PT(Material) mat = new Material(egg_mat->get_name());
498  if (egg_mat->has_diff()) {
499  mat->set_diffuse(egg_mat->get_diff());
500  // By default, ambient is the same as diffuse, if diffuse is
501  // specified but ambient is not.
502  mat->set_ambient(egg_mat->get_diff());
503  }
504  if (egg_mat->has_amb()) {
505  mat->set_ambient(egg_mat->get_amb());
506  }
507  if (egg_mat->has_emit()) {
508  mat->set_emission(egg_mat->get_emit());
509  }
510  if (egg_mat->has_spec()) {
511  mat->set_specular(egg_mat->get_spec());
512  }
513  if (egg_mat->has_shininess()) {
514  mat->set_shininess(egg_mat->get_shininess());
515  }
516  if (egg_mat->has_local()) {
517  mat->set_local(egg_mat->get_local());
518  }
519 
520  mat->set_twoside(bface);
521 
522  // Now get a global Material pointer, shared with other models.
523  Material *shared_mat = MaterialPool::get_material(mat);
524 
525  // And create a MaterialAttrib for this Material.
526  CPT(RenderAttrib) mt = MaterialAttrib::make(shared_mat);
527  materials.insert(Materials::value_type(egg_mat, mt));
528 
529  return mt;
530 }
531 
532 ////////////////////////////////////////////////////////////////////
533 // Function: EggRenderState::get_tex_gen
534 // Access: Private, Static
535 // Description: Extracts the tex_gen from the given egg texture,
536 // and returns its corresponding TexGenAttrib mode.
537 ////////////////////////////////////////////////////////////////////
539 get_tex_gen(const EggTexture *egg_tex) {
540  switch (egg_tex->get_tex_gen()) {
541  case EggTexture::TG_unspecified:
542  return TexGenAttrib::M_off;
543 
544  case EggTexture::TG_eye_sphere_map:
545  return TexGenAttrib::M_eye_sphere_map;
546 
547  case EggTexture::TG_world_cube_map:
548  return TexGenAttrib::M_world_cube_map;
549 
550  case EggTexture::TG_eye_cube_map:
551  return TexGenAttrib::M_eye_cube_map;
552 
553  case EggTexture::TG_world_normal:
554  return TexGenAttrib::M_world_normal;
555 
556  case EggTexture::TG_eye_normal:
557  return TexGenAttrib::M_eye_normal;
558 
559  case EggTexture::TG_world_position:
560  return TexGenAttrib::M_world_position;
561 
562  case EggTexture::TG_eye_position:
563  return TexGenAttrib::M_eye_position;
564 
565  case EggTexture::TG_point_sprite:
566  return TexGenAttrib::M_point_sprite;
567  };
568 
569  return TexGenAttrib::M_off;
570 }
571 
572 ////////////////////////////////////////////////////////////////////
573 // Function: EggRenderState::apply_tex_mat
574 // Access: Private
575 // Description: Applies the texture matrix from the indicated egg
576 // texture to the given TexMatrixAttrib, and returns the
577 // new attrib.
578 ////////////////////////////////////////////////////////////////////
580 apply_tex_mat(CPT(RenderAttrib) tex_mat_attrib,
581  TextureStage *stage, const EggTexture *egg_tex) {
582  if (egg_tex->has_transform()) {
583  CPT(TransformState) transform = _loader.make_transform(egg_tex);
584 
585  if (tex_mat_attrib == (const RenderAttrib *)NULL) {
586  tex_mat_attrib = TexMatrixAttrib::make();
587  }
588  tex_mat_attrib = DCAST(TexMatrixAttrib, tex_mat_attrib)->
589  add_stage(stage, transform);
590  }
591 
592  return tex_mat_attrib;
593 }
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
Definition: eggPrimitive.h:51
VisibilityMode get_visibility_mode() const
Returns the visibility mode that was set, or VM_unspecified if nothing was set.
Definition: eggRenderMode.I:99
Format get_format() const
Returns the format of the texture, which represents both the semantic meaning of the texels and...
Definition: texture.I:872
static Material * get_material(Material *temp)
Returns a Material pointer that represents the same material described by temp, except that it is a s...
Definition: materialPool.I:37
This is our own Panda specialization on the default STL map.
Definition: pmap.h:52
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
A line segment, or a series of connected line segments, defined by a &lt;Line&gt; entry.
Definition: eggLine.h:27
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
LColor get_color() const
Returns the color set on this particular attribute.
bool get_bface_flag() const
Retrieves the backfacing flag of the polygon.
Definition: eggPrimitive.I:301
Indicates which, if any, material should be applied to geometry.
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set. ...
Definition: eggRenderMode.I:47
Defines a texture map that may be applied to geometry.
Definition: eggTexture.h:33
int get_draw_order() const
Returns the &quot;draw-order&quot; flag as set for this particular object.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
Definition: typedObject.I:63
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
EggTexture * get_texture() const
Returns the first texture on the primitive, if any, or NULL if there are no textures on the primitive...
Definition: eggPrimitive.I:182
A single point, or a collection of points as defined by a single &lt;PointLight&gt; entry.
Definition: eggPoint.h:27
void fill_state(EggPrimitive *egg_prim)
Sets up the state as appropriate for the indicated primitive.
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
Definition: textureAttrib.h:34
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
This class is used within this package only to record the render state that should be assigned to eac...
bool get_perspective() const
Returns the perspective flag set on this particular point.
Definition: eggPoint.I:116
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.
Definition: eggRenderMode.h:36
virtual EggRenderMode * determine_depth_test_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
double get_thick() const
Returns the thickness set on this particular point.
Definition: eggPoint.I:72
EggMaterial * get_material() const
Returns a pointer to the applied material, or NULL if there is no material applied.
Definition: eggPrimitive.I:262
static bool has_alpha(Format format)
Returns true if the indicated format includes alpha, false otherwise.
Definition: texture.cxx:2413
int get_num_components() const
Returns the number of color components for each texel of the texture image.
Definition: texture.I:835
void add_attrib(const RenderAttrib *attrib)
A convenience function to add the indicated render attribute to the aggregate state.
virtual EggRenderMode * determine_depth_offset()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
int get_num_textures() const
Returns the number of textures applied to the primitive.
Definition: eggPrimitive.I:218
string get_bin() const
Returns the bin name that has been set for this particular object, if any.
bool has_transform() const
Returns true if the transform is nonempty, false if it is empty (no transform components have been ad...
Definition: eggTransform.I:163
Defines the way an object appears in the presence of lighting.
Definition: material.h:34
virtual EggRenderMode * determine_draw_order()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
Definition: eggRenderMode.I:73
int compare_to(const EggRenderState &other) const
Provides a unique ordering for different EggRenderState objects, so that primitives of similar state ...
Applies a transform matrix to UV&#39;s before they are rendered.
AlphaMode get_alpha_mode() const
Returns the alpha mode that was set, or AM_unspecified if nothing was set.
bool has_material() const
Returns true if the primitive is materiald (and get_material() will return a real pointer)...
Definition: eggPrimitive.I:275
Shading get_connected_shading() const
Determines what sort of shading properties this primitive&#39;s connected neighbors have.
Definition: eggPrimitive.I:120
double get_thick() const
Returns the thickness set on this particular line.
Definition: eggLine.I:71
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:38
static bool has_binary_alpha(Format format)
Returns true if the indicated format includes a binary alpha only, false otherwise.
Definition: texture.cxx:2442
Computes texture coordinates for geometry automatically based on vertex position and/or normal...
Definition: texGenAttrib.h:36
Texture * get_texture() const
If the TextureAttrib is not an &#39;off&#39; TextureAttrib, returns the base-level texture that is associated...
Definition: textureAttrib.I:76
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
int get_depth_offset() const
Returns the &quot;depth-offset&quot; flag as set for this particular object.