diff --git a/lib/createGltf.js b/lib/createGltf.js index 01c6093..0bb96a4 100644 --- a/lib/createGltf.js +++ b/lib/createGltf.js @@ -427,10 +427,10 @@ function createSpecularGlossinessTexture(gltf, specularImage, glossinessImage, o if (packSpecular) { // Write into the R, G, B channels var redChannel = getImageChannel(specularImage, 0, width, height, scratchChannel); - var greenChannel = getImageChannel(specularImage, 1, width, height, scratchChannel); - var blueChannel = getImageChannel(specularImage, 2, width, height, scratchChannel); writeChannel(pixels, redChannel, 0); + var greenChannel = getImageChannel(specularImage, 1, width, height, scratchChannel); writeChannel(pixels, greenChannel, 1); + var blueChannel = getImageChannel(specularImage, 2, width, height, scratchChannel); writeChannel(pixels, blueChannel, 2); } @@ -824,6 +824,7 @@ function addMesh(gltf, materials, images, bufferState, uint32Indices, mesh, opti var hasNormals = mesh.normals.length > 0; var hasUVs = mesh.uvs.length > 0; + // Attributes are shared by all primitives in the mesh var accessorIndex; var attributes = {}; if (hasPositions) {