From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/render/screenshot.cc | 53 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'src/render/screenshot.cc') diff --git a/src/render/screenshot.cc b/src/render/screenshot.cc index dcbada4..342977a 100644 --- a/src/render/screenshot.cc +++ b/src/render/screenshot.cc @@ -1,7 +1,7 @@ /* render/screenshot.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 */ #include @@ -17,7 +17,8 @@ #include "render/tgafile.h" #include "render/gl.h" -namespace render { +namespace render +{ core::Cvar *Screenshot::screenshotformat = 0; core::Cvar *Screenshot::screenshotquality = 0; @@ -27,7 +28,7 @@ int Screenshot::number = 0; void Screenshot::save() { - bool available = false; + bool available = false; std::string filename; const int TYPETGA = 0; const int TYPEPNG = 1; @@ -46,7 +47,7 @@ void Screenshot::save() if ((screenshotformat->str().compare("jpg") == 0) || (screenshotformat->str().compare("jpeg") == 0)) { filetype = TYPEJPG; - if (screenshotquality->value() == 0 ) { + if (screenshotquality->value() == 0) { (*screenshotquality) = 85; } else if (screenshotquality->value() < 10) { (*screenshotquality) = 10; @@ -65,19 +66,19 @@ void Screenshot::save() (*screenshotformat) = "tga"; } - // find the first available screenshots/osirion-yyyymmdd-hhmm-xxxx.ext + // find the first available screenshots/osirion-yyyymmdd-hhmm-xxxx.ext std::stringstream filenamestr; int day, month, year, hour, min; - + sys::get_datetime(year, month, day, hour, min); - + filenamestr << filesystem::writedir() << "screenshots/osirion" << '-'; // date filenamestr << std::setfill('0') << std::setw(4) << year << std::setw(2) << month << std::setw(2) << day << '-'; - // time + // time filenamestr << std::setfill('0') << std::setw(2) << hour << std::setw(2) << min << '-'; - do { + do { std::stringstream nstr; nstr << std::setw(4) << std::setfill('0') << number; @@ -88,32 +89,32 @@ void Screenshot::save() filename.append("."); filename.append(screenshotformat->str()); - FILE *handle = fopen(filename.c_str(), "r"); - if (handle) { - fclose(handle); - } else { - available = true; - } + FILE *handle = fopen(filename.c_str(), "r"); + if (handle) { + fclose(handle); + } else { + available = true; + } number++; - } while (!available); + } while (!available); render::Image image(State::width(), State::height(), 3); - glReadPixels(0, 0, (GLsizei) State::width(), (GLsizei) State::height(), - GL_RGB, GL_UNSIGNED_BYTE, (void *) image.data()); + glReadPixels(0, 0, (GLsizei) State::width(), (GLsizei) State::height(), + GL_RGB, GL_UNSIGNED_BYTE, (void *) image.data()); image.flip(); if (filetype == TYPEPNG) { -/* if ((Camera::width() % 8 != 0 ) || (Camera::height() % 8 != 0 )) { - image.pad(); - }*/ + /* if ((Camera::width() % 8 != 0 ) || (Camera::height() % 8 != 0 )) { + image.pad(); + }*/ render::PNG::save(filename.c_str(), image); } else if (filetype == TYPEJPG) { -/* if ((Camera::width() % 8 != 0 ) || (Camera::height() % 8 != 0 )) { - image.pad(); - } -*/ + /* if ((Camera::width() % 8 != 0 ) || (Camera::height() % 8 != 0 )) { + image.pad(); + } + */ render::JPG::save(filename.c_str(), image, (int) screenshotquality->value()); } else if (filetype == TYPETGA) { render::TGA::save(filename.c_str(), image); -- cgit v1.2.3