feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -367,7 +367,7 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
|
|||
Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
|
||||
_update_triangles();
|
||||
|
||||
if (triangles.size() == 0) {
|
||||
if (triangles.is_empty()) {
|
||||
return Vector2();
|
||||
}
|
||||
|
||||
|
|
@ -385,11 +385,9 @@ Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
|
|||
}
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Vector2 s[2] = {
|
||||
points[j],
|
||||
points[(j + 1) % 3]
|
||||
};
|
||||
Vector2 closest_point = Geometry2D::get_closest_point_to_segment(p_point, s);
|
||||
const Vector2 segment_a = points[j];
|
||||
const Vector2 segment_b = points[(j + 1) % 3];
|
||||
Vector2 closest_point = Geometry2D::get_closest_point_to_segment(p_point, segment_a, segment_b);
|
||||
if (first || closest_point.distance_to(p_point) < best_point.distance_to(p_point)) {
|
||||
best_point = closest_point;
|
||||
first = false;
|
||||
|
|
@ -481,22 +479,20 @@ AnimationNode::NodeTimeInfo AnimationNodeBlendSpace2D::_process(const AnimationM
|
|||
}
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Vector2 s[2] = {
|
||||
points[j],
|
||||
points[(j + 1) % 3]
|
||||
};
|
||||
Vector2 closest2 = Geometry2D::get_closest_point_to_segment(blend_pos, s);
|
||||
const Vector2 segment_a = points[j];
|
||||
const Vector2 segment_b = points[(j + 1) % 3];
|
||||
Vector2 closest2 = Geometry2D::get_closest_point_to_segment(blend_pos, segment_a, segment_b);
|
||||
if (first || closest2.distance_to(blend_pos) < best_point.distance_to(blend_pos)) {
|
||||
best_point = closest2;
|
||||
blend_triangle = i;
|
||||
first = false;
|
||||
float d = s[0].distance_to(s[1]);
|
||||
const real_t d = segment_a.distance_to(segment_b);
|
||||
if (d == 0.0) {
|
||||
blend_weights[j] = 1.0;
|
||||
blend_weights[(j + 1) % 3] = 0.0;
|
||||
blend_weights[(j + 2) % 3] = 0.0;
|
||||
} else {
|
||||
float c = s[0].distance_to(closest2) / d;
|
||||
const real_t c = segment_a.distance_to(closest2) / d;
|
||||
|
||||
blend_weights[j] = 1.0 - c;
|
||||
blend_weights[(j + 1) % 3] = c;
|
||||
|
|
@ -557,7 +553,13 @@ AnimationNode::NodeTimeInfo AnimationNodeBlendSpace2D::_process(const AnimationM
|
|||
Ref<AnimationNodeAnimation> na_c = static_cast<Ref<AnimationNodeAnimation>>(blend_points[cur_closest].node);
|
||||
Ref<AnimationNodeAnimation> na_n = static_cast<Ref<AnimationNodeAnimation>>(blend_points[new_closest].node);
|
||||
if (na_c.is_valid() && na_n.is_valid()) {
|
||||
na_n->process_state = process_state;
|
||||
na_c->process_state = process_state;
|
||||
|
||||
na_n->set_backward(na_c->is_backward());
|
||||
|
||||
na_n = nullptr;
|
||||
na_c = nullptr;
|
||||
}
|
||||
// See how much animation remains.
|
||||
pi.seeked = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue