summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2024-05-23 11:35:23 -0700
committerBrad Linden <brad@lindenlab.com>2024-05-23 11:35:23 -0700
commit9f6849e081deac1f62ab3010ee0984e17749c9e6 (patch)
tree8d916206343d075fc85e90e83ec9dabe8b01376d /indra/newview/llviewerobject.cpp
parenta1f49564d670a2c41bfa25c833bba2564b9b7f48 (diff)
parent03c4458bdcc6821a3047f93b729d412e274ab9af (diff)
Merge remote-tracking branch 'origin/project/gltf_development' into brad/merge-maint-a-to-dev
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp45
1 files changed, 39 insertions, 6 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 7b60dc754f..654f2aa1de 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4296,7 +4296,9 @@ LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const
LLMatrix4a asset_to_agent = getGLTFAssetToAgentTransform();
LLMatrix4a node_to_agent;
- matMul(node.mAssetMatrix, asset_to_agent, node_to_agent);
+ LLMatrix4a am;
+ am.loadu(glm::value_ptr(node.mAssetMatrix));
+ matMul(am, asset_to_agent, node_to_agent);
mat = node_to_agent;
}
@@ -4307,6 +4309,7 @@ LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const
return mat;
}
+
void LLViewerObject::getGLTFNodeTransformAgent(S32 node_index, LLVector3* position, LLQuaternion* rotation, LLVector3* scale) const
{
LLMatrix4a node_to_agent = getGLTFNodeTransformAgent(node_index);
@@ -4354,7 +4357,9 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion
if (node.mParent != -1)
{
auto& parent = mGLTFAsset->mNodes[node.mParent];
- matMul(agent_to_asset, parent.mAssetMatrixInv, agent_to_node);
+ LLMatrix4a ami;
+ ami.loadu(glm::value_ptr(parent.mAssetMatrixInv));
+ matMul(agent_to_asset, ami, agent_to_node);
}
LLQuaternion agent_to_node_rot(agent_to_node.asMatrix4());
@@ -4366,9 +4371,13 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion
LLVector3 pos;
LLQuaternion rot;
LLVector3 scale;
- decomposeMatrix(node.mMatrix, pos, rot, scale);
+ LLMatrix4a mat;
+ mat.loadu(glm::value_ptr(node.mMatrix));
+ decomposeMatrix(mat, pos, rot, scale);
+
+ mat.asMatrix4().initAll(scale, new_rot, pos);
- node.mMatrix.asMatrix4().initAll(scale, new_rot, pos);
+ node.mMatrix = glm::make_mat4(mat.getF32ptr());
mGLTFAsset->updateTransforms();
}
@@ -4382,7 +4391,9 @@ void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset)
LLMatrix4a agent_to_asset = getAgentToGLTFAssetTransform();
LLMatrix4a agent_to_node;
- matMul(agent_to_asset, node.mAssetMatrixInv, agent_to_node);
+ LLMatrix4a ami;
+ ami.loadu(glm::value_ptr(node.mAssetMatrixInv));
+ matMul(agent_to_asset, ami, agent_to_node);
LLVector4a origin = LLVector4a::getZero();
LLVector4a offset_v;
@@ -4399,7 +4410,12 @@ void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset)
trans.setIdentity();
trans.mMatrix[3] = offset_v;
- matMul(trans, node.mMatrix, node.mMatrix);
+ LLMatrix4a mat;
+ mat.loadu(glm::value_ptr(node.mMatrix));
+
+ matMul(trans, mat, mat);
+
+ node.mMatrix = glm::make_mat4(mat.getF32ptr());
// TODO -- only update transforms for this node and its children (or use a dirty flag)
mGLTFAsset->updateTransforms();
@@ -7490,6 +7506,23 @@ void LLViewerObject::shrinkWrap()
}
}
+void LLViewerObject::setGLTFAsset(const LLUUID& id)
+{
+ //get the sculpt params and set the sculpt type and id
+ auto* param = getExtraParameterEntryCreate(LLNetworkData::PARAMS_SCULPT);
+
+ LLSculptParams* sculpt_params = (LLSculptParams*)param->data;
+ sculpt_params->setSculptTexture(id, LL_SCULPT_TYPE_GLTF);
+
+ setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, true, true);
+
+ // Update the volume
+ LLVolumeParams volume_params;
+ volume_params.setSculptID(id, LL_SCULPT_TYPE_GLTF);
+ updateVolume(volume_params);
+}
+
+
class ObjectPhysicsProperties : public LLHTTPNode
{
public: