mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 20:11:50 +00:00
add transform vectors/matrices nan/inf check
This commit is contained in:
parent
35498e1c0f
commit
f1d85000e4
3 changed files with 54 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
|
||||
#include <stdexcept>
|
||||
#include <glm/vec3.hpp>
|
||||
#include <glm/mat4x4.hpp>
|
||||
#include <glm/gtx/norm.hpp>
|
||||
|
|
@ -24,11 +25,17 @@ struct Transform {
|
|||
void refresh();
|
||||
|
||||
inline void setRot(const glm::mat3& m) {
|
||||
if (!checkValue(m)) {
|
||||
return;
|
||||
}
|
||||
rot = m;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
inline void setSize(const glm::vec3& v) {
|
||||
if (!checkValue(v)) {
|
||||
return;
|
||||
}
|
||||
if (glm::distance2(displaySize, v) >= EPSILON) {
|
||||
dirty = true;
|
||||
}
|
||||
|
|
@ -36,9 +43,15 @@ struct Transform {
|
|||
}
|
||||
|
||||
inline void setPos(const glm::vec3& v) {
|
||||
if (!checkValue(v)) {
|
||||
return;
|
||||
}
|
||||
if (glm::distance2(displayPos, v) >= EPSILON) {
|
||||
dirty = true;
|
||||
}
|
||||
pos = v;
|
||||
}
|
||||
|
||||
static bool checkValue(const glm::vec3& v);
|
||||
static bool checkValue(const glm::mat3& v);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue