Use glm::radians instead of deg_to_rad (Fixes #37)

This commit is contained in:
saschawillems 2016-03-08 20:59:25 +01:00
parent 575cbdc341
commit e77884d5bb
25 changed files with 129 additions and 131 deletions

View file

@ -1185,17 +1185,17 @@ public:
void updateUniformBuffersScene()
{
// UFO
ubos.fullscreen.projection = glm::perspective(deg_to_rad(45.0f), (float)width / (float)height, 0.1f, 256.0f);
ubos.fullscreen.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, 0.1f, 256.0f);
glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, -1.0f, zoom));
ubos.fullscreen.model = viewMatrix *
glm::translate(glm::mat4(), glm::vec3(sin(deg_to_rad(timer * 360.0f)) * 0.25f, 0.0f, cos(deg_to_rad(timer * 360.0f)) * 0.25f));
glm::translate(glm::mat4(), glm::vec3(sin(glm::radians(timer * 360.0f)) * 0.25f, 0.0f, cos(glm::radians(timer * 360.0f)) * 0.25f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, deg_to_rad(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, -sinf(deg_to_rad(timer * 360.0f)) * 0.15f, glm::vec3(1.0f, 0.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, deg_to_rad(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, deg_to_rad(timer * 360.0f), glm::vec3(0.0f, 1.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, deg_to_rad(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, -sinf(glm::radians(timer * 360.0f)) * 0.15f, glm::vec3(1.0f, 0.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, glm::radians(timer * 360.0f), glm::vec3(0.0f, 1.0f, 0.0f));
ubos.fullscreen.model = glm::rotate(ubos.fullscreen.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
uint8_t *pData;
VkResult err = vkMapMemory(device, uniformData.vsFullScreen.memory, 0, sizeof(ubos.fullscreen), 0, (void **)&pData);
@ -1204,12 +1204,12 @@ public:
vkUnmapMemory(device, uniformData.vsFullScreen.memory);
// Skybox
ubos.skyBox.projection = glm::perspective(deg_to_rad(45.0f), (float)width / (float)height, 0.1f, 256.0f);
ubos.skyBox.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, 0.1f, 256.0f);
ubos.skyBox.model = glm::mat4();
ubos.skyBox.model = glm::rotate(ubos.skyBox.model, deg_to_rad(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
ubos.skyBox.model = glm::rotate(ubos.skyBox.model, deg_to_rad(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
ubos.skyBox.model = glm::rotate(ubos.skyBox.model, deg_to_rad(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
ubos.skyBox.model = glm::rotate(ubos.skyBox.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
ubos.skyBox.model = glm::rotate(ubos.skyBox.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
ubos.skyBox.model = glm::rotate(ubos.skyBox.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
err = vkMapMemory(device, uniformData.vsSkyBox.memory, 0, sizeof(ubos.skyBox), 0, (void **)&pData);
assert(!err);