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

View file

@ -415,10 +415,25 @@
"states": [ "states": [
{ {
"id": "idle", "id": "idle",
"interpTarget": 15, "interpTarget": 10,
"interpDuration": 15, "interpDuration": 10,
"transitions": [ "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": "isMovingBackward", "state": "walkBwd" },
{ "var": "isMovingRight", "state": "strafeRight" }, { "var": "isMovingRight", "state": "strafeRight" },
{ "var": "isMovingLeft", "state": "strafeLeft" }, { "var": "isMovingLeft", "state": "strafeLeft" },
@ -429,7 +444,7 @@
}, },
{ {
"id": "walkFwd", "id": "walkFwd",
"interpTarget": 6, "interpTarget": 15,
"interpDuration": 6, "interpDuration": 6,
"transitions": [ "transitions": [
{ "var": "isNotMoving", "state": "idle" }, { "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", "id": "walkBwd",
"type": "blendLinearMove", "type": "blendLinearMove",

View file

@ -122,5 +122,5 @@ void AnimBlendLinearMove::setCurrentFrameInternal(float frame) {
auto clipNode = std::dynamic_pointer_cast<AnimClip>(_children.front()); auto clipNode = std::dynamic_pointer_cast<AnimClip>(_children.front());
assert(clipNode); assert(clipNode);
const float NUM_FRAMES = (clipNode->getEndFrame() - clipNode->getStartFrame()) + 1.0f; 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 #ifndef NDEBUG
#define DUMP_FBX_JOINTS
void AnimSkeleton::dump() const { void AnimSkeleton::dump() const {
qCDebug(animation) << "["; qCDebug(animation) << "[";
for (int i = 0; i < getNumJoints(); i++) { for (int i = 0; i < getNumJoints(); i++) {
@ -151,21 +152,22 @@ void AnimSkeleton::dump() const {
qCDebug(animation) << " absDefaultPose =" << getAbsoluteDefaultPose(i); qCDebug(animation) << " absDefaultPose =" << getAbsoluteDefaultPose(i);
qCDebug(animation) << " relDefaultPose =" << getRelativeDefaultPose(i); qCDebug(animation) << " relDefaultPose =" << getRelativeDefaultPose(i);
#ifdef DUMP_FBX_JOINTS #ifdef DUMP_FBX_JOINTS
qCDebug(animation) << " isFree =" << _joints[i].isFree; qCDebug(animation) << " fbxJoint =";
qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage; qCDebug(animation) << " isFree =" << _joints[i].isFree;
qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex; qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage;
qCDebug(animation) << " translation =" << _joints[i].translation; qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex;
qCDebug(animation) << " preTransform =" << _joints[i].preTransform; qCDebug(animation) << " translation =" << _joints[i].translation;
qCDebug(animation) << " preRotation =" << _joints[i].preRotation; qCDebug(animation) << " preTransform =" << _joints[i].preTransform;
qCDebug(animation) << " rotation =" << _joints[i].rotation; qCDebug(animation) << " preRotation =" << _joints[i].preRotation;
qCDebug(animation) << " postRotation =" << _joints[i].postRotation; qCDebug(animation) << " rotation =" << _joints[i].rotation;
qCDebug(animation) << " postTransform =" << _joints[i].postTransform; qCDebug(animation) << " postRotation =" << _joints[i].postRotation;
qCDebug(animation) << " transform =" << _joints[i].transform; qCDebug(animation) << " postTransform =" << _joints[i].postTransform;
qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax; qCDebug(animation) << " transform =" << _joints[i].transform;
qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation; qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax;
qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation; qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation;
qCDebug(animation) << " bindTransform" << _joints[i].bindTransform; qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation;
qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint; qCDebug(animation) << " bindTransform" << _joints[i].bindTransform;
qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint;
#endif #endif
if (getParentIndex(i) >= 0) { if (getParentIndex(i) >= 0) {
qCDebug(animation) << " parent =" << getJointName(getParentIndex(i)); 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); varColor = interpolate3Vec4(particle.color.start, particle.color.middle, particle.color.finish, age);
// anchor point in eye space // 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 quadPos = radius * UNIT_QUAD[twoTriID];
vec4 anchorPoint; vec4 anchorPoint;

View file

@ -13,6 +13,7 @@
#include <ByteCountCoding.h> #include <ByteCountCoding.h>
#include <GLMHelpers.h> #include <GLMHelpers.h>
#include <glm/gtx/transform.hpp>
#include "EntitiesLogging.h" #include "EntitiesLogging.h"
#include "EntityItemProperties.h" #include "EntityItemProperties.h"
@ -243,13 +244,22 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame,
_lastKnownFrameDataRotations.resize(_jointMapping.size()); _lastKnownFrameDataRotations.resize(_jointMapping.size());
_lastKnownFrameDataTranslations.resize(_jointMapping.size()); _lastKnownFrameDataTranslations.resize(_jointMapping.size());
for (int j = 0; j < _jointMapping.size(); j++) { for (int j = 0; j < _jointMapping.size(); j++) {
int index = _jointMapping[j]; int index = _jointMapping[j];
if (index != -1 && index < rotations.size()) { if (index >= 0) {
_lastKnownFrameDataRotations[j] = fbxJoints[index].preRotation * rotations[index]; glm::mat4 translationMat;
} if (index < translations.size()) {
if (index != -1 && index < translations.size()) { translationMat = glm::translate(translations[index]);
_lastKnownFrameDataTranslations[j] = 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); samples.first.addSample(velocity);
velocity = samples.first.average; 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 axis = glm::axis(deltaRot);
auto speed = glm::angle(deltaRot) / deltaTime; auto speed = glm::angle(deltaRot) / deltaTime;
assert(!glm::isnan(speed));
angularVelocity = speed * axis; angularVelocity = speed * axis;
samples.second.addSample(angularVelocity); samples.second.addSample(angularVelocity);
angularVelocity = samples.second.average; angularVelocity = samples.second.average;