mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:37:35 +02:00
merge from upstream
This commit is contained in:
commit
4179e4aa74
13 changed files with 133 additions and 44 deletions
|
@ -112,7 +112,11 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH})
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|
||||||
SET(OSX_SDK "10.9" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH")
|
exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE OSX_VERSION)
|
||||||
|
string(REGEX MATCH "^[0-9]+\\.[0-9]+" OSX_VERSION ${OSX_VERSION})
|
||||||
|
message(STATUS "Detected OS X version = ${OSX_VERSION}")
|
||||||
|
|
||||||
|
set(OSX_SDK "${OSX_VERSION}" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH")
|
||||||
|
|
||||||
# set our OS X deployment target
|
# set our OS X deployment target
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
|
||||||
|
@ -127,13 +131,14 @@ if (APPLE)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT _OSX_DESIRED_SDK_PATH)
|
if (NOT _OSX_DESIRED_SDK_PATH)
|
||||||
message(FATAL_ERROR "Could not find OS X ${OSX_SDK} SDK. Please pass OSX_SDK_PATH to CMake to point us to your SDKs directory.")
|
message(STATUS "Could not find OS X ${OSX_SDK} SDK. Will fall back to default. If you want a specific SDK, please pass OSX_SDK and optionally OSX_SDK_PATH to CMake.")
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "Found OS X ${OSX_SDK} SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk")
|
message(STATUS "Found OS X ${OSX_SDK} SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk")
|
||||||
endif ()
|
|
||||||
|
|
||||||
# set that as the SDK to use
|
# set that as the SDK to use
|
||||||
set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk)
|
set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk)
|
||||||
|
endif ()
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Hide automoc folders (for IDEs)
|
# Hide automoc folders (for IDEs)
|
||||||
|
|
7
cmake/externals/polyvox/CMakeLists.txt
vendored
7
cmake/externals/polyvox/CMakeLists.txt
vendored
|
@ -19,19 +19,20 @@ ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(INSTALL_NAME_LIBRARY_DIR ${INSTALL_DIR}/lib)
|
set(INSTALL_NAME_LIBRARY_DIR ${INSTALL_DIR}/lib)
|
||||||
message(STATUS "in polyvox INSTALL_NAME_LIBRARY_DIR ${INSTALL_NAME_LIBRARY_DIR}")
|
|
||||||
ExternalProject_Add_Step(
|
ExternalProject_Add_Step(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
change-install-name
|
change-install-name-debug
|
||||||
COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking"
|
COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking"
|
||||||
COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${INSTALL_NAME_LIBRARY_DIR}/Debug -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake
|
COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${INSTALL_NAME_LIBRARY_DIR}/Debug -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake
|
||||||
DEPENDEES install
|
DEPENDEES install
|
||||||
WORKING_DIRECTORY <SOURCE_DIR>
|
WORKING_DIRECTORY <SOURCE_DIR>
|
||||||
LOG 1
|
LOG 1
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Add_Step(
|
ExternalProject_Add_Step(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
change-install-name
|
change-install-name-release
|
||||||
COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking"
|
COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking"
|
||||||
COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${INSTALL_NAME_LIBRARY_DIR}/Release -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake
|
COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${INSTALL_NAME_LIBRARY_DIR}/Release -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake
|
||||||
DEPENDEES install
|
DEPENDEES install
|
||||||
|
|
|
@ -72,8 +72,9 @@ var STATE_NEAR_GRABBING_NON_COLLIDING = 5;
|
||||||
var STATE_CONTINUE_NEAR_GRABBING_NON_COLLIDING = 6;
|
var STATE_CONTINUE_NEAR_GRABBING_NON_COLLIDING = 6;
|
||||||
var STATE_RELEASE = 7;
|
var STATE_RELEASE = 7;
|
||||||
|
|
||||||
|
|
||||||
var GRAB_USER_DATA_KEY = "grabKey";
|
var GRAB_USER_DATA_KEY = "grabKey";
|
||||||
|
var GRABBABLE_DATA_KEY = "grabbableKey";
|
||||||
|
|
||||||
function MyController(hand, triggerAction) {
|
function MyController(hand, triggerAction) {
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
if (this.hand === RIGHT_HAND) {
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
@ -182,6 +183,11 @@ function MyController(hand, triggerAction) {
|
||||||
origin: handPosition,
|
origin: handPosition,
|
||||||
direction: Quat.getUp(this.getHandRotation())
|
direction: Quat.getUp(this.getHandRotation())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var defaultGrabbableData = {
|
||||||
|
grabbable: true
|
||||||
|
};
|
||||||
|
|
||||||
var intersection = Entities.findRayIntersection(pickRay, true);
|
var intersection = Entities.findRayIntersection(pickRay, true);
|
||||||
if (intersection.intersects &&
|
if (intersection.intersects &&
|
||||||
intersection.properties.collisionsWillMove === 1 &&
|
intersection.properties.collisionsWillMove === 1 &&
|
||||||
|
@ -190,9 +196,15 @@ function MyController(hand, triggerAction) {
|
||||||
var handControllerPosition = Controller.getSpatialControlPosition(this.palm);
|
var handControllerPosition = Controller.getSpatialControlPosition(this.palm);
|
||||||
var intersectionDistance = Vec3.distance(handControllerPosition, intersection.intersection);
|
var intersectionDistance = Vec3.distance(handControllerPosition, intersection.intersection);
|
||||||
this.grabbedEntity = intersection.entityID;
|
this.grabbedEntity = intersection.entityID;
|
||||||
|
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, defaultGrabbableData);
|
||||||
|
if (grabbableData.grabbable === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (intersectionDistance < NEAR_PICK_MAX_DISTANCE) {
|
if (intersectionDistance < NEAR_PICK_MAX_DISTANCE) {
|
||||||
// the hand is very close to the intersected object. go into close-grabbing mode.
|
// the hand is very close to the intersected object. go into close-grabbing mode.
|
||||||
this.state = STATE_NEAR_GRABBING;
|
this.state = STATE_NEAR_GRABBING;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// the hand is far from the intersected object. go into distance-holding mode
|
// the hand is far from the intersected object. go into distance-holding mode
|
||||||
this.state = STATE_DISTANCE_HOLDING;
|
this.state = STATE_DISTANCE_HOLDING;
|
||||||
|
@ -203,8 +215,16 @@ function MyController(hand, triggerAction) {
|
||||||
var nearbyEntities = Entities.findEntities(handPosition, GRAB_RADIUS);
|
var nearbyEntities = Entities.findEntities(handPosition, GRAB_RADIUS);
|
||||||
var minDistance = GRAB_RADIUS;
|
var minDistance = GRAB_RADIUS;
|
||||||
var i, props, distance;
|
var i, props, distance;
|
||||||
|
|
||||||
for (i = 0; i < nearbyEntities.length; i++) {
|
for (i = 0; i < nearbyEntities.length; i++) {
|
||||||
|
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, nearbyEntities[i], defaultGrabbableData);
|
||||||
|
if (grabbableData.grabbable === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
props = Entities.getEntityProperties(nearbyEntities[i], ["position", "name", "collisionsWillMove", "locked"]);
|
props = Entities.getEntityProperties(nearbyEntities[i], ["position", "name", "collisionsWillMove", "locked"]);
|
||||||
|
|
||||||
distance = Vec3.distance(props.position, handPosition);
|
distance = Vec3.distance(props.position, handPosition);
|
||||||
if (distance < minDistance && props.name !== "pointer") {
|
if (distance < minDistance && props.name !== "pointer") {
|
||||||
this.grabbedEntity = nearbyEntities[i];
|
this.grabbedEntity = nearbyEntities[i];
|
||||||
|
@ -383,7 +403,7 @@ function MyController(hand, triggerAction) {
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrabbingNonColliding");
|
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrabbingNonColliding");
|
||||||
};
|
};
|
||||||
|
|
||||||
_this.allTouchedIDs={};
|
_this.allTouchedIDs = {};
|
||||||
this.touchTest = function() {
|
this.touchTest = function() {
|
||||||
var maxDistance = 0.05;
|
var maxDistance = 0.05;
|
||||||
var leftHandPosition = MyAvatar.getLeftPalmPosition();
|
var leftHandPosition = MyAvatar.getLeftPalmPosition();
|
||||||
|
|
|
@ -90,4 +90,5 @@ function sendBatchToEndpoint(batch) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open("POST", ENDPOINT_URL, false);
|
req.open("POST", ENDPOINT_URL, false);
|
||||||
req.send(JSON.stringify(batch));
|
req.send(JSON.stringify(batch));
|
||||||
|
batch = [];
|
||||||
}
|
}
|
|
@ -246,6 +246,8 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
Hand* hand = _owningAvatar->getHand();
|
Hand* hand = _owningAvatar->getHand();
|
||||||
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
||||||
|
|
||||||
|
// Don't Relax toward hand positions when in animGraph mode.
|
||||||
|
if (!_rig->getEnableAnimGraph()) {
|
||||||
const float HAND_RESTORATION_RATE = 0.25f;
|
const float HAND_RESTORATION_RATE = 0.25f;
|
||||||
if (leftPalmIndex == -1 && rightPalmIndex == -1) {
|
if (leftPalmIndex == -1 && rightPalmIndex == -1) {
|
||||||
// palms are not yet set, use mouse
|
// palms are not yet set, use mouse
|
||||||
|
@ -275,6 +277,7 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonModel::renderIKConstraints(gpu::Batch& batch) {
|
void SkeletonModel::renderIKConstraints(gpu::Batch& batch) {
|
||||||
|
|
|
@ -46,6 +46,7 @@ Stats::Stats(QQuickItem* parent) : QQuickItem(parent) {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
_monospaceFont = font.family();
|
_monospaceFont = font.family();
|
||||||
|
_audioStats = &DependencyManager::get<AudioClient>()->getStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Stats::includeTimingRecord(const QString& name) {
|
bool Stats::includeTimingRecord(const QString& name) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <OffscreenQmlElement.h>
|
#include <OffscreenQmlElement.h>
|
||||||
#include <RenderArgs.h>
|
#include <RenderArgs.h>
|
||||||
#include <QVector3D>
|
#include <QVector3D>
|
||||||
|
#include <AudioIOStats.h>
|
||||||
|
|
||||||
#define STATS_PROPERTY(type, name, initialValue) \
|
#define STATS_PROPERTY(type, name, initialValue) \
|
||||||
Q_PROPERTY(type name READ name NOTIFY name##Changed) \
|
Q_PROPERTY(type name READ name NOTIFY name##Changed) \
|
||||||
|
@ -27,6 +28,8 @@ class Stats : public QQuickItem {
|
||||||
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged)
|
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged)
|
||||||
Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged)
|
Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged)
|
||||||
Q_PROPERTY(QString monospaceFont READ monospaceFont CONSTANT)
|
Q_PROPERTY(QString monospaceFont READ monospaceFont CONSTANT)
|
||||||
|
Q_PROPERTY(float audioPacketlossUpstream READ getAudioPacketLossUpstream)
|
||||||
|
Q_PROPERTY(float audioPacketlossDownstream READ getAudioPacketLossDownstream)
|
||||||
|
|
||||||
STATS_PROPERTY(int, serverCount, 0)
|
STATS_PROPERTY(int, serverCount, 0)
|
||||||
STATS_PROPERTY(int, framerate, 0)
|
STATS_PROPERTY(int, framerate, 0)
|
||||||
|
@ -81,6 +84,10 @@ public:
|
||||||
const QString& monospaceFont() {
|
const QString& monospaceFont() {
|
||||||
return _monospaceFont;
|
return _monospaceFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float getAudioPacketLossUpstream() { return _audioStats->getMixerAvatarStreamStats()._packetStreamStats.getLostRate(); }
|
||||||
|
float getAudioPacketLossDownstream() { return _audioStats->getMixerDownstreamStats()._packetStreamStats.getLostRate(); }
|
||||||
|
|
||||||
void updateStats(bool force = false);
|
void updateStats(bool force = false);
|
||||||
|
|
||||||
bool isExpanded() { return _expanded; }
|
bool isExpanded() { return _expanded; }
|
||||||
|
@ -149,6 +156,7 @@ private:
|
||||||
bool _expanded{ false };
|
bool _expanded{ false };
|
||||||
bool _timingExpanded{ false };
|
bool _timingExpanded{ false };
|
||||||
QString _monospaceFont;
|
QString _monospaceFont;
|
||||||
|
const AudioIOStats* _audioStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Stats_h
|
#endif // hifi_Stats_h
|
||||||
|
|
|
@ -173,6 +173,7 @@ void AnimSkeleton::dump() const {
|
||||||
qCDebug(animation) << "[";
|
qCDebug(animation) << "[";
|
||||||
for (int i = 0; i < getNumJoints(); i++) {
|
for (int i = 0; i < getNumJoints(); i++) {
|
||||||
qCDebug(animation) << " {";
|
qCDebug(animation) << " {";
|
||||||
|
qCDebug(animation) << " index =" << i;
|
||||||
qCDebug(animation) << " name =" << getJointName(i);
|
qCDebug(animation) << " name =" << getJointName(i);
|
||||||
qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i);
|
qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i);
|
||||||
qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i);
|
qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i);
|
||||||
|
@ -188,6 +189,7 @@ void AnimSkeleton::dump(const AnimPoseVec& poses) const {
|
||||||
qCDebug(animation) << "[";
|
qCDebug(animation) << "[";
|
||||||
for (int i = 0; i < getNumJoints(); i++) {
|
for (int i = 0; i < getNumJoints(); i++) {
|
||||||
qCDebug(animation) << " {";
|
qCDebug(animation) << " {";
|
||||||
|
qCDebug(animation) << " index =" << i;
|
||||||
qCDebug(animation) << " name =" << getJointName(i);
|
qCDebug(animation) << " name =" << getJointName(i);
|
||||||
qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i);
|
qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i);
|
||||||
qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i);
|
qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include "AnimationLogging.h"
|
||||||
|
|
||||||
class AnimVariant {
|
class AnimVariant {
|
||||||
public:
|
public:
|
||||||
|
@ -46,6 +47,7 @@ public:
|
||||||
bool isQuat() const { return _type == Type::Quat; }
|
bool isQuat() const { return _type == Type::Quat; }
|
||||||
bool isMat4() const { return _type == Type::Mat4; }
|
bool isMat4() const { return _type == Type::Mat4; }
|
||||||
bool isString() const { return _type == Type::String; }
|
bool isString() const { return _type == Type::String; }
|
||||||
|
Type getType() const { return _type; }
|
||||||
|
|
||||||
void setBool(bool value) { assert(_type == Type::Bool); _val.boolVal = value; }
|
void setBool(bool value) { assert(_type == Type::Bool); _val.boolVal = value; }
|
||||||
void setInt(int value) { assert(_type == Type::Int); _val.intVal = value; }
|
void setInt(int value) { assert(_type == Type::Int); _val.intVal = value; }
|
||||||
|
@ -156,6 +158,37 @@ public:
|
||||||
|
|
||||||
bool hasKey(const QString& key) const { return _map.find(key) != _map.end(); }
|
bool hasKey(const QString& key) const { return _map.find(key) != _map.end(); }
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
void dump() const {
|
||||||
|
qCDebug(animation) << "AnimVariantMap =";
|
||||||
|
for (auto& pair : _map) {
|
||||||
|
switch (pair.second.getType()) {
|
||||||
|
case AnimVariant::Type::Bool:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getBool();
|
||||||
|
break;
|
||||||
|
case AnimVariant::Type::Int:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getInt();
|
||||||
|
break;
|
||||||
|
case AnimVariant::Type::Float:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getFloat();
|
||||||
|
break;
|
||||||
|
case AnimVariant::Type::Vec3:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getVec3();
|
||||||
|
break;
|
||||||
|
case AnimVariant::Type::Quat:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getQuat();
|
||||||
|
break;
|
||||||
|
case AnimVariant::Type::Mat4:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getMat4();
|
||||||
|
break;
|
||||||
|
case AnimVariant::Type::String:
|
||||||
|
qCDebug(animation) << " " << pair.first << "=" << pair.second.getString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::map<QString, AnimVariant> _map;
|
std::map<QString, AnimVariant> _map;
|
||||||
std::set<QString> _triggers;
|
std::set<QString> _triggers;
|
||||||
|
|
|
@ -145,16 +145,20 @@ AnimationHandlePointer Rig::addAnimationByRole(const QString& role, const QStrin
|
||||||
}
|
}
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float FADE_FRAMES = 30.0f;
|
||||||
|
const float FRAMES_PER_SECOND = 30.0f;
|
||||||
|
|
||||||
void Rig::startAnimationByRole(const QString& role, const QString& url, float fps, float priority,
|
void Rig::startAnimationByRole(const QString& role, const QString& url, float fps, float priority,
|
||||||
bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) {
|
bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) {
|
||||||
AnimationHandlePointer handle = addAnimationByRole(role, url, fps, priority, loop, hold, firstFrame, lastFrame, maskedJoints, true);
|
AnimationHandlePointer handle = addAnimationByRole(role, url, fps, priority, loop, hold, firstFrame, lastFrame, maskedJoints, true);
|
||||||
handle->setFadePerSecond(1.0f); // For now. Could be individualized later.
|
handle->setFadePerSecond(FRAMES_PER_SECOND / FADE_FRAMES); // For now. Could be individualized later.
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rig::stopAnimationByRole(const QString& role) {
|
void Rig::stopAnimationByRole(const QString& role) {
|
||||||
foreach (const AnimationHandlePointer& handle, getRunningAnimations()) {
|
foreach (const AnimationHandlePointer& handle, getRunningAnimations()) {
|
||||||
if (handle->getRole() == role) {
|
if (handle->getRole() == role) {
|
||||||
handle->setFadePerSecond(-1.0f); // For now. Could be individualized later.
|
handle->setFadePerSecond(-(FRAMES_PER_SECOND / FADE_FRAMES)); // For now. Could be individualized later.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +167,7 @@ void Rig::stopAnimation(const QString& url) {
|
||||||
foreach (const AnimationHandlePointer& handle, getRunningAnimations()) {
|
foreach (const AnimationHandlePointer& handle, getRunningAnimations()) {
|
||||||
if (handle->getURL() == url) {
|
if (handle->getURL() == url) {
|
||||||
handle->setFade(0.0f); // right away. Will be remove during updateAnimations, without locking
|
handle->setFade(0.0f); // right away. Will be remove during updateAnimations, without locking
|
||||||
handle->setFadePerSecond(-1.0f); // so that the updateAnimation code notices
|
handle->setFadePerSecond(-(FRAMES_PER_SECOND / FADE_FRAMES)); // so that the updateAnimation code notices
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,13 +617,13 @@ void Rig::updateAnimations(float deltaTime, glm::mat4 rootTransform) {
|
||||||
_animVars.setTrigger(trigger);
|
_animVars.setTrigger(trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearJointStatePriorities();
|
||||||
|
|
||||||
// copy poses into jointStates
|
// copy poses into jointStates
|
||||||
const float PRIORITY = 1.0f;
|
const float PRIORITY = 1.0f;
|
||||||
for (size_t i = 0; i < poses.size(); i++) {
|
for (size_t i = 0; i < poses.size(); i++) {
|
||||||
setJointRotationInConstrainedFrame((int)i,
|
setJointRotationInConstrainedFrame((int)i, glm::inverse(_animSkeleton->getRelativeBindPose(i).rot) * poses[i].rot,
|
||||||
glm::inverse(_animSkeleton->getRelativeBindPose(i).rot) * poses[i].rot,
|
PRIORITY, false, 1.0f);
|
||||||
PRIORITY,
|
|
||||||
false);
|
|
||||||
|
|
||||||
JointState& state = _jointStates[i];
|
JointState& state = _jointStates[i];
|
||||||
setJointTranslation((int)i, true, poses[i].trans, PRIORITY);
|
setJointTranslation((int)i, true, poses[i].trans, PRIORITY);
|
||||||
|
@ -959,6 +963,12 @@ void Rig::updateVisibleJointStates() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Rig::clearJointStatePriorities() {
|
||||||
|
for (int i = 0; i < _jointStates.size(); i++) {
|
||||||
|
_jointStates[i].setAnimationPriority(0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Rig::setJointVisibleTransform(int jointIndex, glm::mat4 newTransform) {
|
void Rig::setJointVisibleTransform(int jointIndex, glm::mat4 newTransform) {
|
||||||
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
||||||
return;
|
return;
|
||||||
|
@ -983,6 +993,8 @@ glm::quat Rig::getJointDefaultRotationInParentFrame(int jointIndex) {
|
||||||
void Rig::updateFromHeadParameters(const HeadParameters& params, float dt) {
|
void Rig::updateFromHeadParameters(const HeadParameters& params, float dt) {
|
||||||
if (params.enableLean) {
|
if (params.enableLean) {
|
||||||
updateLeanJoint(params.leanJointIndex, params.leanSideways, params.leanForward, params.torsoTwist);
|
updateLeanJoint(params.leanJointIndex, params.leanSideways, params.leanForward, params.torsoTwist);
|
||||||
|
} else {
|
||||||
|
_animVars.unset("lean");
|
||||||
}
|
}
|
||||||
updateNeckJoint(params.neckJointIndex, params);
|
updateNeckJoint(params.neckJointIndex, params);
|
||||||
updateEyeJoints(params.leftEyeJointIndex, params.rightEyeJointIndex, params.modelTranslation, params.modelRotation,
|
updateEyeJoints(params.leftEyeJointIndex, params.rightEyeJointIndex, params.modelTranslation, params.modelRotation,
|
||||||
|
|
|
@ -180,6 +180,7 @@ public:
|
||||||
bool getJointRotationInConstrainedFrame(int jointIndex, glm::quat& rotOut) const;
|
bool getJointRotationInConstrainedFrame(int jointIndex, glm::quat& rotOut) const;
|
||||||
glm::quat getJointDefaultRotationInParentFrame(int jointIndex);
|
glm::quat getJointDefaultRotationInParentFrame(int jointIndex);
|
||||||
void updateVisibleJointStates();
|
void updateVisibleJointStates();
|
||||||
|
void clearJointStatePriorities();
|
||||||
|
|
||||||
virtual void updateJointState(int index, glm::mat4 rootTransform) = 0;
|
virtual void updateJointState(int index, glm::mat4 rootTransform) = 0;
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,8 @@ void GLBackend::resetStages() {
|
||||||
#define DO_IT_NOW(call, offset)
|
#define DO_IT_NOW(call, offset)
|
||||||
|
|
||||||
void Batch::_glActiveBindTexture(GLenum unit, GLenum target, GLuint texture) {
|
void Batch::_glActiveBindTexture(GLenum unit, GLenum target, GLuint texture) {
|
||||||
|
setResourceTexture(unit - GL_TEXTURE0, nullptr);
|
||||||
|
|
||||||
ADD_COMMAND_GL(glActiveBindTexture);
|
ADD_COMMAND_GL(glActiveBindTexture);
|
||||||
|
|
||||||
_params.push_back(texture);
|
_params.push_back(texture);
|
||||||
|
|
Loading…
Reference in a new issue