ebruneton / precomputed_atmospheric_scattering

This project provides a new implementation of our EGSR 2008 paper "Precomputed Atmospheric Scattering".
BSD 3-Clause "New" or "Revised" License
908 stars 120 forks source link

Using GLM #7

Closed htmlboss closed 7 years ago

htmlboss commented 7 years ago

Hey!

I'm working on integrating your demo into my engine at the moment and I have a couple of issues:

How would I replace the calculations performed in Demo::HandleReshapeEvent(int viewport_width, int viewport_height) with a call to glm::projection()? I tried to do a simple replacement however the scene ends up being squished in the vertical (+y) direction:

const auto mat = glm::perspective(glm::radians(45.0f), 1280.0f / 720.0f, 1.0f, 1000.0f); glUniformMatrix4fv(glGetUniformLocation(program_, "view_from_clip"), 1, false, value_ptr(mat));

1

Also, in the void Demo::HandleRedisplayEvent() const function, where you calculate the "model_from_view", and "camera" uniforms, is the former simply a call to glm::lookat(), and the latter just the camera position (I have a Camera class that handles movement, orientation, etc., so I just want to keep things centralized instead of having to convert back and forth every frame)?

Thanks so much in advance!

ebruneton commented 7 years ago

The matrix "view_from_clip" in HandleReshapeEvent must be the inverse of a perspective matrix such as GL_PROJECTION. Likewise, the matrix "model_from_view" in HandleRedisplayEvent must be the inverse of a classical GL_MODELVIEW matrix.