mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-24 19:42:04 +00:00
Solution for not breaking SDK ABI
This commit is contained in:
parent
619c5d43f8
commit
e74e8f5d7c
4 changed files with 19 additions and 10 deletions
|
@ -2628,6 +2628,7 @@ idSessionLocal::Frame
|
|||
===============
|
||||
*/
|
||||
extern bool CheckOpenALDeviceAndRecoverIfNeeded();
|
||||
extern int g_screenshotFormat;
|
||||
void idSessionLocal::Frame() {
|
||||
|
||||
if ( com_asyncSound.GetInteger() == 0 ) {
|
||||
|
@ -2666,7 +2667,8 @@ void idSessionLocal::Frame() {
|
|||
// skipped frames so write them out
|
||||
int c = aviDemoFrameCount - aviTicStart;
|
||||
while ( c-- ) {
|
||||
renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL, 0 );
|
||||
g_screenshotFormat = 0;
|
||||
renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL );
|
||||
name = va("demos/%s/%s_%05i.tga", aviDemoShortName.c_str(), aviDemoShortName.c_str(), ++aviTicStart );
|
||||
}
|
||||
}
|
||||
|
@ -2676,7 +2678,8 @@ void idSessionLocal::Frame() {
|
|||
console->ClearNotifyLines();
|
||||
|
||||
// this will call Draw, possibly multiple times if com_aviDemoSamples is > 1
|
||||
renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL, 0 );
|
||||
g_screenshotFormat = 0;
|
||||
renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL );
|
||||
}
|
||||
|
||||
// at startup, we may be backwards
|
||||
|
|
|
@ -229,7 +229,7 @@ public:
|
|||
// This will perform swapbuffers, so it is NOT an approppriate way to
|
||||
// generate image files that happen during gameplay, as for savegame
|
||||
// markers. Use WriteRender() instead.
|
||||
virtual void TakeScreenshot( int width, int height, const char *fileName, int samples, struct renderView_s *ref, int overrideFormat = -1 ) = 0;
|
||||
virtual void TakeScreenshot( int width, int height, const char *fileName, int samples, struct renderView_s *ref ) = 0;
|
||||
|
||||
// the render output can be cropped down to a subset of the real screen, as
|
||||
// for save-game reviews and split-screen multiplayer. Users of the renderer
|
||||
|
|
|
@ -306,6 +306,9 @@ PFNGLDEPTHBOUNDSEXTPROC qglDepthBoundsEXT;
|
|||
// DG: couldn't find any extension for this, it's supported in GL2.0 and newer, incl OpenGL ES2.0
|
||||
PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate;
|
||||
|
||||
// eez: This is a slight hack for letting us select the desired screenshot format in other functions
|
||||
int g_screenshotFormat = -1;
|
||||
|
||||
/*
|
||||
=================
|
||||
R_CheckExtension
|
||||
|
@ -1299,9 +1302,9 @@ Downsample is the number of steps to mipmap the image before saving it
|
|||
If ref == NULL, session->updateScreen will be used
|
||||
==================
|
||||
*/
|
||||
void idRenderSystemLocal::TakeScreenshot( int width, int height, const char *fileName, int blends, renderView_t *ref, int overrideFormat ) {
|
||||
void idRenderSystemLocal::TakeScreenshot( int width, int height, const char *fileName, int blends, renderView_t *ref ) {
|
||||
byte *buffer, *swapBuffer;
|
||||
int i, j, k;
|
||||
int i, j;
|
||||
|
||||
takingScreenshot = true;
|
||||
|
||||
|
@ -1355,11 +1358,11 @@ void idRenderSystemLocal::TakeScreenshot( int width, int height, const char *fil
|
|||
}
|
||||
|
||||
// If no specific format is requested, default to using the CVar value.
|
||||
if (overrideFormat == -1) {
|
||||
overrideFormat = cvarSystem->GetCVarInteger( "r_screenshotFormat" );
|
||||
if (g_screenshotFormat == -1) {
|
||||
g_screenshotFormat = cvarSystem->GetCVarInteger( "r_screenshotFormat" );
|
||||
}
|
||||
|
||||
switch (overrideFormat) {
|
||||
switch (g_screenshotFormat) {
|
||||
default:
|
||||
stbi_write_tga_to_func( WriteScreenshot, f, width, height, 3, buffer );
|
||||
break;
|
||||
|
@ -1375,6 +1378,8 @@ void idRenderSystemLocal::TakeScreenshot( int width, int height, const char *fil
|
|||
break;
|
||||
}
|
||||
|
||||
g_screenshotFormat = -1;
|
||||
|
||||
fileSystem->CloseFile(f);
|
||||
|
||||
R_StaticFree( buffer );
|
||||
|
@ -1633,7 +1638,8 @@ void R_EnvShot_f( const idCmdArgs &args ) {
|
|||
ref.height = glConfig.vidHeight;
|
||||
ref.viewaxis = axis[i];
|
||||
sprintf( fullname, "env/%s%s", baseName, extensions[i] );
|
||||
tr.TakeScreenshot( size, size, fullname, blends, &ref, 0 );
|
||||
g_screenshotFormat = 0;
|
||||
tr.TakeScreenshot( size, size, fullname, blends, &ref );
|
||||
}
|
||||
|
||||
common->Printf( "Wrote %s, etc\n", fullname.c_str() );
|
||||
|
|
|
@ -721,7 +721,7 @@ public:
|
|||
virtual void DrawDemoPics();
|
||||
virtual void BeginFrame( int windowWidth, int windowHeight );
|
||||
virtual void EndFrame( int *frontEndMsec, int *backEndMsec );
|
||||
virtual void TakeScreenshot( int width, int height, const char *fileName, int downSample, renderView_t *ref, int overrideFormat = -1 );
|
||||
virtual void TakeScreenshot( int width, int height, const char *fileName, int downSample, renderView_t *ref );
|
||||
virtual void CropRenderSize( int width, int height, bool makePowerOfTwo = false, bool forceDimensions = false );
|
||||
virtual void CaptureRenderToImage( const char *imageName );
|
||||
virtual void CaptureRenderToFile( const char *fileName, bool fixAlpha );
|
||||
|
|
Loading…
Reference in a new issue