Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
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 TypedReferenceCount TypedObject ReferenceCount

Public Member Functions

 __init__ ()
 
 __init__ (const EggVertex copy)
 Copies all properties of the vertex except its vertex pool, index number, and group membership. More...
 
 clearAux ()
 Removes all auxiliary data from the vertex. More...
 
 clearAux (str name)
 Removes the named auxiliary data from the vertex. More...
 
 clearGrefs ()
 Removes all group references from the vertex, so that it is not assigned to any group. More...
 
 clearUv ()
 Removes all UV coordinate pairs from the vertex. More...
 
 clearUv (str name)
 Removes the named UV coordinate pair from the vertex, along with any UV morphs. More...
 
int compareTo (const EggVertex other)
 An ordering operator to compare two vertices for sorting order. More...
 
 copyGrefsFrom (const EggVertex other)
 Copies all the group references from the other vertex onto this one. More...
 
const LVecBase4d getAux (str name)
 Returns the named auxiliary data quadruple on the vertex. More...
 
const EggVertexAux getAuxObj (str name)
 Returns the named EggVertexAux object, which defines the auxiliary data for this name. More...
 
int getExternalIndex ()
 Returns the number set by set_external_index(). More...
 
int getExternalIndex2 ()
 Returns the number set by set_external_index2(). More...
 
int getIndex ()
 Returns the index number of the vertex within its pool. More...
 
int getNumDimensions ()
 
int getNumGlobalCoord ()
 Returns the number of primitives that own this vertex whose vertices are interpreted in the global coordinate system. More...
 
int getNumLocalCoord ()
 Returns the number of primitives that own this vertex whose vertices are interpreted to be in a local coordinate system. More...
 
EggVertexPool getPool ()
 Returns the vertex pool this vertex belongs in. More...
 
double getPos1 ()
 Only valid if get_num_dimensions() returns 1. More...
 
LPoint2d getPos2 ()
 Only valid if get_num_dimensions() returns 2. More...
 
LVertexd getPos3 ()
 Valid if get_num_dimensions() returns 3 or 4. More...
 
LPoint4d getPos4 ()
 This is always valid, regardless of the value of get_num_dimensions. More...
 
LTexCoordd getUv ()
 Returns the unnamed UV coordinate pair on the vertex. More...
 
LTexCoordd getUv (str name)
 Returns the named UV coordinate pair on the vertex. More...
 
const EggVertexUV getUvObj (str name)
 Returns the named EggVertexUV object, which defines both the UV coordinate pair for this name and the UV morphs. More...
 
const LTexCoord3d getUvw (str name)
 Returns the named UV coordinate triple on the vertex. More...
 
bool hasAux ()
 Returns true if the vertex has any auxiliary data, false otherwise. More...
 
bool hasAux (str name)
 Returns true if the vertex has the named auxiliary data quadruple. More...
 
bool hasGref (const EggGroup group)
 Returns true if the indicated group references this vertex, false otherwise. More...
 
int hasPref (const EggPrimitive prim)
 Returns the number of times the vertex appears in the indicated primitive, or 0 if it does not appear. More...
 
bool hasUv ()
 Returns true if the vertex has an unnamed UV coordinate pair, false otherwise. More...
 
bool hasUv (str name)
 Returns true if the vertex has the named UV coordinate pair, and the named UV coordinate pair is 2-d, false otherwise. More...
 
bool hasUvw (str name)
 Returns true if the vertex has the named UV coordinate triple, and the named UV coordinate triple is 3-d, false otherwise. More...
 
bool isForwardReference ()
 Returns true if the vertex is a forward reference to some vertex that hasn't been defined yet. More...
 
EggVertexAux modifyAuxObj (str name)
 Returns a modifiable pointer to the named EggVertexAux object, which defines the auxiliary data for this name. More...
 
EggVertexUV modifyUvObj (str name)
 Returns a modifiable pointer to the named EggVertexUV object, which defines both the UV coordinate pair for this name and the UV morphs. More...
 
EggVertex operator= (const EggVertex copy)
 Copies all properties of the vertex except its vertex pool, index number, and group membership. More...
 
 output (Ostream out)
 
 setAux (str name, const LVecBase4d aux)
 Sets the indicated auxiliary data quadruple on the vertex. More...
 
 setAuxObj (EggVertexAux vertex_aux)
 Sets the indicated EggVertexAux on the vertex. More...
 
 setExternalIndex (int external_index)
 Sets a special index number that is associated with the EggVertex (but is not written to the egg file). More...
 
 setExternalIndex2 (int external_index2)
 Similar to set_external_index(), but this is a different number which may be used for a different purpose by the calling code. More...
 
 setPos (const LPoint2d pos)
 Sets the vertex position. More...
 
 setPos (const LPoint3d pos)
 Sets the vertex position. More...
 
 setPos (const LPoint4d pos)
 Sets the vertex position. More...
 
 setPos (double pos)
 Sets the vertex position. More...
 
 setPos4 (const LPoint4d pos)
 This special flavor of set_pos() sets the vertex as a four-component value, but does not change the set number of dimensions. More...
 
 setUv (const LTexCoordd texCoord)
 Replaces the unnamed UV coordinate pair on the vertex with the indicated value. More...
 
 setUv (str name, const LTexCoordd texCoord)
 Sets the indicated UV coordinate pair on the vertex. More...
 
 setUvObj (EggVertexUV vertex_uv)
 Sets the indicated EggVertexUV on the vertex. More...
 
 setUvw (str name, const LTexCoord3d texCoord)
 Sets the indicated UV coordinate triple on the vertex. More...
 
bool sortsLessThan (const EggVertex other)
 An ordering operator to compare two vertices for sorting order. More...
 
 testGrefIntegrity ()
 
 testPrefIntegrity ()
 
 transform (const LMatrix4d mat)
 Applies the indicated transformation matrix to the vertex. More...
 
 write (Ostream out, int indent_level)
 Writes the vertex to the indicated output stream in Egg format. More...
 
- Public Member Functions inherited from EggObject
 __init__ ()
 
 __init__ (const EggObject copy)
 
 clearUserData ()
 Removes all user data pointers from the node. More...
 
 clearUserData (TypeHandle type)
 Removes the user data pointer of the indicated type. More...
 
EggUserData getUserData ()
 Returns the user data pointer most recently stored on this object, or NULL if nothing was previously stored. More...
 
EggUserData getUserData (TypeHandle type)
 Returns the user data pointer of the indicated type, if it exists, or NULL if it does not. More...
 
bool hasUserData ()
 Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise. More...
 
bool hasUserData (TypeHandle type)
 Returns true if the user data pointer of the indicated type has been set, false otherwise. More...
 
EggObject operator= (const EggObject copy)
 
 setUserData (EggUserData user_data)
 Sets the user data associated with this object. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 
- Public Member Functions inherited from EggAttributes
 __init__ ()
 
 __init__ (const EggAttributes copy)
 
 clearColor ()
 
 clearNormal ()
 
int compareTo (const EggAttributes other)
 An ordering operator to compare two vertices for sorting order. More...
 
 copyColor (const EggAttributes other)
 Sets this color to be the same as the other's, include morphs. More...
 
 copyNormal (const EggAttributes other)
 Sets this normal to be the same as the other's, include morphs. More...
 
LColor getColor ()
 Returns the color set on this particular attribute. More...
 
const LNormald getNormal ()
 
bool hasColor ()
 
bool hasNormal ()
 
bool matchesColor (const EggAttributes other)
 Returns true if this color matches that of the other EggAttributes object, include the morph list. More...
 
bool matchesNormal (const EggAttributes other)
 Returns true if this normal matches that of the other EggAttributes object, include the morph list. More...
 
EggAttributes operator= (const EggAttributes copy)
 
 setColor (const LColor Color)
 
 setNormal (const LNormald normal)
 
bool sortsLessThan (const EggAttributes other)
 An ordering operator to compare two vertices for sorting order. More...
 
 transform (const LMatrix4d mat)
 Applies the indicated transformation matrix to the attributes. More...
 
 write (Ostream out, int indent_level)
 Writes the attributes to the indicated output stream in Egg format. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
static EggVertex makeAverage (const EggVertex first, const EggVertex second)
 Creates a new vertex that lies in between the two given vertices. More...
 
- Static Public Member Functions inherited from EggObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from EggAttributes
static TypeHandle getClassType ()
 

Public Attributes

EggMorphVertexList _dxyzs
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 
- Public Attributes inherited from EggAttributes
EggMorphNormalList _dnormals
 
EggMorphColorList _drgbas
 

Detailed Description

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

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( const EggVertex  copy)

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

◆ clearAux() [1/2]

clearAux ( )

Removes all auxiliary data from the vertex.

◆ clearAux() [2/2]

clearAux ( str  name)

Removes the named auxiliary data from the vertex.

◆ clearGrefs()

clearGrefs ( )

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

◆ clearUv() [1/2]

clearUv ( )

Removes all UV coordinate pairs from the vertex.

◆ clearUv() [2/2]

clearUv ( str  name)

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

◆ compareTo()

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

copyGrefsFrom ( const EggVertex  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.

◆ getAux()

const LVecBase4d getAux ( str  name)

Returns the named auxiliary data quadruple on the vertex.

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

◆ getAuxObj()

const EggVertexAux getAuxObj ( str  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.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getExternalIndex()

int getExternalIndex ( )

Returns the number set by set_external_index().

See set_external_index().

◆ getExternalIndex2()

int getExternalIndex2 ( )

Returns the number set by set_external_index2().

See set_external_index2().

◆ getIndex()

int getIndex ( )

Returns the index number of the vertex within its pool.

◆ getNumDimensions()

int getNumDimensions ( )

◆ getNumGlobalCoord()

int getNumGlobalCoord ( )

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

◆ getNumLocalCoord()

int getNumLocalCoord ( )

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

◆ getPool()

EggVertexPool getPool ( )

Returns the vertex pool this vertex belongs in.

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

◆ getPos1()

double getPos1 ( )

Only valid if get_num_dimensions() returns 1.

Returns the position as a one-dimensional value.

◆ getPos2()

LPoint2d getPos2 ( )

Only valid if get_num_dimensions() returns 2.

Returns the position as a two-dimensional value.

◆ getPos3()

LVertexd getPos3 ( )

Valid if get_num_dimensions() returns 3 or 4.

Returns the position as a three-dimensional value.

◆ getPos4()

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

◆ getUv() [1/2]

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

◆ getUv() [2/2]

LTexCoordd getUv ( str  name)

Returns the named UV coordinate pair on the vertex.

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

◆ getUvObj()

const EggVertexUV getUvObj ( str  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.

◆ getUvw()

const LTexCoord3d getUvw ( str  name)

Returns the named UV coordinate triple on the vertex.

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

◆ hasAux() [1/2]

bool hasAux ( )

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

◆ hasAux() [2/2]

bool hasAux ( str  name)

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

◆ hasGref()

bool hasGref ( const EggGroup  group)

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

◆ hasPref()

int hasPref ( const EggPrimitive  prim)

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

◆ hasUv() [1/2]

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.

◆ hasUv() [2/2]

bool hasUv ( str  name)

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

◆ hasUvw()

bool hasUvw ( str  name)

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

◆ isForwardReference()

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.

◆ makeAverage()

static EggVertex makeAverage ( const EggVertex  first,
const EggVertex  second 
)
static

Creates a new vertex that lies in between the two given vertices.

The attributes for the UV sets they have in common are averaged.

Both vertices need to be either in no pool, or in the same pool. In the latter case, the new vertex will be placed in that pool.

◆ modifyAuxObj()

EggVertexAux modifyAuxObj ( str  name)

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.

◆ modifyUvObj()

EggVertexUV modifyUvObj ( str  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.

◆ operator=()

EggVertex operator= ( const EggVertex  copy)

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

◆ output()

output ( Ostream  out)

◆ setAux()

setAux ( str  name,
const LVecBase4d  aux 
)

Sets the indicated auxiliary data quadruple on the vertex.

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

◆ setAuxObj()

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

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.

◆ setExternalIndex2()

setExternalIndex2 ( int  external_index2)

Similar to set_external_index(), but this is a different number which may be used for a different purpose by the calling code.

The egg library does not assign any meaning to this number or use it in any way.

◆ setPos() [1/4]

setPos ( const LPoint2d  pos)

Sets the vertex position.

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

◆ setPos() [2/4]

setPos ( const LPoint3d  pos)

Sets the vertex position.

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

◆ setPos() [3/4]

setPos ( const LPoint4d  pos)

Sets the vertex position.

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

◆ setPos() [4/4]

setPos ( double  pos)

Sets the vertex position.

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

◆ setPos4()

setPos4 ( const LPoint4d  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() [1/2]

setUv ( const LTexCoordd  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() [2/2]

setUv ( str  name,
const LTexCoordd  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()

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

setUvw ( str  name,
const LTexCoord3d  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.

◆ sortsLessThan()

bool sortsLessThan ( const EggVertex  other)

An ordering operator to compare two vertices for sorting order.

This imposes an arbitrary ordering useful to identify unique vertices.

◆ testGrefIntegrity()

testGrefIntegrity ( )

◆ testPrefIntegrity()

testPrefIntegrity ( )

◆ transform()

transform ( const LMatrix4d  mat)

Applies the indicated transformation matrix to the vertex.

◆ write()

write ( Ostream  out,
int  indent_level 
)

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

Member Data Documentation

◆ _dxyzs

EggMorphVertexList _dxyzs