Remove warnings from RenderEngine

This commit is contained in:
Alexander Bock
2014-12-03 00:18:15 +01:00
parent eb6641a87b
commit 56e9892c56
3 changed files with 17 additions and 24 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ std::vector<ABufferSingleLinked::fragmentData> ABufferSingleLinked::pixelData()
float z = glm::uintBitsToFloat(fragment[0]);
unsigned int next = bitextract_u(fragment[1], mask_id_next, shift_id_next);
glm::vec4 color(glm::unpackUnorm2x16(fragment[2]), glm::unpackUnorm2x16(fragment[3]));
LDEBUG("(" << x << ", " << y << "): " << z);
//LDEBUG("(" << x << ", " << y << "): " << z);
fragmentData fd;
fd._position[0] = fx;
+15 -22
View File
@@ -87,7 +87,7 @@ int printImage(lua_State* L) {
/**
* \ingroup LuaScripts
* visualizeABuffer(bool):
* Toggler the visualization of the ABuffer
* Toggle the visualization of the ABuffer
*/
int visualizeABuffer(lua_State* L) {
int nArguments = lua_gettop(L);
@@ -95,17 +95,9 @@ int visualizeABuffer(lua_State* L) {
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
const int type = lua_type(L, -1);
if (type == LUA_TBOOLEAN) {
bool b = lua_toboolean(L, -1);
OsEng.renderEngine().toggleVisualizeABuffer(b);
return 0;
}
else if (type == LUA_TNUMBER){
lua_Number n = luaL_checknumber(L, -1);
OsEng.renderEngine().toggleVisualizeABuffer(static_cast<bool>(n));
return 0;
}
return luaL_error(L, "Expected boolean value");
bool b = lua_toboolean(L, -1) != 0;
OsEng.renderEngine().toggleVisualizeABuffer(b);
return 0;
}
} // namespace luascriptfunctions
@@ -321,7 +313,7 @@ void RenderEngine::render()
// TODO: Adjust font_size properly when using retina screen
const int font_size_mono = 10;
const int font_size_light = 8;
const int font_with_light = font_size_light*0.7;
const int font_with_light = static_cast<int>(font_size_light*0.7);
const sgct_text::Font* fontLight = sgct_text::FontManager::instance()->getFont(constants::fonts::keyLight, font_size_light);
const sgct_text::Font* fontMono = sgct_text::FontManager::instance()->getFont(constants::fonts::keyMono, font_size_mono);
@@ -338,7 +330,8 @@ void RenderEngine::render()
// GUI PRINT
// Using a macro to shorten line length and increase readability
#define PrintText(i, format, ...) Freetype::print(font, 10, startY - font_size_mono * i * 2, format, __VA_ARGS__);
#define PrintText(i, format, ...) Freetype::print(font, 10.f, static_cast<float>(startY - font_size_mono * i * 2), format, __VA_ARGS__);
int i = 0;
PrintText(i++, "Date: %s", Time::ref().currentTimeUTC().c_str());
PrintText(i++, "Avg. Frametime: %.5f", sgct::Engine::instance()->getAvgDt());
@@ -358,8 +351,8 @@ void RenderEngine::render()
const int max = 10;
const int category_length = 20;
const int msg_length = 140;
const double ttl = 15.0;
const double fade = 5.0;
const float ttl = 15.f;
const float fade = 5.f;
auto entries = _log->last(max);
const glm::vec4 white(0.9, 0.9, 0.9, 1);
@@ -373,7 +366,7 @@ void RenderEngine::render()
const ScreenLog::LogEntry* e = &(*it);
const double t = sgct::Engine::instance()->getTime();
double diff = t - e->timeStamp;
float diff = static_cast<float>(t - e->timeStamp);
// Since all log entries are ordered, once one is exceeding TTL, all have
if (diff > ttl)
@@ -383,8 +376,8 @@ void RenderEngine::render()
float ttf = ttl - fade;
if (diff > ttf) {
diff = diff - ttf;
float p = 0.8 - diff / fade;
alpha = (p <= 0.0) ? 0.0 : pow(p, 0.3);
float p = 0.8f - diff / fade;
alpha = (p <= 0.f) ? 0.f : pow(p, 0.3f);
}
// Since all log entries are ordered, once one exceeds alpha, all have
@@ -392,7 +385,7 @@ void RenderEngine::render()
break;
std::string lvl = "(" + ghoul::logging::LogManager::stringFromLevel(e->level) + ")";
Freetype::print(font, 10, font_size_light * nr * 2, white*alpha,
Freetype::print(font, 10.f, static_cast<float>(font_size_light * nr * 2), white*alpha,
"%-14s %s%s", // Format
e->timeString.c_str(), // Time string
e->category.substr(0, category_length).c_str(), // Category string (up to category_length)
@@ -408,8 +401,8 @@ void RenderEngine::render()
if (e->level == ghoul::logging::LogManager::LogLevel::Fatal)
color = blue;
Freetype::print(font, 10 + 39 * font_with_light, font_size_light * nr * 2, color*alpha, "%s", lvl.c_str());
Freetype::print(font, 10 + 53 * font_with_light, font_size_light * nr * 2, white*alpha, "%s", e->message.substr(0, msg_length).c_str());
Freetype::print(font, static_cast<float>(10 + 39 * font_with_light), static_cast<float>(font_size_light * nr * 2), color*alpha, "%s", lvl.c_str());
Freetype::print(font, static_cast<float>(10 + 53 * font_with_light), static_cast<float>(font_size_light * nr * 2), white*alpha, "%s", e->message.substr(0, msg_length).c_str());
++nr;
}
}