src/gl/partrenderer.cpp

changeset 112
5760cbb32bc0
parent 111
1f42c03fafca
child 119
24275a4064f4
equal deleted inserted replaced
111:1f42c03fafca 112:5760cbb32bc0
83 glm::radians(45.0f), 83 glm::radians(45.0f),
84 static_cast<float>(width) / static_cast<float>(height), 84 static_cast<float>(width) / static_cast<float>(height),
85 0.1f, 85 0.1f,
86 10000.f); 86 10000.f);
87 this->compiler->setUniformMatrix("projectionMatrix", this->projectionMatrix); 87 this->compiler->setUniformMatrix("projectionMatrix", this->projectionMatrix);
88 emit projectionMatrixChanged(this->projectionMatrix); 88 Q_EMIT projectionMatrixChanged(this->projectionMatrix);
89 } 89 }
90 90
91 static GLenum getGlTypeForArrayClass(const gl::ArrayClass vboClass) 91 static GLenum getGlTypeForArrayClass(const gl::ArrayClass vboClass)
92 { 92 {
93 switch (vboClass) 93 switch (vboClass)
200 { 200 {
201 // I'm not quite sure why using the exponent function on the zoom factor causes linear zoom behavior 201 // I'm not quite sure why using the exponent function on the zoom factor causes linear zoom behavior
202 const double z = 2 * std::exp(this->zoom) * (1 + this->compiler->modelDistance()); 202 const double z = 2 * std::exp(this->zoom) * (1 + this->compiler->modelDistance());
203 this->viewMatrix = glm::lookAt(glm::vec3{0, 0, z}, {0, 0, 0}, {0, -1, 0}); 203 this->viewMatrix = glm::lookAt(glm::vec3{0, 0, z}, {0, 0, 0}, {0, -1, 0});
204 this->compiler->setUniformMatrix("viewMatrix", this->viewMatrix); 204 this->compiler->setUniformMatrix("viewMatrix", this->viewMatrix);
205 emit this->viewMatrixChanged(this->viewMatrix); 205 Q_EMIT this->viewMatrixChanged(this->viewMatrix);
206 } 206 }
207 207
208 void PartRenderer::updateModelMatrix() 208 void PartRenderer::updateModelMatrix()
209 { 209 {
210 this->modelMatrix = glm::mat4_cast(this->modelQuaternion); 210 this->modelMatrix = glm::mat4_cast(this->modelQuaternion);
211 this->compiler->setUniformMatrix("modelMatrix", modelMatrix); 211 this->compiler->setUniformMatrix("modelMatrix", modelMatrix);
212 emit this->modelMatrixChanged(this->modelMatrix); 212 Q_EMIT this->modelMatrixChanged(this->modelMatrix);
213 this->update(); 213 this->update();
214 } 214 }
215 215
216 void PartRenderer::setupBackgroundColor() 216 void PartRenderer::setupBackgroundColor()
217 { 217 {
381 if (mainColorChanged or backgroundColorChanged) 381 if (mainColorChanged or backgroundColorChanged)
382 { 382 {
383 this->build(); 383 this->build();
384 this->setupBackgroundColor(); 384 this->setupBackgroundColor();
385 } 385 }
386 emit this->renderPreferencesChanged(); 386 Q_EMIT this->renderPreferencesChanged();
387 this->update(); 387 this->update();
388 } 388 }
389 389
390 /** 390 /**
391 * @return the currently highlighted object 391 * @return the currently highlighted object

mercurial