From 0949e0a6f31d7aa91bc3e2501ded767ab30f4e47 Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Wed, 12 Jun 2019 10:17:47 -0700 Subject: [PATCH] gltfio: fix bad color in ubershader mode. --- libs/gltfio/src/AssetLoader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/gltfio/src/AssetLoader.cpp b/libs/gltfio/src/AssetLoader.cpp index 0433cd5768..9efff1ea97 100644 --- a/libs/gltfio/src/AssetLoader.cpp +++ b/libs/gltfio/src/AssetLoader.cpp @@ -495,17 +495,19 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out if (mMaterials->getSource() == LOAD_UBERSHADERS) { if (!hasUv0) { needsDummyData = true; - vbb.attribute(VertexAttribute::UV0, slot++, VertexBuffer::AttributeType::USHORT2); + vbb.attribute(VertexAttribute::UV0, slot, VertexBuffer::AttributeType::USHORT2); } if (!hasUv1) { needsDummyData = true; - vbb.attribute(VertexAttribute::UV1, slot++, VertexBuffer::AttributeType::USHORT2); + vbb.attribute(VertexAttribute::UV1, slot, VertexBuffer::AttributeType::USHORT2); } if (!hasVertexColor) { needsDummyData = true; - vbb.attribute(VertexAttribute::COLOR, slot++, VertexBuffer::AttributeType::UBYTE4); + vbb.attribute(VertexAttribute::COLOR, slot, VertexBuffer::AttributeType::UBYTE4); vbb.normalized(VertexAttribute::COLOR); } + if (needsDummyData) { + slot++; } int bufferCount = slot;