summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsmeshloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/q3dsmeshloader.cpp')
-rw-r--r--src/runtime/q3dsmeshloader.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/runtime/q3dsmeshloader.cpp b/src/runtime/q3dsmeshloader.cpp
index 1bda3a0..4b6f9fc 100644
--- a/src/runtime/q3dsmeshloader.cpp
+++ b/src/runtime/q3dsmeshloader.cpp
@@ -375,6 +375,7 @@ static const char *getTexTanAttrName() { return "attr_textan"; }
//static const char *getTexBinormalAttrName() { return "attr_binormal"; }
//static const char *getWeightAttrName() { return "attr_weight"; }
//static const char *getBoneIndexAttrName() { return "attr_boneid"; }
+static const char *getColorAttrName() { return "attr_color"; }
struct MeshDataHeader
{
@@ -693,6 +694,19 @@ MeshList loadMeshData(const QByteArray &meshData, quint32 flags, bool useQt3DAtt
stride);
attributes.append(tangentsAttribute);
}
+
+ // Vertex Color
+ if (entryBufferMap.contains(QString::fromLocal8Bit(getColorAttrName()))) {
+ auto vertexColorEntry = entryBufferMap[QString::fromLocal8Bit(getColorAttrName())];
+ auto colorAttribute = new Qt3DRender::QAttribute(vertexBuffer,
+ Qt3DRender::QAttribute::defaultColorAttributeName(),
+ convertRenderComponentToVertexBaseType(vertexColorEntry.m_ComponentType),
+ vertexColorEntry.m_NumComponents,
+ vertexCount,
+ vertexColorEntry.m_FirstItemOffset,
+ stride);
+ attributes.append(colorAttribute);
+ }
}
// Index Buffer
auto indexBuffer = new Qt3DRender::QBuffer;