From a8077baed5da03e273a2c316f77852fe4071cd40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fricoteaux?= Date: Wed, 25 Apr 2018 11:37:56 +0200 Subject: [PATCH] Add vertex color support to glTF2 export --- code/glTF2Exporter.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index e146327ea..0c2677fb2 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -732,6 +732,14 @@ void glTF2Exporter::ExportMeshes() } } + /*************** Vertex colors ****************/ + for (unsigned int indexColorChannel = 0; indexColorChannel < aim->GetNumColorChannels(); ++indexColorChannel) + { + Ref c = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mColors[indexColorChannel], AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT, false); + if (c) + p.attributes.color.push_back(c); + } + /*************** Vertices indices ****************/ if (aim->mNumFaces > 0) { std::vector indices;