mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +02:00
getMeshes handles registration point
This commit is contained in:
parent
8a732e7d4b
commit
be48268be8
2 changed files with 3 additions and 14 deletions
|
@ -1736,9 +1736,7 @@ glm::mat4 EntityScriptingInterface::getEntityTransform(const QUuid& entityID) {
|
||||||
if (entity) {
|
if (entity) {
|
||||||
glm::mat4 translation = glm::translate(entity->getPosition());
|
glm::mat4 translation = glm::translate(entity->getPosition());
|
||||||
glm::mat4 rotation = glm::mat4_cast(entity->getRotation());
|
glm::mat4 rotation = glm::mat4_cast(entity->getRotation());
|
||||||
glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT -
|
result = translation * rotation;
|
||||||
entity->getRegistrationPoint());
|
|
||||||
result = translation * rotation /* * registration */;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1753,9 +1751,7 @@ glm::mat4 EntityScriptingInterface::getEntityLocalTransform(const QUuid& entityI
|
||||||
if (entity) {
|
if (entity) {
|
||||||
glm::mat4 translation = glm::translate(entity->getLocalPosition());
|
glm::mat4 translation = glm::translate(entity->getLocalPosition());
|
||||||
glm::mat4 rotation = glm::mat4_cast(entity->getLocalOrientation());
|
glm::mat4 rotation = glm::mat4_cast(entity->getLocalOrientation());
|
||||||
glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT -
|
result = translation * rotation;
|
||||||
entity->getRegistrationPoint());
|
|
||||||
result = translation * rotation * registration;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -473,16 +473,9 @@ bool Model::getMeshes(MeshProxyList& result) {
|
||||||
|
|
||||||
Transform offset;
|
Transform offset;
|
||||||
offset.setScale(_scale);
|
offset.setScale(_scale);
|
||||||
// offset.postTranslate(_offset);
|
offset.postTranslate(_offset);
|
||||||
glm::mat4 offsetMat = offset.getMatrix();
|
glm::mat4 offsetMat = offset.getMatrix();
|
||||||
|
|
||||||
Extents modelExtents = getUnscaledMeshExtents();
|
|
||||||
glm::vec3 dimensions = modelExtents.maximum - modelExtents.minimum;
|
|
||||||
|
|
||||||
const glm::vec3 DEFAULT_ENTITY_REGISTRATION_POINT = glm::vec3(0.5f, 0.5f, 0.5f);
|
|
||||||
glm::vec3 regis = (DEFAULT_ENTITY_REGISTRATION_POINT - _registrationPoint);
|
|
||||||
glm::vec3 regisOffset = dimensions * regis;
|
|
||||||
|
|
||||||
for (std::shared_ptr<const model::Mesh> mesh : meshes) {
|
for (std::shared_ptr<const model::Mesh> mesh : meshes) {
|
||||||
if (!mesh) {
|
if (!mesh) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue