Merge branch 'master' of https://github.com/highfidelity/hifi into rightClickMenu

This commit is contained in:
Brad Hefta-Gaub 2015-12-18 14:30:16 -08:00
commit 42764426ce
7 changed files with 72 additions and 31 deletions

View file

@ -60,7 +60,7 @@
});
break;
case 3:
print("Radius spread");
print("Radius spread - temporarily not working");
Entities.editEntity(particles, {
accelerationSpread: { x: 0.0, y: 0.0, z: 0.0 },
radiusSpread: 0.035
@ -71,6 +71,7 @@
Entities.editEntity(particles, {
radiusSpread: 0.0,
radiusStart: 0.0,
particleRadius: 2 * PARTICLE_RADIUS, // Bezier interpolation used means that middle value isn't intersected
radiusFinish: 0.0
});
break;
@ -78,12 +79,13 @@
print("Alpha 0.5");
Entities.editEntity(particles, {
radiusStart: PARTICLE_RADIUS,
particleRadius: PARTICLE_RADIUS,
radiusFinish: PARTICLE_RADIUS,
alpha: 0.5
});
break;
case 6:
print("Alpha spread");
print("Alpha spread - temporarily not working");
Entities.editEntity(particles, {
alpha: 0.5,
alphaSpread: 0.5
@ -99,7 +101,7 @@
});
break;
case 8:
print("Color spread");
print("Color spread - temporarily not working");
Entities.editEntity(particles, {
alpha: 1.0,
alphaStart: 1.0,
@ -255,7 +257,6 @@
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
color: { red: 255, green: 255, blue: 255 },
lifespan: 5.0,
visible: false,
locked: false,
isEmitting: false,
lifetime: 3600 // 1 hour; just in case

View file

@ -415,10 +415,25 @@
"states": [
{
"id": "idle",
"interpTarget": 15,
"interpDuration": 15,
"interpTarget": 10,
"interpDuration": 10,
"transitions": [
{ "var": "isMovingForward", "state": "walkFwd" },
{ "var": "isMovingForward", "state": "idleToWalkFwd" },
{ "var": "isMovingBackward", "state": "walkBwd" },
{ "var": "isMovingRight", "state": "strafeRight" },
{ "var": "isMovingLeft", "state": "strafeLeft" },
{ "var": "isTurningRight", "state": "turnRight" },
{ "var": "isTurningLeft", "state": "turnLeft" },
{ "var": "isAway", "state": "awayIntro" }
]
},
{
"id": "idleToWalkFwd",
"interpTarget": 3,
"interpDuration": 3,
"transitions": [
{ "var": "idleToWalkFwdOnDone", "state": "walkFwd" },
{ "var": "isNotMoving", "state": "idle" },
{ "var": "isMovingBackward", "state": "walkBwd" },
{ "var": "isMovingRight", "state": "strafeRight" },
{ "var": "isMovingLeft", "state": "strafeLeft" },
@ -429,7 +444,7 @@
},
{
"id": "walkFwd",
"interpTarget": 6,
"interpTarget": 15,
"interpDuration": 6,
"transitions": [
{ "var": "isNotMoving", "state": "idle" },
@ -638,6 +653,18 @@
}
]
},
{
"id": "idleToWalkFwd",
"type": "clip",
"data": {
"url": "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims/idle_to_walk.fbx",
"startFrame": 1.0,
"endFrame": 19.0,
"timeScale": 1.0,
"loopFlag": false
},
"children": []
},
{
"id": "walkBwd",
"type": "blendLinearMove",

View file

@ -122,5 +122,5 @@ void AnimBlendLinearMove::setCurrentFrameInternal(float frame) {
auto clipNode = std::dynamic_pointer_cast<AnimClip>(_children.front());
assert(clipNode);
const float NUM_FRAMES = (clipNode->getEndFrame() - clipNode->getStartFrame()) + 1.0f;
_phase = fmodf(frame, NUM_FRAMES);
_phase = fmodf(frame / NUM_FRAMES, 1.0f);
}

View file

@ -140,6 +140,7 @@ void AnimSkeleton::buildSkeletonFromJoints(const std::vector<FBXJoint>& joints)
}
#ifndef NDEBUG
#define DUMP_FBX_JOINTS
void AnimSkeleton::dump() const {
qCDebug(animation) << "[";
for (int i = 0; i < getNumJoints(); i++) {
@ -151,21 +152,22 @@ void AnimSkeleton::dump() const {
qCDebug(animation) << " absDefaultPose =" << getAbsoluteDefaultPose(i);
qCDebug(animation) << " relDefaultPose =" << getRelativeDefaultPose(i);
#ifdef DUMP_FBX_JOINTS
qCDebug(animation) << " isFree =" << _joints[i].isFree;
qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage;
qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex;
qCDebug(animation) << " translation =" << _joints[i].translation;
qCDebug(animation) << " preTransform =" << _joints[i].preTransform;
qCDebug(animation) << " preRotation =" << _joints[i].preRotation;
qCDebug(animation) << " rotation =" << _joints[i].rotation;
qCDebug(animation) << " postRotation =" << _joints[i].postRotation;
qCDebug(animation) << " postTransform =" << _joints[i].postTransform;
qCDebug(animation) << " transform =" << _joints[i].transform;
qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax;
qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation;
qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation;
qCDebug(animation) << " bindTransform" << _joints[i].bindTransform;
qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint;
qCDebug(animation) << " fbxJoint =";
qCDebug(animation) << " isFree =" << _joints[i].isFree;
qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage;
qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex;
qCDebug(animation) << " translation =" << _joints[i].translation;
qCDebug(animation) << " preTransform =" << _joints[i].preTransform;
qCDebug(animation) << " preRotation =" << _joints[i].preRotation;
qCDebug(animation) << " rotation =" << _joints[i].rotation;
qCDebug(animation) << " postRotation =" << _joints[i].postRotation;
qCDebug(animation) << " postTransform =" << _joints[i].postTransform;
qCDebug(animation) << " transform =" << _joints[i].transform;
qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax;
qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation;
qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation;
qCDebug(animation) << " bindTransform" << _joints[i].bindTransform;
qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint;
#endif
if (getParentIndex(i) >= 0) {
qCDebug(animation) << " parent =" << getJointName(getParentIndex(i));

View file

@ -82,7 +82,7 @@ void main(void) {
varColor = interpolate3Vec4(particle.color.start, particle.color.middle, particle.color.finish, age);
// anchor point in eye space
float radius = bezierInterpolate(particle.radius.start, particle.radius.middle, particle.radius.finish , age);
float radius = bezierInterpolate(particle.radius.start, particle.radius.middle, particle.radius.finish, age);
vec4 quadPos = radius * UNIT_QUAD[twoTriID];
vec4 anchorPoint;

View file

@ -13,6 +13,7 @@
#include <ByteCountCoding.h>
#include <GLMHelpers.h>
#include <glm/gtx/transform.hpp>
#include "EntitiesLogging.h"
#include "EntityItemProperties.h"
@ -243,13 +244,22 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame,
_lastKnownFrameDataRotations.resize(_jointMapping.size());
_lastKnownFrameDataTranslations.resize(_jointMapping.size());
for (int j = 0; j < _jointMapping.size(); j++) {
int index = _jointMapping[j];
if (index != -1 && index < rotations.size()) {
_lastKnownFrameDataRotations[j] = fbxJoints[index].preRotation * rotations[index];
}
if (index != -1 && index < translations.size()) {
_lastKnownFrameDataTranslations[j] = translations[index];
if (index >= 0) {
glm::mat4 translationMat;
if (index < translations.size()) {
translationMat = glm::translate(translations[index]);
}
glm::mat4 rotationMat;
if (index < rotations.size()) {
rotationMat = glm::mat4_cast(rotations[index]);
}
glm::mat4 finalMat = (translationMat * fbxJoints[index].preTransform *
rotationMat * fbxJoints[index].postTransform);
_lastKnownFrameDataTranslations[j] = extractTranslation(finalMat);
_lastKnownFrameDataRotations[j] = glmExtractRotation(finalMat);
}
}
}

View file

@ -466,9 +466,10 @@ void SixenseManager::InputDevice::handlePoseEvent(float deltaTime, glm::vec3 pos
samples.first.addSample(velocity);
velocity = samples.first.average;
auto deltaRot = rotation * glm::conjugate(prevPose.getRotation());
auto deltaRot = glm::normalize(rotation * glm::conjugate(prevPose.getRotation()));
auto axis = glm::axis(deltaRot);
auto speed = glm::angle(deltaRot) / deltaTime;
assert(!glm::isnan(speed));
angularVelocity = speed * axis;
samples.second.addSample(angularVelocity);
angularVelocity = samples.second.average;