Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
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 MemoryBase

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.
 clearAux ()
 Removes all auxiliary data from the vertex.
 clearAux (string name)
 Removes the named auxiliary data from the vertex.
 clearGrefs ()
 Removes all group references from the vertex, so that it is not assigned to any group.
 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.
 copyGrefsFrom (EggVertex const other)
 Copies all the group references from the other vertex onto this one.
VBase4D const getAux (string name)
 Returns the named auxiliary data quadruple on the vertex.
EggVertexAux const getAuxObj (string name)
 Returns the named EggVertexAux object, which defines the auxiliary data for this name.
int getExternalIndex ()
 Returns the number set by set_external_index().
int getIndex ()
 Returns the index number of the vertex within its pool.
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.
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 hasAux ()
 Returns true if the vertex has any auxiliary data, false otherwise.
bool hasAux (string name)
 Returns true if the vertex has the named auxiliary data quadruple.
bool hasGref (EggGroup const group)
 Returns true if the indicated group references this vertex, false otherwise.
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 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.
EggVertexAux modifyAuxObj (string name)
 Returns a modifiable pointer to the named EggVertexAux object, which defines the auxiliary data for this name.
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)
 setAux (string name, VBase4D const aux)
 Sets the indicated auxiliary data quadruple on the vertex.
 setAuxObj (EggVertexAux vertex_aux)
 Sets the indicated EggVertexAux on the vertex.
 setExternalIndex (int external_index)
 Sets a special index number that is associated with the EggVertex (but is not written to the egg file).
 setPos (Point2D const pos)
 Sets the vertex position.
 setPos (Point3D const pos)
 Sets the vertex position.
 setPos (Point4D const pos)
 Sets the vertex position.
 setPos (double 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.
 setUv (Point2D const texCoord)
 Replaces the unnamed UV coordinate pair on the vertex with the indicated value.
 setUv (string name, Point2D const texCoord)
 Sets the indicated UV coordinate pair on the vertex.
 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 (EggVertex const other)
 An ordering operator to compare two vertices for sorting order.
 testGrefIntegrity ()
 testPrefIntegrity ()
 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

clearAux ( )

Removes all auxiliary data from the vertex.

clearAux ( string  name)

Removes the named auxiliary data from the vertex.

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

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.

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.

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.

VBase4D const getAux ( string  name)

Returns the named auxiliary data quadruple on the vertex.

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

EggVertexAux const getAuxObj ( string  name)

Returns the named EggVertexAux object, which defines the auxiliary data for this name.

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

static TypeHandle getClassType ( ) [static]

Reimplemented from EggObject.

Returns the number set by set_external_index().

See set_external_index().

int getIndex ( )

Returns the index number of the vertex within its pool.

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

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

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.

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.

Point2D getUv ( string  name)

Returns the named UV coordinate pair on the vertex.

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

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.

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

bool hasAux ( )

Returns true if the vertex has any auxiliary data, false otherwise.

bool hasAux ( string  name)

Returns true if the vertex has the named auxiliary data quadruple.

bool hasGref ( EggGroup const  group)

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

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

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.

Returns a modifiable pointer to the named EggVertexAux object, which defines the auxiliary data for this name.

Returns NULL if there is no such named UV object.

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)
setAux ( string  name,
VBase4D const  aux 
)

Sets the indicated auxiliary data quadruple on the vertex.

This replaces any auxiliary data with the same name already on the vertex.

setAuxObj ( EggVertexAux  vertex_aux)

Sets the indicated EggVertexAux on the vertex.

This replaces any auxiliary data with the same name already on the vertex.

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.

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 ( Point4D const  pos)

Sets the vertex position.

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

setPos ( double  pos)

Sets the vertex position.

This variant sets the vertex to a one-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.

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 ( EggVertex const  other)

An ordering operator to compare two vertices for sorting order.

This imposes an arbitrary ordering useful to identify unique vertices.

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