这里我想实现一个类似于glulookat()
的简单OpenGL函数:
mat4 Transform::lookAt(vec3 eye, vec3 up) {
vec3 w = glm::normalize(eye);
vec3 u = glm::normalize(glm::cross(up, w));
vec3 v = glm::cross(w, u);
mat4 r = (
u.x, u.y, u.z, 0,
v.x, v.y, v.z, 0,
w.x, w.y, w.z, 0,
0, 0, 0, 1
);
mat4 t = (
1.0, 0.0, 0.0, -eye.x,
0.0, 1.0, 0.0, -eye.y,
0.0, 0.0, 1.0, -eye.z,
0.0, 0.0, 0.0, 1.0
);
mat4 result = glm::transpose(r)*glm::transpose(t);
return result;
}
VS2017告诉我:Error (active) E0415 no suitable constructor exists to convert from "double" to "glm::detail::tmat4x4<glm::core::type::precision::lowp_float>"
我知道此问题可能是由类型转换引起的,但是,在我将所有0.0
修改为0
后,再次出现类似的问题(从"int"
到XXX没有合适的XXX)。我无法弄清楚如何解决它。有什么建议吗?
答案 0 :(得分:1)
矩阵声明代码Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
中存在语法错误
是错的。正确的语法应该是:
mat4 r = (...)
(没有=中间)