mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 00:03:39 +02:00
Fix support for FBX texture scaling using ModelUVTranslation/ModelUVScaling
This commit is contained in:
parent
f98f070c8b
commit
f349e48a25
1 changed files with 9 additions and 2 deletions
|
@ -45,10 +45,11 @@ HFMTexture FBXSerializer::getTexture(const QString& textureID) {
|
|||
if (_textureParams.contains(textureID)) {
|
||||
auto p = _textureParams.value(textureID);
|
||||
|
||||
texture.transform.setTranslation(p.translation);
|
||||
texture.transform.setTranslation(p.translation + glm::vec3(p.UVTranslation.x, p.UVTranslation.y, 0.0f));
|
||||
texture.transform.setRotation(glm::quat(glm::radians(p.rotation)));
|
||||
|
||||
auto scaling = p.scaling;
|
||||
auto uvScaling = glm::vec3(p.UVScaling.x, p.UVScaling.y, 1.0f);
|
||||
// Protect from bad scaling which should never happen
|
||||
if (scaling.x == 0.0f) {
|
||||
scaling.x = 1.0f;
|
||||
|
@ -59,7 +60,13 @@ HFMTexture FBXSerializer::getTexture(const QString& textureID) {
|
|||
if (scaling.z == 0.0f) {
|
||||
scaling.z = 1.0f;
|
||||
}
|
||||
texture.transform.setScale(scaling);
|
||||
if (uvScaling.x == 0.0f) {
|
||||
uvScaling.x = 1.0f;
|
||||
}
|
||||
if (uvScaling.y == 0.0f) {
|
||||
uvScaling.y = 1.0f;
|
||||
}
|
||||
texture.transform.setScale(scaling * uvScaling);
|
||||
|
||||
if ((p.UVSet != "map1") && (p.UVSet != "UVSet0")) {
|
||||
texture.texcoordSet = 1;
|
||||
|
|
Loading…
Reference in a new issue