implement fast mesh rendering for Qt5 port (7x faster)

This commit is contained in:
wmayer
2018-07-28 11:08:03 +02:00
parent db4f47cf28
commit 039e972a4b
8 changed files with 565 additions and 122 deletions

View File

@@ -100,6 +100,12 @@ ViewProviderMeshFaceSet::ViewProviderMeshFaceSet()
pcMeshCoord->ref();
pcMeshFaces = new SoFCIndexedFaceSet;
pcMeshFaces->ref();
// setup engine to notify 'pcMeshFaces' node about material changes.
// When the affected nodes are deleted the engine will be deleted, too.
SoFCMaterialEngine* engine = new SoFCMaterialEngine();
engine->diffuseColor.connectFrom(&pcShapeMaterial->diffuseColor);
pcMeshFaces->updateGLArray.connectFrom(&engine->trigger);
}
ViewProviderMeshFaceSet::~ViewProviderMeshFaceSet()
@@ -132,7 +138,7 @@ void ViewProviderMeshFaceSet::updateData(const App::Property* prop)
if (prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
const Mesh::MeshObject* mesh = static_cast<const Mesh::PropertyMeshKernel*>(prop)->getValuePtr();
bool direct = (mesh->countFacets() > this->triangleCount);
bool direct = MeshRenderer::shouldRenderDirectly(mesh->countFacets() > this->triangleCount);
if (direct) {
this->pcMeshNode->mesh.setValue(mesh);
// Needs to update internal bounding box caches