Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TransformBlend Class Reference

This defines a single entry in a TransformBlendTable. More...

Public Member Functions

 __init__ ()
 
 __init__ (const TransformBlend copy)
 
 __init__ (const VertexTransform transform0, float weight0)
 
 __init__ (const VertexTransform transform0, float weight0, const VertexTransform transform1, float weight1)
 
 __init__ (const VertexTransform transform0, float weight0, const VertexTransform transform1, float weight1, const VertexTransform transform2, float weight2)
 
 __init__ (const VertexTransform transform0, float weight0, const VertexTransform transform1, float weight1, const VertexTransform transform2, float weight2, const VertexTransform transform3, float weight3)
 
 addTransform (const VertexTransform transform, float weight)
 Adds a new transform to the blend. More...
 
int compareTo (const TransformBlend other)
 Defines an arbitrary ordering for TransformBlend objects. More...
 
 getBlend (LMatrix4 result, Thread current_thread)
 Returns the current value of the blend, based on the current value of all of the nested transform objects and their associated weights. More...
 
UpdateSeq getModified (Thread current_thread)
 Returns a counter which is guaranteed to increment at least as often as the result of get_blend() changes. More...
 
int getNumTransforms ()
 Returns the number of transforms stored in the blend object. More...
 
const VertexTransform getTransform (int n)
 Returns the nth transform stored in the blend object. More...
 
list getTransforms ()
 
float getWeight (const VertexTransform transform)
 Returns the weight associated with the indicated transform, or 0 if there is no entry for the transform. More...
 
float getWeight (int n)
 Returns the weight associated with the nth transform stored in the blend object. More...
 
bool hasTransform (const VertexTransform transform)
 Returns true if the blend has the indicated transform, false otherwise. More...
 
 limitTransforms (int max_transforms)
 If the total number of transforms in the blend exceeds max_transforms, removes the n least-important transforms as needed to reduce the number of transforms to max_transforms. More...
 
 normalizeWeights ()
 Rescales all of the weights on the various transforms so that they sum to 1.0. More...
 
bool operator != (const TransformBlend other)
 
bool operator< (const TransformBlend other)
 
TransformBlend operator= (const TransformBlend copy)
 
bool operator== (const TransformBlend other)
 
 output (Ostream out)
 
 removeTransform (const VertexTransform transform)
 Removes the indicated transform from the blend. More...
 
 removeTransform (int n)
 Removes the nth transform stored in the blend object. More...
 
 setTransform (int n, const VertexTransform transform)
 Replaces the nth transform stored in the blend object. More...
 
 setWeight (int n, float weight)
 Replaces the weight associated with the nth transform stored in the blend object. More...
 
 transformPoint (LPoint3d point, Thread current_thread)
 Transforms the indicated point by the blend matrix. More...
 
 transformPoint (LPoint3f point, Thread current_thread)
 
 transformPoint (LPoint4d point, Thread current_thread)
 Transforms the indicated point by the blend matrix. More...
 
 transformPoint (LPoint4f point, Thread current_thread)
 
 transformVector (LVector3d point, Thread current_thread)
 Transforms the indicated vector by the blend matrix. More...
 
 transformVector (LVector3f point, Thread current_thread)
 
 updateBlend (Thread current_thread)
 Recomputes the internal representation of the blend value, if necessary. More...
 
 write (Ostream out, int indent_level)
 

Static Public Member Functions

static TypeHandle getClassType ()
 

Public Attributes

UpdateSeq modified
 Returns a counter which is guaranteed to increment at least as often as the result of get_blend() changes. More...
 
const VertexTransform transforms []
 
float weights []
 

Detailed Description

This defines a single entry in a TransformBlendTable.

It represents a unique combination of VertexTransform pointers and blend amounts.

Member Function Documentation

◆ __init__() [1/6]

__init__ ( )

◆ __init__() [2/6]

__init__ ( const TransformBlend  copy)

◆ __init__() [3/6]

__init__ ( const VertexTransform  transform0,
float  weight0 
)

◆ __init__() [4/6]

__init__ ( const VertexTransform  transform0,
float  weight0,
const VertexTransform  transform1,
float  weight1 
)

◆ __init__() [5/6]

__init__ ( const VertexTransform  transform0,
float  weight0,
const VertexTransform  transform1,
float  weight1,
const VertexTransform  transform2,
float  weight2 
)

◆ __init__() [6/6]

__init__ ( const VertexTransform  transform0,
float  weight0,
const VertexTransform  transform1,
float  weight1,
const VertexTransform  transform2,
float  weight2,
const VertexTransform  transform3,
float  weight3 
)

◆ addTransform()

addTransform ( const VertexTransform  transform,
float  weight 
)

Adds a new transform to the blend.

If the transform already existed, increases its weight factor.

◆ compareTo()

int compareTo ( const TransformBlend  other)

Defines an arbitrary ordering for TransformBlend objects.

◆ getBlend()

getBlend ( LMatrix4  result,
Thread  current_thread 
)

Returns the current value of the blend, based on the current value of all of the nested transform objects and their associated weights.

You should call update_blend() to ensure that the cache is up-to-date before calling this.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getModified()

UpdateSeq getModified ( Thread  current_thread)

Returns a counter which is guaranteed to increment at least as often as the result of get_blend() changes.

◆ getNumTransforms()

int getNumTransforms ( )

Returns the number of transforms stored in the blend object.

◆ getTransform()

const VertexTransform getTransform ( int  n)

Returns the nth transform stored in the blend object.

◆ getTransforms()

list getTransforms ( )

◆ getWeight() [1/2]

float getWeight ( const VertexTransform  transform)

Returns the weight associated with the indicated transform, or 0 if there is no entry for the transform.

◆ getWeight() [2/2]

float getWeight ( int  n)

Returns the weight associated with the nth transform stored in the blend object.

◆ hasTransform()

bool hasTransform ( const VertexTransform  transform)

Returns true if the blend has the indicated transform, false otherwise.

◆ limitTransforms()

limitTransforms ( int  max_transforms)

If the total number of transforms in the blend exceeds max_transforms, removes the n least-important transforms as needed to reduce the number of transforms to max_transforms.

◆ normalizeWeights()

normalizeWeights ( )

Rescales all of the weights on the various transforms so that they sum to 1.0.

It is generally a good idea to call this after adding or removing transforms from the blend.

◆ operator !=()

bool operator != ( const TransformBlend  other)

◆ operator<()

bool operator< ( const TransformBlend  other)

◆ operator=()

TransformBlend operator= ( const TransformBlend  copy)

◆ operator==()

bool operator== ( const TransformBlend  other)

◆ output()

output ( Ostream  out)

◆ removeTransform() [1/2]

removeTransform ( const VertexTransform  transform)

Removes the indicated transform from the blend.

◆ removeTransform() [2/2]

removeTransform ( int  n)

Removes the nth transform stored in the blend object.

◆ setTransform()

setTransform ( int  n,
const VertexTransform  transform 
)

Replaces the nth transform stored in the blend object.

◆ setWeight()

setWeight ( int  n,
float  weight 
)

Replaces the weight associated with the nth transform stored in the blend object.

◆ transformPoint() [1/4]

transformPoint ( LPoint3d  point,
Thread  current_thread 
)

Transforms the indicated point by the blend matrix.

You should call update_blend() to ensure that the cache is up-to-date before calling this.

◆ transformPoint() [2/4]

transformPoint ( LPoint3f  point,
Thread  current_thread 
)

◆ transformPoint() [3/4]

transformPoint ( LPoint4d  point,
Thread  current_thread 
)

Transforms the indicated point by the blend matrix.

You should call update_blend() to ensure that the cache is up-to-date before calling this.

◆ transformPoint() [4/4]

transformPoint ( LPoint4f  point,
Thread  current_thread 
)

◆ transformVector() [1/2]

transformVector ( LVector3d  point,
Thread  current_thread 
)

Transforms the indicated vector by the blend matrix.

You should call update_blend() to ensure that the cache is up-to-date before calling this.

◆ transformVector() [2/2]

transformVector ( LVector3f  point,
Thread  current_thread 
)

◆ updateBlend()

updateBlend ( Thread  current_thread)

Recomputes the internal representation of the blend value, if necessary.

You should call this before calling get_blend() or transform_point().

◆ write()

write ( Ostream  out,
int  indent_level 
)

Member Data Documentation

◆ modified

UpdateSeq modified

Returns a counter which is guaranteed to increment at least as often as the result of get_blend() changes.

◆ transforms

const VertexTransform transforms[]

◆ weights

float weights[]