Disabled final model matrix caching for now, since it doesn't seem to work in all cases. (CP_Rocky2 pickup platforms and ceiling doens't get updated for some reason?!?)

This commit is contained in:
2016-03-13 00:57:54 +01:00
parent a1fda82d3a
commit 993e56ec59
+8 -8
View File
@@ -144,16 +144,16 @@ glm::mat4 TransformSystem::ModelMatrix(EntityID entityID, World* world)
glm::mat4 TransformSystem::ModelMatrix(EntityWrapper entity)
{
auto cacheIt = MatrixCache.find(entity);
ComponentWrapper cTransform = entity["Transform"];
bool isDirty = cTransform["Position"].Dirty(DirtySetType::Transform) || cTransform["Orientation"].Dirty(DirtySetType::Transform) || cTransform["Scale"].Dirty(DirtySetType::Transform);
if (cacheIt != MatrixCache.end() && !isDirty && false) {
return cacheIt->second;
} else {
//auto cacheIt = MatrixCache.find(entity);
//ComponentWrapper cTransform = entity["Transform"];
//bool isDirty = cTransform["Position"].Dirty(DirtySetType::Transform) || cTransform["Orientation"].Dirty(DirtySetType::Transform) || cTransform["Scale"].Dirty(DirtySetType::Transform);
//if (cacheIt != MatrixCache.end() && !isDirty && false) {
// return cacheIt->second;
//} else {
glm::mat4 matrix = glm::translate(AbsolutePosition(entity)) * glm::toMat4(AbsoluteOrientation(entity)) * glm::scale(AbsoluteScale(entity));
MatrixCache[entity] = matrix;
// MatrixCache[entity] = matrix;
return matrix;
}
//}
}
glm::vec3 TransformSystem::TransformPoint(const glm::vec3& point, const glm::mat4& matrix)