TransformBlend
-
class TransformBlend
This defines a single entry in a
TransformBlendTable
. It represents a unique combination ofVertexTransform
pointers and blend amounts.Inheritance diagram
-
TransformBlend(void)
-
TransformBlend(VertexTransform const *transform0, PN_stdfloat weight0)
-
TransformBlend(VertexTransform const *transform0, PN_stdfloat weight0, VertexTransform const *transform1, PN_stdfloat weight1)
-
TransformBlend(VertexTransform const *transform0, PN_stdfloat weight0, VertexTransform const *transform1, PN_stdfloat weight1, VertexTransform const *transform2, PN_stdfloat weight2)
-
TransformBlend(VertexTransform const *transform0, PN_stdfloat weight0, VertexTransform const *transform1, PN_stdfloat weight1, VertexTransform const *transform2, PN_stdfloat weight2, VertexTransform const *transform3, PN_stdfloat weight3)
-
TransformBlend(TransformBlend const ©)
-
void add_transform(VertexTransform const *transform, PN_stdfloat weight)
Adds a new transform to the blend. If the transform already existed, increases its weight factor.
-
int compare_to(TransformBlend const &other) const
Defines an arbitrary ordering for
TransformBlend
objects.
-
void get_blend(LMatrix4 &result, Thread *current_thread) const
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.
-
static TypeHandle get_class_type(void)
-
UpdateSeq get_modified(Thread *current_thread = Thread::get_current_thread()) const
Returns a counter which is guaranteed to increment at least as often as the result of
get_blend()
changes.
-
std::size_t get_num_transforms(void) const
Returns the number of transforms stored in the blend object.
-
VertexTransform const *get_transform(std::size_t n) const
Returns the nth transform stored in the blend object.
-
PN_stdfloat get_weight(VertexTransform const *transform) const
-
PN_stdfloat get_weight(std::size_t n) const
Returns the weight associated with the nth transform stored in the blend object.
Returns the weight associated with the indicated transform, or 0 if there is no entry for the transform.
-
bool has_transform(VertexTransform const *transform) const
Returns true if the blend has the indicated transform, false otherwise.
-
void limit_transforms(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.
-
void normalize_weights(void)
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.
-
void output(std::ostream &out) const
-
void remove_transform(VertexTransform const *transform)
-
void remove_transform(std::size_t n)
Removes the nth transform stored in the blend object.
Removes the indicated transform from the blend.
-
void set_transform(std::size_t n, VertexTransform const *transform)
Replaces the nth transform stored in the blend object.
-
void set_weight(std::size_t n, PN_stdfloat weight)
Replaces the weight associated with the nth transform stored in the blend object.
-
void transform_point(LPoint3d &point, Thread *current_thread) const
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.
-
void transform_vector(LVector3d &point, Thread *current_thread) const
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.
-
void update_blend(Thread *current_thread) const
Recomputes the internal representation of the blend value, if necessary. You should call this before calling
get_blend()
ortransform_point()
.
-
void write(std::ostream &out, int indent_level) const
-
TransformBlend(void)