mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +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) {
|
||||
glm::mat4 translation = glm::translate(entity->getPosition());
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getRotation());
|
||||
glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT -
|
||||
entity->getRegistrationPoint());
|
||||
result = translation * rotation /* * registration */;
|
||||
result = translation * rotation;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1753,9 +1751,7 @@ glm::mat4 EntityScriptingInterface::getEntityLocalTransform(const QUuid& entityI
|
|||
if (entity) {
|
||||
glm::mat4 translation = glm::translate(entity->getLocalPosition());
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getLocalOrientation());
|
||||
glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT -
|
||||
entity->getRegistrationPoint());
|
||||
result = translation * rotation * registration;
|
||||
result = translation * rotation;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -473,16 +473,9 @@ bool Model::getMeshes(MeshProxyList& result) {
|
|||
|
||||
Transform offset;
|
||||
offset.setScale(_scale);
|
||||
// offset.postTranslate(_offset);
|
||||
offset.postTranslate(_offset);
|
||||
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) {
|
||||
if (!mesh) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue