Performance Optimizations (#450)

* Make derived transform classes less involved in simulation state
* Add performance measurements in openspaceengine
* Avoid redundant transformation lookups
* Fix bug causing redundant calls to GPULayerManager::bind
* Move water reflectance to alpha component of normal buffer. Remove otherData buffer.
This commit is contained in:
Emil Axelsson
2018-01-08 09:43:41 +01:00
committed by GitHub
parent 237affa80d
commit 4c2f72226f
57 changed files with 296 additions and 205 deletions
+8 -3
View File
@@ -35,7 +35,7 @@ namespace ghoul { class Dictionary; }
namespace openspace {
struct UpdateData;
class Time;
namespace documentation { struct Documentation; }
@@ -48,14 +48,19 @@ public:
virtual ~Rotation() = default;
virtual bool initialize();
const glm::dmat3& matrix() const;
virtual void update(const UpdateData& data);
virtual glm::dmat3 matrix(const Time& time) const = 0;
void update(const Time& time);
static documentation::Documentation Documentation();
protected:
Rotation();
void requireUpdate();
glm::dmat3 _matrix;
private:
bool _needsUpdate;
double _cachedTime;
glm::dmat3 _cachedMatrix;
};
} // namespace openspace
+10 -5
View File
@@ -35,7 +35,7 @@ namespace ghoul { class Dictionary; }
namespace openspace {
struct UpdateData;
class Time;
namespace documentation { struct Documentation; }
@@ -48,13 +48,18 @@ public:
virtual ~Scale() = default;
virtual bool initialize();
virtual double scaleValue() const;
virtual void update(const UpdateData& data);
double scaleValue() const;
virtual double scaleValue(const Time& time) const = 0;
virtual void update(const Time& data);
static documentation::Documentation Documentation();
protected:
double _scale;
void requireUpdate();
private:
bool _needsUpdate;
double _cachedTime;
double _cachedScale;
};
} // namespace openspace
+10 -7
View File
@@ -36,7 +36,7 @@ namespace ghoul { class Dictionary; }
namespace openspace {
struct UpdateData;
class Time;
namespace documentation { struct Documentation; }
@@ -49,10 +49,10 @@ public:
virtual ~Translation() = default;
virtual bool initialize();
virtual glm::dvec3 position() const;
virtual void update(const UpdateData& data);
glm::dvec3 position() const;
void update(const Time& time);
glm::dvec3 position(double time);
virtual glm::dvec3 position(const Time& time) const = 0;
// Registers a callback that gets called when a significant change has been made that
// invalidates potentially stored points, for example in trails
@@ -61,11 +61,14 @@ public:
static documentation::Documentation Documentation();
protected:
void notifyObservers();
void notifyObservers() const;
void requireUpdate();
private:
bool _needsUpdate;
double _cachedTime;
glm::dvec3 _cachedPosition;
std::function<void()> _onParameterChangeCallback;
glm::dvec3 _positionValue;
};
} // namespace openspace