src/gl/partrenderer.cpp

changeset 70
f21b800b02a4
parent 66
77c819262b7a
child 71
198d25fe4e21
equal deleted inserted replaced
69:a36913fc552a 70:f21b800b02a4
78 glm::radians(45.0f), 78 glm::radians(45.0f),
79 static_cast<float>(width) / static_cast<float>(height), 79 static_cast<float>(width) / static_cast<float>(height),
80 0.1f, 80 0.1f,
81 10000.f); 81 10000.f);
82 this->compiler->setUniformMatrix("projectionMatrix", this->projectionMatrix); 82 this->compiler->setUniformMatrix("projectionMatrix", this->projectionMatrix);
83 emit projectionMatrixChanged(); 83 emit projectionMatrixChanged(this->projectionMatrix);
84 } 84 }
85 85
86 static GLenum getGlTypeForArrayClass(const gl::ArrayClass vboClass) 86 static GLenum getGlTypeForArrayClass(const gl::ArrayClass vboClass)
87 { 87 {
88 switch (vboClass) 88 switch (vboClass)
190 { 190 {
191 // I'm not quite sure why using the exponent function on the zoom factor causes linear zoom behavior 191 // I'm not quite sure why using the exponent function on the zoom factor causes linear zoom behavior
192 const double z = 2 * std::exp(this->zoom) * (1 + this->compiler->modelDistance()); 192 const double z = 2 * std::exp(this->zoom) * (1 + this->compiler->modelDistance());
193 this->viewMatrix = glm::lookAt(glm::vec3{0, 0, z}, {0, 0, 0}, {0, -1, 0}); 193 this->viewMatrix = glm::lookAt(glm::vec3{0, 0, z}, {0, 0, 0}, {0, -1, 0});
194 this->compiler->setUniformMatrix("viewMatrix", this->viewMatrix); 194 this->compiler->setUniformMatrix("viewMatrix", this->viewMatrix);
195 emit this->viewMatrixChanged(); 195 emit this->viewMatrixChanged(this->viewMatrix);
196 } 196 }
197 197
198 void PartRenderer::updateModelMatrix() 198 void PartRenderer::updateModelMatrix()
199 { 199 {
200 this->modelMatrix = glm::mat4_cast(this->modelQuaternion); 200 this->modelMatrix = glm::mat4_cast(this->modelQuaternion);
201 this->compiler->setUniformMatrix("modelMatrix", modelMatrix); 201 this->compiler->setUniformMatrix("modelMatrix", modelMatrix);
202 emit this->modelMatrixChanged(); 202 emit this->modelMatrixChanged(this->modelMatrix);
203 this->update(); 203 this->update();
204 } 204 }
205 205
206 void PartRenderer::setupBackgroundColor() 206 void PartRenderer::setupBackgroundColor()
207 { 207 {

mercurial