Panda3D
Public Member Functions | Static Public Member Functions

EggVertex Class Reference

Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal. More...

Inheritance diagram for EggVertex:
EggObject EggAttributes

List of all members.

Public Member Functions

 EggVertex ()
 EggVertex (EggVertex const copy)
 Copies all properties of the vertex except its vertex pool, index number, and group membership.
 clearColor ()
 clearGrefs ()
 Removes all group references from the vertex, so that it is not assigned to any group.
 clearNormal ()
 clearUserData (TypeHandle type)
 Removes the user data pointer of the indicated type.
 clearUserData ()
 Removes *all* user data pointers from the node.
 clearUv ()
 Removes all UV coordinate pairs from the vertex.
 clearUv (string name)
 Removes the named UV coordinate pair from the vertex, along with any UV morphs.
int compareTo (EggVertex const other)
 An ordering operator to compare two vertices for sorting order.
int compareTo (EggAttributes const other)
 An ordering operator to compare two vertices for sorting order.
 copyColor (EggAttributes const other)
 Sets this color to be the same as the other's, include morphs.
 copyGrefsFrom (EggVertex const other)
 Copies all the group references from the other vertex onto this one.
 copyNormal (EggAttributes const other)
 Sets this normal to be the same as the other's, include morphs.
VBase4 getColor ()
 Returns the color set on this particular attribute.
int getExternalIndex ()
 Returns the number set by set_external_index().
int getIndex ()
 Returns the index number of the vertex within its pool.
Vec3D const getNormal ()
int getNumDimensions ()
int getNumGlobalCoord ()
 Returns the number of primitives that own this vertex whose vertices are interpreted in the global coordinate system.
int getNumLocalCoord ()
 Returns the number of primitives that own this vertex whose vertices are interpreted to be in a local coordinate system.
EggVertexPool getPool ()
 Returns the vertex pool this vertex belongs in.
double getPos1 ()
Point2D getPos2 ()
 Only valid if get_num_dimensions() returns 2.
Point3D getPos3 ()
 Valid if get_num_dimensions() returns 3 or 4.
Point4D getPos4 ()
 This is always valid, regardless of the value of get_num_dimensions.
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.
Point2D getUv ()
 Returns the unnamed UV coordinate pair on the vertex.
Point2D getUv (string name)
 Returns the named UV coordinate pair on the vertex.
EggVertexUV const getUvObj (string name)
 Returns the named EggVertexUV object, which defines both the UV coordinate pair for this name and the UV morphs.
Point3D const getUvw (string name)
 Returns the named UV coordinate triple on the vertex.
bool hasColor ()
bool hasGref (EggGroup const group)
 Returns true if the indicated group references this vertex, false otherwise.
bool hasNormal ()
int hasPref (EggPrimitive const prim)
 Returns the number of times the vertex appears in the indicated primitive, or 0 if it does not appear.
bool hasUserData ()
 Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.
bool hasUserData (TypeHandle type)
 Returns true if the user data pointer of the indicated type has been set, false otherwise.
bool hasUv ()
 Returns true if the vertex has an unnamed UV coordinate pair, false otherwise.
bool hasUv (string name)
 Returns true if the vertex has the named UV coordinate pair, and the named UV coordinate pair is 2-d, false otherwise.
bool hasUvw (string name)
 Returns true if the vertex has the named UV coordinate triple, and the named UV coordinate triple is 3-d, false otherwise.
bool isForwardReference ()
 Returns true if the vertex is a forward reference to some vertex that hasn't been defined yet.
bool matchesColor (EggAttributes const other)
 Returns true if this color matches that of the other EggAttributes object, include the morph list.
bool matchesNormal (EggAttributes const other)
 Returns true if this normal matches that of the other EggAttributes object, include the morph list.
EggVertexUV modifyUvObj (string name)
 Returns a modifiable pointer to the named EggVertexUV object, which defines both the UV coordinate pair for this name and the UV morphs.
EggVertex operator= (EggVertex const copy)
 Copies all properties of the vertex except its vertex pool, index number, and group membership.
 output (ostream out)
 setColor (VBase4 const Color)
 setExternalIndex (int external_index)
 Sets a special index number that is associated with the EggVertex (but is not written to the egg file).
 setNormal (Vec3D const normal)
 setPos (Point4D const pos)
 Sets the vertex position.
 setPos (double pos)
 Sets the vertex position.
 setPos (Point3D const pos)
 Sets the vertex position.
 setPos (Point2D const pos)
 Sets the vertex position.
 setPos4 (Point4D const pos)
 This special flavor of set_pos() sets the vertex as a four-component value, but does not change the set number of dimensions.
 setUserData (EggUserData user_data)
 Sets the user data associated with this object.
 setUv (string name, Point2D const texCoord)
 Sets the indicated UV coordinate pair on the vertex.
 setUv (Point2D const texCoord)
 Replaces the unnamed UV coordinate pair on the vertex with the indicated value.
 setUvObj (EggVertexUV vertex_uv)
 Sets the indicated EggVertexUV on the vertex.
 setUvw (string name, Point3D const texCoord)
 Sets the indicated UV coordinate triple on the vertex.
bool sortsLessThan (EggAttributes const other)
 An ordering operator to compare two vertices for sorting order.
bool sortsLessThan (EggVertex const other)
 An ordering operator to compare two vertices for sorting order.
 testGrefIntegrity ()
 Verifies that the gref list is correct and that all the groups included actually exist and do reference the vertex.
 testPrefIntegrity ()
 Verifies that the pref list is correct and that all the primitives included actually exist and do reference the vertex.
 transform (Mat4D const mat)
 Applies the indicated transformation matrix to the vertex.
 write (ostream out, int indent_level)
 Writes the vertex to the indicated output stream in Egg format.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.


Constructor & Destructor Documentation

EggVertex ( )
EggVertex ( EggVertex const  copy)

Copies all properties of the vertex except its vertex pool, index number, and group membership.


Member Function Documentation

clearColor ( ) [inherited]
clearGrefs ( )

Removes all group references from the vertex, so that it is not assigned to any group.

clearNormal ( ) [inherited]
clearUserData ( ) [inherited]

Removes *all* user data pointers from the node.

clearUserData ( TypeHandle  type) [inherited]

Removes the user data pointer of the indicated type.

clearUv ( )

Removes all UV coordinate pairs from the vertex.

clearUv ( string  name)

Removes the named UV coordinate pair from the vertex, along with any UV morphs.

int compareTo ( EggAttributes const  other) [inherited]

An ordering operator to compare two vertices for sorting order.

This imposes an arbitrary ordering useful to identify unique vertices.

int compareTo ( EggVertex const  other)

An ordering operator to compare two vertices for sorting order.

This imposes an arbitrary ordering useful to identify unique vertices.

Group membership is not considered in this comparison. This is somewhat problematic, but cannot easily be helped, because considering group membership would make it difficult to add and remove groups from vertices. It also makes it impossible to meaningfully compare with a concrete EggVertex object (which cannot have group memberships).

However, this is not altogether bad, because two vertices that are identical in all other properties should generally also be identical in group memberships, else the vertices will tend to fly apart when the joints animate.

copyColor ( EggAttributes const  other) [inherited]

Sets this color to be the same as the other's, include morphs.

If the other has no color, this clears the color.

copyGrefsFrom ( EggVertex const  other)

Copies all the group references from the other vertex onto this one.

This assigns the current vertex to exactly the same groups, with exactly the same memberships, as the given one.

Warning: only an EggVertex allocated from the free store may have groups assigned to it. Do not attempt to call this on a temporary concrete EggVertex object; a core dump will certainly result.

copyNormal ( EggAttributes const  other) [inherited]

Sets this normal to be the same as the other's, include morphs.

If the other has no normal, this clears the normal.

static TypeHandle getClassType ( ) [static]

Reimplemented from EggObject.

VBase4 getColor ( ) [inherited]

Returns the color set on this particular attribute.

If there is no color set, returns white.

int getExternalIndex ( )

Returns the number set by set_external_index().

See set_external_index().

int getIndex ( )

Returns the index number of the vertex within its pool.

Vec3D const getNormal ( ) [inherited]
int getNumDimensions ( )
int getNumGlobalCoord ( )

Returns the number of primitives that own this vertex whose vertices are interpreted in the global coordinate system.

int getNumLocalCoord ( )

Returns the number of primitives that own this vertex whose vertices are interpreted to be in a local coordinate system.

EggVertexPool getPool ( )

Returns the vertex pool this vertex belongs in.

This may be NULL if the vertex has not been added to a pool.

double getPos1 ( )
Point2D getPos2 ( )

Only valid if get_num_dimensions() returns 2.

Returns the position as a two-dimensional value.

Point3D getPos3 ( )

Valid if get_num_dimensions() returns 3 or 4.

Returns the position as a three-dimensional value.

Point4D getPos4 ( )

This is always valid, regardless of the value of get_num_dimensions.

It returns the position as a four-dimensional value. If the pos has fewer than four dimensions, this value represents the pos extended into four-dimensional homogenous space, e.g. by adding 1 as the fourth component.

EggUserData getUserData ( TypeHandle  type) [inherited]

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

EggUserData getUserData ( ) [inherited]

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

Point2D getUv ( string  name)

Returns the named UV coordinate pair on the vertex.

vertex. It is an error to call this if has_uv(name) returned false.

Point2D getUv ( )

Returns the unnamed UV coordinate pair on the vertex.

It is an error to call this if has_uv() has returned false.

This is the more restrictive interface, and is generally useful only in the absence of multitexturing; see get_uv(name) for the interface that supports multitexturing.

EggVertexUV const getUvObj ( string  name)

Returns the named EggVertexUV object, which defines both the UV coordinate pair for this name and the UV morphs.

This object might be shared between multiple vertices. You should not attempt to modify this object; instead, call modify_uv_object to return a modifiable pointer.

Point3D const getUvw ( string  name)

Returns the named UV coordinate triple on the vertex.

vertex. It is an error to call this if has_uvw(name) returned false.

bool hasColor ( ) [inherited]
bool hasGref ( EggGroup const  group)

Returns true if the indicated group references this vertex, false otherwise.

bool hasNormal ( ) [inherited]
int hasPref ( EggPrimitive const  prim)

Returns the number of times the vertex appears in the indicated primitive, or 0 if it does not appear.

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

Returns true if the vertex has an unnamed UV coordinate pair, false otherwise.

This is the more restrictive interface, and is generally useful only in the absence of multitexturing; see has_uv(name) for the interface that supports multitexturing.

bool hasUv ( string  name)

Returns true if the vertex has the named UV coordinate pair, and the named UV coordinate pair is 2-d, false otherwise.

bool hasUvw ( string  name)

Returns true if the vertex has the named UV coordinate triple, and the named UV coordinate triple is 3-d, false otherwise.

bool isForwardReference ( )

Returns true if the vertex is a forward reference to some vertex that hasn't been defined yet.

In this case, the vertex may not have any properties filled in yet.

This can only happen if you implicitly create a vertex via EggVertexPool.get_forward_vertex(). Presumably, when the vertex pool is later filled in, this vertex will be replaced with real data.

bool matchesColor ( EggAttributes const  other) [inherited]

Returns true if this color matches that of the other EggAttributes object, include the morph list.

bool matchesNormal ( EggAttributes const  other) [inherited]

Returns true if this normal matches that of the other EggAttributes object, include the morph list.

EggVertexUV modifyUvObj ( string  name)

Returns a modifiable pointer to the named EggVertexUV object, which defines both the UV coordinate pair for this name and the UV morphs.

Returns NULL if there is no such named UV object.

EggVertex operator= ( EggVertex const  copy)

Copies all properties of the vertex except its vertex pool, index number, and group membership.

output ( ostream  out)
setColor ( VBase4 const  Color) [inherited]
setExternalIndex ( int  external_index)

Sets a special index number that is associated with the EggVertex (but is not written to the egg file).

This number is not interpreted by any egg code; it is simply maintained along with the vertex. It *is* used to differentiate otherwise identical vertices in EggVertexPool.create_unique_vertex(), however.

The intention of this number is as an aid for file converters, to associate an EggVertex back to the index number of the original source vertex.

setNormal ( Vec3D const  normal) [inherited]
setPos ( Point2D const  pos)

Sets the vertex position.

This variant sets the vertex to a two-dimensional value.

setPos ( Point3D const  pos)

Sets the vertex position.

This variant sets the vertex to a three-dimensional value.

setPos ( double  pos)

Sets the vertex position.

This variant sets the vertex to a one-dimensional value.

setPos ( Point4D const  pos)

Sets the vertex position.

This variant sets the vertex to a four-dimensional value.

setPos4 ( Point4D const  pos)

This special flavor of set_pos() sets the vertex as a four-component value, but does not change the set number of dimensions.

It's handy for retrieving the vertex position via get_pos4, manipulating it, then storing it back again, without worrying about the number of dimensions it actually had.

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.

setUv ( Point2D const  texCoord)

Replaces the unnamed UV coordinate pair on the vertex with the indicated value.

This is the more restrictive interface, and is generally useful only in the absence of multitexturing; see set_uv(name, uv) for the interface that supports multitexturing.

setUv ( string  name,
Point2D const  texCoord 
)

Sets the indicated UV coordinate pair on the vertex.

This replaces any UV coordinate pair with the same name already on the vertex, but preserves UV morphs.

setUvObj ( EggVertexUV  vertex_uv)

Sets the indicated EggVertexUV on the vertex.

This replaces any UV coordinate pair with the same name already on the vertex, including UV morphs.

setUvw ( string  name,
Point3D const  texCoord 
)

Sets the indicated UV coordinate triple on the vertex.

This replaces any UV coordinate pair or triple with the same name already on the vertex, but preserves UV morphs.

bool sortsLessThan ( EggAttributes const  other) [inherited]

An ordering operator to compare two vertices for sorting order.

This imposes an arbitrary ordering useful to identify unique vertices.

bool sortsLessThan ( EggVertex const  other)

An ordering operator to compare two vertices for sorting order.

This imposes an arbitrary ordering useful to identify unique vertices.

testGrefIntegrity ( )

Verifies that the gref list is correct and that all the groups included actually exist and do reference the vertex.

testPrefIntegrity ( )

Verifies that the pref list is correct and that all the primitives included actually exist and do reference the vertex.

transform ( Mat4D const  mat)

Applies the indicated transformation matrix to the vertex.

Reimplemented from EggAttributes.

write ( ostream  out,
int  indent_level 
)

Writes the vertex to the indicated output stream in Egg format.

Reimplemented from EggAttributes.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties