fix wrong entity display position on slow movement
This commit is contained in:
@@ -32,6 +32,8 @@ void Transform::refresh() {
|
|||||||
combined = glm::translate(combined, pos);
|
combined = glm::translate(combined, pos);
|
||||||
combined = glm::scale(combined, size);
|
combined = glm::scale(combined, size);
|
||||||
combined = combined * glm::mat4(rot);
|
combined = combined * glm::mat4(rot);
|
||||||
|
displayPos = pos;
|
||||||
|
displaySize = size;
|
||||||
dirty = false;
|
dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ struct Transform {
|
|||||||
glm::mat4 combined;
|
glm::mat4 combined;
|
||||||
bool dirty = true;
|
bool dirty = true;
|
||||||
|
|
||||||
|
glm::vec3 displayPos;
|
||||||
|
glm::vec3 displaySize;
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
inline void setRot(glm::mat3 m) {
|
inline void setRot(glm::mat3 m) {
|
||||||
@@ -52,14 +55,14 @@ struct Transform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void setSize(glm::vec3 v) {
|
inline void setSize(glm::vec3 v) {
|
||||||
if (glm::distance2(size, v) >= 0.0000001f) {
|
if (glm::distance2(displaySize, v) >= 0.00001f) {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
size = v;
|
size = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setPos(glm::vec3 v) {
|
inline void setPos(glm::vec3 v) {
|
||||||
if (glm::distance2(pos, v) >= 0.00001f) {
|
if (glm::distance2(displayPos, v) >= 0.0001f) {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
pos = v;
|
pos = v;
|
||||||
|
|||||||
Reference in New Issue
Block a user