Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-08-18 09:24:15 +0000
committerStijn Buys <ingar@osirion.org>2009-08-18 09:24:15 +0000
commitf030154fe727e25a2afe1f78b3998c2d2dba95e4 (patch)
treecd92baf9e4fa8a136523b9eb570e9811846c9250 /src/render/screenshot.cc
parent5636fad174f0bcff857c357c394c4cc8d424b302 (diff)
astyle cleanup, corrects not loading of material textures
Diffstat (limited to 'src/render/screenshot.cc')
-rw-r--r--src/render/screenshot.cc53
1 files changed, 27 insertions, 26 deletions
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 <iomanip>
@@ -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);