Renderer

Description

Abstract interface and helper functionality for rendering scene objects.

Classes

class  ParamBlockParam< T >
 Wrapper for a single parameter in a parameter block buffer. More...
 
struct  ParamBlock
 Base class for all parameter blocks. More...
 
class  ParamBlockManager
 Takes care of initializing param block definitions in a delayed manner since they depend on engine systems yet are usually used as global variables which are initialized before engine systems are ready. More...
 
struct  RendererOptions
 Set of options that can be used for controlling the renderer. More...
 
struct  Renderer::RenderCallbackData
 Contains information about a render callback. More...
 
class  Renderer
 Primarily rendering class that allows you to specify how to render objects that exist in the scene graph. More...
 
class  RendererExtension
 Interface that can be implemented in order to provide custom rendering code to the renderer. More...
 
class  RendererFactory
 Factory class for creating Renderer objects. More...
 
class  RendererManager
 Allows you to change and retrieve the active renderer. More...
 

Macros

#define BS_PARAM_BLOCK_BEGIN(Name)
 Starts a new custom parameter block. More...
 
#define BS_PARAM_BLOCK_ENTRY_ARRAY(Type, Name, NumElements)
 Registers a new entry in a parameter block. More...
 
#define BS_PARAM_BLOCK_ENTRY(Type, Name)   BS_PARAM_BLOCK_ENTRY_ARRAY(Type, Name, 1)
 Registers a new entry in a parameter block. More...
 
#define BS_PARAM_BLOCK_END
 Ends parameter block definition. More...
 

Typedefs

typedef Flags< CameraFlag > CameraFlags
 

Enumerations

enum  CameraDirtyFlag { Transform = 1<<0, Everything = 1<<1, PostProcess = 1<<2 }
 Signals which portion of a Camera is dirty. More...
 
enum  CameraFlag { Overlay = 1 << 0, HDR = 1 << 1, NoLighting = 1 << 2 }
 Flags that describe a camera. More...
 
enum  RenderLocation { PreBasePass, PostBasePass, PostLightPass, Overlay }
 A set of available locations at which the renderer can call RendererExtension's render() method. More...
 

Functions

 BS_FLAGS_OPERATORS (CameraFlag)
 
SPtr< Renderer > BS_CORE_EXPORT gRenderer ()
 Provides easy access to Renderer. More...
 

Macro Definition Documentation

#define BS_PARAM_BLOCK_BEGIN (   Name)
Value:
struct Name : ParamBlock \
{ \
Name() \
{ \
ParamBlockManager::registerBlock(this); \
} \
\
SPtr<GpuParamBlockBuffer> createBuffer() const { return GpuParamBlockBuffer::create(mBlockSize); } \
\
private: \
friend class ParamBlockManager; \
\
void initialize() override \
{ \
mParams = getEntries(); \
RenderAPI& rapi = RenderAPI::instance(); \
\
GpuParamBlockDesc blockDesc = rapi.generateParamBlockDesc(#Name, mParams); \
mBlockSize = blockDesc.blockSize * sizeof(UINT32); \
\
initEntries(); \
} \
\
struct META_FirstEntry {}; \
static void META_GetPrevEntries(Vector<GpuParamDataDesc>& params, META_FirstEntry id) { } \
void META_InitPrevEntry(const Vector<GpuParamDataDesc>& params, UINT32 idx, META_FirstEntry id) { } \
\
typedef META_FirstEntry

Starts a new custom parameter block.

Custom parameter blocks allow you to create C++ structures that map directly to GPU program buffers (for example uniform buffer in OpenGL or constant buffer in DX). Must be followed by BS_PARAM_BLOCK_END.

#define BS_PARAM_BLOCK_END
Value:
META_LastEntry; \
\
static Vector<GpuParamDataDesc> getEntries() \
{ \
Vector<GpuParamDataDesc> entries; \
META_GetPrevEntries(entries, META_LastEntry()); \
return entries; \
} \
\
void initEntries() \
{ \
META_InitPrevEntry(mParams, (UINT32)mParams.size() - 1, META_LastEntry()); \
} \
\
Vector<GpuParamDataDesc> mParams; \
UINT32 mBlockSize; \
};

Ends parameter block definition.

See BS_PARAM_BLOCK_BEGIN.

#define BS_PARAM_BLOCK_ENTRY (   Type,
  Name 
)    BS_PARAM_BLOCK_ENTRY_ARRAY(Type, Name, 1)

Registers a new entry in a parameter block.

Must be called in between BS_PARAM_BLOCK_BEGIN and BS_PARAM_BLOCK_END calls.

#define BS_PARAM_BLOCK_ENTRY_ARRAY (   Type,
  Name,
  NumElements 
)
Value:
META_Entry_##Name; \
\
struct META_NextEntry_##Name {}; \
static void META_GetPrevEntries(Vector<GpuParamDataDesc>& params, META_NextEntry_##Name id) \
{ \
META_GetPrevEntries(params, META_Entry_##Name()); \
\
params.push_back(GpuParamDataDesc()); \
GpuParamDataDesc& newEntry = params.back(); \
newEntry.name = #Name; \
newEntry.type = (GpuParamDataType)TGpuDataParamInfo<Type>::TypeId; \
newEntry.arraySize = NumElements; \
} \
\
void META_InitPrevEntry(const Vector<GpuParamDataDesc>& params, UINT32 idx, META_NextEntry_##Name id) \
{ \
META_InitPrevEntry(params, idx - 1, META_Entry_##Name()); \
Name = ParamBlockParam<Type>(params[idx]); \
} \
\
public: \
ParamBlockParam<Type> Name; \
\
private: \
typedef META_NextEntry_##Name
GpuParamDataType
Type of GPU data parameters that can be used as inputs to a GPU program.
Definition: BsCommonTypes.h:308

Registers a new entry in a parameter block.

Must be called in between BS_PARAM_BLOCK_BEGIN and BS_PARAM_BLOCK_END calls.

Enumeration Type Documentation

enum CameraDirtyFlag
strong

Signals which portion of a Camera is dirty.

enum CameraFlag
strong

Flags that describe a camera.

Enumerator
Overlay 

This flag is a signal to the renderer that his camera will only render overlays and doesn't require depth buffer or multi-sampled render targets.

Such cameras will not render any scene objects. This can improve performance and memory usage.

HDR 

High dynamic range allows light intensity to be more correctly recorded when rendering by allowing for a larger range of values.

The stored light is then converted into visible color range using exposure and a tone mapping operator.

NoLighting 

Specify that no lighting should be applied to scene objects and everything should be rendered using their albedo texture.

enum RenderLocation
strong

A set of available locations at which the renderer can call RendererExtension's render() method.

Enumerator
PreBasePass 

Rendering happens before any scene objects are rendered.

The renderer guarantees the render targets used for rendering scene objects will be bound (e.g. GBuffer).

PostBasePass 

Rendering happens after all scene objects are rendered.

The renderer guarantees the render targets used for rendering scene objects will be bound (e.g. GBuffer).

PostLightPass 

Rendering happens after all scene objects have been rendered and their final information has been written to the final scene color buffer, without any post-processing.

The renderer guarantees the final scene color render target will be bound.

Overlay 

Rendering happens after all scene objects have been rendered and their final information has been written to the final scene color buffer, with post-processing.

The renderer guarantees the final scene color render target will be bound.

Function Documentation

SPtr<Renderer> BS_CORE_EXPORT bs::ct::gRenderer ( )

Provides easy access to Renderer.