src/gl/partrenderer.cpp

changeset 329
6d75fa09cc0c
parent 313
c24d87f64bed
child 333
07e65a4c6611
equal deleted inserted replaced
328:3ea38fd469ca 329:6d75fa09cc0c
47 this->setMouseTracking(true); 47 this->setMouseTracking(true);
48 this->setFocusPolicy(Qt::WheelFocus); 48 this->setFocusPolicy(Qt::WheelFocus);
49 QSurfaceFormat surfaceFormat; 49 QSurfaceFormat surfaceFormat;
50 surfaceFormat.setSamples(8); 50 surfaceFormat.setSamples(8);
51 this->setFormat(surfaceFormat); 51 this->setFormat(surfaceFormat);
52 connect(model, &Model::rowsInserted, [&]{ 52 const auto setNeedBuild = [&]{this->needBuild = true;};
53 this->needBuild = true; 53 connect(model, &Model::rowsInserted, setNeedBuild);
54 }); 54 connect(model, &Model::rowsRemoved, setNeedBuild);
55 connect(model, &Model::rowsRemoved, [&]{ this->needBuild = true; }); 55 connect(model, &Model::dataChanged, setNeedBuild);
56 connect(model, &Model::modelReset, setNeedBuild);
56 const auto updateLayerMvpMatrix = [this]{ 57 const auto updateLayerMvpMatrix = [this]{
57 const glm::mat4 newMvpMatrix = this->projectionMatrix * this->viewMatrix * this->modelMatrix; 58 const glm::mat4 newMvpMatrix = this->projectionMatrix * this->viewMatrix * this->modelMatrix;
58 for (RenderLayer* layer : this->activeRenderLayers) { 59 for (RenderLayer* layer : this->activeRenderLayers) {
59 layer->mvpMatrixChanged(newMvpMatrix); 60 layer->mvpMatrixChanged(newMvpMatrix);
60 } 61 }

mercurial