FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::RenderBackend Class Referenceabstract

Abstract interface for all the renderbackends. More...

#include <renderbackend.h>

+ Inheritance diagram for FIFE::RenderBackend:
+ Collaboration diagram for FIFE::RenderBackend:

Classes

class  ClipInfo
 

Public Member Functions

 RenderBackend (const SDL_Color &colorkey)
 Constructor. More...
 
virtual ~RenderBackend ()
 Destructor. More...
 
virtual const std::string & getName () const =0
 The name of the renderbackend. More...
 
virtual void startFrame ()
 Called when a new frame starts. More...
 
virtual void endFrame ()
 Called when a frame is finished and ready to be displayed. More...
 
virtual void init (const std::string &driver)=0
 Initializes the backend. More...
 
virtual void clearBackBuffer ()=0
 Forces a clear of the backbuffer. More...
 
virtual void setLightingModel (uint32_t lighting)=0
 Initializes the light. More...
 
virtual uint32_t getLightingModel () const =0
 Gets the current light model. More...
 
virtual void setLighting (float red, float green, float blue)=0
 Set colors for lighting. More...
 
virtual void resetLighting ()=0
 Reset lighting with default values. More...
 
virtual void resetStencilBuffer (uint8_t buffer)=0
 Reset stencil buffer with given value. More...
 
virtual void changeBlending (int32_t scr, int32_t dst)=0
 Change the Blendingmodel. More...
 
void deinit ()
 Performs cleanup actions. More...
 
virtual void createMainScreen (const ScreenMode &mode, const std::string &title, const std::string &icon)=0
 Creates the mainscreen (the display window). More...
 
virtual void setScreenMode (const ScreenMode &mode)=0
 Sets the mainscreen display mode. More...
 
virtual ImagecreateImage (IResourceLoader *loader=0)=0
 
virtual ImagecreateImage (const std::string &name, IResourceLoader *loader=0)=0
 
virtual ImagecreateImage (const uint8_t *data, uint32_t width, uint32_t height)=0
 Creates an Image suitable for this renderbackend. More...
 
virtual ImagecreateImage (const std::string &name, const uint8_t *data, uint32_t width, uint32_t height)=0
 
virtual ImagecreateImage (SDL_Surface *surface)=0
 Helper function to create images from SDL_Surfaces. More...
 
virtual ImagecreateImage (const std::string &name, SDL_Surface *surface)=0
 
virtual void renderVertexArrays ()=0
 Render the Vertex Arrays, only for primitives (points, lines,...) More...
 
virtual void addImageToArray (uint32_t id, const Rect &rec, float const *st, uint8_t alpha, uint8_t const *rgba)=0
 Add the Image data to the array. More...
 
virtual void changeRenderInfos (RenderDataType type, uint16_t elements, int32_t src, int32_t dst, bool light, bool stentest, uint8_t stenref, GLConstants stenop, GLConstants stenfunc, OverlayType otype=OVERLAY_TYPE_NONE)=0
 Dirty helper function to change the render infos. More...
 
virtual void captureScreen (const std::string &filename)=0
 Creates a Screenshot and saves it to a file. More...
 
virtual void captureScreen (const std::string &filename, uint32_t width, uint32_t height)=0
 Creates a Screenshot with the given size(w,h) and saves it to a file. More...
 
SDL_Window * getWindow ()
 
const ScreenModegetCurrentScreenMode () const
 Get current screen mode. More...
 
uint32_t getWidth () const
 
uint32_t getHeight () const
 
uint32_t getScreenWidth () const
 
uint32_t getScreenHeight () const
 
const RectgetArea () const
 
void pushClipArea (const Rect &cliparea, bool clear=true)
 Pushes clip area to clip stack Clip areas define which area is drawn on screen. More...
 
void popClipArea ()
 Pops clip area from clip stack. More...
 
const RectgetClipArea () const
 Gets the current clip area. More...
 
virtual bool putPixel (int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Writes pixel to given position. More...
 
virtual void drawLine (const Point &p1, const Point &p2, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws line between given points with given RGBA. More...
 
virtual void drawThickLine (const Point &p1, const Point &p2, uint8_t width, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws line between given points with given RGBA and width. More...
 
virtual void drawPolyLine (const std::vector< Point > &points, uint8_t width, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws lines between given points with given RGBA and width. More...
 
virtual void drawBezier (const std::vector< Point > &points, int32_t steps, uint8_t width, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws bezier curve between given points with given RGBA and width. More...
 
virtual void drawTriangle (const Point &p1, const Point &p2, const Point &p3, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws triangle between given points with given RGBA. More...
 
virtual void drawRectangle (const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws an axis parallel rectangle. More...
 
virtual void fillRectangle (const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws a filled axis parallel rectangle. More...
 
virtual void drawQuad (const Point &p1, const Point &p2, const Point &p3, const Point &p4, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws quad between given points with given RGBA. More...
 
virtual void drawVertex (const Point &p, const uint8_t size, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws a quad that represents a vertex with given RGBA. More...
 
virtual void drawCircle (const Point &p, uint32_t radius, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws a circle. More...
 
virtual void drawFillCircle (const Point &p, uint32_t radius, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws a filled circle. More...
 
virtual void drawCircleSegment (const Point &p, uint32_t radius, int32_t sangle, int32_t eangle, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws a circle segment. More...
 
virtual void drawFillCircleSegment (const Point &p, uint32_t radius, int32_t sangle, int32_t eangle, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
 Draws a filled circle segment. More...
 
virtual void drawLightPrimitive (const Point &p, uint8_t intensity, float radius, int32_t subdivisions, float xstretch, float ystretch, uint8_t red, uint8_t green, uint8_t blue)=0
 Draws a light primitive that based on a triangle fan. More...
 
virtual void enableScissorTest ()=0
 Enables scissor test on the render backend. More...
 
virtual void disableScissorTest ()=0
 Disables scissor test on the render backend. More...
 
void setAlphaOptimizerEnabled (bool enabled)
 Enable or disable the alpha 'optimizing' code. More...
 
bool isAlphaOptimizerEnabled () const
 
void setImageCompressingEnabled (bool enabled)
 Enables or disable compressing images by video driver. More...
 
bool isImageCompressingEnabled () const
 
void setFramebufferEnabled (bool enabled)
 Enables or disable the usage of the framebuffer, if available. More...
 
bool isFramebufferEnabled () const
 
void setNPOTEnabled (bool enabled)
 Enables or disable the usage of npot, if available. More...
 
bool isNPOTEnabled () const
 
void setTextureFiltering (TextureFiltering filter)
 Sets the texture filtering method. More...
 
TextureFiltering getTextureFiltering () const
 
void setMipmappingEnabled (bool enabled)
 Enables or disables the usage of mipmapping. More...
 
bool isMipmappingEnabled () const
 
int32_t getMaxAnisotropy () const
 Gets max antisotropy for antisotropic filtering. More...
 
void setMonochromeEnabled (bool enabled)
 Enables or disables monochrome rendering. More...
 
bool isMonochromeEnabled () const
 
void setDepthBufferEnabled (bool enabled)
 Enables or disables depth buffer rendering. More...
 
bool isDepthBufferEnabled () const
 
void setAlphaTestValue (float alpha)
 Sets the value for alpha test. More...
 
float getAlphaTestValue () const
 
void setColorKeyEnabled (bool colorkeyenable)
 Sets whether to use the colorkey feature. More...
 
bool isColorKeyEnabled () const
 Gets whether the colorkey feature is in use. More...
 
void setColorKey (const SDL_Color &colorkey)
 Sets the global colorkey to use for images. More...
 
const SDL_Color & getColorKey () const
 Gets the global colorkey setting. More...
 
void setBackgroundColor (uint8_t r, uint8_t g, uint8_t b)
 Set the background color. More...
 
void resetBackgroundColor ()
 Reset the background color to black. More...
 
const SDL_PixelFormat & getPixelFormat () const
 Gets the current screen rgba format. More...
 
void setVSyncEnabled (bool vsync)
 Sets whether to use VSync. More...
 
bool isVSyncEnabled () const
 Gets whether VSync is in use. More...
 
void setFrameLimitEnabled (bool limited)
 Sets whether to use the frame limiter. More...
 
bool isFrameLimitEnabled () const
 Gets whether the frame limiter is in use. More...
 
void setFrameLimit (uint16_t framelimit)
 Sets the frame limit. More...
 
uint16_t getFrameLimit () const
 Gets the frame limit. More...
 
SDL_Surface * getScreenSurface ()
 Returns screen render surface. More...
 
SDL_Surface * getRenderTargetSurface ()
 Returns currently attached render surface. More...
 
virtual void attachRenderTarget (ImagePtr &img, bool discard)=0
 Attaches given image as a new render surface. More...
 
virtual void detachRenderTarget ()=0
 Detaches current render surface. More...
 
virtual void renderGuiGeometry (const std::vector< GuiVertex > &vertices, const std::vector< int > &indices, const DoublePoint &translation, ImagePtr texture)=0
 Renders geometry required by gui. More...
 
Point getBezierPoint (const std::vector< Point > &points, int32_t elements, float t)
 Helper that returns an interpolated Point. More...
 
void addControlPoints (const std::vector< Point > &points, std::vector< Point > &newPoints)
 Helper that adds the control points for bezier curves. More...
 
- Public Member Functions inherited from FIFE::DynamicSingleton< RenderBackend >
 DynamicSingleton ()
 
virtual ~DynamicSingleton ()
 

Protected Member Functions

virtual void setClipArea (const Rect &cliparea, bool clear)=0
 Sets given clip area into image. More...
 
void clearClipArea ()
 Clears any possible clip areas. More...
 

Protected Attributes

SDL_Window * m_window
 
SDL_Surface * m_screen
 
SDL_Surface * m_target
 
bool m_compressimages
 
bool m_useframebuffer
 
bool m_usenpot
 
bool m_isalphaoptimized
 
bool m_iscolorkeyenabled
 
SDL_Color m_colorkey
 
ScreenMode m_screenMode
 
SDL_PixelFormat m_rgba_format
 
bool m_isbackgroundcolor
 
SDL_Color m_backgroundcolor
 
bool m_isMipmapping
 
TextureFiltering m_textureFilter
 
int32_t m_maxAnisotropy
 
bool m_monochrome
 
bool m_isDepthBuffer
 
float m_alphaValue
 
bool m_vSync
 
std::stack< ClipInfom_clipstack
 
ClipInfo m_guiClip
 

Private Attributes

bool m_isframelimit
 
uint32_t m_frame_start
 
uint16_t m_framelimit
 

Additional Inherited Members

- Static Public Member Functions inherited from FIFE::DynamicSingleton< RenderBackend >
static RenderBackendinstance ()
 

Detailed Description

Abstract interface for all the renderbackends.

Definition at line 121 of file renderbackend.h.

Constructor & Destructor Documentation

◆ RenderBackend()

FIFE::RenderBackend::RenderBackend ( const SDL_Color &  colorkey)

Constructor.

Parameters
colorkeyThe colorkey to use.

Definition at line 34 of file renderbackend.cpp.

References m_backgroundcolor, and m_isbackgroundcolor.

◆ ~RenderBackend()

FIFE::RenderBackend::~RenderBackend ( )
virtual

Destructor.

Definition at line 61 of file renderbackend.cpp.

Member Function Documentation

◆ addControlPoints()

void FIFE::RenderBackend::addControlPoints ( const std::vector< Point > &  points,
std::vector< Point > &  newPoints 
)

Helper that adds the control points for bezier curves.

Definition at line 284 of file renderbackend.cpp.

References FIFE::PointType2D< T >::x, and FIFE::PointType2D< T >::y.

◆ addImageToArray()

virtual void FIFE::RenderBackend::addImageToArray ( uint32_t  id,
const Rect rec,
float const *  st,
uint8_t  alpha,
uint8_t const *  rgba 
)
pure virtual

Add the Image data to the array.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::GLImage::render().

+ Here is the caller graph for this function:

◆ attachRenderTarget()

virtual void FIFE::RenderBackend::attachRenderTarget ( ImagePtr img,
bool  discard 
)
pure virtual

Attaches given image as a new render surface.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::TargetRenderer::render(), and FIFE::Camera::renderStaticLayer().

+ Here is the caller graph for this function:

◆ captureScreen() [1/2]

virtual void FIFE::RenderBackend::captureScreen ( const std::string &  filename)
pure virtual

Creates a Screenshot and saves it to a file.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

◆ captureScreen() [2/2]

virtual void FIFE::RenderBackend::captureScreen ( const std::string &  filename,
uint32_t  width,
uint32_t  height 
)
pure virtual

Creates a Screenshot with the given size(w,h) and saves it to a file.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

◆ changeBlending()

virtual void FIFE::RenderBackend::changeBlending ( int32_t  scr,
int32_t  dst 
)
pure virtual

Change the Blendingmodel.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

◆ changeRenderInfos()

◆ clearBackBuffer()

virtual void FIFE::RenderBackend::clearBackBuffer ( )
pure virtual

Forces a clear of the backbuffer.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Engine::pump().

+ Here is the caller graph for this function:

◆ clearClipArea()

void FIFE::RenderBackend::clearClipArea ( )
protected

Clears any possible clip areas.

See also
pushClipArea

Definition at line 131 of file renderbackend.cpp.

References getArea(), and setClipArea().

◆ createImage() [1/6]

◆ createImage() [2/6]

virtual Image* FIFE::RenderBackend::createImage ( const std::string &  name,
IResourceLoader loader = 0 
)
pure virtual

◆ createImage() [3/6]

virtual Image* FIFE::RenderBackend::createImage ( const uint8_t *  data,
uint32_t  width,
uint32_t  height 
)
pure virtual

Creates an Image suitable for this renderbackend.

Parameters
dataPointer to the imagedata (needs to be in RGBA, 8 bits per channel).
widthWidth of the image.
heightHeight of the image.
Returns
The new Image.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

◆ createImage() [4/6]

virtual Image* FIFE::RenderBackend::createImage ( const std::string &  name,
const uint8_t *  data,
uint32_t  width,
uint32_t  height 
)
pure virtual

◆ createImage() [5/6]

virtual Image* FIFE::RenderBackend::createImage ( SDL_Surface *  surface)
pure virtual

Helper function to create images from SDL_Surfaces.

Takes ownership over the surface.

Parameters
surfaceThe surface to convert.
Returns
The new Image.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

◆ createImage() [6/6]

virtual Image* FIFE::RenderBackend::createImage ( const std::string &  name,
SDL_Surface *  surface 
)
pure virtual

◆ createMainScreen()

virtual void FIFE::RenderBackend::createMainScreen ( const ScreenMode mode,
const std::string &  title,
const std::string &  icon 
)
pure virtual

Creates the mainscreen (the display window).

Parameters
modeThe ScreenMode to use.
See also
FIFE::ScreenMode.
Parameters
titleThe window title to use.
iconThe window icon to use.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Engine::changeScreenMode(), and FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ deinit()

void FIFE::RenderBackend::deinit ( )

Performs cleanup actions.

Definition at line 64 of file renderbackend.cpp.

Referenced by FIFE::RenderBackendOpenGL::~RenderBackendOpenGL(), and FIFE::RenderBackendSDL::~RenderBackendSDL().

+ Here is the caller graph for this function:

◆ detachRenderTarget()

virtual void FIFE::RenderBackend::detachRenderTarget ( )
pure virtual

Detaches current render surface.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::TargetRenderer::render(), and FIFE::Camera::renderStaticLayer().

+ Here is the caller graph for this function:

◆ disableScissorTest()

virtual void FIFE::RenderBackend::disableScissorTest ( )
pure virtual

Disables scissor test on the render backend.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::LibRocketRenderInterface::render().

+ Here is the caller graph for this function:

◆ drawBezier()

virtual void FIFE::RenderBackend::drawBezier ( const std::vector< Point > &  points,
int32_t  steps,
uint8_t  width,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws bezier curve between given points with given RGBA and width.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawBezier().

+ Here is the caller graph for this function:

◆ drawCircle()

virtual void FIFE::RenderBackend::drawCircle ( const Point p,
uint32_t  radius,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws a circle.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawCircle().

+ Here is the caller graph for this function:

◆ drawCircleSegment()

virtual void FIFE::RenderBackend::drawCircleSegment ( const Point p,
uint32_t  radius,
int32_t  sangle,
int32_t  eangle,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws a circle segment.

Note: The start angle must be less than the end angle. 0 angle is right side.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawCircleSegment().

+ Here is the caller graph for this function:

◆ drawFillCircle()

virtual void FIFE::RenderBackend::drawFillCircle ( const Point p,
uint32_t  radius,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws a filled circle.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawFillCircle().

+ Here is the caller graph for this function:

◆ drawFillCircleSegment()

virtual void FIFE::RenderBackend::drawFillCircleSegment ( const Point p,
uint32_t  radius,
int32_t  sangle,
int32_t  eangle,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws a filled circle segment.

0 angle is right side. Note: The start angle must be less than the end angle.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawFillCircleSegment().

+ Here is the caller graph for this function:

◆ drawLightPrimitive()

virtual void FIFE::RenderBackend::drawLightPrimitive ( const Point p,
uint8_t  intensity,
float  radius,
int32_t  subdivisions,
float  xstretch,
float  ystretch,
uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
pure virtual

Draws a light primitive that based on a triangle fan.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::LightRendererSimpleLightInfo::render().

+ Here is the caller graph for this function:

◆ drawLine()

virtual void FIFE::RenderBackend::drawLine ( const Point p1,
const Point p2,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

◆ drawPolyLine()

virtual void FIFE::RenderBackend::drawPolyLine ( const std::vector< Point > &  points,
uint8_t  width,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws lines between given points with given RGBA and width.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawPolyLine().

+ Here is the caller graph for this function:

◆ drawQuad()

virtual void FIFE::RenderBackend::drawQuad ( const Point p1,
const Point p2,
const Point p3,
const Point p4,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws quad between given points with given RGBA.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::OffRendererQuadInfo::render(), and FIFE::GenericRendererQuadInfo::render().

+ Here is the caller graph for this function:

◆ drawRectangle()

virtual void FIFE::RenderBackend::drawRectangle ( const Point p,
uint16_t  w,
uint16_t  h,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws an axis parallel rectangle.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawRectangle(), and FIFE::FloatingTextRenderer::render().

+ Here is the caller graph for this function:

◆ drawThickLine()

virtual void FIFE::RenderBackend::drawThickLine ( const Point p1,
const Point p2,
uint8_t  width,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws line between given points with given RGBA and width.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawLine().

+ Here is the caller graph for this function:

◆ drawTriangle()

virtual void FIFE::RenderBackend::drawTriangle ( const Point p1,
const Point p2,
const Point p3,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws triangle between given points with given RGBA.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::OffRendererTriangleInfo::render(), and FIFE::GenericRendererTriangleInfo::render().

+ Here is the caller graph for this function:

◆ drawVertex()

virtual void FIFE::RenderBackend::drawVertex ( const Point p,
const uint8_t  size,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws a quad that represents a vertex with given RGBA.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::OffRendererVertexInfo::render(), and FIFE::GenericRendererVertexInfo::render().

+ Here is the caller graph for this function:

◆ enableScissorTest()

virtual void FIFE::RenderBackend::enableScissorTest ( )
pure virtual

Enables scissor test on the render backend.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::LibRocketRenderInterface::render().

+ Here is the caller graph for this function:

◆ endFrame()

void FIFE::RenderBackend::endFrame ( )
virtual

Called when a frame is finished and ready to be displayed.

Reimplemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Definition at line 75 of file renderbackend.cpp.

References m_frame_start, m_framelimit, and m_isframelimit.

Referenced by FIFE::RenderBackendOpenGL::endFrame(), FIFE::RenderBackendSDL::endFrame(), and FIFE::Engine::pump().

+ Here is the caller graph for this function:

◆ fillRectangle()

virtual void FIFE::RenderBackend::fillRectangle ( const Point p,
uint16_t  w,
uint16_t  h,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Draws a filled axis parallel rectangle.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::fillRectangle(), FIFE::FloatingTextRenderer::render(), and FIFE::Camera::renderOverlay().

+ Here is the caller graph for this function:

◆ getAlphaTestValue()

float FIFE::RenderBackend::getAlphaTestValue ( ) const
See also
setAlphaValue

Definition at line 175 of file renderbackend.cpp.

References m_alphaValue.

◆ getArea()

const Rect & FIFE::RenderBackend::getArea ( ) const

Definition at line 97 of file renderbackend.cpp.

References m_screen.

Referenced by clearClipArea(), getClipArea(), popClipArea(), and FIFE::EventManager::processMouseEvent().

+ Here is the caller graph for this function:

◆ getBezierPoint()

Point FIFE::RenderBackend::getBezierPoint ( const std::vector< Point > &  points,
int32_t  elements,
float  t 
)

Helper that returns an interpolated Point.

Definition at line 244 of file renderbackend.cpp.

References FIFE::Math< T >::Pow().

Referenced by FIFE::RenderBackendSDL::drawBezier(), and FIFE::RenderBackendOpenGL::drawBezier().

+ Here is the caller graph for this function:

◆ getClipArea()

const Rect & FIFE::RenderBackend::getClipArea ( ) const

Gets the current clip area.

See also
pushClipArea

Definition at line 123 of file renderbackend.cpp.

References getArea(), and m_clipstack.

◆ getColorKey()

const SDL_Color & FIFE::RenderBackend::getColorKey ( ) const

Gets the global colorkey setting.

Definition at line 191 of file renderbackend.cpp.

References m_colorkey.

Referenced by FIFE::GLImage::resetGlimage(), FIFE::SDLImage::resetSdlimage(), and FIFE::SubImageFont::SubImageFont().

+ Here is the caller graph for this function:

◆ getCurrentScreenMode()

const ScreenMode & FIFE::RenderBackend::getCurrentScreenMode ( ) const

Get current screen mode.

Returns
The current screen mode

Definition at line 85 of file renderbackend.cpp.

References m_screenMode.

◆ getFrameLimit()

uint16_t FIFE::RenderBackend::getFrameLimit ( ) const

Gets the frame limit.

Definition at line 232 of file renderbackend.cpp.

References m_framelimit.

◆ getHeight()

◆ getLightingModel()

◆ getMaxAnisotropy()

int32_t FIFE::RenderBackend::getMaxAnisotropy ( ) const

Gets max antisotropy for antisotropic filtering.

Definition at line 151 of file renderbackend.cpp.

References m_maxAnisotropy.

◆ getName()

virtual const std::string& FIFE::RenderBackend::getName ( ) const
pure virtual

The name of the renderbackend.

Returns
The name of this renderbackend.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::InstanceRenderer::InstanceRenderer(), FIFE::ImageLoader::load(), and FIFE::Camera::renderStaticLayer().

+ Here is the caller graph for this function:

◆ getPixelFormat()

const SDL_PixelFormat & FIFE::RenderBackend::getPixelFormat ( ) const

Gets the current screen rgba format.

Definition at line 208 of file renderbackend.cpp.

References m_rgba_format.

Referenced by FIFE::GLImage::generateGLTexture(), and FIFE::ImageLoader::load().

+ Here is the caller graph for this function:

◆ getRenderTargetSurface()

SDL_Surface * FIFE::RenderBackend::getRenderTargetSurface ( )

Returns currently attached render surface.

Definition at line 240 of file renderbackend.cpp.

References m_target.

Referenced by FIFE::GLImage::generateGLTexture(), FIFE::SDLImage::render(), FIFE::GLImage::render(), and FIFE::GLImage::renderZ().

+ Here is the caller graph for this function:

◆ getScreenHeight()

uint32_t FIFE::RenderBackend::getScreenHeight ( ) const
inline

Definition at line 243 of file renderbackend.h.

Referenced by FIFE::MapLoader::load(), and FIFE::Console::reLayout().

+ Here is the caller graph for this function:

◆ getScreenSurface()

SDL_Surface * FIFE::RenderBackend::getScreenSurface ( )

Returns screen render surface.

Definition at line 236 of file renderbackend.cpp.

References m_screen.

Referenced by FIFE::SdlGuiGraphics::SdlGuiGraphics(), and FIFE::SdlGuiGraphics::updateTarget().

+ Here is the caller graph for this function:

◆ getScreenWidth()

uint32_t FIFE::RenderBackend::getScreenWidth ( ) const
inline

Definition at line 242 of file renderbackend.h.

Referenced by FIFE::MapLoader::load(), and FIFE::Console::reLayout().

+ Here is the caller graph for this function:

◆ getTextureFiltering()

TextureFiltering FIFE::RenderBackend::getTextureFiltering ( ) const
See also
setTextureFiltering

Definition at line 139 of file renderbackend.cpp.

References m_textureFilter.

◆ getWidth()

uint32_t FIFE::RenderBackend::getWidth ( ) const

◆ getWindow()

SDL_Window* FIFE::RenderBackend::getWindow ( )
inline

Definition at line 233 of file renderbackend.h.

◆ init()

virtual void FIFE::RenderBackend::init ( const std::string &  driver)
pure virtual

Initializes the backend.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ isAlphaOptimizerEnabled()

bool FIFE::RenderBackend::isAlphaOptimizerEnabled ( ) const
inline
See also
setAlphaOptimizerEnabled

Definition at line 341 of file renderbackend.h.

◆ isColorKeyEnabled()

bool FIFE::RenderBackend::isColorKeyEnabled ( ) const

Gets whether the colorkey feature is in use.

Definition at line 183 of file renderbackend.cpp.

References m_iscolorkeyenabled.

Referenced by FIFE::GLImage::generateGLTexture().

+ Here is the caller graph for this function:

◆ isDepthBufferEnabled()

bool FIFE::RenderBackend::isDepthBufferEnabled ( ) const
See also
setMonochromeEnabled

Definition at line 167 of file renderbackend.cpp.

References m_isDepthBuffer.

Referenced by FIFE::InstanceRenderer::InstanceRenderer().

+ Here is the caller graph for this function:

◆ isFramebufferEnabled()

bool FIFE::RenderBackend::isFramebufferEnabled ( ) const
inline
See also
setFramebufferEnabled

Definition at line 358 of file renderbackend.h.

◆ isFrameLimitEnabled()

bool FIFE::RenderBackend::isFrameLimitEnabled ( ) const

Gets whether the frame limiter is in use.

Definition at line 224 of file renderbackend.cpp.

References m_isframelimit.

◆ isImageCompressingEnabled()

bool FIFE::RenderBackend::isImageCompressingEnabled ( ) const
inline
See also
setImageCompressingEnabled

Definition at line 350 of file renderbackend.h.

Referenced by FIFE::GuiImageLoader::load().

+ Here is the caller graph for this function:

◆ isMipmappingEnabled()

bool FIFE::RenderBackend::isMipmappingEnabled ( ) const
See also
setMipmappingEnabled

Definition at line 147 of file renderbackend.cpp.

References m_isMipmapping.

Referenced by FIFE::GLImage::generateGLTexture().

+ Here is the caller graph for this function:

◆ isMonochromeEnabled()

bool FIFE::RenderBackend::isMonochromeEnabled ( ) const
See also
setMonochromeEnabled

Definition at line 159 of file renderbackend.cpp.

References m_monochrome.

Referenced by FIFE::GLImage::generateGLTexture().

+ Here is the caller graph for this function:

◆ isNPOTEnabled()

bool FIFE::RenderBackend::isNPOTEnabled ( ) const
inline
See also
setNPOTEnabled

Definition at line 366 of file renderbackend.h.

◆ isVSyncEnabled()

bool FIFE::RenderBackend::isVSyncEnabled ( ) const

Gets whether VSync is in use.

Definition at line 216 of file renderbackend.cpp.

References m_vSync.

◆ popClipArea()

◆ pushClipArea()

void FIFE::RenderBackend::pushClipArea ( const Rect cliparea,
bool  clear = true 
)

Pushes clip area to clip stack Clip areas define which area is drawn on screen.

Usable e.g. with viewports note that previous items in stack do not affect the latest area pushed

Definition at line 102 of file renderbackend.cpp.

References FIFE::RenderBackend::ClipInfo::clearing, m_clipstack, FIFE::RenderBackend::ClipInfo::r, and setClipArea().

Referenced by FIFE::OpenGLGuiGraphics::_beginDraw(), FIFE::SdlGuiGraphics::_beginDraw(), FIFE::Cursor::draw(), FIFE::OpenGLGuiGraphics::pushClipArea(), FIFE::SdlGuiGraphics::pushClipArea(), FIFE::LibRocketRenderInterface::render(), FIFE::OffRenderer::render(), FIFE::Camera::render(), and FIFE::Camera::renderStaticLayer().

+ Here is the caller graph for this function:

◆ putPixel()

virtual bool FIFE::RenderBackend::putPixel ( int32_t  x,
int32_t  y,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
pure virtual

Writes pixel to given position.

Returns true, if pixel was written (not out of bounds)

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::SdlGuiGraphics::drawPoint(), FIFE::OffRendererPointInfo::render(), and FIFE::GenericRendererPointInfo::render().

+ Here is the caller graph for this function:

◆ renderGuiGeometry()

virtual void FIFE::RenderBackend::renderGuiGeometry ( const std::vector< GuiVertex > &  vertices,
const std::vector< int > &  indices,
const DoublePoint translation,
ImagePtr  texture 
)
pure virtual

Renders geometry required by gui.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::LibRocketRenderInterface::render().

+ Here is the caller graph for this function:

◆ renderVertexArrays()

virtual void FIFE::RenderBackend::renderVertexArrays ( )
pure virtual

Render the Vertex Arrays, only for primitives (points, lines,...)

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Cursor::draw(), FIFE::OffRenderer::render(), FIFE::Camera::render(), and FIFE::Camera::renderStaticLayer().

+ Here is the caller graph for this function:

◆ resetBackgroundColor()

void FIFE::RenderBackend::resetBackgroundColor ( )

Reset the background color to black.

Definition at line 204 of file renderbackend.cpp.

References setBackgroundColor().

◆ resetLighting()

virtual void FIFE::RenderBackend::resetLighting ( )
pure virtual

Reset lighting with default values.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Camera::render(), and FIFE::Camera::resetLightingColor().

+ Here is the caller graph for this function:

◆ resetStencilBuffer()

virtual void FIFE::RenderBackend::resetStencilBuffer ( uint8_t  buffer)
pure virtual

Reset stencil buffer with given value.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Camera::render().

+ Here is the caller graph for this function:

◆ setAlphaOptimizerEnabled()

void FIFE::RenderBackend::setAlphaOptimizerEnabled ( bool  enabled)
inline

Enable or disable the alpha 'optimizing' code.

Parameters
enabledOptimize whether the image shall be analysed for 'fake' alpha images. Only implemented by and useful for the SDL backend at the moment.

Definition at line 337 of file renderbackend.h.

◆ setAlphaTestValue()

void FIFE::RenderBackend::setAlphaTestValue ( float  alpha)

Sets the value for alpha test.

Discards a fragment if its value is not greater. Only used if depth buffer is enabled. Note! Works only for OpenGL backend.

Definition at line 171 of file renderbackend.cpp.

References m_alphaValue.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setBackgroundColor()

void FIFE::RenderBackend::setBackgroundColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set the background color.

Definition at line 195 of file renderbackend.cpp.

References m_backgroundcolor, and m_isbackgroundcolor.

Referenced by resetBackgroundColor().

+ Here is the caller graph for this function:

◆ setClipArea()

virtual void FIFE::RenderBackend::setClipArea ( const Rect cliparea,
bool  clear 
)
protectedpure virtual

Sets given clip area into image.

See also
pushClipArea

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by clearClipArea(), popClipArea(), and pushClipArea().

+ Here is the caller graph for this function:

◆ setColorKey()

void FIFE::RenderBackend::setColorKey ( const SDL_Color &  colorkey)

Sets the global colorkey to use for images.

Definition at line 187 of file renderbackend.cpp.

References m_colorkey.

◆ setColorKeyEnabled()

void FIFE::RenderBackend::setColorKeyEnabled ( bool  colorkeyenable)

Sets whether to use the colorkey feature.

Definition at line 179 of file renderbackend.cpp.

References m_iscolorkeyenabled.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setDepthBufferEnabled()

void FIFE::RenderBackend::setDepthBufferEnabled ( bool  enabled)

Enables or disables depth buffer rendering.

Note! Works only for OpenGL backend.

Definition at line 163 of file renderbackend.cpp.

References m_isDepthBuffer.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setFramebufferEnabled()

void FIFE::RenderBackend::setFramebufferEnabled ( bool  enabled)
inline

Enables or disable the usage of the framebuffer, if available.

Definition at line 354 of file renderbackend.h.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setFrameLimit()

void FIFE::RenderBackend::setFrameLimit ( uint16_t  framelimit)

Sets the frame limit.

Definition at line 228 of file renderbackend.cpp.

References m_framelimit.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setFrameLimitEnabled()

void FIFE::RenderBackend::setFrameLimitEnabled ( bool  limited)

Sets whether to use the frame limiter.

Definition at line 220 of file renderbackend.cpp.

References m_isframelimit.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setImageCompressingEnabled()

void FIFE::RenderBackend::setImageCompressingEnabled ( bool  enabled)
inline

Enables or disable compressing images by video driver.

Remarks
This is relevant for in OpenGL renderbackend

Definition at line 346 of file renderbackend.h.

Referenced by FIFE::Engine::init(), and FIFE::GuiImageLoader::load().

+ Here is the caller graph for this function:

◆ setLighting()

virtual void FIFE::RenderBackend::setLighting ( float  red,
float  green,
float  blue 
)
pure virtual

Set colors for lighting.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Camera::render().

+ Here is the caller graph for this function:

◆ setLightingModel()

virtual void FIFE::RenderBackend::setLightingModel ( uint32_t  lighting)
pure virtual

Initializes the light.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setMipmappingEnabled()

void FIFE::RenderBackend::setMipmappingEnabled ( bool  enabled)

Enables or disables the usage of mipmapping.

Note! Works only for OpenGL backends.

Definition at line 143 of file renderbackend.cpp.

References m_isMipmapping.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setMonochromeEnabled()

void FIFE::RenderBackend::setMonochromeEnabled ( bool  enabled)

Enables or disables monochrome rendering.

Note! Works only for OpenGL backends.

Definition at line 155 of file renderbackend.cpp.

References m_monochrome.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setNPOTEnabled()

void FIFE::RenderBackend::setNPOTEnabled ( bool  enabled)
inline

Enables or disable the usage of npot, if available.

Definition at line 362 of file renderbackend.h.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setScreenMode()

virtual void FIFE::RenderBackend::setScreenMode ( const ScreenMode mode)
pure virtual

Sets the mainscreen display mode.

Parameters
modeThe ScreenMode to change the display to.
See also
FIFE::ScreenMode.

Implemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

◆ setTextureFiltering()

void FIFE::RenderBackend::setTextureFiltering ( TextureFiltering  filter)

Sets the texture filtering method.

Supports none, bilinear, trilinear and anisotropic filtering. Note! Works only for OpenGL backends.

See also
TextureFiltering

Definition at line 135 of file renderbackend.cpp.

References m_textureFilter.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ setVSyncEnabled()

void FIFE::RenderBackend::setVSyncEnabled ( bool  vsync)

Sets whether to use VSync.

Definition at line 212 of file renderbackend.cpp.

References m_vSync.

Referenced by FIFE::Engine::init().

+ Here is the caller graph for this function:

◆ startFrame()

void FIFE::RenderBackend::startFrame ( )
virtual

Called when a new frame starts.

Reimplemented in FIFE::RenderBackendOpenGL, and FIFE::RenderBackendSDL.

Definition at line 69 of file renderbackend.cpp.

References m_frame_start, and m_isframelimit.

Referenced by FIFE::Engine::pump(), FIFE::RenderBackendSDL::startFrame(), and FIFE::RenderBackendOpenGL::startFrame().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_alphaValue

float FIFE::RenderBackend::m_alphaValue
protected

◆ m_backgroundcolor

SDL_Color FIFE::RenderBackend::m_backgroundcolor
protected

◆ m_clipstack

std::stack<ClipInfo> FIFE::RenderBackend::m_clipstack
protected

Definition at line 547 of file renderbackend.h.

Referenced by getClipArea(), popClipArea(), and pushClipArea().

◆ m_colorkey

SDL_Color FIFE::RenderBackend::m_colorkey
protected

Definition at line 515 of file renderbackend.h.

Referenced by getColorKey(), and setColorKey().

◆ m_compressimages

bool FIFE::RenderBackend::m_compressimages
protected

Definition at line 510 of file renderbackend.h.

◆ m_frame_start

uint32_t FIFE::RenderBackend::m_frame_start
private

Definition at line 552 of file renderbackend.h.

Referenced by endFrame(), and startFrame().

◆ m_framelimit

uint16_t FIFE::RenderBackend::m_framelimit
private

Definition at line 553 of file renderbackend.h.

Referenced by endFrame(), getFrameLimit(), and setFrameLimit().

◆ m_guiClip

ClipInfo FIFE::RenderBackend::m_guiClip
protected

Definition at line 549 of file renderbackend.h.

◆ m_isalphaoptimized

bool FIFE::RenderBackend::m_isalphaoptimized
protected

Definition at line 513 of file renderbackend.h.

◆ m_isbackgroundcolor

bool FIFE::RenderBackend::m_isbackgroundcolor
protected

◆ m_iscolorkeyenabled

bool FIFE::RenderBackend::m_iscolorkeyenabled
protected

Definition at line 514 of file renderbackend.h.

Referenced by isColorKeyEnabled(), and setColorKeyEnabled().

◆ m_isDepthBuffer

bool FIFE::RenderBackend::m_isDepthBuffer
protected

Definition at line 531 of file renderbackend.h.

Referenced by isDepthBufferEnabled(), and setDepthBufferEnabled().

◆ m_isframelimit

bool FIFE::RenderBackend::m_isframelimit
private

Definition at line 551 of file renderbackend.h.

Referenced by endFrame(), isFrameLimitEnabled(), setFrameLimitEnabled(), and startFrame().

◆ m_isMipmapping

bool FIFE::RenderBackend::m_isMipmapping
protected

Definition at line 523 of file renderbackend.h.

Referenced by isMipmappingEnabled(), and setMipmappingEnabled().

◆ m_maxAnisotropy

int32_t FIFE::RenderBackend::m_maxAnisotropy
protected

Definition at line 527 of file renderbackend.h.

Referenced by getMaxAnisotropy(), and FIFE::RenderBackendOpenGL::setScreenMode().

◆ m_monochrome

bool FIFE::RenderBackend::m_monochrome
protected

Definition at line 529 of file renderbackend.h.

Referenced by isMonochromeEnabled(), and setMonochromeEnabled().

◆ m_rgba_format

◆ m_screen

◆ m_screenMode

ScreenMode FIFE::RenderBackend::m_screenMode
protected

◆ m_target

◆ m_textureFilter

TextureFiltering FIFE::RenderBackend::m_textureFilter
protected

◆ m_useframebuffer

◆ m_usenpot

bool FIFE::RenderBackend::m_usenpot
protected

Definition at line 512 of file renderbackend.h.

◆ m_vSync

bool FIFE::RenderBackend::m_vSync
protected

◆ m_window


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