00001
00002
00003 #include "SceneAnalyseGUI.h"
00004
00005 #include "CoreEngine.h"
00006 #include "TextEdit.h"
00007 #include "Utils.h"
00008 #include "String.h"
00009
00010
00011 namespace pge {
00012 namespace gui {
00013
00014
00015
00016
00017
00018
00019
00020 SceneAnalyseGUI::SceneAnalyseGUI(void) {
00021 Vector4f backgroundColor(0.5f, 0.3f, 0.3f, 0.4f);
00022
00023
00024 m_visibleTriangleCount = 0;
00025 m_visibleMeshCount = 0;
00026 m_visibleNodeCount = 0;
00027 m_occlusionCulledNodeCount = 0;
00028 m_triangleCount = 0;
00029 m_meshCount = 0;
00030 m_nodeCount = 0;
00031 m_currentFPS = 0;
00032 m_timePassed = 0;
00033
00034
00035
00036 m_textEdit0 = new TextEdit(10, 10, 300, 30);
00037 m_textEdit0->setBackgroundColor(backgroundColor);
00038 m_textEdit0->setBackgroundEnabled(true);
00039 m_textEdit0->setText(std::string("Visible triangles: 0 / ") += m_triangleCount);
00040
00041
00042 m_textEdit1 = new TextEdit(10, 25, 350, 15);
00043 m_textEdit1->setBackgroundColor(backgroundColor);
00044 m_textEdit1->setBackgroundEnabled(true);
00045 m_textEdit1->setText(std::string("Visible meshs: 0 / ") += m_meshCount);
00046
00047
00048 m_textEdit2 = new TextEdit(10, 40, 350, 15);
00049 m_textEdit2->setBackgroundColor(backgroundColor);
00050 m_textEdit2->setBackgroundEnabled(true);
00051 m_textEdit2->setText(std::string("Visible nodes: 0 / ") += m_nodeCount);
00052
00053
00054 m_textEdit4 = new TextEdit(10, 55, 350, 15);
00055 m_textEdit4->setBackgroundColor(backgroundColor);
00056 m_textEdit4->setBackgroundEnabled(true);
00057 m_textEdit4->setText(std::string("Occlusion culled nodes: ") += m_occlusionCulledNodeCount);
00058
00059
00060 m_textEdit3 = new TextEdit(10, 40, 300, 30);
00061 m_textEdit3->setBackgroundColor(backgroundColor);
00062 m_textEdit3->setBackgroundEnabled(true);
00063 m_textEdit3->setText(std::string("Current FPS: ") += m_currentFPS);
00064 }
00065
00066
00067
00068
00069
00070
00071
00072 SceneAnalyseGUI::~SceneAnalyseGUI(void) {
00073 }
00074
00075
00076
00077
00078
00079
00080
00081 SceneAnalyseGUI* SceneAnalyseGUI::getInstance(void) {
00082 static SceneAnalyseGUI instance;
00083 return &instance;
00084 }
00085
00086
00087
00088
00089
00090
00091
00092 bool SceneAnalyseGUI::init(void) {
00093 return true;
00094 }
00095
00096
00097
00098
00099
00100
00101
00102 void SceneAnalyseGUI::render(void) {
00103 String temp;
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 m_textEdit0->setText("World Of Phobos");
00118 m_textEdit0->render();
00119
00120 temp = String("Current FPS: ") + m_currentFPS;
00121 m_textEdit3->setText(temp.getString());
00122 m_textEdit3->render();
00123
00124
00125
00126
00127
00128
00129
00130 m_visibleTriangleCount = 0;
00131 m_visibleMeshCount = 0;
00132 m_visibleNodeCount = 0;
00133 m_occlusionCulledNodeCount = 0;
00134
00135 }
00136
00137
00138
00139
00140
00141
00142
00143 void SceneAnalyseGUI::timer(unsigned int delay) {
00144
00145 m_currentFPS = CoreEngine::getInstance()->getFPS();
00146
00147 if(m_timePassed >= 1000) {
00148
00149 m_timePassed = 0;
00150 }
00151 m_timePassed += delay;
00152 }
00153 };
00154 };