Fixed matrix math

This commit is contained in:
arvid schröder 2022-11-30 17:29:04 +01:00
parent f44de665e0
commit 8b7ed9626f

View file

@ -1,3 +1,4 @@
#include <array>
#include "light/light.h"
#include "scene/scene.h"
#include "shader/brdfshader.h"
@ -21,15 +22,14 @@ Color BrdfShader::shade(Scene const &scene, Ray const &ray) const {
return Vector3d{
((axis_y.y * axis_z.z - axis_y.z * axis_z.y) * vec.x +
(axis_y.z * axis_z.x - axis_y.x * axis_z.z) * vec.y +
(axis_y.x * axis_z.y - axis_y.y * axis_z.x) * vec.z) / det,
(axis_y.x * axis_z.y - axis_z.x * axis_y.y) * vec.z) / det,
((axis_x.z * axis_z.y - axis_x.y * axis_z.z) * vec.x +
(axis_x.x * axis_z.z - axis_x.x * axis_y.z) * vec.y +
(axis_x.y * axis_z.x - axis_x.x * axis_y.x) * vec.z) / det,
(axis_x.x * axis_z.z - axis_x.z * axis_z.x) * vec.y +
(axis_z.x * axis_x.y - axis_x.x * axis_z.y) * vec.z) / det,
((axis_x.y * axis_y.z - axis_x.z * axis_y.y) * vec.x +
(axis_x.z * axis_y.x - axis_x.x * axis_y.z) * vec.y +
(axis_x.x * axis_y.y - axis_x.y * axis_y.x) * vec.z) / det
(axis_y.x * axis_x.z - axis_x.x * axis_y.z) * vec.y +
(axis_x.x * axis_y.y - axis_y.x * axis_x.y) * vec.z) / det
};
};
for (auto &light: scene.lights()) {