简体   繁体   English

如何使用glm :: isnan()

[英]How to use glm::isnan()

I can't get glm::isnan() to compile in my Visual C++ project. 我无法在我的Visual C ++项目中编译glm :: isnan()。

#include <glm/glm.hpp>

glm::vec3 my_vector = ... ;

bool b = glm::isnan(my_vector);

The last line causes the following compilation error: 最后一行导致以下编译错误:

error C2440: 'initializing' : cannot convert from 'glm::detail::tvec3' to 'bool' 错误C2440:“正在初始化”:无法从“ glm :: detail :: tvec3”转换为“ bool”

According to documentation it returs true or false. 根据文档,它表示正确或错误。

The GLM 0.9.9 documentation for glm::isnan can be found at https://glm.g-truc.net/0.9.9/api/a00662.html . 可以在https://glm.g-truc.net/0.9.9/api/a00662.html上找到glm::isnan的GLM 0.9.9文档。 It says that the return type is vec<L, bool, Q> , so you can use glm::all like so: 它说返回类型是vec<L, bool, Q> ,所以您可以像这样使用glm::all

bool b = glm::all(glm::isnan(my_vector));

to check if all components of my_vector are NaN. 检查my_vector所有分量是否均为NaN。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM