File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ namespace rendering
3737 const unsigned int shadowWidth = 1024 ;
3838 const unsigned int shadowHeight = 1024 ;
3939
40+ /* *
41+ * @brief Convert GLM mat4 to Eigen::Matrix4f.
42+ *
43+ * @param m GLM mat4 to convert.
44+ * @return Eigen::Matrix4f Converted Eigen matrix.
45+ */
46+ Eigen::Matrix4f glmToEigen (const glm::mat4 &m);
47+
4048 private:
4149 void initShadowResources ();
4250 };
Original file line number Diff line number Diff line change @@ -64,4 +64,12 @@ namespace rendering
6464 LOG_INFO (" Shadow map initialized." );
6565 }
6666
67+ Eigen::Matrix4f toEigen (const glm::mat4 &m)
68+ {
69+ Eigen::Matrix4f e;
70+ for (int r = 0 ; r < 4 ; ++r)
71+ for (int c = 0 ; c < 4 ; ++c)
72+ e (r, c) = m[c][r]; // glm is indexed [column][row]
73+ return e;
74+ }
6775} // namespace rendering
Original file line number Diff line number Diff line change 55#include < Eigen/Geometry>
66#include < glad/glad.h>
77
8- namespace
9- {
10- /* *
11- * @brief Convert GLM mat4 to Eigen::Matrix4f.
12- *
13- * @param m GLM mat4 to convert.
14- * @return Eigen::Matrix4f Converted Eigen matrix.
15- */
16- Eigen::Matrix4f toEigen (const glm::mat4 &m)
17- {
18- Eigen::Matrix4f e;
19- for (int r = 0 ; r < 4 ; ++r)
20- for (int c = 0 ; c < 4 ; ++c)
21- e (r, c) = m[c][r]; // glm is indexed [column][row]
22- return e;
23- }
24- }
25-
268namespace rendering
279{
2810
@@ -39,7 +21,7 @@ namespace rendering
3921 void DirLight::confShadowMap (Shader &shader)
4022 {
4123 // Since shader.setUniform expects Eigen matrices
42- const Eigen::Matrix4f lightSpaceEigen = toEigen (m_lightSpaceMatrix);
24+ const Eigen::Matrix4f lightSpaceEigen = glmToEigen (m_lightSpaceMatrix);
4325 shader.setUniform (" lightSpaceMatrix" , lightSpaceEigen);
4426
4527 // Prepare the shadow map framebuffer
You can’t perform that action at this time.
0 commit comments