Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
added history graph
Browse files Browse the repository at this point in the history
  • Loading branch information
aidinabedi committed Dec 24, 2010
1 parent 2605c0e commit 37c43ef
Show file tree
Hide file tree
Showing 9 changed files with 815 additions and 0 deletions.
47 changes: 47 additions & 0 deletions ShinyOgre/include/HistoryGraph.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) 2009 Aidin Abedi. All Rights Reserved. //
//******************************************************//

#pragma once

#include "ShinyOgre.h"

namespace ShinyOgre {


//-----------------------------------------------------------------------------

class HistoryGraph {
private:

Ogre::ManualObject* mObject;
/*
Ogre::Overlay* mOverlay;
Ogre::SceneNode* mNode;
*/

std::vector<Real> mPoints;

float mScale;

void initialize(void);
void refresh(void);

public:

HistoryGraph(void);
~HistoryGraph() { destroy(); }

void resize(uint count);
void reset(void);

void addPoint(Ogre::Real value);
void setScale(Ogre::Real scale) { mScale = scale * 2; }

void create(const String& material = "BaseWhiteNoLighting");
void destroy(void);

void show(void);
void hide(void);
};

} // namespace
82 changes: 82 additions & 0 deletions ShinyOgre/include/Profiler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright (c) 2009 Aidin Abedi. All Rights Reserved. //
//******************************************************//

#pragma once

#include "Common.h"
#include "Singleton.h"
#include "System.h"
#include "ProfilerAddon.h"
#include "Action.h"


namespace R3 { // tolua_export


//-----------------------------------------------------------------------------

class Profiler : // tolua_export
public Singleton<Profiler>,
public System /* if you think public is a mistake, think again */ // tolua_export
,
private Action
{ // tolua_export
private:

uint m_nFramesElapsed;
uint m_nFramesMax;
float m_fDamping;

int m_mode;
bool m_firstUpdate;

typedef vector<ProfilerAddon*> AddonVector;

AddonVector mAddons;

static const char* skipNamespace(const char* name);
void removeNamespaces(void);

virtual bool actionPressed(int clicks);
virtual String actionName(void) { return "CycleProfiler"; }
virtual bool actionUnload(void) { return true; }

virtual void systemLoad(void);
virtual bool systemUnload(void);
virtual void systemUpdate(void);

virtual String systemName(void) { return "Profiler"; }

virtual int systemPriority(void) { return SP_PROFILER; }

public: // tolua_export

// tolua_begin
Profiler(void);
~Profiler(void) { destroyAllAddons(); }
// tolua_end

// tolua_begin
void setMode(PROFILERMODE mode);
PROFILERMODE getMode(void) { return static_cast<PROFILERMODE>(m_mode); }

void setFrames(uint a_nFrames);
uint getFrames(void) { return m_nFramesMax; }

void setDamping(float a_fDamping) { m_fDamping = a_fDamping; }
float getDamping(void) { return m_fDamping; }

static Profiler& getSingleton(void) { return Singleton<Profiler>::getSingleton(); }
static Profiler* getSingletonPtr(void) { return Singleton<Profiler>::getSingletonPtr(); }

void addon(ProfilerAddon* p);
void removeAddon(ProfilerAddon* p);

void updateAllAddons(void);
void destroyAllAddons(void);

void clear(void) { PROFILE_DESTROY(); }
// tolua_end
}; // tolua_export

} // namespace // tolua_export
57 changes: 57 additions & 0 deletions ShinyOgre/include/ProfilerGraph.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) 2009 Aidin Abedi. All Rights Reserved. //
//******************************************************//

#pragma once

#include "HistoryGraph.h"
#include "ProfilerAddon.h"


namespace R3 { // tolua_export


//-----------------------------------------------------------------------------

PROFILE_SHARED_EXTERN(DisplaySystem);
PROFILE_SHARED_EXTERN(ScriptSystem);
PROFILE_SHARED_EXTERN(PhysicsSystem);
PROFILE_SHARED_EXTERN(Debug);


//-----------------------------------------------------------------------------

class ProfilerGraph : // tolua_export
public ProfilerAddon // tolua_export
{ // tolua_export
private:

enum GRAPH {
GRAPH_DISPLAY,
GRAPH_SCRIPT,
GRAPH_PHYSICS,
GRAPH_DEBUG,

GRAPH_MAX,
GRAPH_ZORDER = 100
};

PROFILERMODE m_mode;

HistoryGraph m_Graphs[GRAPH_MAX];

void show(void);
void hide(void);

virtual void profilerLoad();
virtual void profilerMode(PROFILERMODE mode);

virtual void profilerUpdate(void);

public: // tolua_begin

ProfilerGraph(void);
~ProfilerGraph() {}
};
// tolua_end

} // namespace // tolua_export
39 changes: 39 additions & 0 deletions ShinyOgre/include/ProfilerOutput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) 2009 Aidin Abedi. All Rights Reserved. //
//******************************************************//

#pragma once

#include "Common.h"
#include "ProfilerAddon.h"


namespace R3 { // tolua_export


//-----------------------------------------------------------------------------

class ProfilerOutput : // tolua_export
public ProfilerAddon // tolua_export
{ // tolua_export
private:

PROFILERMODE m_mode;

Ogre::Overlay* m_Overlay;
Ogre::OverlayElement* m_Output;
Ogre::OverlayElement* m_Variables;

string getVariablesAsString(void);

public: // tolua_begin

ProfilerOutput(void);
~ProfilerOutput() {}

void profilerMode(PROFILERMODE mode);

void profilerUpdate(void);
};
// tolua_end

} // namespace // tolua_export
32 changes: 32 additions & 0 deletions ShinyOgre/scripts/ShinyOgre.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\HistoryGraph.cpp"
>
</File>
<File
RelativePath="..\src\Profiler.cpp"
>
</File>
<File
RelativePath="..\src\ProfilerGraph.cpp"
>
</File>
<File
RelativePath="..\src\ProfilerOutput.cpp"
>
</File>
<File
RelativePath="..\src\ShinyOgre.cpp"
>
Expand All @@ -163,6 +179,22 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\include\HistoryGraph.h"
>
</File>
<File
RelativePath="..\include\Profiler.h"
>
</File>
<File
RelativePath="..\include\ProfilerGraph.h"
>
</File>
<File
RelativePath="..\include\ProfilerOutput.h"
>
</File>
<File
RelativePath="..\include\ShinyOgre.h"
>
Expand Down
Loading

0 comments on commit 37c43ef

Please sign in to comment.