summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2019-03-27 15:01:08 +0200
committerTomi Korpipää <tomi.korpipaa@qt.io>2019-03-28 04:17:36 +0000
commit03f9f0ae7d7b87ac9d4e0c5eaeba9628f20738b2 (patch)
treebd3632aab05248ab28ff3fd01be47f22b4a5bf3a /src
parentfbb0642d7da044d3f61382e6e2d74e1529dc81e6 (diff)
Use correct stride when calculating vertex counts for custom meshes
Change-Id: I31a80d4ed69758327d50c354ad5db451661905c5 Task-id: QT3DS-2930 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/q3dsmeshloader.cpp2
-rw-r--r--src/runtime/q3dsuippresentation.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/q3dsmeshloader.cpp b/src/runtime/q3dsmeshloader.cpp
index f26f893..5ca3657 100644
--- a/src/runtime/q3dsmeshloader.cpp
+++ b/src/runtime/q3dsmeshloader.cpp
@@ -894,7 +894,7 @@ Q3DSMesh *loadMeshDataFromCustomGeometry(const Q3DSGeometry &geom, Q3DSMeshLoade
continue;
Qt3DRender::QBuffer *vertexBuffer = mapping->bufferMap[attrDesc->bufferIndex];
- const int vertexCount = vertexBuffer->data().size() / componentByteSize(attrDesc->componentType);
+ const int vertexCount = vertexBuffer->data().size() / attrDesc->stride;
Qt3DRender::QAttribute *attr = new Qt3DRender::QAttribute(vertexBuffer,
q3dsAttributeName(attrDesc->semantic),
Qt3DRender::QAttribute::VertexBaseType(attrDesc->componentType),
diff --git a/src/runtime/q3dsuippresentation.cpp b/src/runtime/q3dsuippresentation.cpp
index 56f97a1..5ab3fd6 100644
--- a/src/runtime/q3dsuippresentation.cpp
+++ b/src/runtime/q3dsuippresentation.cpp
@@ -3532,7 +3532,8 @@ Q3DSPropertyChange Q3DSModelNode::setCustomMesh(Q3DSGeometry *geom)
{
if (m_customMesh != geom)
delete m_customMesh;
-
+ // Update attributes so that qt3d has up-to-date parameters.
+ Q3DSMeshLoader::loadMesh(*geom, &m_customMeshMapping);
m_customMesh = geom; // takes ownership
// like setMesh but note that the m_mesh_unresolved value does not change