Reputation: 1758
If I declare a value as glm::vec3 myVector;
am I able to just check
safely that it is null by doing a
if (!myVector) {
setVector(myVector);
}
or is there a way to set glm::vec3
values to null without having to set each individual value to null
Upvotes: 2
Views: 3265
Reputation: 3305
When you declare the vector as
glm::vec3 myVector;
It don't get initialised, you need to declare as:
glm::vec3 myVector(0.0);
To get properly initialised to 0.
BTW:
if (!myVector) { //It is always false, because, it is a reference to a local variable, not a pointer.
If there is a single scalar parameter to a vector constructor, it is used to initialize all components of the constructed vector to that scalar’s value.
Upvotes: 1