Aether3D
Game Engine
Public Member Functions | Static Public Attributes | List of all members
Renderer Class Referenceabstract

Renders models and UI. More...

#include <Renderer.hpp>

Public Member Functions

virtual void AddShaderSearchPath (const char *path) const =0
 Adds a path where Material will search for shaders. Paths are searched in order they are added and the first matching shader is used when using Material.SetShaders(). More...
 
virtual void ClearScreen () const =0
 
virtual void Deinit ()=0
 
virtual void Draw (const Texture *texture, int x, int y, const Vec4 &color)=0
 
virtual void Draw (const Texture *texture, int x, int y, int width, int height, const Vec4 &color)=0
 
virtual void Draw (const char *text, const char *fontName, float scale, int x, int y, const Vec4 &color)=0
 
virtual void Draw (Scene *scene)=0
 
virtual void DrawLines (const Vec3 *lineArray, int arraySize, const Vec4 &color)=0
 
virtual void DrawStatistics ()=0
 
virtual void FinishFrame ()=0
 
virtual double GetTime () const =0
 
virtual int Height () const =0
 
virtual Error::Enum LoadFont (const char *fontName, const char *fontBitmapPath, const char *fontMetadataPath)=0
 
virtual Error::Enum OpenWindow (int width, int height, bool fullScreen, int antialiasSamples, bool hasWindowAndContext)=0
 
virtual void Resize (int width, int height)=0
 
virtual void SetBloom (bool enable, float factor, int blurIterations)=0
 
virtual void SetClearColor (float red, float green, float blue)=0
 
virtual void SetSSAO (bool enable, float radius, float power)=0
 
virtual void SetWindowTitle (const char *title) const =0
 
virtual void SwapBuffers ()=0
 
virtual int Width () const =0
 
virtual void BeginQuery ()=0
 
virtual double EndQuery ()=0
 
virtual bool HasFocus () const =0
 

Static Public Attributes

static const unsigned apiVersion = 23
 

Detailed Description

Renders models and UI.

Member Function Documentation

◆ AddShaderSearchPath()

virtual void Renderer::AddShaderSearchPath ( const char *  path) const
pure virtual

Adds a path where Material will search for shaders. Paths are searched in order they are added and the first matching shader is used when using Material.SetShaders().

Parameters
pathPath. Must end with '/'.

◆ BeginQuery()

virtual void Renderer::BeginQuery ( )
pure virtual

Begins a GPU timer query.

◆ ClearScreen()

virtual void Renderer::ClearScreen ( ) const
pure virtual

Clears the active framebuffer using color set by SetClearColor. Implicitly called by Draw( scene ).

◆ Deinit()

virtual void Renderer::Deinit ( )
pure virtual

Releases resources and terminates the running application.

◆ Draw() [1/4]

virtual void Renderer::Draw ( const char *  text,
const char *  fontName,
float  scale,
int  x,
int  y,
const Vec4 color 
)
pure virtual

Draws a string of text (screen-space).

Parameters
textText to draw. Characters not in font will be rendered empty.
fontNameFont name. Must have been added using CreateFont(). Builtin font name is "aether3d_font".
scaleScale of the font.
xPixel coordinate of the left side of the text.
yPixel coordinate of the top side of the text.
colorColor tint in range 0-1. .w is opacity.

◆ Draw() [2/4]

virtual void Renderer::Draw ( const Texture texture,
int  x,
int  y,
const Vec4 color 
)
pure virtual

Draws a texture.

Parameters
textureTexture.
xPixel coordinate from the left side of the window.
yPixel coordinate from the top of the window.
colorColor tint in range 0-1. .w is opacity.

◆ Draw() [3/4]

virtual void Renderer::Draw ( const Texture texture,
int  x,
int  y,
int  width,
int  height,
const Vec4 color 
)
pure virtual

Draws a texture in custom dimensions.

Parameters
textureTexture.
xPixel coordinate from the left side of the window.
yPixel coordinate from the top of the window.
widthWidth in pixels.
heightHeight in pixels.
colorColor tint in range 0-1. .w is opacity.

◆ Draw() [4/4]

virtual void Renderer::Draw ( Scene scene)
pure virtual

Draws a scene. Should only be called once per frame. Render-to-texture Cameras are rendered before normal cameras.

Parameters
sceneScene.

◆ DrawLines()

virtual void Renderer::DrawLines ( const Vec3 lineArray,
int  arraySize,
const Vec4 color 
)
pure virtual

Draws lines in 3D.

Parameters
lineArrayLine geometry.
arraySizelineArray length.
colorColor.

◆ DrawStatistics()

virtual void Renderer::DrawStatistics ( )
pure virtual

Draws frame time and draw call count.

◆ EndQuery()

virtual double Renderer::EndQuery ( )
pure virtual
Returns
Elapsed GPU time from BeginQuery to EndQuery in milliseconds.

◆ FinishFrame()

virtual void Renderer::FinishFrame ( )
pure virtual

Renders everything that was called with Draw() methods. Call before SwapBuffers().

◆ GetTime()

virtual double Renderer::GetTime ( ) const
pure virtual
Returns
Time in seconds.

◆ HasFocus()

virtual bool Renderer::HasFocus ( ) const
pure virtual
Returns
True, if the window has focus.

◆ Height()

virtual int Renderer::Height ( ) const
pure virtual
Returns
Window height in pixels.

◆ LoadFont()

virtual Error::Enum Renderer::LoadFont ( const char *  fontName,
const char *  fontBitmapPath,
const char *  fontMetadataPath 
)
pure virtual

Creates a bitmap font from a file and metadata.

Parameters
fontNameFont's name. Used when drawing text.
fontBitmapPathFont's path. Supported image formats are .png, .bmp, .tga, .jpg.
fontMetadataPathFont's meta data path. Currently supports only meta data generated by BMFont.
Returns
NO_ERRORS on success, error otherwise.

◆ OpenWindow()

virtual Error::Enum Renderer::OpenWindow ( int  width,
int  height,
bool  fullScreen,
int  antialiasSamples,
bool  hasWindowAndContext 
)
pure virtual

Opens a window, creating rendering context.

Parameters
widthWidth in pixels. 0 means desktop width.
heightHeight in pixels. 0 means desktop height.
fullScreenShould the window be fullscreen.
antialiasSamplesHow many antialias sample buffers are used? Pass 1 to disable antialiasing.
hasWindowAndContextTrue, if the DLL creates the graphics window and context. False, if the DLL is loaded into some other application's window/context, like Editor.

◆ Resize()

virtual void Renderer::Resize ( int  width,
int  height 
)
pure virtual
Parameters
widthNew width.
heightNew height.

◆ SetBloom()

virtual void Renderer::SetBloom ( bool  enable,
float  factor,
int  blurIterations 
)
pure virtual

Sets bloom. Defaults to no bloom.

Parameters
enableTrue if bloom should be applied, false otherwise.
factorBloom intensity factor. Values near 0.5 should be ok.
blurIterationsBlur iterations.

◆ SetClearColor()

virtual void Renderer::SetClearColor ( float  red,
float  green,
float  blue 
)
pure virtual

Sets clear color. Must be set after OpenWindow(). Defaults to black.

Parameters
redRed (0.0-1.0)
greenGreen (0.0-1.0)
blueBlue (0.0-1.0)

◆ SetSSAO()

virtual void Renderer::SetSSAO ( bool  enable,
float  radius,
float  power 
)
pure virtual

Sets SSAO. Defaults to disabled.

Parameters
enableTrue if SSAO should be applied, false otherwise.
radiusRadius.
powerPower.

◆ SetWindowTitle()

virtual void Renderer::SetWindowTitle ( const char *  title) const
pure virtual
Parameters
titleTitle

◆ SwapBuffers()

virtual void Renderer::SwapBuffers ( )
pure virtual

Shows the rendering on screen.

◆ Width()

virtual int Renderer::Width ( ) const
pure virtual
Returns
window width in pixels.

Member Data Documentation

◆ apiVersion

const unsigned Renderer::apiVersion = 23
static

Used to verify that the DLL version matches header version.


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