PixelLightAPI  .
Public Types | Public Member Functions | Public Attributes | Protected Member Functions
PLRenderer::Surface Class Reference

Abstract renderer surface where we can render in. More...

#include <Surface.h>

Inheritance diagram for PLRenderer::Surface:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EType { Window = 0, TextureBuffer = 1 }
 Surface types. More...

Public Member Functions

virtual PLRENDERER_API ~Surface ()
 Destructor.
RendererGetRenderer () const
 Returns the owner renderer.
EType GetType () const
 Returns the surface type.
bool IsActive () const
 Returns whether the surface is active or not.
void SetActive (bool bActive=true)
 Sets whether the surface is active or not.
SurfacePainterGetPainter () const
 Returns the surface painter.
PLRENDERER_API bool SetPainter (SurfacePainter *pPainter, bool bDestroy=true)
 Set a surface painter.
PLRENDERER_API void Draw ()
 Draws the surface.
bool IsSwapY () const
 Returns the whether the surface is flipped along the y axis.
void SetSwapY (bool bSwapY=false)
 Sets the whether the surface is flipped along the y axis.
virtual PLMath::Vector2i GetSize () const =0
 Returns the size of this renderer surface.
virtual PLRENDERER_API bool IsAPISwapY () const
 Returns the whether the surface is flipped along the y axis.

Public Attributes

PLCore::Event EventPaintBegin
PLCore::Event EventPaint
PLCore::Event EventPaintEnd

Protected Member Functions

PLRENDERER_API Surface (Renderer &cRenderer, EType nType)
 Constructor.
virtual bool Init ()=0
 Initializes the surface.
virtual void DeInit ()=0
 De-initializes the surface.
virtual bool MakeCurrent (PLCore::uint8 nFace=0)=0
 Makes this surface to the renderers current render target.
virtual PLRENDERER_API bool UnmakeCurrent ()
 Unmakes this surface from the renderers current render target.
virtual bool Present ()=0
 Presents the contents of the next buffer in the sequence of back buffers owned by the device.
virtual PLRENDERER_API void BackupDeviceData ()
 Backups the surface device data.
virtual PLRENDERER_API void RestoreDeviceData ()
 Restores the surface device data.

Detailed Description

Abstract renderer surface where we can render in.


Member Enumeration Documentation

Surface types.

Enumerator:
Window 

Render to window

TextureBuffer 

Render to texture buffer


Constructor & Destructor Documentation

virtual PLRENDERER_API PLRenderer::Surface::~Surface ( ) [virtual]

Destructor.

PLRENDERER_API PLRenderer::Surface::Surface ( Renderer cRenderer,
EType  nType 
) [protected]

Constructor.

Parameters:
[in]cRendererOwner renderer
[in]nTypeSurface type

Member Function Documentation

Returns the owner renderer.

Returns:
The owner renderer

Returns the surface type.

Returns:
Surface type
bool PLRenderer::Surface::IsActive ( ) const [inline]

Returns whether the surface is active or not.

Returns:
'true' if the surface is active, else 'false'
void PLRenderer::Surface::SetActive ( bool  bActive = true) [inline]

Sets whether the surface is active or not.

Parameters:
[in]bActive'true' if the surface is active, else 'false'

Returns the surface painter.

Returns:
The surface painter, a null pointer if there's no surface painter
PLRENDERER_API bool PLRenderer::Surface::SetPainter ( SurfacePainter pPainter,
bool  bDestroy = true 
)

Set a surface painter.

Parameters:
[in]pPainterPointer to the surface painter, can be a null pointer
[in]bDestroyDestroy the current set surface painter? (if there's one)
Returns:
'true' if all went fine, else 'false'
Remarks:
The painter will be destroyed by the surface, so don't delete it again!
PLRENDERER_API void PLRenderer::Surface::Draw ( )

Draws the surface.

Remarks:
Just calls the OnPaint() function if there's a surface painter and if this surface is active.
bool PLRenderer::Surface::IsSwapY ( ) const [inline]

Returns the whether the surface is flipped along the y axis.

Returns:
'true' if the surface is flipped along the y axis, else 'false'
void PLRenderer::Surface::SetSwapY ( bool  bSwapY = false) [inline]

Sets the whether the surface is flipped along the y axis.

Parameters:
[in]bSwapY'true' if the surface is flipped along the y axis, else 'false'
virtual PLMath::Vector2i PLRenderer::Surface::GetSize ( ) const [pure virtual]

Returns the size of this renderer surface.

Returns:
The size of this renderer surface
virtual PLRENDERER_API bool PLRenderer::Surface::IsAPISwapY ( ) const [virtual]

Returns the whether the surface is flipped along the y axis.

Returns:
'true' if the surface is flipped along the y axis, else 'false'
Note:
  • By overwriting this function, the renderer backend can decide by itself how to flip the surface
virtual bool PLRenderer::Surface::Init ( ) [protected, pure virtual]

Initializes the surface.

Returns:
'true' if all went fine, else 'false'
virtual void PLRenderer::Surface::DeInit ( ) [protected, pure virtual]

De-initializes the surface.

virtual bool PLRenderer::Surface::MakeCurrent ( PLCore::uint8  nFace = 0) [protected, pure virtual]

Makes this surface to the renderers current render target.

Parameters:
[in]nFaceCube map face to render in (0-5) - only used if this is a cube texture buffer render target
Returns:
'true' if all went fine, else 'false'
virtual PLRENDERER_API bool PLRenderer::Surface::UnmakeCurrent ( ) [protected, virtual]

Unmakes this surface from the renderers current render target.

Returns:
'true' if all went fine, else 'false'
virtual bool PLRenderer::Surface::Present ( ) [protected, pure virtual]

Presents the contents of the next buffer in the sequence of back buffers owned by the device.

Returns:
'true' if all went fine, else 'false'
virtual PLRENDERER_API void PLRenderer::Surface::BackupDeviceData ( ) [protected, virtual]

Backups the surface device data.

Note:
  • Used for instance if the display mode is changed to backup/restore all surface device data
  • Normally only used inside Renderer::BackupDeviceObjects()/Renderer::RestoreDeviceObjects()
virtual PLRENDERER_API void PLRenderer::Surface::RestoreDeviceData ( ) [protected, virtual]

Restores the surface device data.

See also:

Member Data Documentation

Paint begin event - emitted BEFORE any painting begins

Paint event - emitted BEFORE any painting

Paint end event - emitted AFTER any painting ends


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:39
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported