mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 23:45:14 +02:00
- changed g3d screenshot resizing to render at desired screensize instead of scaling image.
This commit is contained in:
@@ -260,6 +260,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
|||||||
|
|
||||||
bool autoScreenShotAndExit = false;
|
bool autoScreenShotAndExit = false;
|
||||||
vector<string> autoScreenShotParams;
|
vector<string> autoScreenShotParams;
|
||||||
|
std::pair<int,int> overrideSize(0,0);
|
||||||
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
// class MainWindow
|
// class MainWindow
|
||||||
@@ -572,28 +573,13 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||||||
// notice that we use GetSize() here and not GetClientSize() because
|
// notice that we use GetSize() here and not GetClientSize() because
|
||||||
// the latter doesn't return correct results for the minimized windows
|
// the latter doesn't return correct results for the minimized windows
|
||||||
// (at least not under Windows)
|
// (at least not under Windows)
|
||||||
#if defined(WIN32)
|
int viewportW = GetClientSize().x;
|
||||||
/*
|
int viewportH = GetClientSize().y;
|
||||||
//Seems like windows cannot handle this consistently
|
|
||||||
|
|
||||||
if(autoScreenShotAndExit == true) {
|
#if defined(WIN32)
|
||||||
printf("\n\n$$$ GetSize() x = %d y = %d, Renderer::windowW = %d H = %d\n",GetSize().x,GetSize().y,Renderer::windowW,Renderer::windowH);
|
renderer->reset(viewportW, viewportH, playerColor);
|
||||||
//renderer->reset(GetSize().x, GetSize().y-10, playerColor);
|
|
||||||
//renderer->reset(Renderer::windowW, Renderer::windowH-20, playerColor);
|
|
||||||
//this->Iconize(false);
|
|
||||||
|
|
||||||
//this->Refresh();
|
|
||||||
//renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
|
||||||
renderer->reset(Renderer::windowW, Renderer::windowH-20, playerColor);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("\n\n### GetClientSize() x = %d y = %d\n",GetClientSize().x,GetClientSize().y);
|
|
||||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
|
||||||
#else
|
#else
|
||||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
renderer->reset(viewportW, viewportH, playerColor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
renderer->transform(rotX, rotY, zoom);
|
renderer->transform(rotX, rotY, zoom);
|
||||||
@@ -950,22 +936,6 @@ void MainWindow::onMenumFileToggleScreenshotTransparent(wxCommandEvent &event) {
|
|||||||
|
|
||||||
void MainWindow::saveScreenshot() {
|
void MainWindow::saveScreenshot() {
|
||||||
try {
|
try {
|
||||||
std::pair<int,int> overrideSize(0,0);
|
|
||||||
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
|
||||||
if(_strnicmp(autoScreenShotParams[i].c_str(),"resize-",7) == 0) {
|
|
||||||
printf("Screenshot option [%s]\n",autoScreenShotParams[i].c_str());
|
|
||||||
|
|
||||||
string resize = autoScreenShotParams[i];
|
|
||||||
resize = resize.erase(0,7);
|
|
||||||
vector<string> values;
|
|
||||||
Tokenize(resize,values,"x");
|
|
||||||
overrideSize.first = strToInt(values[0]);
|
|
||||||
overrideSize.second = strToInt(values[1]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int autoSaveScreenshotIndex = -1;
|
int autoSaveScreenshotIndex = -1;
|
||||||
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
||||||
if(_strnicmp(autoScreenShotParams[i].c_str(),"saveas-",7) == 0) {
|
if(_strnicmp(autoScreenShotParams[i].c_str(),"saveas-",7) == 0) {
|
||||||
@@ -2069,13 +2039,27 @@ bool App::OnInit() {
|
|||||||
autoScreenShotParams.clear();
|
autoScreenShotParams.clear();
|
||||||
Tokenize(optionsValue,autoScreenShotParams,",");
|
Tokenize(optionsValue,autoScreenShotParams,",");
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
|
std::auto_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
|
||||||
autoScreenShotParams[i] = utf8_encode(wstr.get());
|
autoScreenShotParams[i] = utf8_encode(wstr.get());
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
if(_strnicmp(autoScreenShotParams[i].c_str(),"resize-",7) == 0) {
|
||||||
|
printf("Screenshot option [%s]\n",autoScreenShotParams[i].c_str());
|
||||||
|
|
||||||
|
string resize = autoScreenShotParams[i];
|
||||||
|
resize = resize.erase(0,7);
|
||||||
|
vector<string> values;
|
||||||
|
Tokenize(resize,values,"x");
|
||||||
|
overrideSize.first = strToInt(values[0]);
|
||||||
|
overrideSize.second = strToInt(values[1]);
|
||||||
|
|
||||||
|
Renderer::windowW = overrideSize.first;
|
||||||
|
Renderer::windowH = overrideSize.second + 25;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,9 @@ using namespace Shared::Graphics::Gl;
|
|||||||
|
|
||||||
namespace Shared{ namespace G3dViewer{
|
namespace Shared{ namespace G3dViewer{
|
||||||
|
|
||||||
|
int Renderer::windowW= 640;
|
||||||
|
int Renderer::windowH= 480;
|
||||||
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
// class MeshCallbackTeamColor
|
// class MeshCallbackTeamColor
|
||||||
// ===============================================
|
// ===============================================
|
||||||
@@ -494,9 +497,9 @@ void Renderer::saveScreen(const string &path,std::pair<int,int> *overrideSize) {
|
|||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
if(overrideSize != NULL && overrideSize->first > 0 && overrideSize->second > 0) {
|
//if(overrideSize != NULL && overrideSize->first > 0 && overrideSize->second > 0) {
|
||||||
pixmapScreenShot->Scale(GL_RGBA,overrideSize->first,overrideSize->second);
|
// pixmapScreenShot->Scale(GL_RGBA,overrideSize->first,overrideSize->second);
|
||||||
}
|
//}
|
||||||
|
|
||||||
pixmapScreenShot->save(path);
|
pixmapScreenShot->save(path);
|
||||||
delete pixmapScreenShot;
|
delete pixmapScreenShot;
|
||||||
|
@@ -70,8 +70,8 @@ class Renderer : public RendererInterface {
|
|||||||
public:
|
public:
|
||||||
static const int windowX= 100;
|
static const int windowX= 100;
|
||||||
static const int windowY= 100;
|
static const int windowY= 100;
|
||||||
static const int windowW= 640;
|
static int windowW;
|
||||||
static const int windowH= 480;
|
static int windowH;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum PlayerColor{
|
enum PlayerColor{
|
||||||
|
Reference in New Issue
Block a user