mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-14 13:36:02 +02:00
Merge remote-tracking branch 'upstream/master' into nametag
This commit is contained in:
commit
b2e0067c08
16 changed files with 100 additions and 42 deletions
|
@ -27,8 +27,9 @@ QString Audio::HMD { "VR" };
|
|||
Setting::Handle<bool> enableNoiseReductionSetting { QStringList { Audio::AUDIO, "NoiseReduction" }, true };
|
||||
|
||||
float Audio::loudnessToLevel(float loudness) {
|
||||
float level = 6.02059991f * fastLog2f(loudness); // level in dBFS
|
||||
level = (level + 48.0f) * (1/39.0f); // map [-48, -9] dBFS to [0, 1]
|
||||
float level = loudness * (1/32768.0f); // level in [0, 1]
|
||||
level = 6.02059991f * fastLog2f(level); // convert to dBFS
|
||||
level = (level + 48.0f) * (1/42.0f); // map [-48, -6] dBFS to [0, 1]
|
||||
return glm::clamp(level, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,11 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
|
|||
RENAME_PROP(start, position);
|
||||
}
|
||||
RENAME_PROP(point, position);
|
||||
RENAME_PROP(scale, dimensions);
|
||||
if (type != "Model") {
|
||||
RENAME_PROP(scale, dimensions);
|
||||
} else {
|
||||
RENAME_PROP(scale, modelScale);
|
||||
}
|
||||
RENAME_PROP(size, dimensions);
|
||||
RENAME_PROP(orientation, rotation);
|
||||
RENAME_PROP(localOrientation, localRotation);
|
||||
|
@ -644,7 +648,11 @@ QVariantMap Overlays::convertEntityToOverlayProperties(const EntityItemPropertie
|
|||
RENAME_PROP(position, start);
|
||||
}
|
||||
RENAME_PROP(position, point);
|
||||
RENAME_PROP(dimensions, scale);
|
||||
if (type != "Model") {
|
||||
RENAME_PROP(dimensions, scale);
|
||||
} else {
|
||||
RENAME_PROP(modelScale, scale);
|
||||
}
|
||||
RENAME_PROP(dimensions, size);
|
||||
RENAME_PROP(ignorePickIntersection, ignoreRayIntersection);
|
||||
|
||||
|
@ -1726,7 +1734,8 @@ QVector<QUuid> Overlays::findOverlays(const glm::vec3& center, float radius) {
|
|||
*
|
||||
* @property {Vec3} position - The position of the overlay center. Synonyms: <code>p1</code>, <code>point</code>, and
|
||||
* <code>start</code>.
|
||||
* @property {Vec3} dimensions - The dimensions of the overlay. Synonyms: <code>scale</code>, <code>size</code>.
|
||||
* @property {Vec3} dimensions - The dimensions of the overlay. Synonyms: <code>size</code>.
|
||||
* @property {Vec3} scale - The scale factor applied to the model's dimensions.
|
||||
* @property {Quat} rotation - The orientation of the overlay. Synonym: <code>orientation</code>.
|
||||
* @property {Vec3} localPosition - The local position of the overlay relative to its parent if the overlay has a
|
||||
* <code>parentID</code> set, otherwise the same value as <code>position</code>.
|
||||
|
|
|
@ -175,7 +175,7 @@ static float computeLoudness(int16_t* samples, int numSamples, int numChannels,
|
|||
const int32_t CLIPPING_THRESHOLD = 32392; // -0.1 dBFS
|
||||
const int32_t CLIPPING_DETECTION = 3; // consecutive samples over threshold
|
||||
|
||||
float scale = numSamples ? 1.0f / (numSamples * 32768.0f) : 0.0f;
|
||||
float scale = numSamples ? 1.0f / numSamples : 0.0f;
|
||||
|
||||
int32_t loudness = 0;
|
||||
isClipping = false;
|
||||
|
@ -249,6 +249,8 @@ AudioClient::AudioClient() :
|
|||
_outputBufferSizeFrames("audioOutputBufferFrames", DEFAULT_BUFFER_FRAMES),
|
||||
_sessionOutputBufferSizeFrames(_outputBufferSizeFrames.get()),
|
||||
_outputStarveDetectionEnabled("audioOutputStarveDetectionEnabled", DEFAULT_STARVE_DETECTION_ENABLED),
|
||||
_lastRawInputLoudness(0.0f),
|
||||
_lastSmoothedRawInputLoudness(0.0f),
|
||||
_lastInputLoudness(0.0f),
|
||||
_timeSinceLastClip(-1.0f),
|
||||
_muted(false),
|
||||
|
@ -1144,6 +1146,9 @@ void AudioClient::handleAudioInput(QByteArray& audioBuffer) {
|
|||
emit inputReceived(audioBuffer);
|
||||
}
|
||||
|
||||
// loudness after mute/gate
|
||||
_lastInputLoudness = (_muted || !audioGateOpen) ? 0.0f : _lastRawInputLoudness;
|
||||
|
||||
// detect gate opening and closing
|
||||
bool openedInLastBlock = !_audioGateOpen && audioGateOpen; // the gate just opened
|
||||
bool closedInLastBlock = _audioGateOpen && !audioGateOpen; // the gate just closed
|
||||
|
@ -1222,12 +1227,15 @@ void AudioClient::handleMicAudioInput() {
|
|||
|
||||
// detect loudness and clipping on the raw input
|
||||
bool isClipping = false;
|
||||
float inputLoudness = computeLoudness(inputAudioSamples.get(), inputSamplesRequired, _inputFormat.channelCount(), isClipping);
|
||||
float loudness = computeLoudness(inputAudioSamples.get(), inputSamplesRequired, _inputFormat.channelCount(), isClipping);
|
||||
_lastRawInputLoudness = loudness;
|
||||
|
||||
float tc = (inputLoudness > _lastInputLoudness) ? 0.378f : 0.967f; // 10ms attack, 300ms release @ 100Hz
|
||||
inputLoudness += tc * (_lastInputLoudness - inputLoudness);
|
||||
_lastInputLoudness = inputLoudness;
|
||||
// envelope detection
|
||||
float tc = (loudness > _lastSmoothedRawInputLoudness) ? 0.378f : 0.967f; // 10ms attack, 300ms release @ 100Hz
|
||||
loudness += tc * (_lastSmoothedRawInputLoudness - loudness);
|
||||
_lastSmoothedRawInputLoudness = loudness;
|
||||
|
||||
// clipping indicator
|
||||
if (isClipping) {
|
||||
_timeSinceLastClip = 0.0f;
|
||||
} else if (_timeSinceLastClip >= 0.0f) {
|
||||
|
@ -1235,7 +1243,7 @@ void AudioClient::handleMicAudioInput() {
|
|||
}
|
||||
isClipping = (_timeSinceLastClip >= 0.0f) && (_timeSinceLastClip < 2.0f); // 2 second hold time
|
||||
|
||||
emit inputLoudnessChanged(_lastInputLoudness, isClipping);
|
||||
emit inputLoudnessChanged(_lastSmoothedRawInputLoudness, isClipping);
|
||||
|
||||
if (!_muted) {
|
||||
possibleResampling(_inputToNetworkResampler,
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
const QAudioFormat& getOutputFormat() const { return _outputFormat; }
|
||||
|
||||
float getLastInputLoudness() const { return _lastInputLoudness; } // TODO: relative to noise floor?
|
||||
float getLastInputLoudness() const { return _lastInputLoudness; }
|
||||
|
||||
float getTimeSinceLastClip() const { return _timeSinceLastClip; }
|
||||
float getAudioAverageInputLoudness() const { return _lastInputLoudness; }
|
||||
|
@ -355,7 +355,9 @@ private:
|
|||
|
||||
StDev _stdev;
|
||||
QElapsedTimer _timeSinceLastReceived;
|
||||
float _lastInputLoudness;
|
||||
float _lastRawInputLoudness; // before mute/gate
|
||||
float _lastSmoothedRawInputLoudness;
|
||||
float _lastInputLoudness; // after mute/gate
|
||||
float _timeSinceLastClip;
|
||||
int _totalInputAudioSamples;
|
||||
|
||||
|
|
|
@ -219,7 +219,6 @@ void EntityTreeRenderer::clearNonLocalEntities() {
|
|||
|
||||
std::unordered_map<EntityItemID, EntityRendererPointer> savedEntities;
|
||||
// remove all entities from the scene
|
||||
_space->clear();
|
||||
auto scene = _viewState->getMain3DScene();
|
||||
if (scene) {
|
||||
render::Transaction transaction;
|
||||
|
@ -259,8 +258,6 @@ void EntityTreeRenderer::clear() {
|
|||
resetEntitiesScriptEngine();
|
||||
}
|
||||
// remove all entities from the scene
|
||||
|
||||
_space->clear();
|
||||
auto scene = _viewState->getMain3DScene();
|
||||
if (scene) {
|
||||
render::Transaction transaction;
|
||||
|
@ -1392,4 +1389,4 @@ bool EntityTreeRenderer::removeMaterialFromAvatar(const QUuid& avatarID, graphic
|
|||
return _removeMaterialFromAvatarOperator(avatarID, material, parentMaterialName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
|||
APPEND_ENTITY_PROPERTY(PROP_HREF, getHref());
|
||||
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, getDescription());
|
||||
APPEND_ENTITY_PROPERTY(PROP_POSITION, getLocalPosition());
|
||||
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getUnscaledDimensions());
|
||||
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getScaledDimensions());
|
||||
APPEND_ENTITY_PROPERTY(PROP_ROTATION, getLocalOrientation());
|
||||
APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, getRegistrationPoint());
|
||||
APPEND_ENTITY_PROPERTY(PROP_CREATED, getCreated());
|
||||
|
@ -819,7 +819,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
};
|
||||
READ_ENTITY_PROPERTY(PROP_POSITION, glm::vec3, customUpdatePositionFromNetwork);
|
||||
}
|
||||
READ_ENTITY_PROPERTY(PROP_DIMENSIONS, glm::vec3, setUnscaledDimensions);
|
||||
READ_ENTITY_PROPERTY(PROP_DIMENSIONS, glm::vec3, setScaledDimensions);
|
||||
{ // See comment above
|
||||
auto customUpdateRotationFromNetwork = [this, shouldUpdate, lastEdited](glm::quat value) {
|
||||
if (shouldUpdate(_lastUpdatedRotationTimestamp, value != _lastUpdatedRotationValue)) {
|
||||
|
@ -1316,7 +1316,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
|
|||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(description, getDescription);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(position, getLocalPosition);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(dimensions, getUnscaledDimensions);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(dimensions, getScaledDimensions);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(rotation, getLocalOrientation);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(registrationPoint, getRegistrationPoint);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(created, getCreated);
|
||||
|
@ -1463,7 +1463,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(position, setPosition);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(dimensions, setUnscaledDimensions);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(dimensions, setScaledDimensions);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(rotation, setRotation);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(registrationPoint, setRegistrationPoint);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, setCreated);
|
||||
|
@ -1873,7 +1873,7 @@ glm::vec3 EntityItem::getScaledDimensions() const {
|
|||
|
||||
void EntityItem::setScaledDimensions(const glm::vec3& value) {
|
||||
glm::vec3 parentScale = getSNScale();
|
||||
setUnscaledDimensions(value * parentScale);
|
||||
setUnscaledDimensions(value / parentScale);
|
||||
}
|
||||
|
||||
void EntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
||||
|
|
|
@ -580,6 +580,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
|
||||
// Model
|
||||
CHECK_PROPERTY_CHANGE(PROP_MODEL_URL, modelURL);
|
||||
CHECK_PROPERTY_CHANGE(PROP_MODEL_SCALE, modelScale);
|
||||
CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
|
||||
CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS, jointRotations);
|
||||
CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
|
||||
|
@ -1012,6 +1013,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. When adding an entity, if no <code>dimensions</code>
|
||||
* value is specified then the model is automatically sized to its
|
||||
* <code>{@link Entities.EntityProperties|naturalDimensions}</code>.
|
||||
* @property {Vec3} modelScale - The scale factor applied to the model's dimensions. Deprecated.
|
||||
* @property {Color} color=255,255,255 - <em>Currently not used.</em>
|
||||
* @property {string} modelURL="" - The URL of the FBX of OBJ model. Baked FBX models' URLs end in ".baked.fbx".<br />
|
||||
* @property {string} textures="" - A JSON string of texture name, URL pairs used when rendering the model in place of the
|
||||
|
@ -1683,6 +1685,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures);
|
||||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_URL, modelURL);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_SCALE, modelScale);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
|
||||
|
@ -2078,6 +2081,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
|||
|
||||
// Model
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(modelURL, QString, setModelURL);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(modelScale, vec3, setModelScale);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslationsSet, qVectorBool, setJointTranslationsSet);
|
||||
|
@ -2357,6 +2361,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
|||
|
||||
// Model
|
||||
COPY_PROPERTY_IF_CHANGED(modelURL);
|
||||
COPY_PROPERTY_IF_CHANGED(modelScale);
|
||||
COPY_PROPERTY_IF_CHANGED(jointRotationsSet);
|
||||
COPY_PROPERTY_IF_CHANGED(jointRotations);
|
||||
COPY_PROPERTY_IF_CHANGED(jointTranslationsSet);
|
||||
|
@ -2700,6 +2705,7 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
|
|||
|
||||
// Model
|
||||
ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString);
|
||||
ADD_PROPERTY_TO_MAP(PROP_MODEL_SCALE, ModelScale, modelScale, vec3);
|
||||
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>);
|
||||
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<quat>);
|
||||
ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector<bool>);
|
||||
|
@ -3989,6 +3995,7 @@ void EntityItemProperties::markAllChanged() {
|
|||
|
||||
// Model
|
||||
_modelURLChanged = true;
|
||||
_modelScaleChanged = true;
|
||||
_jointRotationsSetChanged = true;
|
||||
_jointRotationsChanged = true;
|
||||
_jointTranslationsSetChanged = true;
|
||||
|
@ -4526,6 +4533,9 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
|||
if (modelURLChanged()) {
|
||||
out += "modelURL";
|
||||
}
|
||||
if (modelScaleChanged()) {
|
||||
out += "scale";
|
||||
}
|
||||
if (jointRotationsSetChanged()) {
|
||||
out += "jointRotationsSet";
|
||||
}
|
||||
|
|
|
@ -279,6 +279,7 @@ public:
|
|||
|
||||
// Model
|
||||
DEFINE_PROPERTY_REF(PROP_MODEL_URL, ModelURL, modelURL, QString, "");
|
||||
DEFINE_PROPERTY_REF(PROP_MODEL_SCALE, ModelScale, modelScale, glm::vec3, glm::vec3(1.0f));
|
||||
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_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector<bool>, QVector<bool>());
|
||||
|
|
|
@ -202,22 +202,23 @@ enum EntityPropertyList {
|
|||
|
||||
// Model
|
||||
PROP_MODEL_URL = PROP_DERIVED_0,
|
||||
PROP_JOINT_ROTATIONS_SET = PROP_DERIVED_1,
|
||||
PROP_JOINT_ROTATIONS = PROP_DERIVED_2,
|
||||
PROP_JOINT_TRANSLATIONS_SET = PROP_DERIVED_3,
|
||||
PROP_JOINT_TRANSLATIONS = PROP_DERIVED_4,
|
||||
PROP_RELAY_PARENT_JOINTS = PROP_DERIVED_5,
|
||||
PROP_GROUP_CULLED = PROP_DERIVED_6,
|
||||
PROP_MODEL_SCALE = PROP_DERIVED_1,
|
||||
PROP_JOINT_ROTATIONS_SET = PROP_DERIVED_2,
|
||||
PROP_JOINT_ROTATIONS = PROP_DERIVED_3,
|
||||
PROP_JOINT_TRANSLATIONS_SET = PROP_DERIVED_4,
|
||||
PROP_JOINT_TRANSLATIONS = PROP_DERIVED_5,
|
||||
PROP_RELAY_PARENT_JOINTS = PROP_DERIVED_6,
|
||||
PROP_GROUP_CULLED = PROP_DERIVED_7,
|
||||
// Animation
|
||||
PROP_ANIMATION_URL = PROP_DERIVED_7,
|
||||
PROP_ANIMATION_ALLOW_TRANSLATION = PROP_DERIVED_8,
|
||||
PROP_ANIMATION_FPS = PROP_DERIVED_9,
|
||||
PROP_ANIMATION_FRAME_INDEX = PROP_DERIVED_10,
|
||||
PROP_ANIMATION_PLAYING = PROP_DERIVED_11,
|
||||
PROP_ANIMATION_LOOP = PROP_DERIVED_12,
|
||||
PROP_ANIMATION_FIRST_FRAME = PROP_DERIVED_13,
|
||||
PROP_ANIMATION_LAST_FRAME = PROP_DERIVED_14,
|
||||
PROP_ANIMATION_HOLD = PROP_DERIVED_15,
|
||||
PROP_ANIMATION_URL = PROP_DERIVED_8,
|
||||
PROP_ANIMATION_ALLOW_TRANSLATION = PROP_DERIVED_9,
|
||||
PROP_ANIMATION_FPS = PROP_DERIVED_10,
|
||||
PROP_ANIMATION_FRAME_INDEX = PROP_DERIVED_11,
|
||||
PROP_ANIMATION_PLAYING = PROP_DERIVED_12,
|
||||
PROP_ANIMATION_LOOP = PROP_DERIVED_13,
|
||||
PROP_ANIMATION_FIRST_FRAME = PROP_DERIVED_14,
|
||||
PROP_ANIMATION_LAST_FRAME = PROP_DERIVED_15,
|
||||
PROP_ANIMATION_HOLD = PROP_DERIVED_16,
|
||||
|
||||
// Light
|
||||
PROP_IS_SPOTLIGHT = PROP_DERIVED_0,
|
||||
|
|
|
@ -63,6 +63,7 @@ EntityItemProperties ModelEntityItem::getProperties(const EntityPropertyFlags& d
|
|||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures);
|
||||
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(modelURL, getModelURL);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(modelScale, getModelScale);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotationsSet, getJointRotationsSet);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotations, getJointRotations);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet);
|
||||
|
@ -85,6 +86,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures);
|
||||
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(modelURL, setModelURL);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(modelScale, setModelScale);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotationsSet, setJointRotationsSet);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotations, setJointRotations);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointTranslationsSet, setJointTranslationsSet);
|
||||
|
@ -128,6 +130,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
|||
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL);
|
||||
READ_ENTITY_PROPERTY(PROP_MODEL_SCALE, glm::vec3, setModelScale);
|
||||
READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, QVector<bool>, setJointRotationsSet);
|
||||
READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, QVector<glm::quat>, setJointRotations);
|
||||
READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, QVector<bool>, setJointTranslationsSet);
|
||||
|
@ -165,6 +168,7 @@ EntityPropertyFlags ModelEntityItem::getEntityProperties(EncodeBitstreamParams&
|
|||
requestedProperties += PROP_TEXTURES;
|
||||
|
||||
requestedProperties += PROP_MODEL_URL;
|
||||
requestedProperties += PROP_MODEL_SCALE;
|
||||
requestedProperties += PROP_JOINT_ROTATIONS_SET;
|
||||
requestedProperties += PROP_JOINT_ROTATIONS;
|
||||
requestedProperties += PROP_JOINT_TRANSLATIONS_SET;
|
||||
|
@ -192,6 +196,7 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
|||
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
|
||||
|
||||
APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, getModelURL());
|
||||
APPEND_ENTITY_PROPERTY(PROP_MODEL_SCALE, getModelScale());
|
||||
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, getJointRotationsSet());
|
||||
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, getJointRotations());
|
||||
APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, getJointTranslationsSet());
|
||||
|
@ -708,3 +713,15 @@ bool ModelEntityItem::applyNewAnimationProperties(AnimationPropertyGroup newProp
|
|||
}
|
||||
return somethingChanged;
|
||||
}
|
||||
|
||||
glm::vec3 ModelEntityItem::getModelScale() const {
|
||||
return _modelScaleLock.resultWithReadLock<glm::vec3>([&] {
|
||||
return getSNScale();
|
||||
});
|
||||
}
|
||||
|
||||
void ModelEntityItem::setModelScale(const glm::vec3& modelScale) {
|
||||
_modelScaleLock.withWriteLock([&] {
|
||||
setSNScale(modelScale);
|
||||
});
|
||||
}
|
|
@ -126,6 +126,9 @@ public:
|
|||
QVector<glm::vec3> getJointTranslations() const;
|
||||
QVector<bool> getJointTranslationsSet() const;
|
||||
|
||||
glm::vec3 getModelScale() const;
|
||||
void setModelScale(const glm::vec3& modelScale);
|
||||
|
||||
private:
|
||||
void setAnimationSettings(const QString& value); // only called for old bitstream format
|
||||
bool applyNewAnimationProperties(AnimationPropertyGroup newProperties);
|
||||
|
@ -141,6 +144,7 @@ protected:
|
|||
// they aren't currently updated from data in the model/rig, and they don't have a direct effect
|
||||
// on what's rendered.
|
||||
ReadWriteLockable _jointDataLock;
|
||||
ReadWriteLockable _modelScaleLock;
|
||||
|
||||
bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations
|
||||
bool _jointTranslationsExplicitlySet{ false }; // were the joints set as a property or just side effect of animations
|
||||
|
|
|
@ -262,6 +262,7 @@ enum class EntityVersion : PacketVersion {
|
|||
RingGizmoEntities,
|
||||
ShowKeyboardFocusHighlight,
|
||||
WebBillboardMode,
|
||||
ModelScale,
|
||||
|
||||
// Add new versions above here
|
||||
NUM_PACKET_TYPE,
|
||||
|
|
|
@ -178,6 +178,7 @@ void CauterizedModel::updateClusterMatrices() {
|
|||
}
|
||||
}
|
||||
}
|
||||
computeMeshPartLocalBounds();
|
||||
|
||||
// post the blender if we're not currently waiting for one to finish
|
||||
auto modelBlender = DependencyManager::get<ModelBlender>();
|
||||
|
|
|
@ -1386,6 +1386,7 @@ void Model::updateClusterMatrices() {
|
|||
}
|
||||
}
|
||||
}
|
||||
computeMeshPartLocalBounds();
|
||||
|
||||
// post the blender if we're not currently waiting for one to finish
|
||||
auto modelBlender = DependencyManager::get<ModelBlender>();
|
||||
|
|
|
@ -861,7 +861,7 @@ void SpatiallyNestable::setSNScale(const glm::vec3& scale, bool& success) {
|
|||
}
|
||||
});
|
||||
if (success && changed) {
|
||||
locationChanged();
|
||||
dimensionsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1420,11 +1420,16 @@ QUuid SpatiallyNestable::getEditSenderID() {
|
|||
return editSenderID;
|
||||
}
|
||||
|
||||
void SpatiallyNestable::bumpAncestorChainRenderableVersion() const {
|
||||
void SpatiallyNestable::bumpAncestorChainRenderableVersion(int depth) const {
|
||||
if (depth > MAX_PARENTING_CHAIN_SIZE) {
|
||||
// can't break the parent chain here, because it will call setParentID, which calls this
|
||||
return;
|
||||
}
|
||||
|
||||
_ancestorChainRenderableVersion++;
|
||||
bool success = false;
|
||||
auto parent = getParentPointer(success);
|
||||
if (success && parent) {
|
||||
parent->bumpAncestorChainRenderableVersion();
|
||||
parent->bumpAncestorChainRenderableVersion(depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ public:
|
|||
bool hasGrabs();
|
||||
virtual QUuid getEditSenderID();
|
||||
|
||||
void bumpAncestorChainRenderableVersion() const;
|
||||
void bumpAncestorChainRenderableVersion(int depth = 0) const;
|
||||
|
||||
protected:
|
||||
QUuid _id;
|
||||
|
|
Loading…
Reference in a new issue