mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 12:39:49 -06:00
Initial work on performance measuring
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
namespace ghoul {
|
||||
class SharedMemory;
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
// Forward declare to minimize dependencies
|
||||
@@ -59,6 +63,8 @@ public:
|
||||
void takeScreenshot();
|
||||
void toggleVisualizeABuffer(bool b);
|
||||
|
||||
void setPerformanceMeasurements(bool performanceMeasurements);
|
||||
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
|
||||
@@ -72,8 +78,9 @@ public:
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
|
||||
private:
|
||||
void storePerformanceMeasurements();
|
||||
|
||||
Camera* _mainCamera;
|
||||
SceneGraph* _sceneGraph;
|
||||
ABuffer* _abuffer;
|
||||
@@ -83,6 +90,9 @@ private:
|
||||
bool _showScreenLog;
|
||||
bool _takeScreenshot;
|
||||
|
||||
bool _doPerformanceMeasurements;
|
||||
ghoul::SharedMemory* _performanceMemory;
|
||||
|
||||
void generateGlslConfig();
|
||||
|
||||
bool _visualizeABuffer;
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <openspace/util/updatestructures.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
// ghoul includes
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
@@ -44,6 +43,8 @@ namespace openspace {
|
||||
|
||||
class SceneGraphNode;
|
||||
|
||||
// Notifications:
|
||||
// SceneGraphFinishedLoading
|
||||
class SceneGraph {
|
||||
public:
|
||||
// constructors & destructor
|
||||
@@ -99,6 +100,8 @@ public:
|
||||
*/
|
||||
SceneGraphNode* sceneGraphNode(const std::string& name) const;
|
||||
|
||||
std::vector<SceneGraphNode*> allSceneGraphNodes() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to change the
|
||||
* scene graph. The functions contained are
|
||||
|
||||
@@ -44,9 +44,14 @@ namespace openspace {
|
||||
|
||||
class SceneGraphNode : public properties::PropertyOwner {
|
||||
public:
|
||||
struct PerformanceRecord {
|
||||
long long renderTime; // time in ns
|
||||
long long updateTimeRenderable; // time in ns
|
||||
long long updateTimeEphemeris; // time in ns
|
||||
};
|
||||
|
||||
static std::string RootNodeName;
|
||||
|
||||
// constructors & destructor
|
||||
SceneGraphNode();
|
||||
~SceneGraphNode();
|
||||
|
||||
@@ -55,12 +60,10 @@ public:
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
// essential
|
||||
void update(const UpdateData& data);
|
||||
void evaluate(const Camera* camera, const psc& parentPosition = psc());
|
||||
void render(const RenderData& data);
|
||||
|
||||
// set & get
|
||||
void addNode(SceneGraphNode* child);
|
||||
|
||||
void setParent(SceneGraphNode* parent);
|
||||
@@ -70,7 +73,6 @@ public:
|
||||
SceneGraphNode* parent() const;
|
||||
const std::vector<SceneGraphNode*>& children() const;
|
||||
|
||||
// bounding sphere
|
||||
PowerScaledScalar calculateBoundingSphere();
|
||||
PowerScaledScalar boundingSphere() const;
|
||||
|
||||
@@ -78,27 +80,26 @@ public:
|
||||
|
||||
void print() const;
|
||||
|
||||
// renderable
|
||||
const PerformanceRecord& performanceRecord() const { return _performanceRecord; }
|
||||
|
||||
void setRenderable(Renderable* renderable);
|
||||
const Renderable* renderable() const;
|
||||
Renderable* renderable();
|
||||
|
||||
private:
|
||||
// essential
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
bool sphereInsideFrustum(const psc s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
|
||||
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
SceneGraphNode* _parent;
|
||||
Ephemeris* _ephemeris;
|
||||
|
||||
// renderable
|
||||
PerformanceRecord _performanceRecord;
|
||||
|
||||
Renderable* _renderable;
|
||||
bool _renderableVisible;
|
||||
|
||||
// bounding sphere
|
||||
bool _boundingSphereVisible;
|
||||
PowerScaledScalar _boundingSphere;
|
||||
|
||||
// private helper methods
|
||||
bool sphereInsideFrustum(const psc s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -33,12 +33,13 @@ namespace openspace {
|
||||
struct UpdateData {
|
||||
double time;
|
||||
double delta;
|
||||
bool doPerformanceMeasurement;
|
||||
};
|
||||
|
||||
struct RenderData {
|
||||
const Camera& camera;
|
||||
psc position;
|
||||
|
||||
bool doPerformanceMeasurement;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user