void GlobalStats::update() { if ( !mEnabled ) return; mNamesText->setCaption( "AvgFPS:\r\nAvgTime:" ); auto stats = gEngine->getGraphics()->getRoot()->getFrameStats(); static wchar_t values[64]; swprintf_s( values, 64, L"%0.2f\r\n%0.2f", stats->getAvgFps(), stats->getAvgTime() ); mValuesText->setCaption( Ogre::UTFString( values ) ); }
void HdrApp::renderText() { // General informations Color c = Color::WHITE; font.addText(2, screenH-20, c, "OpenGL High Dynamic Range demo"); font.addText(screenW-120, screenH-20, c, "Fps: %.1f", getAvgFps()); // Selection informations c = Color(1.0f, 1.0f, 0.0f); font.addText(2, 2, c, "Press key to increase and Ctrl+key to decrease value."); font.addText(2, 22, c, "(m) Mesh: %s - %u faces", fileMesh.at(currentMesh).c_str(), mesh->getNumVertices()/3); font.addText(2, 42, c, "(c) Environment map: %s", fileCubeMap.at(currentCubeMap).c_str()); c = Color(0.6f, 0.6f, 0.8f); font.addText(2, 62, c, "(h) Effect: %s", fileShaderEffect.at(currentEffect).c_str()); // Brightness Threshold c = Color(1.0f, 1.0f, 0.0f); font.addText(2, 82, c, "(t) Bright: %.2f", brightThreshold); // Bloom factor font.addText(2, 102, c, "(o) Bloom: %.2f", bloomFactor); // Exposure font.addText(2, 122, c, "(e) Exposure: %.2f", exposure); // Fresnel parameters if (currentEffect == 3 || currentEffect == 4) { c = Color(0.6f, 0.6f, 0.8f); font.addText(screenW-190, 62, c, "Fresnel effect:"); font.addText(screenW-170, 42, c, "(b) bias: %.2f ", fresnelBias); font.addText(screenW-170, 22, c, "(s) scale: %.2f ", fresnelScale); font.addText(screenW-170, 2, c, "(p) power: %.2f ", fresnelPower); } // Material color if (currentEffect == 0) { c = Color(0.6f, 0.6f, 0.8f); font.addText(screenW-160, 62, c, "Material color:"); font.addText(screenW-140, 42, c, "(1) R: %.2f ", matColor.r); font.addText(screenW-140, 22, c, "(2) G: %.2f ", matColor.g); font.addText(screenW-140, 2, c, "(3) B: %.2f ", matColor.b); } // eta ratio if (currentEffect == 2 || currentEffect == 3) { c = Color(0.6f, 0.6f, 0.8f); font.addText(2, 142, c, "(a) eta ratio: %.2f", etaRatio.x); } // eta ratio : rgb if (currentEffect == 4) { c = Color(0.6f, 0.6f, 0.8f); font.addText(screenW-360, 62, c, "(a) eta ratio:"); font.addText(screenW-340, 42, c, "(5) R: %.2f ", etaRatio.x); font.addText(screenW-340, 22, c, "(6) G: %.2f ", etaRatio.y); font.addText(screenW-340, 2, c, "(7) B: %.2f ", etaRatio.z); } // Reflection factor if (currentEffect == 0 || currentEffect == 1) { c = Color(0.6f, 0.6f, 0.8f); font.addText(2, 142, c, "(r) Reflection factor: %.2f", reflectionFactor); } // HDR and LDR c = Color(1.0f, 0.4f, 0.4f); font.addText((int)(mid*screenW), screenH-40, c, "HDR-->"); font.addText((int)(mid*screenW)-70, screenH-40, c, "<--LDR"); font.render(); }