ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Wintermute::BaseRenderOpenGLTexture Class Reference

A 2D-renderer implementation for WME. More...

#include <base_render_opengl_texture.h>

Inheritance diagram for Wintermute::BaseRenderOpenGLTexture:
Collaboration diagram for Wintermute::BaseRenderOpenGLTexture:

List of all members.

Public Types

typedef Common::List
< RenderTicketOpenGL * >
::iterator 
RenderQueueIterator

Public Member Functions

 BaseRenderOpenGLTexture (BaseGame *inGame)
 ~BaseRenderOpenGLTexture () override
Common::String getName () const override
 Get the name of the current renderer.
bool initRenderer (int width, int height, bool windowed) override
bool flip () override
 Flip the backbuffer onto the screen-buffer The screen will NOT be updated before calling this function.
bool indicatorFlip () override
 Special flip for the indicator drawn during save/load essentially, just copies the region defined by the _indicator-variables.
bool forcedFlip () override
bool fill (byte r, byte g, byte b, Common::Rect *rect=nullptr) override
 Fill a portion of the screen with a specified color.
Graphics::PixelFormat getPixelFormat () const override
void fade (uint16 alpha) override
 Fade the screen to black.
void fadeToColor (byte r, byte g, byte b, byte a) override
 Fade a portion of the screen to a specific color.
bool drawLine (int x1, int y1, int x2, int y2, uint32 color) override
BaseImagetakeScreenshot () override
 Take a screenshot of the current screenstate.
void onWindowChange () override
void setWindowed (bool windowed) override
void invalidateTicket (RenderTicketOpenGL *renderTicket)
void invalidateTicketsFromSurface (BaseSurfaceOpenGLTexture *surf)
void drawFromTicket (RenderTicketOpenGL *renderTicket)
 Insert a new ticket into the queue, adding a dirty rect.
void drawFromQueuedTicket (const RenderQueueIterator &ticket)
 Re-insert an existing ticket into the queue, adding a dirty rect out-of-order from last draw from the ticket.
bool setViewport (int left, int top, int right, int bottom) override
bool setViewport (Rect32 *rect) override
Rect32 getViewPort () override
void modTargetRect (Common::Rect *rect)
void pointFromScreen (Point32 *point)
void pointToScreen (Point32 *point)
void dumpData (const char *filename) override
float getScaleRatioX () const override
float getScaleRatioY () const override
bool startSpriteBatch () override
bool endSpriteBatch () override
void endSaveLoad () override
void drawSurface (BaseSurfaceOpenGLTexture *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Graphics::TransformStruct &transform)
BaseSurfacecreateSurface () override
 Create a Surface fit for use with the renderer.

Private Member Functions

void addDirtyRect (const Common::Rect &rect)
 Mark a specified rect of the screen as dirty.
void drawTickets ()
 Traverse the tickets that are dirty, and draw them.
void drawFromSurface (RenderTicketOpenGL *ticket)
void drawFromSurface (RenderTicketOpenGL *ticket, Common::Rect *dstRect, Common::Rect *clipRect)
void drawRenderSurface ()

Private Attributes

Common::Rect_dirtyRect
Common::List
< RenderTicketOpenGL * > 
_renderQueue
bool _needsFlip
RenderQueueIterator _lastFrameIter
Common::Rect _renderRect
Graphics::Surface_renderSurface
Graphics::Surface_blankSurface
int _borderLeft
int _borderTop
int _borderRight
int _borderBottom
bool _disableDirtyRects
float _ratioX
float _ratioY
uint32 _clearColor
bool _skipThisFrame
int _lastScreenChangeID

Detailed Description

A 2D-renderer implementation for WME.

This renderer makes use of a "ticket"-system, where all draw-calls are stored as tickets until flip() is called, and compared against the tickets from last frame, to determine which calls were the same as last round (i.e. in the exact same order, with the exact same arguments), and thus figure out which parts of the screen need to be redrawn.

Important concepts to handle here, is the ordered number of any ticket which is called the "drawNum", every frame this starts from scratch, and then the incoming tickets created from the draw-calls are checked to see whether they came before, on, or after the drawNum they had last frame. Everything else being equal, this information is then used to check whether the draw order changed, which will then create a need for redrawing, as we draw with an alpha-channel here.

There is also a draw path that draws without tickets, for debugging purposes, as well as to accomodate situations with large enough amounts of draw calls, that there will be too much overhead involved with comparing the generated tickets.

Definition at line 60 of file base_render_opengl_texture.h.


Member Typedef Documentation


Constructor & Destructor Documentation

Wintermute::BaseRenderOpenGLTexture::BaseRenderOpenGLTexture ( BaseGame inGame  ) 

Definition at line 53 of file base_render_opengl_texture.cpp.

Wintermute::BaseRenderOpenGLTexture::~BaseRenderOpenGLTexture (  )  [override]

Definition at line 74 of file base_render_opengl_texture.cpp.


Member Function Documentation

void Wintermute::BaseRenderOpenGLTexture::addDirtyRect ( const Common::Rect rect  )  [private]

Mark a specified rect of the screen as dirty.

Parameters:
rect the region to be marked as dirty

Definition at line 386 of file base_render_opengl_texture.cpp.

BaseSurface * Wintermute::BaseRenderOpenGLTexture::createSurface (  )  [override, virtual]

Create a Surface fit for use with the renderer.

As diverse implementations of BaseRenderer might have different solutions for storing surfaces this allows for a common interface for creating surface-handles. (Mostly usefull to ease future implementation of hw-accelerated rendering, or readding 3D-support at some point).

Returns:
a surface that can be used with this renderer

Implements Wintermute::BaseRenderer.

Definition at line 610 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawFromQueuedTicket ( const RenderQueueIterator ticket  ) 

Re-insert an existing ticket into the queue, adding a dirty rect out-of-order from last draw from the ticket.

Parameters:
ticket iterator pointing to the ticket to be added.

Definition at line 369 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawFromSurface ( RenderTicketOpenGL ticket  )  [private]

Definition at line 475 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawFromSurface ( RenderTicketOpenGL ticket,
Common::Rect dstRect,
Common::Rect clipRect 
) [private]

Definition at line 479 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawFromTicket ( RenderTicketOpenGL renderTicket  ) 

Insert a new ticket into the queue, adding a dirty rect.

Parameters:
renderTicket the ticket to be added.

Definition at line 350 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::drawLine ( int  x1,
int  y1,
int  x2,
int  y2,
uint32  color 
) [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 515 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawRenderSurface (  )  [private]

Definition at line 483 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawSurface ( BaseSurfaceOpenGLTexture owner,
const Graphics::Surface surf,
Common::Rect srcRect,
Common::Rect dstRect,
Graphics::TransformStruct transform 
)

Definition at line 290 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::drawTickets (  )  [private]

Traverse the tickets that are dirty, and draw them.

Definition at line 395 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::dumpData ( const char *  filename  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 606 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::endSaveLoad (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 614 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::endSpriteBatch (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 639 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::fade ( uint16  alpha  )  [override, virtual]

Fade the screen to black.

Parameters:
alpha amount to fade by (alpha value of black)

Implements Wintermute::BaseRenderer.

Definition at line 250 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::fadeToColor ( byte  r,
byte  g,
byte  b,
byte  a 
) [override, virtual]

Fade a portion of the screen to a specific color.

Parameters:
r the red component to fade too.
g the green component to fade too.
b the blue component to fade too.
a the alpha component to fade too.
rect the portion of the screen to fade (if nullptr, the entire screen will be faded).

Implements Wintermute::BaseRenderer.

Definition at line 256 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::fill ( byte  r,
byte  g,
byte  b,
Common::Rect rect = nullptr 
) [override, virtual]

Fill a portion of the screen with a specified color.

Parameters:
r the red component to fill with.
g the green component to fill with.
b the blue component to fill with.

Implements Wintermute::BaseRenderer.

Definition at line 229 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::flip (  )  [override, virtual]

Flip the backbuffer onto the screen-buffer The screen will NOT be updated before calling this function.

Returns:
true if successfull, false on error.

Implements Wintermute::BaseRenderer.

Definition at line 158 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::forcedFlip (  )  [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 152 of file base_render_opengl_texture.cpp.

Common::String Wintermute::BaseRenderOpenGLTexture::getName (  )  const [override, virtual]

Get the name of the current renderer.

Returns:
the name of the renderer.

Implements Wintermute::BaseRenderer.

Definition at line 555 of file base_render_opengl_texture.cpp.

Graphics::PixelFormat Wintermute::BaseRenderOpenGLTexture::getPixelFormat (  )  const [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 286 of file base_render_opengl_texture.cpp.

float Wintermute::BaseRenderOpenGLTexture::getScaleRatioX (  )  const [inline, override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 107 of file base_render_opengl_texture.h.

float Wintermute::BaseRenderOpenGLTexture::getScaleRatioY (  )  const [inline, override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 110 of file base_render_opengl_texture.h.

Rect32 Wintermute::BaseRenderOpenGLTexture::getViewPort (  )  [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 572 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::indicatorFlip (  )  [override, virtual]

Special flip for the indicator drawn during save/load essentially, just copies the region defined by the _indicator-variables.

Implements Wintermute::BaseRenderer.

Definition at line 144 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::initRenderer ( int  width,
int  height,
bool  windowed 
) [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 91 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::invalidateTicket ( RenderTicketOpenGL renderTicket  ) 

Definition at line 335 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::invalidateTicketsFromSurface ( BaseSurfaceOpenGLTexture surf  ) 

Definition at line 341 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::modTargetRect ( Common::Rect rect  ) 

Definition at line 582 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::onWindowChange (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 216 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::pointFromScreen ( Point32 point  ) 

Definition at line 593 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::pointToScreen ( Point32 point  ) 

Definition at line 600 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::setViewport ( Rect32 rect  )  [inline, override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 99 of file base_render_opengl_texture.h.

bool Wintermute::BaseRenderOpenGLTexture::setViewport ( int  left,
int  top,
int  right,
int  bottom 
) [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 560 of file base_render_opengl_texture.cpp.

void Wintermute::BaseRenderOpenGLTexture::setWindowed ( bool  windowed  )  [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 221 of file base_render_opengl_texture.cpp.

bool Wintermute::BaseRenderOpenGLTexture::startSpriteBatch (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 635 of file base_render_opengl_texture.cpp.

BaseImage * Wintermute::BaseRenderOpenGLTexture::takeScreenshot (  )  [override, virtual]

Take a screenshot of the current screenstate.

Returns:
a BaseImage containing the current screen-buffer.

Implements Wintermute::BaseRenderer.

Definition at line 547 of file base_render_opengl_texture.cpp.


Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Sat Sep 26 2020 05:04:13 for ResidualVM by doxygen 1.7.1
curved edge   curved edge