Panda3D
Public Types | Public Member Functions | Static Public Member Functions

EggXfmSAnim Class Reference

This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that specify the nine components of a transformation. More...

Inheritance diagram for EggXfmSAnim:
EggGroupNode EggNode EggNamedObject EggObject

List of all members.

Public Types

enum  TriangulateFlags {
  TPolygon = 1, TConvex = 2, TComposite = 4, TRecurse = 8,
  TFlatShaded = 16
}

Public Member Functions

 EggXfmSAnim (EggXfmAnimData const convert_from)
 Converts the older-style XfmAnim table to the newer-style XfmSAnim table.
 EggXfmSAnim (EggXfmSAnim const copy)
 EggXfmSAnim (string name)
 EggXfmSAnim ()
 EggXfmSAnim (string name, CoordinateSystem cs)
EggNode addChild (EggNode node)
 Adds the indicated child to the group and returns it.
 addComponentData (string component_name, double value)
 Adds a new row to the named component (one of matrix_component_letters) of the table.
 addComponentData (int component, double value)
 Adds a new row to the indicated component (0-12) of the table.
bool addData (Mat4D const mat)
 Adds a new matrix to the table, by adding a new row to each of the subtables.
 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.
 applyTexmats ()
 Applies the texture matrices to the UV's of the vertices that reference them, and then removes the texture matrices from the textures themselves.
 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().
 clearData ()
 Removes all data from the table.
 clearFps ()
 clearOrder ()
 clearUserData ()
 Removes *all* user data pointers from the node.
 clearUserData (TypeHandle type)
 Removes the user data pointer of the indicated type.
EggRenderMode determineAlphaMode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has an alpha_mode other than AM_unspecified.
EggRenderMode determineBin ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a bin specified.
bool determineDecal ()
 Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set.
EggRenderMode determineDepthOffset ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_offset specified.
EggRenderMode determineDepthTestMode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_test_mode other than DTM_unspecified.
EggRenderMode determineDepthWriteMode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_write_mode other than DWM_unspecified.
EggRenderMode determineDrawOrder ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a draw_order specified.
bool determineIndexed ()
 Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set.
EggRenderMode determineVisibilityMode ()
 Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a visibility_mode other than VM_unspecified.
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.
 flattenTransforms ()
 Removes any transform and instance records from this node in the scene graph and below.
 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.
CoordinateSystem getCoordinateSystem ()
 Returns the coordinate system this table believes it is defined within.
int getDepth ()
 Returns the number of nodes above this node in the egg hierarchy.
EggNode getFirstChild ()
 Returns the first child in the group's list of children, or NULL if the list of children is empty.
double getFps ()
 This is only valid if has_fps() returns true.
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.
Mat4D const getNodeFrame ()
 Returns the coordinate frame of the node itself.
Mat4D const getNodeFrameInv ()
 Returns the inverse of the matrix returned by get_node_frame().
Mat4D const getNodeFrameInvPtr ()
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame_inv() matrix.
Mat4D const getNodeFramePtr ()
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix.
Mat4D const getNodeToVertex ()
 Returns the transformation matrix suitable for converting vertices in the coordinate space of the node to the appropriate coordinate space for storing in the egg file.
Mat4D const getNodeToVertexPtr ()
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_to_vertex() matrix.
int getNumRows ()
 Returns the effective number of rows in the table.
string getOrder ()
EggGroupNode getParent ()
EggUserData getUserData ()
 Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored.
EggUserData getUserData (TypeHandle type)
 Returns the user data pointer of the indicated type, if it exists, or NULL if it does not.
 getValue (int row, Mat4D mat)
 Returns the value of the aggregate row of the table as a matrix.
Mat4D const getVertexFrame ()
 Returns the coordinate frame of the vertices referenced by primitives at or under this node.
Mat4D const getVertexFrameInv ()
 Returns the inverse of the matrix returned by get_vertex_frame().
Mat4D const getVertexFrameInvPtr ()
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame_inv() matrix.
Mat4D const getVertexFramePtr ()
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix.
Mat4D const getVertexToNode ()
 Returns the transformation matrix suitable for converting the vertices as read from the egg file into the coordinate space of the node.
Mat4D const getVertexToNodePtr ()
 Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_to_node() matrix.
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 hasFps ()
bool hasNormals ()
 Returns true if any of the primitives (e.g.
bool hasOrder ()
bool hasPrimitives ()
 Returns true if there are any primitives (e.g.
bool hasUserData (TypeHandle type)
 Returns true if the user data pointer of the indicated type has been set, false otherwise.
bool hasUserData ()
 Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.
bool isAnimMatrix ()
 Returns true if this node represents a table of animation transformation data, false otherwise.
bool isJoint ()
 Returns true if this particular node represents a <Joint> entry or not.
bool isLocalCoord ()
 Returns true if this node's vertices are not in the global coordinate space.
bool isUnderInstance ()
 Returns true if there is an <Instance> node somewhere in the egg tree at or above this node, false otherwise.
bool isUnderTransform ()
 Returns true if there is a <Transform> entry somewhere in the egg tree at or above this node, false otherwise.
bool jointHasPrimitives ()
 Returns true if there are any primitives (e.g.
 meshTriangles (int flags)
 Combine triangles together into triangle strips, at this group and below.
 normalize ()
 The inverse operation of optimize(), this ensures that all the sub-tables have the same length by duplicating rows as necessary.
EggXfmSAnim operator= (EggXfmSAnim const copy)
 optimize ()
 Optimizes the table by collapsing redundant sub-tables.
 optimizeToStandardOrder ()
 Optimizes the table by collapsing redundant sub-tables, and simultaneously ensures that the order string is the standard order (which is the same as that supported by compose_matrix() and decompose_matrix()).
 output (ostream out)
bool parseEgg (string egg_syntax)
 Parses the egg syntax given in the indicate string as if it had been read from the egg file within this object's definition.
 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 (vectorbasic_stringchar const names)
 This function recomputes the tangent and binormal for the named texture coordinate sets.
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 recomputeTangentBinormalAuto ()
 This function recomputes the tangent and binormal for any texture coordinate set that affects a normal map.
 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.
 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.
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 renameNode (vectorbasic_stringchar strip_prefix)
 Rename by stripping out the prefix.
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.
 setFps (double fps)
 setOrder (string order)
 setUserData (EggUserData user_data)
 Sets the user data associated with this object.
bool setValue (int row, Mat4D const mat)
 Replaces the indicated row of the table with the given matrix.
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.
 testUnderIntegrity ()
 Recursively checks the integrity of the _under_flags, _parent, and _depth members of this node and all of its ancestors.
 transform (Mat4D const mat)
 Applies the indicated transformation to the node and all of its descendants.
 transformVerticesOnly (Mat4D const mat)
 Applies the indicated transformation only to vertices that appear in global space within vertex pools 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.
 write (ostream out, int indent_level)

Static Public Member Functions

static composeWithOrder (Mat4D mat, VBase3D const scale, VBase3D const shear, VBase3D const hpr, VBase3D const trans, string order, CoordinateSystem cs)
 Composes a matrix out of the nine individual components, respecting the order string.
static TypeHandle getClassType ()
static string getStandardOrder ()
 Returns the standard order of matrix component composition.
static bool isRight (Vec2D const v1, Vec2D const v2)
 Returns true if the 2-d v1 is to the right of v2.

Detailed Description

This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that specify the nine components of a transformation.

It's implemented as a group that can contain any number of EggSAnimData children.


Member Enumeration Documentation

enum TriangulateFlags [inherited]
Enumerator:
TPolygon 
TConvex 
TComposite 
TRecurse 
TFlatShaded 

Constructor & Destructor Documentation

EggXfmSAnim ( EggXfmAnimData const  convert_from)

Converts the older-style XfmAnim table to the newer-style XfmSAnim table.

EggXfmSAnim ( EggXfmSAnim const  copy)
EggXfmSAnim ( string  name,
CoordinateSystem  cs 
)
EggXfmSAnim ( string  name)

Member Function Documentation

EggNode addChild ( EggNode  node) [inherited]

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.

addComponentData ( int  component,
double  value 
)

Adds a new row to the indicated component (0-12) of the table.

addComponentData ( string  component_name,
double  value 
)

Adds a new row to the named component (one of matrix_component_letters) of the table.

bool addData ( Mat4D const  mat)

Adds a new matrix to the table, by adding a new row to each of the subtables.

This is a convenience function that treats the table of tables as if it were a single table of matrices. It is an error to call this if any SAnimData children of this node have an improper name (e.g. not a single letter, or not one of "ijkabchprxyz").

This function has the further requirement that all nine of the subtables must exist and be of the same length. Furthermore, the order string must be the standard order string, which matches the system compose_matrix() and decompose_matrix() functions.

Thus, you probably cannot take an existing EggXfmSAnim object and start adding matrices to the end; you must clear out the original data first. (As a special exception, if no tables exist, they will be created.) The method normalize() will do this for you on an existing EggXfmSAnim.

This function may fail silently if the matrix cannot be decomposed into scale, shear, rotate, and translate. In this case, the closest approximation is added to the table, and false is returned.

applyFirstAttribute ( bool  recurse) [inherited]

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) [inherited]

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().

applyTexmats ( ) [inherited]

Applies the texture matrices to the UV's of the vertices that reference them, and then removes the texture matrices from the textures themselves.

clear ( ) [inherited]
clearConnectedShading ( ) [inherited]

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.

clearData ( )

Removes all data from the table.

It does this by removing all of its children.

clearFps ( )
clearOrder ( )
clearUserData ( ) [inherited]

Removes *all* user data pointers from the node.

clearUserData ( TypeHandle  type) [inherited]

Removes the user data pointer of the indicated type.

static composeWithOrder ( Mat4D  mat,
VBase3D const  scale,
VBase3D const  shear,
VBase3D const  hpr,
VBase3D const  trans,
string  order,
CoordinateSystem  cs 
) [static]

Composes a matrix out of the nine individual components, respecting the order string.

The components will be applied in the order indicated by the string.

EggRenderMode determineAlphaMode ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has an alpha_mode other than AM_unspecified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

EggRenderMode determineBin ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a bin specified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

bool determineDecal ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag set.

Returns the value of the decal flag if it is found, or false if it is not.

In other words, returns true if the "decal" flag is in effect for the indicated node, false otherwise.

Reimplemented in EggGroup.

EggRenderMode determineDepthOffset ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_offset specified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

EggRenderMode determineDepthTestMode ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_test_mode other than DTM_unspecified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

EggRenderMode determineDepthWriteMode ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a depth_write_mode other than DWM_unspecified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

EggRenderMode determineDrawOrder ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a draw_order specified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

bool determineIndexed ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" scalar set.

Returns the value of the indexed scalar if it is found, or false if it is not.

In other words, returns true if the "indexed" flag is in effect for the indicated node, false otherwise.

Reimplemented in EggGroup.

EggRenderMode determineVisibilityMode ( ) [inherited]

Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this level or above this node that has a visibility_mode other than VM_unspecified.

Returns a valid EggRenderMode pointer if one is found, or NULL otherwise.

Reimplemented in EggGroup, and EggPrimitive.

bool empty ( ) [inherited]
EggNode findChild ( string  name) [inherited]

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.

flattenTransforms ( ) [inherited]

Removes any transform and instance records from this node in the scene graph and below.

If an instance node is encountered, removes the instance and applies the transform to its vertices, duplicating vertices if necessary.

Since this function may result in duplicated vertices, it may be a good idea to call remove_unused_vertices() after calling this.

forceFilenames ( Filename const  directory) [inherited]

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 EggGroupNode.

getConnectedShading ( ) [inherited]

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.

CoordinateSystem getCoordinateSystem ( )

Returns the coordinate system this table believes it is defined within.

This should always match the coordinate system of the EggData structure that owns it. It is necessary to store it here because the meaning of the h, p, and r columns depends on the coordinate system.

int getDepth ( ) [inherited]

Returns the number of nodes above this node in the egg hierarchy.

EggNode getFirstChild ( ) [inherited]

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.

double getFps ( )

This is only valid if has_fps() returns true.

EggNode getNextChild ( ) [inherited]

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().

Mat4D const getNodeFrame ( ) [inherited]

Returns the coordinate frame of the node itself.

This is simply the net product of all transformations up to the root.

Mat4D const getNodeFrameInv ( ) [inherited]

Returns the inverse of the matrix returned by get_node_frame().

See get_node_frame().

Mat4D const getNodeFrameInvPtr ( ) [inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame_inv() matrix.

Mat4D const getNodeFramePtr ( ) [inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_frame() matrix.

Mat4D const getNodeToVertex ( ) [inherited]

Returns the transformation matrix suitable for converting vertices in the coordinate space of the node to the appropriate coordinate space for storing in the egg file.

This is the same thing as:

get_node_frame() * get_vertex_frame_inv()

Mat4D const getNodeToVertexPtr ( ) [inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_node_to_vertex() matrix.

int getNumRows ( )

Returns the effective number of rows in the table.

This is actually the number of rows of the smallest subtable larger than one row. This is a convenience function that treats the table of tables as if it were a single table of matrices.

string getOrder ( )
EggGroupNode getParent ( ) [inherited]
static string getStandardOrder ( ) [static]

Returns the standard order of matrix component composition.

This is what the order string must be set to in order to use set_value() or add_data() successfully.

EggUserData getUserData ( ) [inherited]

Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored.

EggUserData getUserData ( TypeHandle  type) [inherited]

Returns the user data pointer of the indicated type, if it exists, or NULL if it does not.

getValue ( int  row,
Mat4D  mat 
)

Returns the value of the aggregate row of the table as a matrix.

This is a convenience function that treats the table of tables as if it were a single table of matrices. It is an error to call this if any SAnimData children of this node have an improper name (e.g. not a single letter, or not one of "ijkabchprxyz").

Mat4D const getVertexFrame ( ) [inherited]

Returns the coordinate frame of the vertices referenced by primitives at or under this node.

This is not the same as get_node_frame().

Generally, vertices in an egg file are stored in the global coordinate space, regardless of the transforms defined at each node. Thus, get_vertex_frame() will usually return the identity transform (global coordinate space). However, primitives under an <Instance> entry reference their vertices in the coordinate system under effect at the time of the <Instance>. Thus, nodes under an <Instance> entry may return this non-identity matrix.

Specifically, this may return a non-identity matrix only if is_local_coord() is true.

Mat4D const getVertexFrameInv ( ) [inherited]

Returns the inverse of the matrix returned by get_vertex_frame().

See get_vertex_frame().

Mat4D const getVertexFrameInvPtr ( ) [inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame_inv() matrix.

Mat4D const getVertexFramePtr ( ) [inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_frame() matrix.

Mat4D const getVertexToNode ( ) [inherited]

Returns the transformation matrix suitable for converting the vertices as read from the egg file into the coordinate space of the node.

This is the same thing as:

get_vertex_frame() * get_node_frame_inv()

Mat4D const getVertexToNodePtr ( ) [inherited]

Returns either a NULL pointer or a unique pointer shared by nodes with the same get_vertex_to_node() matrix.

bool hasAbsolutePathnames ( ) [inherited]

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 hasFps ( )
bool hasNormals ( ) [inherited]

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 hasOrder ( )
bool hasPrimitives ( ) [inherited]

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

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

bool hasUserData ( TypeHandle  type) [inherited]

Returns true if the user data pointer of the indicated type has been set, false otherwise.

bool hasUserData ( ) [inherited]

Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.

bool isAnimMatrix ( ) [inherited]

Returns true if this node represents a table of animation transformation data, false otherwise.

bool isJoint ( ) [inherited]

Returns true if this particular node represents a <Joint> entry or not.

This is a handy thing to know since Joints are sorted to the end of their sibling list when writing an egg file. See EggGroupNode.write().

Reimplemented in EggGroup.

bool isLocalCoord ( ) [inherited]

Returns true if this node's vertices are not in the global coordinate space.

This will be the case if there was an <Instance> node under a transform at or above this node.

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

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

bool isUnderInstance ( ) [inherited]

Returns true if there is an <Instance> node somewhere in the egg tree at or above this node, false otherwise.

bool isUnderTransform ( ) [inherited]

Returns true if there is a <Transform> entry somewhere in the egg tree at or above this node, false otherwise.

bool jointHasPrimitives ( ) [inherited]

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

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

meshTriangles ( int  flags) [inherited]

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

normalize ( )

The inverse operation of optimize(), this ensures that all the sub-tables have the same length by duplicating rows as necessary.

This is needed before doing operations like add_data() or set_value() on an existing table.

EggXfmSAnim operator= ( EggXfmSAnim const  copy)
optimize ( )

Optimizes the table by collapsing redundant sub-tables.

optimizeToStandardOrder ( )

Optimizes the table by collapsing redundant sub-tables, and simultaneously ensures that the order string is the standard order (which is the same as that supported by compose_matrix() and decompose_matrix()).

output ( ostream  out) [inherited]
bool parseEgg ( string  egg_syntax) [inherited]

Parses the egg syntax given in the indicate string as if it had been read from the egg file within this object's definition.

Updates the object accordingly. Returns true if successful, false if there was some parse error or if the object does not support this functionality.

postApplyFlatAttribute ( bool  recurse) [inherited]

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) [inherited]

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 ( ) [inherited]

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) [inherited]

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) [inherited]

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 ( ) [inherited]

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) [inherited]

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 
) [inherited]

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) [inherited]

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) [inherited]

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) [inherited]

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 renameNode ( vectorbasic_stringchar  strip_prefix) [inherited]

Rename by stripping out the prefix.

int renameNodes ( vectorbasic_stringchar  strip_prefix,
bool  recurse 
) [inherited]

Rename by stripping out the prefix.

resolveFilenames ( DSearchPath const  searchpath) [inherited]

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 ( ) [inherited]

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

Does not change the surface normals, if any.

setFps ( double  fps)
setOrder ( string  order)
setUserData ( EggUserData  user_data) [inherited]

Sets the user data associated with this object.

This may be any EggUserData-derived object. The egg library will do nothing with this pointer, except to hold its reference count and return the pointer on request.

The EggObject maintains multiple different EggUserData pointers, one for each unique type (as reported by get_type()). If you know that only one type of EggUserData object will be added in your application, you may use the query functions that accept no parameters, but it is recommended that in general you pass in the type of your particular user data, to allow multiple applications to coexist in the same egg data.

This pointer is also copied by the copy assignment operator and copy constructor.

bool setValue ( int  row,
Mat4D const  mat 
)

Replaces the indicated row of the table with the given matrix.

This function can only be called if all the constraints of add_data(), below, are met. Call normalize() first if you are not sure.

The return value is true if the matrix can be decomposed and stored as scale, shear, rotate, and translate, or false otherwise. The data is set in either case.

unsigned int size ( ) [inherited]
stealChildren ( EggGroupNode  other) [inherited]

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 ( ) [inherited]

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.

testUnderIntegrity ( ) [inherited]

Recursively checks the integrity of the _under_flags, _parent, and _depth members of this node and all of its ancestors.

transform ( Mat4D const  mat) [inherited]

Applies the indicated transformation to the node and all of its descendants.

Reimplemented in EggVertexPool.

transformVerticesOnly ( Mat4D const  mat) [inherited]

Applies the indicated transformation only to vertices that appear in global space within vertex pools at this node and below.

Joints and other transforms are not affected, nor are local vertices.

int triangulatePolygons ( int  flags) [inherited]

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 
) [inherited]

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().

write ( ostream  out,
int  indent_level 
) [inherited]

Reimplemented in EggGroup, EggTexture, and EggPrimitive.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties