mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #112852 from aaronp64/gltf_texture_transform_keys
Check if scale/offset values are provided in gltf `KHR_texture_transform`
This commit is contained in:
commit
436853de2a
1 changed files with 12 additions and 8 deletions
|
|
@ -3209,16 +3209,20 @@ void GLTFDocument::_set_texture_transform_uv1(const Dictionary &p_dict, Ref<Base
|
||||||
if (extensions.has("KHR_texture_transform")) {
|
if (extensions.has("KHR_texture_transform")) {
|
||||||
if (p_material.is_valid()) {
|
if (p_material.is_valid()) {
|
||||||
const Dictionary &texture_transform = extensions["KHR_texture_transform"];
|
const Dictionary &texture_transform = extensions["KHR_texture_transform"];
|
||||||
const Array &offset_arr = texture_transform["offset"];
|
if (texture_transform.has("offset")) {
|
||||||
if (offset_arr.size() == 2) {
|
const Array offset_arr = texture_transform["offset"];
|
||||||
const Vector3 offset_vector3 = Vector3(offset_arr[0], offset_arr[1], 0.0f);
|
if (offset_arr.size() == 2) {
|
||||||
p_material->set_uv1_offset(offset_vector3);
|
const Vector3 offset_vector3 = Vector3(offset_arr[0], offset_arr[1], 0.0f);
|
||||||
|
p_material->set_uv1_offset(offset_vector3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Array &scale_arr = texture_transform["scale"];
|
if (texture_transform.has("scale")) {
|
||||||
if (scale_arr.size() == 2) {
|
const Array scale_arr = texture_transform["scale"];
|
||||||
const Vector3 scale_vector3 = Vector3(scale_arr[0], scale_arr[1], 1.0f);
|
if (scale_arr.size() == 2) {
|
||||||
p_material->set_uv1_scale(scale_vector3);
|
const Vector3 scale_vector3 = Vector3(scale_arr[0], scale_arr[1], 1.0f);
|
||||||
|
p_material->set_uv1_scale(scale_vector3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue