mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Pixelisation when moving
This commit is contained in:
@ -19,7 +19,7 @@ int main(int argc, char **argv)
|
||||
if (argc <= 1 || !scene.parseScene(argv[1]))
|
||||
return (1);
|
||||
|
||||
Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 0);
|
||||
Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 5);
|
||||
Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/compute.glsl");
|
||||
|
||||
GLint max_gpu_size;
|
||||
@ -72,6 +72,7 @@ int main(int argc, char **argv)
|
||||
|
||||
shader.set_int("u_frameCount", window.getFrameCount());
|
||||
shader.set_int("u_objectsNum", object_data.size());
|
||||
shader.set_int("u_pixelisation", window.getPixelisation() * 10 + 1);
|
||||
shader.set_float("u_time", (float)(glfwGetTime()));
|
||||
shader.set_vec2("u_resolution", glm::vec2(WIDTH, HEIGHT));
|
||||
|
||||
|
@ -117,6 +117,11 @@ GPUCamera Camera::getGPUData()
|
||||
return (data);
|
||||
}
|
||||
|
||||
float Camera::getVelocity()
|
||||
{
|
||||
return (glm::length(_velocity));
|
||||
}
|
||||
|
||||
void Camera::setPosition(glm::vec3 position)
|
||||
{
|
||||
_position = position;
|
||||
|
@ -162,3 +162,13 @@ int Window::getFrameCount(void) const
|
||||
{
|
||||
return (_frameCount);
|
||||
}
|
||||
|
||||
int Window::getPixelisation(void)
|
||||
{
|
||||
bool mouse = glfwGetMouseButton(_window, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS;
|
||||
bool movement = _scene->getCamera()->getVelocity() > 0.0f;
|
||||
|
||||
if (mouse || movement)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
Reference in New Issue
Block a user