2013-06-23 07:49:34 +00:00
# ifndef __GL_FRAMEBUFFER
# define __GL_FRAMEBUFFER
# ifdef _WIN32
# include "win32iface.h"
# include "win32gliface.h"
# endif
2016-08-17 18:33:10 +00:00
# include <memory>
2013-06-23 07:49:34 +00:00
class FHardwareTexture ;
2016-08-06 22:40:31 +00:00
class FSimpleVertexBuffer ;
2016-08-17 18:33:10 +00:00
class FGLDebug ;
2013-06-23 07:49:34 +00:00
extern long gl_frameMS ;
extern long gl_frameCount ;
# ifdef _WIN32
class OpenGLFrameBuffer : public Win32GLFrameBuffer
{
typedef Win32GLFrameBuffer Super ;
DECLARE_CLASS ( OpenGLFrameBuffer , Win32GLFrameBuffer )
# else
# include "sdlglvideo.h"
class OpenGLFrameBuffer : public SDLGLFB
{
// typedef SDLGLFB Super; //[C]commented, DECLARE_CLASS defines this in linux
DECLARE_CLASS ( OpenGLFrameBuffer , SDLGLFB )
# endif
public :
explicit OpenGLFrameBuffer ( ) { }
OpenGLFrameBuffer ( void * hMonitor , int width , int height , int bits , int refreshHz , bool fullscreen ) ;
~ OpenGLFrameBuffer ( ) ;
void InitializeState ( ) ;
void Update ( ) ;
// Color correction
bool SetGamma ( float gamma ) ;
bool SetBrightness ( float bright ) ;
bool SetContrast ( float contrast ) ;
void DoSetGamma ( ) ;
void UpdatePalette ( ) ;
void GetFlashedPalette ( PalEntry pal [ 256 ] ) ;
PalEntry * GetPalette ( ) ;
bool SetFlash ( PalEntry rgb , int amount ) ;
void GetFlash ( PalEntry & rgb , int & amount ) ;
int GetPageCount ( ) ;
bool Begin2D ( bool copy3d ) ;
void GameRestart ( ) ;
// Retrieves a buffer containing image data for a screenshot.
// Hint: Pitch can be negative for upside-down images, in which case buffer
// points to the last row in the buffer, which will be the first row output.
2017-03-09 18:54:41 +00:00
virtual void GetScreenshotBuffer ( const uint8_t * & buffer , int & pitch , ESSType & color_type ) ;
2013-06-23 07:49:34 +00:00
// Releases the screenshot buffer.
virtual void ReleaseScreenshotBuffer ( ) ;
// 2D drawing
2016-04-09 11:05:43 +00:00
void DrawTextureParms ( FTexture * img , DrawParms & parms ) ;
2017-03-09 18:31:45 +00:00
void DrawLine ( int x1 , int y1 , int x2 , int y2 , int palcolor , uint32_t color ) ;
void DrawPixel ( int x1 , int y1 , int palcolor , uint32_t color ) ;
void Clear ( int left , int top , int right , int bottom , int palcolor , uint32_t color ) ;
2013-06-23 07:49:34 +00:00
void Dim ( PalEntry color = 0 ) ;
void Dim ( PalEntry color , float damount , int x1 , int y1 , int w , int h ) ;
void FlatFill ( int left , int top , int right , int bottom , FTexture * src , bool local_origin = false ) ;
void FillSimplePoly ( FTexture * tex , FVector2 * points , int npoints ,
double originx , double originy , double scalex , double scaley ,
2017-01-28 19:44:46 +00:00
DAngle rotation , FDynamicColormap * colormap , PalEntry flatcolor , int lightlevel , int bottomclip ) ;
2013-06-23 07:49:34 +00:00
FNativePalette * CreatePalette ( FRemapTable * remap ) ;
bool WipeStartScreen ( int type ) ;
void WipeEndScreen ( ) ;
bool WipeDo ( int ticks ) ;
void WipeCleanup ( ) ;
void Swap ( ) ;
bool Is8BitMode ( ) { return false ; }
2016-07-26 19:27:02 +00:00
bool IsHWGammaActive ( ) const { return HWGammaActive ; }
2013-06-23 07:49:34 +00:00
2017-03-03 15:30:04 +00:00
void SetVSync ( bool vsync ) ;
2017-03-11 20:10:21 +00:00
int palette_brightness ; // brightness of the active palette - this is used for screen blends
bool HWGammaActive = false ; // Are we using hardware or software gamma?
std : : shared_ptr < FGLDebug > mDebug ; // Debug API
2013-06-23 07:49:34 +00:00
private :
2017-03-11 20:10:21 +00:00
PalEntry Flash ; // Only needed to support some cruft in the interface that only makes sense for the software renderer
PalEntry SourcePalette [ 256 ] ; // This is where unpaletted textures get their palette from
uint8_t * ScreenshotBuffer ; // What the name says. This must be maintained because the software renderer can return a locked canvas surface which the caller cannot release.
2013-06-23 07:49:34 +00:00
class Wiper
{
2016-08-06 12:12:40 +00:00
protected :
2016-08-06 22:40:31 +00:00
FSimpleVertexBuffer * mVertexBuf ;
2016-08-06 12:12:40 +00:00
void MakeVBO ( OpenGLFrameBuffer * fb ) ;
2013-06-23 07:49:34 +00:00
public :
2016-08-06 12:12:40 +00:00
Wiper ( ) ;
2013-06-23 07:49:34 +00:00
virtual ~ Wiper ( ) ;
virtual bool Run ( int ticks , OpenGLFrameBuffer * fb ) = 0 ;
} ;
class Wiper_Melt ; friend class Wiper_Melt ;
class Wiper_Burn ; friend class Wiper_Burn ;
class Wiper_Crossfade ; friend class Wiper_Crossfade ;
Wiper * ScreenWipe ;
FHardwareTexture * wipestartscreen ;
FHardwareTexture * wipeendscreen ;
2016-08-17 18:33:10 +00:00
2013-06-23 07:49:34 +00:00
public :
} ;
# endif //__GL_FRAMEBUFFER