summaryrefslogtreecommitdiffstats
path: root/src/render/io/gltfparser.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2014-07-15 16:27:54 +0200
committerSean Harmer <sean.harmer@kdab.com>2014-07-19 23:19:34 +0200
commit90e3ebfec5c521acfa2f5aa756d9216a2051d477 (patch)
tree3100c7b718cc97fec7e7e198af5ada22442d1b9e /src/render/io/gltfparser.cpp
parent65061f869f59d579113e153a3753249477dd723e (diff)
QAbstractMeshFunctor
Each QAbstractMesh class now has to implement a QAbstractMeshFunctor class. When a mesh is set to dirty, the functor is sent through a QChangeArbiter notification to the backend. The backend, using the functor can then rebuild the mesh. There should be no issue if the frontend mesh is deleted while the backend is creating the mesh as the functor has no direct reference to the frontend element and contains all the data needed for a complete creation of the mesh. Change-Id: I4984f03a612e74c688bfb6cc2f19d9241b517457 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/io/gltfparser.cpp')
-rw-r--r--src/render/io/gltfparser.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp
index fa23b3ca2..431adb06c 100644
--- a/src/render/io/gltfparser.cpp
+++ b/src/render/io/gltfparser.cpp
@@ -965,14 +965,26 @@ GLTFParser::GLTFParserMesh::GLTFParserMesh(QNode *parent)
{
}
-bool GLTFParser::GLTFParserMesh::load()
+void GLTFParser::GLTFParserMesh::setData(MeshDataPtr data)
{
- return true;
+ m_meshData = data;
+ QAbstractMesh::setDirty(this);
}
-void GLTFParser::GLTFParserMesh::setData(MeshDataPtr data)
+QAbstractMeshFunctorPtr GLTFParser::GLTFParserMesh::meshFunctor() const
+{
+ return QAbstractMeshFunctorPtr(new GLTFParserMesh::GLTFParserMeshFunctor(m_meshData));
+}
+
+GLTFParser::GLTFParserMesh::GLTFParserMeshFunctor::GLTFParserMeshFunctor(MeshDataPtr meshData)
+ : QAbstractMeshFunctor()
+ , m_meshData(meshData)
+{
+}
+
+QAbstractMeshDataPtr GLTFParser::GLTFParserMesh::GLTFParserMeshFunctor::operator ()()
{
- QAbstractMesh::setData(data.staticCast<QAbstractMeshData>());
+ return m_meshData;
}
} // of namespace Qt3D