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 } |