Oficina Framework  1.3
Games Framework
OficinaFramework::RenderingSystem Class Reference

Groups rendering-related controls. Use this to allocate and deallocate textures accelerated by GPU, and also for drawing textures or primitives onscreen. More...

#include <RenderingSystem.hpp>

Classes

class  Animation
 Represents an Animation, a set of controls for animating objects using SpriteSheets. More...
 
class  Font
 Represents a Font, a texture with monospace characters to be used to draw text onscreen. More...
 
class  FrameBuffer
 Describes a Frame Buffer object. More...
 
class  IRendererObject
 Interface for GPU-related objects. More...
 
class  RenderBuffer
 
class  SpriteSheet
 Represents a Sprite Sheet, a texture containing frames used for animating objects such as characters. More...
 
class  Texture
 Represents a texture. Use RenderingSystem::TexturePool to allocate a new Texture. More...
 
class  TexturePool
 Represents a structure that can manage the allocation and deallocation of textures. More...
 

Public Types

enum  RenderProperty { RENDER_NORMALLY, RENDER_FLIP_X, RENDER_FLIP_Y, RENDER_FLIP_BOTH }
 Rendering properties to be used. More...
 
enum  RenderEffect {
  MODULATE_EFFECT, REPLACE_EFFECT, CHROMAKEY_EFFECT, INVERSION_EFFECT,
  LIGHT_EFFECT
}
 Rendering effects to be used. More...
 

Static Public Member Functions

static void glClearColorM (ColorM c)
 glClearColor equivalent for a color mask (color or (color)ColorDef) More...
 
static void glClearAccumM (ColorM c)
 glClearAccum equivalent for a color mask (color or (color)ColorDef) More...
 
static void glColorM (ColorM c, float transparency)
 glColor equivalent for a color mask (color or (color)ColorDef) More...
 
static void glColorM (ColorM c)
 glColor equivalent for a color mask (color or (color)ColorDef) More...
 
static void SetCameraPosition (vec2 CameraCenter)
 Sets the position of the current viewport. More...
 
static vec2 GetCameraPosition ()
 Gets the central camera position. More...
 
static vec2 GetViewportPosition ()
 Gets the viewport position. More...
 
static void init ()
 Initializes the OpenGL renderer. More...
 
static void dispose ()
 Disposes the active textures and etc. More...
 
static void SetViewportSize (vec2dw size)
 Sets the size of the viewport. More...
 
static vec2dw GetViewportSize ()
 Gets the size of the viewport. More...
 
static void SetResolution (vec2dw res)
 Sets the resolution for the application. More...
 
static vec2dw GetResolution ()
 Gets the current application resolution. More...
 
static void glTranslateToViewportPos ()
 Translates viewport to current camera position. More...
 
static float GetZoomFactor ()
 Gets the camera zoom factor. More...
 
static void SetZoomFactor (float value)
 Sets the camera zoom factor. More...
 
static void DrawRectangle (vec2 Position, vec2 Size, float angle, ColorDef Color, float transparency)
 Draws a rectangle on screen. More...
 
static void DrawTriangle (vec2 BaricenterPosition, float HalfWidth, float HalfHeight, float angle, ColorDef Color, float transparency)
 Draws an equilateral triangle on screen. More...
 
static void DrawTriangle (vec2 BaricenterPosition, vec2 Vertex1, vec2 Vertex2, vec2 Vertex3, float angle, ColorDef Color, float transparency)
 Draws an triangle on screen. More...
 
static void DrawTriangle (vec2 BaricenterPosition, vec2 Vertices[3], float angle, ColorDef Color, float transparency)
 Draws an triangle on screen. More...
 
static void SetLinearFiltering (bool state)
 Disables or enables the state of linear filtering. More...
 
static bool GetLinearFilteringState ()
 Gets the state of linear filtering. More...
 
static bool IsARBDebugActive ()
 Checks for ARB debug (only works with DEBUG_ENABLED define). More...
 
static void CreateDefaultBuffer ()
 Creates the default buffer. Normally used when resizing the window. More...
 
static void DestroyDefaultBuffer ()
 Destroys the default buffer. Normally used when resizing the window. More...
 
static FrameBufferGetDefaultBuffer ()
 Gets the default buffer where the scene is rendered to. More...
 

Detailed Description

Groups rendering-related controls. Use this to allocate and deallocate textures accelerated by GPU, and also for drawing textures or primitives onscreen.

Todo:
  • Ditch fixed pipeline completely in favor of using shaders.

Member Enumeration Documentation

◆ RenderEffect

Rendering effects to be used.

Note
For advanced effects, please consider using GLSL Shaders.
Enumerator
MODULATE_EFFECT 

Modulate alpha and tint onto texel color.

REPLACE_EFFECT 

Skip tint and non-100% alpha and use texel colors.

CHROMAKEY_EFFECT 

Replace alpha by tint.

INVERSION_EFFECT 

Modulate alpha and tint onto texel color, then invert it.

LIGHT_EFFECT 

Add alpha and tint onto texel color, then also add top colors.

◆ RenderProperty

Rendering properties to be used.

Enumerator
RENDER_NORMALLY 

Renders normally.

RENDER_FLIP_X 

Renders flipping on X axis.

RENDER_FLIP_Y 

Renders flipping on Y axis.

RENDER_FLIP_BOTH 

Renders flippling both axis.

Member Function Documentation

◆ CreateDefaultBuffer()

static void OficinaFramework::RenderingSystem::CreateDefaultBuffer ( )
static

Creates the default buffer. Normally used when resizing the window.

Warning
Do not use this unless you are aware of what you're doing!

◆ DestroyDefaultBuffer()

static void OficinaFramework::RenderingSystem::DestroyDefaultBuffer ( )
static

Destroys the default buffer. Normally used when resizing the window.

Warning
Do not use this unless you are aware of what you're doing!

◆ dispose()

static void OficinaFramework::RenderingSystem::dispose ( )
static

Disposes the active textures and etc.

◆ DrawRectangle()

static void OficinaFramework::RenderingSystem::DrawRectangle ( vec2  Position,
vec2  Size,
float  angle,
ColorDef  Color,
float  transparency 
)
static

Draws a rectangle on screen.

Parameters
PositionPosition of the upper left corner of the rectangle on screen.
SizeSize of the rectangle.
angleAngle of the rectangle around the upper left corner, in degrees. Defaults to 0.0f.
ColorColor of the rectangle.
transparencyAlpha ratio of the rectangle. Defaults to 1.0f.

◆ DrawTriangle() [1/3]

static void OficinaFramework::RenderingSystem::DrawTriangle ( vec2  BaricenterPosition,
float  HalfWidth,
float  HalfHeight,
float  angle,
ColorDef  Color,
float  transparency 
)
static

Draws an equilateral triangle on screen.

Parameters
BaricenterPositionPosition of the exact triangle center.
HalfWidthHalf size of bottom edge's length.
HalfHeightHalf of the size from the straight line described from top vertex to bottom edge.
angleAngle for turning the triangle towards baricenter, in degrees. Defaults to 0.0f.
ColorColor of the triangle.
transparencyAlpha ratio of the rectangle. Defaults to 1.0f.

◆ DrawTriangle() [2/3]

static void OficinaFramework::RenderingSystem::DrawTriangle ( vec2  BaricenterPosition,
vec2  Vertex1,
vec2  Vertex2,
vec2  Vertex3,
float  angle,
ColorDef  Color,
float  transparency 
)
static

Draws an triangle on screen.

Parameters
BaricenterPositionPosition of the exact triangle center.
Vertex1First vertex of the triangle.
Vertex2Second vertex of the triangle.
Vertex3Third vertex of the triangle.
angleAngle for turning the triangle towards baricenter, in degrees. Defaults to 0.0f.
ColorColor of the triangle.
transparencyAlpha ratio of the rectangle. Defaults to 1.0f.

◆ DrawTriangle() [3/3]

static void OficinaFramework::RenderingSystem::DrawTriangle ( vec2  BaricenterPosition,
vec2  Vertices[3],
float  angle,
ColorDef  Color,
float  transparency 
)
static

Draws an triangle on screen.

Parameters
BaricenterPositionPosition of the exact triangle center.
VerticesVertices of the triangle.
angleAngle for turning the triangle towards baricenter, in degrees. Defaults to 0.0f.
ColorColor of the triangle.
transparencyAlpha ratio of the rectangle. Defaults to 1.0f.

◆ GetCameraPosition()

static vec2 OficinaFramework::RenderingSystem::GetCameraPosition ( )
static

Gets the central camera position.

Returns
The center position of the camera related to the viewport.

◆ GetDefaultBuffer()

static FrameBuffer* OficinaFramework::RenderingSystem::GetDefaultBuffer ( )
static

Gets the default buffer where the scene is rendered to.

◆ GetLinearFilteringState()

static bool OficinaFramework::RenderingSystem::GetLinearFilteringState ( )
static

Gets the state of linear filtering.

Returns
Whether linear filtering is active or inactive.

◆ GetResolution()

static vec2dw OficinaFramework::RenderingSystem::GetResolution ( )
static

Gets the current application resolution.

Returns
Current internal resolution, despite resizing.

◆ GetViewportPosition()

static vec2 OficinaFramework::RenderingSystem::GetViewportPosition ( )
static

Gets the viewport position.

Returns
The upper top position of the viewport.

◆ GetViewportSize()

static vec2dw OficinaFramework::RenderingSystem::GetViewportSize ( )
static

Gets the size of the viewport.

Returns
The viewport size.

◆ GetZoomFactor()

static float OficinaFramework::RenderingSystem::GetZoomFactor ( )
static

Gets the camera zoom factor.

Returns
Camera zoom factor. 1.0f equals 100%.

◆ glClearAccumM()

static void OficinaFramework::RenderingSystem::glClearAccumM ( ColorM  c)
static

glClearAccum equivalent for a color mask (color or (color)ColorDef)

Parameters
cColor to fill the accumulation buffer after cleaning it.

◆ glClearColorM()

static void OficinaFramework::RenderingSystem::glClearColorM ( ColorM  c)
static

glClearColor equivalent for a color mask (color or (color)ColorDef)

Parameters
cColor to fill the back buffer after cleaning it.

◆ glColorM() [1/2]

static void OficinaFramework::RenderingSystem::glColorM ( ColorM  c,
float  transparency 
)
static

glColor equivalent for a color mask (color or (color)ColorDef)

Parameters
cColor to bind to the next vertex (before the call of another glColor function).
transparencyAlpha ratio of the color.

◆ glColorM() [2/2]

static void OficinaFramework::RenderingSystem::glColorM ( ColorM  c)
static

glColor equivalent for a color mask (color or (color)ColorDef)

Parameters
cColor to bind to the next vertex (before the call of another glColor function).

◆ glTranslateToViewportPos()

static void OficinaFramework::RenderingSystem::glTranslateToViewportPos ( )
static

Translates viewport to current camera position.

◆ init()

static void OficinaFramework::RenderingSystem::init ( )
static

Initializes the OpenGL renderer.

◆ IsARBDebugActive()

static bool OficinaFramework::RenderingSystem::IsARBDebugActive ( )
static

Checks for ARB debug (only works with DEBUG_ENABLED define).

Returns
Whether ARB debug is active or not

◆ SetCameraPosition()

static void OficinaFramework::RenderingSystem::SetCameraPosition ( vec2  CameraCenter)
static

Sets the position of the current viewport.

Parameters
CameraCenterFloat-precision vec2 camera center position.

◆ SetLinearFiltering()

static void OficinaFramework::RenderingSystem::SetLinearFiltering ( bool  state)
static

Disables or enables the state of linear filtering.

Parameters
stateWhether linear filtering should be active or inactive.

◆ SetResolution()

static void OficinaFramework::RenderingSystem::SetResolution ( vec2dw  res)
static

Sets the resolution for the application.

Parameters
resDesired resolution.

◆ SetViewportSize()

static void OficinaFramework::RenderingSystem::SetViewportSize ( vec2dw  size)
static

Sets the size of the viewport.

Parameters
sizeNew size for the viewport.

◆ SetZoomFactor()

static void OficinaFramework::RenderingSystem::SetZoomFactor ( float  value)
static

Sets the camera zoom factor.

Parameters
valueZoom factor to be given to camera. 1.0f equals 100%.

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