mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
code review feedback
This commit is contained in:
parent
147d067c4e
commit
a14fa5dab9
4 changed files with 13 additions and 14 deletions
|
@ -734,21 +734,21 @@ void AnimInverseKinematics::initConstraints() {
|
|||
std::vector<glm::vec3> swungDirections;
|
||||
float deltaTheta = PI / 4.0f;
|
||||
float theta = 0.0f;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), -0.25f, sinf(theta)));
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), -0.25f, sinf(theta)));
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), 0.0f, sinf(theta)));
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), 0.0f, sinf(theta)));
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), 0.25f, sinf(theta))); // posterior
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), 0.25f, sinf(theta))); // posterior
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), 0.0f, sinf(theta)));
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), 0.0f, sinf(theta)));
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), -0.25f, sinf(theta)));
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), -0.25f, sinf(theta)));
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), -0.5f, sinf(theta)));
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), -0.5f, sinf(theta)));
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), -0.5f, sinf(theta))); // anterior
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), -0.5f, sinf(theta))); // anterior
|
||||
theta += deltaTheta;
|
||||
swungDirections.push_back(glm::vec3(cosf(theta), -0.5f, sinf(theta)));
|
||||
swungDirections.push_back(glm::vec3(mirror * cosf(theta), -0.5f, sinf(theta)));
|
||||
|
||||
std::vector<float> minDots;
|
||||
for (size_t i = 0; i < swungDirections.size(); i++) {
|
||||
|
|
|
@ -37,16 +37,15 @@ glm::quat averageQuats(size_t numQuats, const glm::quat* quats) {
|
|||
if (numQuats == 0) {
|
||||
return glm::quat();
|
||||
}
|
||||
float alpha = 1.0f / (float)numQuats;
|
||||
glm::quat accum(0, 0, 0, 0);
|
||||
glm::quat accum = quats[0];
|
||||
glm::quat firstRot = quats[0];
|
||||
for (size_t i = 0; i < numQuats; i++) {
|
||||
for (size_t i = 1; i < numQuats; i++) {
|
||||
glm::quat rot = quats[i];
|
||||
float dot = glm::dot(firstRot, rot);
|
||||
if (dot < 0.0f) {
|
||||
rot = -rot;
|
||||
}
|
||||
accum += alpha * rot;
|
||||
accum += rot;
|
||||
}
|
||||
return glm::normalize(accum);
|
||||
}
|
||||
|
|
|
@ -941,7 +941,7 @@ void Rig::updateAnimationStateHandlers() { // called on avatar update thread (wh
|
|||
}
|
||||
}
|
||||
|
||||
void Rig::updateAnimations(float deltaTime, glm::mat4 rootTransform, glm::mat4 rigToWorldTransform) {
|
||||
void Rig::updateAnimations(float deltaTime, const glm::mat4& rootTransform, const glm::mat4& rigToWorldTransform) {
|
||||
|
||||
PROFILE_RANGE_EX(simulation_animation_detail, __FUNCTION__, 0xffff00ff, 0);
|
||||
PerformanceTimer perfTimer("updateAnimations");
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
void computeMotionAnimationState(float deltaTime, const glm::vec3& worldPosition, const glm::vec3& worldVelocity, const glm::quat& worldRotation, CharacterControllerState ccState);
|
||||
|
||||
// Regardless of who started the animations or how many, update the joints.
|
||||
void updateAnimations(float deltaTime, glm::mat4 rootTransform, glm::mat4 rigToWorldTransform);
|
||||
void updateAnimations(float deltaTime, const glm::mat4& rootTransform, const glm::mat4& rigToWorldTransform);
|
||||
|
||||
// legacy
|
||||
void inverseKinematics(int endIndex, glm::vec3 targetPosition, const glm::quat& targetRotation, float priority,
|
||||
|
|
Loading…
Reference in a new issue