mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:49:05 +02:00
Merge branch 'master' into feature/hand-controller-web-entity-integration
This commit is contained in:
commit
7b248b440a
13 changed files with 190 additions and 61 deletions
|
@ -91,6 +91,11 @@ void RenderableShapeEntityItem::render(RenderArgs* args) {
|
||||||
_procedural.reset(new Procedural(getUserData()));
|
_procedural.reset(new Procedural(getUserData()));
|
||||||
_procedural->_vertexSource = simple_vert;
|
_procedural->_vertexSource = simple_vert;
|
||||||
_procedural->_fragmentSource = simple_frag;
|
_procedural->_fragmentSource = simple_frag;
|
||||||
|
_procedural->_opaqueState->setCullMode(gpu::State::CULL_NONE);
|
||||||
|
_procedural->_opaqueState->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||||
|
_procedural->_opaqueState->setBlendFunction(false,
|
||||||
|
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||||
|
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::Batch& batch = *args->_batch;
|
gpu::Batch& batch = *args->_batch;
|
||||||
|
|
|
@ -325,6 +325,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_QUERY_AA_CUBE, queryAACube);
|
CHECK_PROPERTY_CHANGE(PROP_QUERY_AA_CUBE, queryAACube);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LOCAL_POSITION, localPosition);
|
CHECK_PROPERTY_CHANGE(PROP_LOCAL_POSITION, localPosition);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LOCAL_ROTATION, localRotation);
|
CHECK_PROPERTY_CHANGE(PROP_LOCAL_ROTATION, localRotation);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_LOCAL_VELOCITY, localVelocity);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity);
|
||||||
|
|
||||||
CHECK_PROPERTY_CHANGE(PROP_FLYING_ALLOWED, flyingAllowed);
|
CHECK_PROPERTY_CHANGE(PROP_FLYING_ALLOWED, flyingAllowed);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed);
|
CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed);
|
||||||
|
@ -570,6 +572,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
|
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ROTATION, localRotation);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ROTATION, localRotation);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_VELOCITY, localVelocity);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity);
|
||||||
|
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||||
|
@ -707,6 +711,8 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(localPosition, glmVec3, setLocalPosition);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(localPosition, glmVec3, setLocalPosition);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(localRotation, glmQuat, setLocalRotation);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(localRotation, glmQuat, setLocalRotation);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(localVelocity, glmVec3, setLocalVelocity);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(localAngularVelocity, glmVec3, setLocalAngularVelocity);
|
||||||
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations);
|
||||||
|
@ -864,6 +870,8 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
|
||||||
|
|
||||||
ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, LocalPosition, localPosition, glm::vec3);
|
ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, LocalPosition, localPosition, glm::vec3);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, glm::quat);
|
ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, glm::quat);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_LOCAL_VELOCITY, LocalVelocity, localVelocity, glm::vec3);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_LOCAL_ANGULAR_VELOCITY, LocalAngularVelocity, localAngularVelocity, glm::vec3);
|
||||||
|
|
||||||
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>);
|
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<glm::quat>);
|
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<glm::quat>);
|
||||||
|
@ -1982,7 +1990,9 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityItemProperties::parentDependentPropertyChanged() const {
|
bool EntityItemProperties::parentDependentPropertyChanged() const {
|
||||||
return localPositionChanged() || positionChanged() || localRotationChanged() || rotationChanged();
|
return localPositionChanged() || positionChanged() ||
|
||||||
|
localRotationChanged() || rotationChanged() ||
|
||||||
|
localVelocityChanged() || localAngularVelocityChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityItemProperties::parentRelatedPropertyChanged() const {
|
bool EntityItemProperties::parentRelatedPropertyChanged() const {
|
||||||
|
|
|
@ -201,6 +201,8 @@ public:
|
||||||
// these are used when bouncing location data into and out of scripts
|
// these are used when bouncing location data into and out of scripts
|
||||||
DEFINE_PROPERTY_REF(PROP_LOCAL_POSITION, LocalPosition, localPosition, glmVec3, ENTITY_ITEM_ZERO_VEC3);
|
DEFINE_PROPERTY_REF(PROP_LOCAL_POSITION, LocalPosition, localPosition, glmVec3, ENTITY_ITEM_ZERO_VEC3);
|
||||||
DEFINE_PROPERTY_REF(PROP_LOCAL_ROTATION, LocalRotation, localRotation, glmQuat, ENTITY_ITEM_DEFAULT_ROTATION);
|
DEFINE_PROPERTY_REF(PROP_LOCAL_ROTATION, LocalRotation, localRotation, glmQuat, ENTITY_ITEM_DEFAULT_ROTATION);
|
||||||
|
DEFINE_PROPERTY_REF(PROP_LOCAL_VELOCITY, LocalVelocity, localVelocity, glmVec3, ENTITY_ITEM_ZERO_VEC3);
|
||||||
|
DEFINE_PROPERTY_REF(PROP_LOCAL_ANGULAR_VELOCITY, LocalAngularVelocity, localAngularVelocity, glmVec3, ENTITY_ITEM_ZERO_VEC3);
|
||||||
|
|
||||||
DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>, QVector<bool>());
|
DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>, QVector<bool>());
|
||||||
DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<glm::quat>, QVector<glm::quat>());
|
DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<glm::quat>, QVector<glm::quat>());
|
||||||
|
|
|
@ -177,6 +177,9 @@ enum EntityPropertyList {
|
||||||
|
|
||||||
PROP_SHAPE,
|
PROP_SHAPE,
|
||||||
|
|
||||||
|
PROP_LOCAL_VELOCITY, // only used to convert values to and from scripts
|
||||||
|
PROP_LOCAL_ANGULAR_VELOCITY, // only used to convert values to and from scripts
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// ATTENTION: add new properties to end of list just ABOVE this line
|
// ATTENTION: add new properties to end of list just ABOVE this line
|
||||||
PROP_AFTER_LAST_ITEM,
|
PROP_AFTER_LAST_ITEM,
|
||||||
|
|
|
@ -78,6 +78,8 @@ EntityItemProperties convertLocationToScriptSemantics(const EntityItemProperties
|
||||||
EntityItemProperties scriptSideProperties = entitySideProperties;
|
EntityItemProperties scriptSideProperties = entitySideProperties;
|
||||||
scriptSideProperties.setLocalPosition(entitySideProperties.getPosition());
|
scriptSideProperties.setLocalPosition(entitySideProperties.getPosition());
|
||||||
scriptSideProperties.setLocalRotation(entitySideProperties.getRotation());
|
scriptSideProperties.setLocalRotation(entitySideProperties.getRotation());
|
||||||
|
scriptSideProperties.setLocalVelocity(entitySideProperties.getLocalVelocity());
|
||||||
|
scriptSideProperties.setLocalAngularVelocity(entitySideProperties.getLocalAngularVelocity());
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
glm::vec3 worldPosition = SpatiallyNestable::localToWorld(entitySideProperties.getPosition(),
|
glm::vec3 worldPosition = SpatiallyNestable::localToWorld(entitySideProperties.getPosition(),
|
||||||
|
@ -88,10 +90,19 @@ EntityItemProperties convertLocationToScriptSemantics(const EntityItemProperties
|
||||||
entitySideProperties.getParentID(),
|
entitySideProperties.getParentID(),
|
||||||
entitySideProperties.getParentJointIndex(),
|
entitySideProperties.getParentJointIndex(),
|
||||||
success);
|
success);
|
||||||
// TODO -- handle velocity and angularVelocity
|
glm::vec3 worldVelocity = SpatiallyNestable::localToWorldVelocity(entitySideProperties.getVelocity(),
|
||||||
|
entitySideProperties.getParentID(),
|
||||||
|
entitySideProperties.getParentJointIndex(),
|
||||||
|
success);
|
||||||
|
glm::vec3 worldAngularVelocity = SpatiallyNestable::localToWorldAngularVelocity(entitySideProperties.getAngularVelocity(),
|
||||||
|
entitySideProperties.getParentID(),
|
||||||
|
entitySideProperties.getParentJointIndex(),
|
||||||
|
success);
|
||||||
|
|
||||||
scriptSideProperties.setPosition(worldPosition);
|
scriptSideProperties.setPosition(worldPosition);
|
||||||
scriptSideProperties.setRotation(worldRotation);
|
scriptSideProperties.setRotation(worldRotation);
|
||||||
|
scriptSideProperties.setVelocity(worldVelocity);
|
||||||
|
scriptSideProperties.setAngularVelocity(worldAngularVelocity);
|
||||||
|
|
||||||
return scriptSideProperties;
|
return scriptSideProperties;
|
||||||
}
|
}
|
||||||
|
@ -125,6 +136,27 @@ EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperti
|
||||||
entitySideProperties.setRotation(localRotation);
|
entitySideProperties.setRotation(localRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scriptSideProperties.localVelocityChanged()) {
|
||||||
|
entitySideProperties.setVelocity(scriptSideProperties.getLocalVelocity());
|
||||||
|
} else if (scriptSideProperties.velocityChanged()) {
|
||||||
|
glm::vec3 localVelocity = SpatiallyNestable::worldToLocalVelocity(entitySideProperties.getVelocity(),
|
||||||
|
entitySideProperties.getParentID(),
|
||||||
|
entitySideProperties.getParentJointIndex(),
|
||||||
|
success);
|
||||||
|
entitySideProperties.setVelocity(localVelocity);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scriptSideProperties.localAngularVelocityChanged()) {
|
||||||
|
entitySideProperties.setAngularVelocity(scriptSideProperties.getLocalAngularVelocity());
|
||||||
|
} else if (scriptSideProperties.angularVelocityChanged()) {
|
||||||
|
glm::vec3 localAngularVelocity =
|
||||||
|
SpatiallyNestable::worldToLocalAngularVelocity(entitySideProperties.getAngularVelocity(),
|
||||||
|
entitySideProperties.getParentID(),
|
||||||
|
entitySideProperties.getParentJointIndex(),
|
||||||
|
success);
|
||||||
|
entitySideProperties.setAngularVelocity(localAngularVelocity);
|
||||||
|
}
|
||||||
|
|
||||||
return entitySideProperties;
|
return entitySideProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "FBXReader.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
|
@ -20,9 +24,8 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include "FBXReader.h"
|
|
||||||
|
|
||||||
#include <memory>
|
#include "ModelFormatLogging.h"
|
||||||
|
|
||||||
bool FBXMaterial::needTangentSpace() const {
|
bool FBXMaterial::needTangentSpace() const {
|
||||||
return !normalTexture.isNull();
|
return !normalTexture.isNull();
|
||||||
|
@ -258,11 +261,11 @@ void FBXReader::consolidateFBXMaterials(const QVariantHash& mapping) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << " fbx material Name:" << material.name;
|
qCDebug(modelformat) << " fbx material Name:" << material.name;
|
||||||
|
|
||||||
if (materialMap.contains(material.name)) {
|
if (materialMap.contains(material.name)) {
|
||||||
QJsonObject materialOptions = materialMap.value(material.name).toObject();
|
QJsonObject materialOptions = materialMap.value(material.name).toObject();
|
||||||
qDebug() << "Mapping fbx material:" << material.name << " with HifiMaterial: " << materialOptions;
|
qCDebug(modelformat) << "Mapping fbx material:" << material.name << " with HifiMaterial: " << materialOptions;
|
||||||
|
|
||||||
if (materialOptions.contains("scattering")) {
|
if (materialOptions.contains("scattering")) {
|
||||||
float scattering = (float) materialOptions.value("scattering").toDouble();
|
float scattering = (float) materialOptions.value("scattering").toDouble();
|
||||||
|
|
|
@ -224,6 +224,38 @@ glm::quat SpatiallyNestable::worldToLocal(const glm::quat& orientation,
|
||||||
return result.getRotation();
|
return result.getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 SpatiallyNestable::worldToLocalVelocity(const glm::vec3& velocity, const QUuid& parentID,
|
||||||
|
int parentJointIndex, bool& success) {
|
||||||
|
SpatiallyNestablePointer parent = SpatiallyNestable::findByID(parentID, success);
|
||||||
|
if (!success || !parent) {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
Transform parentTransform = parent->getTransform(success);
|
||||||
|
if (!success) {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
glm::vec3 parentVelocity = parent->getVelocity(success);
|
||||||
|
if (!success) {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 SpatiallyNestable::worldToLocalAngularVelocity(const glm::vec3& angularVelocity, const QUuid& parentID,
|
||||||
|
int parentJointIndex, bool& success) {
|
||||||
|
SpatiallyNestablePointer parent = SpatiallyNestable::findByID(parentID, success);
|
||||||
|
if (!success || !parent) {
|
||||||
|
return angularVelocity;
|
||||||
|
}
|
||||||
|
Transform parentTransform = parent->getTransform(success);
|
||||||
|
if (!success) {
|
||||||
|
return angularVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return glm::inverse(parentTransform.getRotation()) * angularVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 SpatiallyNestable::localToWorld(const glm::vec3& position,
|
glm::vec3 SpatiallyNestable::localToWorld(const glm::vec3& position,
|
||||||
const QUuid& parentID, int parentJointIndex,
|
const QUuid& parentID, int parentJointIndex,
|
||||||
bool& success) {
|
bool& success) {
|
||||||
|
@ -298,6 +330,38 @@ glm::quat SpatiallyNestable::localToWorld(const glm::quat& orientation,
|
||||||
return result.getRotation();
|
return result.getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 SpatiallyNestable::localToWorldVelocity(const glm::vec3& velocity, const QUuid& parentID,
|
||||||
|
int parentJointIndex, bool& success) {
|
||||||
|
SpatiallyNestablePointer parent = SpatiallyNestable::findByID(parentID, success);
|
||||||
|
if (!success || !parent) {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
Transform parentTransform = parent->getTransform(success);
|
||||||
|
if (!success) {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
glm::vec3 parentVelocity = parent->getVelocity(success);
|
||||||
|
if (!success) {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentVelocity + parentTransform.getRotation() * velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 SpatiallyNestable::localToWorldAngularVelocity(const glm::vec3& angularVelocity, const QUuid& parentID,
|
||||||
|
int parentJointIndex, bool& success) {
|
||||||
|
SpatiallyNestablePointer parent = SpatiallyNestable::findByID(parentID, success);
|
||||||
|
if (!success || !parent) {
|
||||||
|
return angularVelocity;
|
||||||
|
}
|
||||||
|
Transform parentTransform = parent->getTransform(success);
|
||||||
|
if (!success) {
|
||||||
|
return angularVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentTransform.getRotation() * angularVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 SpatiallyNestable::getPosition(bool& success) const {
|
glm::vec3 SpatiallyNestable::getPosition(bool& success) const {
|
||||||
return getTransform(success).getTranslation();
|
return getTransform(success).getTranslation();
|
||||||
}
|
}
|
||||||
|
@ -1004,3 +1068,15 @@ void SpatiallyNestable::setLocalTransformAndVelocities(
|
||||||
locationChanged(false);
|
locationChanged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpatiallyNestablePointer SpatiallyNestable::findByID(QUuid id, bool& success) {
|
||||||
|
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
||||||
|
if (!parentFinder) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
SpatiallyNestableWeakPointer parentWP = parentFinder->find(id, success);
|
||||||
|
if (!success) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return parentWP.lock();
|
||||||
|
}
|
||||||
|
|
|
@ -48,9 +48,17 @@ public:
|
||||||
|
|
||||||
static glm::vec3 worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex, bool& success);
|
static glm::vec3 worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex, bool& success);
|
||||||
static glm::quat worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex, bool& success);
|
static glm::quat worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex, bool& success);
|
||||||
|
static glm::vec3 worldToLocalVelocity(const glm::vec3& velocity, const QUuid& parentID,
|
||||||
|
int parentJointIndex, bool& success);
|
||||||
|
static glm::vec3 worldToLocalAngularVelocity(const glm::vec3& angularVelocity, const QUuid& parentID,
|
||||||
|
int parentJointIndex, bool& success);
|
||||||
|
|
||||||
static glm::vec3 localToWorld(const glm::vec3& position, const QUuid& parentID, int parentJointIndex, bool& success);
|
static glm::vec3 localToWorld(const glm::vec3& position, const QUuid& parentID, int parentJointIndex, bool& success);
|
||||||
static glm::quat localToWorld(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex, bool& success);
|
static glm::quat localToWorld(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex, bool& success);
|
||||||
|
static glm::vec3 localToWorldVelocity(const glm::vec3& velocity,
|
||||||
|
const QUuid& parentID, int parentJointIndex, bool& success);
|
||||||
|
static glm::vec3 localToWorldAngularVelocity(const glm::vec3& angularVelocity,
|
||||||
|
const QUuid& parentID, int parentJointIndex, bool& success);
|
||||||
|
|
||||||
// world frame
|
// world frame
|
||||||
virtual const Transform getTransform(bool& success, int depth = 0) const;
|
virtual const Transform getTransform(bool& success, int depth = 0) const;
|
||||||
|
@ -151,6 +159,8 @@ public:
|
||||||
virtual SpatialParentTree* getParentTree() const { return nullptr; }
|
virtual SpatialParentTree* getParentTree() const { return nullptr; }
|
||||||
|
|
||||||
bool hasAncestorOfType(NestableType nestableType);
|
bool hasAncestorOfType(NestableType nestableType);
|
||||||
|
SpatiallyNestablePointer getParentPointer(bool& success) const;
|
||||||
|
static SpatiallyNestablePointer findByID(QUuid id, bool& success);
|
||||||
|
|
||||||
void getLocalTransformAndVelocities(Transform& localTransform,
|
void getLocalTransformAndVelocities(Transform& localTransform,
|
||||||
glm::vec3& localVelocity,
|
glm::vec3& localVelocity,
|
||||||
|
@ -166,7 +176,6 @@ protected:
|
||||||
QUuid _id;
|
QUuid _id;
|
||||||
QUuid _parentID; // what is this thing's transform relative to?
|
QUuid _parentID; // what is this thing's transform relative to?
|
||||||
quint16 _parentJointIndex { 0 }; // which joint of the parent is this relative to?
|
quint16 _parentJointIndex { 0 }; // which joint of the parent is this relative to?
|
||||||
SpatiallyNestablePointer getParentPointer(bool& success) const;
|
|
||||||
|
|
||||||
mutable SpatiallyNestableWeakPointer _parent;
|
mutable SpatiallyNestableWeakPointer _parent;
|
||||||
|
|
||||||
|
|
|
@ -2418,28 +2418,13 @@ function MyController(hand) {
|
||||||
var props = Entities.getEntityProperties(entityID, ["parentID", "velocity", "dynamic", "shapeType"]);
|
var props = Entities.getEntityProperties(entityID, ["parentID", "velocity", "dynamic", "shapeType"]);
|
||||||
var parentID = props.parentID;
|
var parentID = props.parentID;
|
||||||
|
|
||||||
var doSetVelocity = false;
|
|
||||||
if (parentID != NULL_UUID && deactiveProps.parentID == NULL_UUID && propsArePhysical(props)) {
|
|
||||||
// TODO: EntityScriptingInterface::convertLocationToScriptSemantics should be setting up
|
|
||||||
// props.velocity to be a world-frame velocity and localVelocity to be vs parent. Until that
|
|
||||||
// is done, we use a measured velocity here so that things held via a bumper-grab / parenting-grab
|
|
||||||
// can be thrown.
|
|
||||||
doSetVelocity = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!noVelocity &&
|
if (!noVelocity &&
|
||||||
!doSetVelocity &&
|
|
||||||
parentID == MyAvatar.sessionUUID &&
|
parentID == MyAvatar.sessionUUID &&
|
||||||
Vec3.length(data["gravity"]) > 0.0 &&
|
Vec3.length(data["gravity"]) > 0.0 &&
|
||||||
data["dynamic"] &&
|
data["dynamic"] &&
|
||||||
data["parentID"] == NULL_UUID &&
|
data["parentID"] == NULL_UUID &&
|
||||||
!data["collisionless"]) {
|
!data["collisionless"]) {
|
||||||
deactiveProps["velocity"] = {
|
deactiveProps["velocity"] = this.currentVelocity;
|
||||||
x: 0.0,
|
|
||||||
y: 0.1,
|
|
||||||
z: 0.0
|
|
||||||
};
|
|
||||||
doSetVelocity = false;
|
|
||||||
}
|
}
|
||||||
if (noVelocity) {
|
if (noVelocity) {
|
||||||
deactiveProps["velocity"] = {
|
deactiveProps["velocity"] = {
|
||||||
|
@ -2452,21 +2437,9 @@ function MyController(hand) {
|
||||||
y: 0.0,
|
y: 0.0,
|
||||||
z: 0.0
|
z: 0.0
|
||||||
};
|
};
|
||||||
doSetVelocity = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Entities.editEntity(entityID, deactiveProps);
|
Entities.editEntity(entityID, deactiveProps);
|
||||||
|
|
||||||
if (doSetVelocity) {
|
|
||||||
// this is a continuation of the TODO above -- we shouldn't need to set this here.
|
|
||||||
// do this after the parent has been reset. setting this at the same time as
|
|
||||||
// the parent causes it to go off in the wrong direction. This is a bug that should
|
|
||||||
// be fixed.
|
|
||||||
Entities.editEntity(entityID, {
|
|
||||||
velocity: this.currentVelocity
|
|
||||||
// angularVelocity: this.currentAngularVelocity
|
|
||||||
});
|
|
||||||
}
|
|
||||||
data = null;
|
data = null;
|
||||||
} else if (this.shouldResetParentOnRelease) {
|
} else if (this.shouldResetParentOnRelease) {
|
||||||
// we parent-grabbed this from another parent grab. try to put it back where we found it.
|
// we parent-grabbed this from another parent grab. try to put it back where we found it.
|
||||||
|
|
|
@ -1128,37 +1128,40 @@ function handeMenuEvent(menuItem) {
|
||||||
}
|
}
|
||||||
tooltip.show(false);
|
tooltip.show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function tries to find a reasonable position to place a new entity based on the camera
|
|
||||||
// position. If a reasonable position within the world bounds can't be found, `null` will
|
|
||||||
// be returned. The returned position will also take into account grid snapping settings.
|
|
||||||
function getPositionToCreateEntity() {
|
function getPositionToCreateEntity() {
|
||||||
var distance = cameraManager.enabled ? cameraManager.zoomDistance : DEFAULT_ENTITY_DRAG_DROP_DISTANCE;
|
|
||||||
var direction = Quat.getFront(Camera.orientation);
|
|
||||||
var offset = Vec3.multiply(distance, direction);
|
|
||||||
var placementPosition = Vec3.sum(Camera.position, offset);
|
|
||||||
|
|
||||||
var cameraPosition = Camera.position;
|
|
||||||
|
|
||||||
var HALF_TREE_SCALE = 16384;
|
var HALF_TREE_SCALE = 16384;
|
||||||
|
var direction = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var distance = 1;
|
||||||
|
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, distance));
|
||||||
|
|
||||||
var cameraOutOfBounds = Math.abs(cameraPosition.x) > HALF_TREE_SCALE || Math.abs(cameraPosition.y) > HALF_TREE_SCALE ||
|
if (Camera.mode === "entity" || Camera.mode === "independent") {
|
||||||
Math.abs(cameraPosition.z) > HALF_TREE_SCALE;
|
position = Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), distance))
|
||||||
var placementOutOfBounds = Math.abs(placementPosition.x) > HALF_TREE_SCALE ||
|
|
||||||
Math.abs(placementPosition.y) > HALF_TREE_SCALE ||
|
|
||||||
Math.abs(placementPosition.z) > HALF_TREE_SCALE;
|
|
||||||
|
|
||||||
if (cameraOutOfBounds && placementOutOfBounds) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
position.y += 0.5;
|
||||||
placementPosition.x = Math.min(HALF_TREE_SCALE, Math.max(-HALF_TREE_SCALE, placementPosition.x));
|
if (position.x > HALF_TREE_SCALE || position.y > HALF_TREE_SCALE || position.z > HALF_TREE_SCALE) {
|
||||||
placementPosition.y = Math.min(HALF_TREE_SCALE, Math.max(-HALF_TREE_SCALE, placementPosition.y));
|
return null
|
||||||
placementPosition.z = Math.min(HALF_TREE_SCALE, Math.max(-HALF_TREE_SCALE, placementPosition.z));
|
}
|
||||||
|
return position;
|
||||||
return placementPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPositionToImportEntity() {
|
||||||
|
var dimensions = Clipboard.getContentsDimensions();
|
||||||
|
var HALF_TREE_SCALE = 16384;
|
||||||
|
var direction = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var longest = 1;
|
||||||
|
longest = Math.sqrt(Math.pow(dimensions.x, 2) + Math.pow(dimensions.z, 2));
|
||||||
|
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, longest));
|
||||||
|
|
||||||
|
if (Camera.mode === "entity" || Camera.mode === "independent") {
|
||||||
|
position = Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), longest))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position.x > HALF_TREE_SCALE || position.y > HALF_TREE_SCALE || position.z > HALF_TREE_SCALE) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
function importSVO(importURL) {
|
function importSVO(importURL) {
|
||||||
print("Import URL requested: " + importURL);
|
print("Import URL requested: " + importURL);
|
||||||
if (!Entities.canAdjustLocks()) {
|
if (!Entities.canAdjustLocks()) {
|
||||||
|
@ -1183,7 +1186,7 @@ function importSVO(importURL) {
|
||||||
z: 0
|
z: 0
|
||||||
};
|
};
|
||||||
if (Clipboard.getClipboardContentsLargestDimension() < VERY_LARGE) {
|
if (Clipboard.getClipboardContentsLargestDimension() < VERY_LARGE) {
|
||||||
position = getPositionToCreateEntity();
|
position = getPositionToImportEntity();
|
||||||
}
|
}
|
||||||
if (position !== null && position !== undefined) {
|
if (position !== null && position !== undefined) {
|
||||||
var pastedEntityIDs = Clipboard.pasteEntities(position);
|
var pastedEntityIDs = Clipboard.pasteEntities(position);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<body onload="ready()">
|
<body onload="ready()">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<input id="search-input" placeholder="filter" />
|
<input id="search-input" placeholder="filter" />
|
||||||
|
<button id="view-logs">Open Log Directory</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="tabs top">
|
<ul class="tabs top">
|
||||||
|
|
|
@ -43,6 +43,7 @@ ready = function() {
|
||||||
|
|
||||||
var domainServer = remote.getGlobal('domainServer');
|
var domainServer = remote.getGlobal('domainServer');
|
||||||
var acMonitor = remote.getGlobal('acMonitor');
|
var acMonitor = remote.getGlobal('acMonitor');
|
||||||
|
var openLogDirectory = remote.getGlobal('openLogDirectory');
|
||||||
|
|
||||||
var pendingLines = {
|
var pendingLines = {
|
||||||
'ds': new Array(),
|
'ds': new Array(),
|
||||||
|
@ -218,6 +219,12 @@ ready = function() {
|
||||||
appendLogMessages('ac');
|
appendLogMessages('ac');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Binding a remote function directly does not work, so bind to a function
|
||||||
|
// that calls the remote function.
|
||||||
|
$('#view-logs').on('click', function() {
|
||||||
|
openLogDirectory();
|
||||||
|
});
|
||||||
|
|
||||||
// handle filtering of table rows on input change
|
// handle filtering of table rows on input change
|
||||||
$('#search-input').on('input', function() {
|
$('#search-input').on('input', function() {
|
||||||
filter = $(this).val().toLowerCase();
|
filter = $(this).val().toLowerCase();
|
||||||
|
|
|
@ -285,6 +285,10 @@ function openFileBrowser(path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openLogDirectory() {
|
||||||
|
openFileBrowser(logPath);
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: this looks like it does nothing, but it's very important.
|
// NOTE: this looks like it does nothing, but it's very important.
|
||||||
// Without it the default behaviour is to quit the app once all windows closed
|
// Without it the default behaviour is to quit the app once all windows closed
|
||||||
// which is absolutely not what we want for a taskbar application.
|
// which is absolutely not what we want for a taskbar application.
|
||||||
|
@ -309,6 +313,7 @@ global.homeServer = null;
|
||||||
global.domainServer = null;
|
global.domainServer = null;
|
||||||
global.acMonitor = null;
|
global.acMonitor = null;
|
||||||
global.userConfig = userConfig;
|
global.userConfig = userConfig;
|
||||||
|
global.openLogDirectory = openLogDirectory;
|
||||||
|
|
||||||
var LogWindow = function(ac, ds) {
|
var LogWindow = function(ac, ds) {
|
||||||
this.ac = ac;
|
this.ac = ac;
|
||||||
|
|
Loading…
Reference in a new issue