diff --git a/resources/glTF_import/MultiUVTest/README.md b/resources/glTF_import/MultiUVTest/README.md new file mode 100644 index 0000000..b5e10ba --- /dev/null +++ b/resources/glTF_import/MultiUVTest/README.md @@ -0,0 +1,15 @@ +# MultiUV Test + +## Screenshot + +![screenshot](screenshot/screenshot.jpg) + +## Description + +This model has two uv texture coordinates. + +## License Information + +Donated by [Hilo3d](https://github.com/hiloteam/Hilo3d) for glTF testing. + +This model is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). diff --git a/resources/glTF_import/MultiUVTest/glTF/MultiUVTest.bin b/resources/glTF_import/MultiUVTest/glTF/MultiUVTest.bin new file mode 100644 index 0000000..008de1b Binary files /dev/null and b/resources/glTF_import/MultiUVTest/glTF/MultiUVTest.bin differ diff --git a/resources/glTF_import/MultiUVTest/glTF/MultiUVTest.gltf b/resources/glTF_import/MultiUVTest/glTF/MultiUVTest.gltf new file mode 100644 index 0000000..890f617 --- /dev/null +++ b/resources/glTF_import/MultiUVTest/glTF/MultiUVTest.gltf @@ -0,0 +1,256 @@ +{ + "accessors" : [ + { + "bufferView" : 0, + "componentType" : 5121, + "count" : 36, + "max" : [ + 23 + ], + "min" : [ + 0 + ], + "type" : "SCALAR" + }, + { + "bufferView" : 1, + "componentType" : 5126, + "count" : 24, + "max" : [ + 1.0000004768371582, + 1.0, + 1.0000005960464478 + ], + "min" : [ + -1.0000003576278687, + -1.0, + -1.0000003576278687 + ], + "type" : "VEC3" + }, + { + "bufferView" : 2, + "componentType" : 5126, + "count" : 24, + "max" : [ + 1.0, + 1.0, + 1.0 + ], + "min" : [ + -1.0, + -1.0, + -1.0 + ], + "type" : "VEC3" + }, + { + "bufferView" : 3, + "componentType" : 5126, + "count" : 24, + "max" : [ + 1.0, + 6.661325971652322e-16, + 1.0, + 1.0 + ], + "min" : [ + -1.0, + -2.9802322387695312e-08, + -1.0, + 1.0 + ], + "type" : "VEC4" + }, + { + "bufferView" : 4, + "componentType" : 5126, + "count" : 24, + "max" : [ + 0.7499566674232483, + 0.9999134124518605 + ], + "min" : [ + 8.658754813950509e-05, + 8.660554885864258e-05 + ], + "type" : "VEC2" + }, + { + "bufferView" : 5, + "componentType" : 5126, + "count" : 24, + "max" : [ + 0.25, + 0.25 + ], + "min" : [ + 0.0, + 0.0 + ], + "type" : "VEC2" + } + ], + "asset" : { + "copyright" : "hiloteam", + "generator" : "Khronos Blender glTF 2.0 exporter", + "version" : "2.0" + }, + "bufferViews" : [ + { + "buffer" : 0, + "byteLength" : 36, + "byteOffset" : 0, + "target" : 34963 + }, + { + "buffer" : 0, + "byteLength" : 288, + "byteOffset" : 36, + "target" : 34962 + }, + { + "buffer" : 0, + "byteLength" : 288, + "byteOffset" : 324, + "target" : 34962 + }, + { + "buffer" : 0, + "byteLength" : 384, + "byteOffset" : 612, + "target" : 34962 + }, + { + "buffer" : 0, + "byteLength" : 192, + "byteOffset" : 996, + "target" : 34962 + }, + { + "buffer" : 0, + "byteLength" : 192, + "byteOffset" : 1188, + "target" : 34962 + } + ], + "buffers" : [ + { + "byteLength" : 1380, + "uri" : "MultiUVTest.bin" + } + ], + "cameras" : [ + { + "name" : "Camera", + "perspective" : { + "aspectRatio" : 1.7777777777777777, + "yfov" : 0.5033799372418416, + "zfar" : 100.0, + "znear" : 0.10000000149011612 + }, + "type" : "perspective" + } + ], + "images" : [ + { + "uri" : "uv0.png" + }, + { + "uri" : "uv1.png" + } + ], + "materials" : [ + { + "emissiveFactor" : [ + 1.0, + 1.0, + 1.0 + ], + "emissiveTexture" : { + "index" : 1, + "texCoord" : 1 + }, + "name" : "Material", + "pbrMetallicRoughness" : { + "baseColorTexture" : { + "index" : 0 + } + } + } + ], + "meshes" : [ + { + "name" : "Cube", + "primitives" : [ + { + "attributes" : { + "NORMAL" : 2, + "POSITION" : 1, + "TANGENT" : 3, + "TEXCOORD_0" : 4, + "TEXCOORD_1" : 5 + }, + "indices" : 0, + "material" : 0 + } + ] + } + ], + "nodes" : [ + { + "camera" : 0, + "name" : "Correction_Camera", + "rotation" : [ + -0.7071067690849304, + -0.0, + 0.0, + 0.7071067690849304 + ] + }, + { + "children" : [ + 0 + ], + "name" : "Camera", + "rotation" : [ + 0.483536034822464, + 0.33687159419059753, + -0.20870360732078552, + 0.7804827094078064 + ], + "translation" : [ + 7.481131553649902, + 5.34366512298584, + 6.5076398849487305 + ] + }, + { + "mesh" : 0, + "name" : "Cube" + } + ], + "samplers" : [ + {} + ], + "scene" : 0, + "scenes" : [ + { + "name" : "Scene", + "nodes" : [ + 2, + 1 + ] + } + ], + "textures" : [ + { + "sampler" : 0, + "source" : 0 + }, + { + "sampler" : 0, + "source" : 1 + } + ] +} diff --git a/resources/glTF_import/MultiUVTest/glTF/uv0.png b/resources/glTF_import/MultiUVTest/glTF/uv0.png new file mode 100644 index 0000000..c15b9b4 Binary files /dev/null and b/resources/glTF_import/MultiUVTest/glTF/uv0.png differ diff --git a/resources/glTF_import/MultiUVTest/glTF/uv1.png b/resources/glTF_import/MultiUVTest/glTF/uv1.png new file mode 100644 index 0000000..75853b7 Binary files /dev/null and b/resources/glTF_import/MultiUVTest/glTF/uv1.png differ diff --git a/resources/glTF_import/MultiUVTest/screenshot/screenshot.jpg b/resources/glTF_import/MultiUVTest/screenshot/screenshot.jpg new file mode 100644 index 0000000..e8978d9 Binary files /dev/null and b/resources/glTF_import/MultiUVTest/screenshot/screenshot.jpg differ diff --git a/source/MaterialXglTF/GltfMaterialHandler.cpp b/source/MaterialXglTF/GltfMaterialHandler.cpp index 578ccb4..bf60828 100644 --- a/source/MaterialXglTF/GltfMaterialHandler.cpp +++ b/source/MaterialXglTF/GltfMaterialHandler.cpp @@ -1149,7 +1149,7 @@ void addTexCoordNode(NodePtr image, int uvindex) NodePtr texcoordNode = parentGraph->addNode("texcoord", texcoordName, "vector2"); if (texcoordNode) { - InputPtr uvIndexInput = texcoordNode->addInputFromNodeDef("uvindex"); + InputPtr uvIndexInput = texcoordNode->addInputFromNodeDef("index"); if (uvIndexInput) { uvIndexInput->setValue(uvindex);