Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# EggGroupNode Class Reference

A base class for nodes in the hierarchy that are not leaf nodes. More...

Inheritance diagram for EggGroupNode:

List of all members.

## Public Types
enum | TriangulateFlags { TPolygon = 1, TConvex = 2, TComposite = 4, TRecurse = 8, TFlatShaded = 16 }
## Public Member Functions
| EggGroupNode (EggGroupNode const copy)
| EggGroupNode (string name)
| EggGroupNode ()
EggNode | addChild (EggNode node)
| Adds the indicated child to the group and returns it.
| applyFirstAttribute (bool recurse)
| Sets the first vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded.
| applyLastAttribute (bool recurse)
| Sets the last vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded.
| clear ()
| clearConnectedShading ()
| Resets the connected_shading information on all primitives at this node and below, so that it may be accurately rederived by the next call to get_connected_shading().
bool | empty ()
EggNode | findChild (string name)
| Returns the child of this node whose name is the indicated string, or NULL if there is no child of this node by that name.
| forceFilenames (Filename const directory)
| Similar to resolve_filenames, but each non-absolute filename encountered is arbitrarily taken to be in the indicated directory, whether or not the so-named filename exists.
| getConnectedShading ()
| Queries the connected_shading information on all primitives at this node and below, to ensure that it has been completely filled in before we start mucking around with vertices.
EggNode | getFirstChild ()
| Returns the first child in the group's list of children, or NULL if the list of children is empty.
EggNode | getNextChild ()
| Returns the next child in the group's list of children since the last call to get_first_child() or get_next_child(), or NULL if the last child has been returned.
bool | hasAbsolutePathnames ()
| Returns true if any nodes at this level and below include a reference to a file via an absolute pathname, or false if all references are relative.
bool | hasNormals ()
| Returns true if any of the primitives (e.g.
bool | hasPrimitives ()
| Returns true if there are any primitives (e.g.
bool | jointHasPrimitives ()
| Returns true if there are any primitives (e.g.
| makePointPrimitives ()
| Creates PointLight primitives to reference any otherwise unreferences vertices discovered in this group or below.
| meshTriangles (int flags)
| Combine triangles together into triangle strips, at this group and below.
EggGroupNode | operator= (EggGroupNode const copy)
| postApplyFlatAttribute (bool recurse)
| Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices of the primitive, if they don't already have an attribute set, just so they end up with *something*.
| recomputePolygonNormals (CoordinateSystem cs)
| Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.
| recomputePolygonNormals ()
| Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.
bool | recomputeTangentBinormal (GlobPattern const uv_name)
| This function recomputes the tangent and binormal for the named texture coordinate set for all vertices at this level and below.
bool | recomputeTangentBinormal (vectorbasic_stringchar const names)
| This function recomputes the tangent and binormal for the named texture coordinate sets.
bool | recomputeTangentBinormalAuto ()
| This function recomputes the tangent and binormal for any texture coordinate set that affects a normal map.
| recomputeVertexNormals (double threshold)
| Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.
| recomputeVertexNormals (double threshold, CoordinateSystem cs)
| Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.
EggNode | removeChild (EggNode node)
| Removes the indicated child node from the group and returns it.
int | removeInvalidPrimitives (bool recurse)
| Removes primitives at this level and below which appear to be degenerate; e.g.
int | removeUnusedVertices (bool recurse)
| Removes all vertices from VertexPools within this group or below that are not referenced by at least one primitive.
int | renameNodes (vectorbasic_stringchar strip_prefix, bool recurse)
| Rename by stripping out the prefix.
| resolveFilenames (DSearchPath const searchpath)
| Walks the tree and attempts to resolve any filenames encountered.
| reverseVertexOrdering ()
| Reverses the vertex ordering of all polygons defined at this node and below.
unsigned int | size ()
| stealChildren (EggGroupNode other)
| Moves all the children from the other node to this one.
| stripNormals ()
| Removes all normals from primitives, and the vertices they reference, at this node and below.
int | triangulatePolygons (int flags)
| Replace all higher-order polygons at this point in the scene graph and below with triangles.
| unifyAttributes (bool use_connected_shading, bool allow_per_primitive, bool recurse)
| Applies per-vertex normal and color to all vertices, if they are in fact per-vertex (and different for each vertex), or moves them to the primitive if they are all the same.
## Static Public Member Functions
static TypeHandle | getClassType ()
static bool | isRight (Vec2D const v1, Vec2D const v2)
| Returns true if the 2-d v1 is to the right of v2.

## Detailed Description

A base class for nodes in the hierarchy that are not leaf nodes.

(See also EggGroup, which is specifically the "<Group>" node in egg.)

An EggGroupNode is an STL-style container of pointers to EggNodes, like a vector. Functions push_back()/pop_back() and insert()/erase() are provided to manipulate the list. The list may also be operated on (read-only) via iterators and begin()/end().

## Member Enumeration Documentation

enum TriangulateFlags

Enumerator:

  TPolygon |
  TConvex |
  TComposite |
  TRecurse |
  TFlatShaded |

## Constructor & Destructor Documentation

EggGroupNode | ( | EggGroupNode const | copy | ) |

EggGroupNode | ( | string | name | ) |

EggGroupNode | ( |  | ) |

## Member Function Documentation

EggNode addChild | ( | EggNode | node | ) |

Adds the indicated child to the group and returns it.

If the child node is already a child of some other node, removes it first.

applyFirstAttribute | ( | bool | recurse | ) |

Sets the first vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded.

This reflects the DirectX convention of storing flat-shaded properties on the first vertex, although it is not usually a convention in Egg.

This may create redundant vertices in the vertex pool, so it may be a good idea to follow this up with remove_unused_vertices().

applyLastAttribute | ( | bool | recurse | ) |

Sets the last vertex of the triangle (or each component) to the primitive normal and/or color, if the primitive is flat-shaded.

This reflects the OpenGL convention of storing flat-shaded properties on the last vertex, although it is not usually a convention in Egg.

This may create redundant vertices in the vertex pool, so it may be a good idea to follow this up with remove_unused_vertices().

clear | ( |  | ) |

clearConnectedShading | ( |  | ) |

Resets the connected_shading information on all primitives at this node and below, so that it may be accurately rederived by the next call to get_connected_shading().

It may be a good idea to call remove_unused_vertices() as well, to establish the correct connectivity between common vertices.

bool empty | ( |  | ) |

EggNode findChild | ( | string | name | ) |

Returns the child of this node whose name is the indicated string, or NULL if there is no child of this node by that name.

Does not search recursively.

forceFilenames | ( | Filename const | directory | ) |

Similar to resolve_filenames, but each non-absolute filename encountered is arbitrarily taken to be in the indicated directory, whether or not the so-named filename exists.

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented from EggNode.

Reimplemented in EggGroup, EggBin, EggData, EggTable, and EggXfmSAnim.

getConnectedShading | ( |  | ) |

Queries the connected_shading information on all primitives at this node and below, to ensure that it has been completely filled in before we start mucking around with vertices.

EggNode getFirstChild | ( |  | ) |

Returns the first child in the group's list of children, or NULL if the list of children is empty.

Can be used with get_next_child() to return the complete list of children without using the iterator class; however, this is non-thread-safe, and so is not recommended except for languages other than C++ which cannot use the iterators.

EggNode getNextChild | ( |  | ) |

Returns the next child in the group's list of children since the last call to get_first_child() or get_next_child(), or NULL if the last child has been returned.

Can be used with get_first_child() to return the complete list of children without using the iterator class; however, this is non-thread-safe, and so is not recommended except for languages other than C++ which cannot use the iterators.

It is an error to call this without previously calling get_first_child().

bool hasAbsolutePathnames | ( |  | ) |

Returns true if any nodes at this level and below include a reference to a file via an absolute pathname, or false if all references are relative.

bool hasNormals | ( |  | ) |

Returns true if any of the primitives (e.g.

polygons) defined within this group or below have either face or vertex normals defined, false otherwise.

bool hasPrimitives | ( |  | ) |

Returns true if there are any primitives (e.g.

polygons) defined within this group or below, false otherwise.

static bool isRight | ( | Vec2D const | v1,
|  | Vec2D const | v2
| ) |  | `[static]`

Returns true if the 2-d v1 is to the right of v2.

bool jointHasPrimitives | ( |  | ) |

Returns true if there are any primitives (e.g.

polygons) defined within this group or below, but the search does not include nested joints.

makePointPrimitives | ( |  | ) |

Creates PointLight primitives to reference any otherwise unreferences vertices discovered in this group or below.

meshTriangles | ( | int | flags | ) |

Combine triangles together into triangle strips, at this group and below.

EggGroupNode operator= | ( | EggGroupNode const | copy | ) |

postApplyFlatAttribute | ( | bool | recurse | ) |

Intended as a followup to apply_last_attribute(), this also sets an attribute on the first vertices of the primitive, if they don't already have an attribute set, just so they end up with *something*.

recomputePolygonNormals | ( | CoordinateSystem | cs | ) |

Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.

Normals are removed from the vertices and defined only on polygons, giving the geometry a faceted appearance.

This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normals removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

recomputePolygonNormals | ( |  | ) |

Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.

Normals are removed from the vertices and defined only on polygons, giving the geometry a faceted appearance.

This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normals removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

Reimplemented in EggData.

bool recomputeTangentBinormal | ( | vectorbasic_stringchar const | names | ) |

This function recomputes the tangent and binormal for the named texture coordinate sets.

Returns true if anything was done.

bool recomputeTangentBinormal | ( | GlobPattern const | uv_name | ) |

This function recomputes the tangent and binormal for the named texture coordinate set for all vertices at this level and below.

Use the empty string for the default texture coordinate set.

It is necessary for each vertex to already have a normal (or at least a polygon normal), as well as a texture coordinate in the named texture coordinate set, before calling this function. You might precede this with recompute_vertex_normals() to ensure that the normals exist.

Like recompute_vertex_normals(), this function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the new tangents and binormals computed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

bool recomputeTangentBinormalAuto | ( |  | ) |

This function recomputes the tangent and binormal for any texture coordinate set that affects a normal map.

Returns true if anything was done.

recomputeVertexNormals | ( | double | threshold | ) |

Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.

A shared edge between two polygons (even in different groups) is considered smooth if the angle between the two edges is less than threshold degrees.

This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the correct normals. Thus, it is a good idea to call remove_unused_vertices() after calling this.

Reimplemented in EggData.

recomputeVertexNormals | ( | double | threshold,
|  | CoordinateSystem | cs
| ) |  |

Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.

A shared edge between two polygons (even in different groups) is considered smooth if the angle between the two edges is less than threshold degrees.

This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the correct normals. Thus, it is a good idea to call remove_unused_vertices() after calling this.

EggNode removeChild | ( | EggNode | node | ) |

Removes the indicated child node from the group and returns it.

If the child was not already in the group, does nothing and returns NULL.

int removeInvalidPrimitives | ( | bool | recurse | ) |

Removes primitives at this level and below which appear to be degenerate; e.g.

polygons with fewer than 3 vertices, etc. Returns the number of primitives removed.

int removeUnusedVertices | ( | bool | recurse | ) |

Removes all vertices from VertexPools within this group or below that are not referenced by at least one primitive.

Also collapses together equivalent vertices, and renumbers all vertices after the operation so their indices are consecutive, beginning at zero. Returns the total number of vertices removed.

Note that this operates on the VertexPools within this group level, without respect to primitives that reference these vertices (unlike other functions like strip_normals()). It is therefore most useful to call this on the EggData root, rather than on a subgroup within the hierarchy, since a VertexPool may appear anywhere in the hierarchy.

int renameNodes | ( | vectorbasic_stringchar | strip_prefix,
|  | bool | recurse
| ) |  |

Rename by stripping out the prefix.

resolveFilenames | ( | DSearchPath const | searchpath | ) |

Walks the tree and attempts to resolve any filenames encountered.

This looks up filenames along the specified search path; it does not automatically search the model_path for missing files.

reverseVertexOrdering | ( |  | ) |

Reverses the vertex ordering of all polygons defined at this node and below.

Does not change the surface normals, if any.

unsigned int size | ( |  | ) |

stealChildren | ( | EggGroupNode | other | ) |

Moves all the children from the other node to this one.

This is especially useful because the group node copy assignment operator does not copy children.

stripNormals | ( |  | ) |

Removes all normals from primitives, and the vertices they reference, at this node and below.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normal removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

Reimplemented in EggData.

int triangulatePolygons | ( | int | flags | ) |

Replace all higher-order polygons at this point in the scene graph and below with triangles.

Returns the total number of new triangles produced, less degenerate polygons removed.

If flags contains T_polygon and T_convex, both concave and convex polygons will be subdivided into triangles; with only T_polygon, only concave polygons will be subdivided, and convex polygons will be largely unchanged.

unifyAttributes | ( | bool | use_connected_shading,
|  | bool | allow_per_primitive,
|  | bool | recurse
| ) |  |

Applies per-vertex normal and color to all vertices, if they are in fact per-vertex (and different for each vertex), or moves them to the primitive if they are all the same.

After this call, either the primitive will have normals or its vertices will, but not both. Ditto for colors.

If use_connected_shading is true, each polygon is considered in conjunction with all connected polygons; otherwise, each polygon is considered individually.

If allow_per_primitive is false, S_per_face or S_overall will treated like S_per_vertex: normals and colors will always be assigned to the vertices. In this case, there will never be per-primitive colors or normals after this call returns. On the other hand, if allow_per_primitive is true, then S_per_face means that normals and colors should be assigned to the primitives, and removed from the vertices, as described above.

This may create redundant vertices in the vertex pool, so it may be a good idea to follow this up with remove_unused_vertices().

All Classes Namespaces Functions Variables Enumerations Enumerator Properties