the camera rotates with the thing yo wt

This commit is contained in:
benkyd
2022-11-27 19:55:23 +00:00
parent 63d520df9c
commit 832a61dfd6
4 changed files with 18 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ RayField RaySource::getInitialRays(bool MSAA)
const float aspect = mReferenceCamera->getRayViewport().x / mReferenceCamera->getRayViewport().y;
float scale = tan(mReferenceCamera->FOV / 2.0f * helpers::PI / 180.0f);
glm::mat4 cameraToWorld = mReferenceCamera->getViewMatrix();
glm::mat4 cameraToWorld = mReferenceCamera->getCameraLook();
glm::vec3 origin = mReferenceCamera->Position;
for (int x = 0; x < mReferenceCamera->getRayViewport().x; x++)
@@ -51,7 +51,7 @@ RayField RaySource::getInitialRays(bool MSAA)
Ray* ray = new Ray;
ray->Origin = origin;
ray->Direction = glm::normalize(glm::vec4(Px, Py, -1.0f, 1.0f) * cameraToWorld);
ray->Direction = glm::normalize((glm::vec4(Px, Py, -1.0f, 1.0f) * cameraToWorld));
field.push_back(ray);
}