Berserk
Classes | Typedefs | Enumerations | Functions | Variables
Render

Rendering module of the engine. More...

Classes

class  ShaderArchetypeBase
 Base shader type to draw a mesh on screen. More...
 
class  UtilsGLSL
 GLSL source code processing utils. More...
 
class  Material
 Controls how object is actually rendered. More...
 
class  MaterialParams
 Packed material params ready for rendering usage. More...
 
class  SubMesh
 Separate sufficient entity inside mesh object. More...
 
class  MeshArrays
 Struct describing mesh data per attribute. More...
 
class  Mesh
 Contains vertex array-based geometry. More...
 
class  MeshAttributeInfo
 Info about attribute. More...
 
class  MeshFormats
 Manages vertex layouts for default engine mesh formats. More...
 
class  RenderEngine
 Main rendering engine class. More...
 
class  ShaderOption
 Single option exposed by the shader. More...
 
class  ShaderCompileOptions
 Options passed to compile shader. More...
 
class  Shader
 Defines complete rendering flow for the object. More...
 
class  ShaderVariationHelper
 Assist in building variation key from options. More...
 
class  ShaderArchetype
 Handles source code pre-processing of shaders with this archetype. More...
 
class  ShaderCompiler
 Responsible to compile shaders in engine .shader.xml format. More...
 
class  ShaderManager
 Class for loading and importing engine shaders. More...
 
class  ShaderParam
 Describes single param in the shader. More...
 
class  ShaderParams
 Describes layout of shader params for packing by material. More...
 
struct  ShaderParams::ShaderParamLight
 
struct  ShaderParams::DataParamInfo
 Info about raw data param. More...
 
struct  ShaderParams::TextureParamInfo
 Info about texture data param. More...
 
class  ShaderPass
 Single rendering pass stage of the shader. More...
 
class  ShaderTechnique
 Represents particular approach to draw single object. More...
 
class  MeshAttribute
 Available mesh vertex attributes. More...
 
class  MeshFormat
 Mask defining mesh format (composed from attributes) More...
 
class  ShaderVariation
 Describes variation of compiled shader of the single type (max 64 flags) More...
 
class  ShaderParamType
 General types of shader params. More...
 
class  ShaderTechniqueTag
 Technique tags used to select techniques. More...
 
class  ShaderTechniqueTags
 Set of tags. More...
 

Typedefs

using MeshFormat = Mask< MeshAttribute, 8 >
 
using ShaderVariation = uint32
 
using ShaderTechniqueTags = Mask< ShaderTechniqueTag >
 

Enumerations

enum class  MeshAttribute : uint8 {
  Position = 0 , Normal = 1 , Tangent = 2 , Color = 3 ,
  UV = 4 , UV2 = 5 , Weights = 6 , Bones = 7
}
 
enum class  ShaderParamType : uint8 { Texture , Data , Unknown }
 
enum class  ShaderTechniqueTag
 

Functions

MeshAttributeInfo MeshGetAttributeInfo (MeshAttribute attribute)
 
BRK_API ShaderParams::ShaderParams (std::vector< ShaderParam > params)
 
BRK_API ShaderParams::~ShaderParams () override=default
 
BRK_API bool ShaderParams::HasParam (const StringName &name) const
 
BRK_API uint32 ShaderParams::GetParamId (const StringName &name) const
 
BRK_API const ShaderParamShaderParams::GetParam (const StringName &name) const
 
BRK_API const ShaderParamLightShaderParams::GetParamLight (const StringName &name) const
 
BRK_API const ShaderParamShaderParams::GetParam (uint32 id) const
 
BRK_API const ShaderParamLightShaderParams::GetParamLight (uint32 id) const
 
BRK_API const std::unordered_map< StringName, uint32 > & ShaderParams::GetParamLookUp () const
 
BRK_API const std::vector< ShaderParam > & ShaderParams::GetParams () const
 
BRK_API const std::vector< ShaderParamLight > & ShaderParams::GetParamsLight () const
 
BRK_API const std::vector< DataParamInfo > & ShaderParams::GetDataParamsInfo () const
 
BRK_API const std::vector< TextureParamInfo > & ShaderParams::GetTextureParamsInfo () const
 
BRK_API const std::vector< unsigned char > & ShaderParams::GetDefaultDataValues () const
 
uint32 ShaderParams::GetDataSize () const
 
uint32 ShaderParams::GetTexturesCount () const
 
void ShaderParams::Build ()
 
void ShaderParams::InitDefaults ()
 

Variables

StringName ShaderParam::name
 
StringName ShaderParam::uiName
 
String ShaderParam::description
 
String ShaderParam::defaultValue
 
uint32 ShaderParam::arraySize = 1
 
uint32 ShaderParam::info = 0xffffffff
 
ShaderParamType ShaderParam::type = ShaderParamType::Unknown
 
RHIShaderDataType ShaderParam::typeData = RHIShaderDataType::Unknown
 
RHIShaderParamType ShaderParam::typeParam = RHIShaderParamType::Unknown
 
static const uint32 ShaderParams::INVALID_ID = 0xffffffff
 
uint32 ShaderParams::ShaderParamLight::info = 0xffffffff
 
uint32 ShaderParams::ShaderParamLight::arraySize = 0u
 
ShaderParamType ShaderParams::ShaderParamLight::type = ShaderParamType::Unknown
 
RHIShaderDataType ShaderParams::ShaderParamLight::typeData = RHIShaderDataType::Unknown
 
RHIShaderParamType ShaderParams::ShaderParamLight::typeParam = RHIShaderParamType::Unknown
 
uint32 ShaderParams::DataParamInfo::offset = 0
 
uint32 ShaderParams::DataParamInfo::size = 0
 
uint32 ShaderParams::TextureParamInfo::offset = 0
 

Detailed Description

Rendering module of the engine.

Provides access to engine low-level and high-level rendering functionality, required for the rendering of the complex 2d/3d scenes as well as auxiliary features for debugging.

Implements such primitives as high-level shaders, materials, provides low-level abstraction for render view, render objects, auxiliary debug draw features.

Also provides abstraction for 3d scene, high-level render objects, meshes, post effects, high-level graphics pipelines.

Typedef Documentation

◆ MeshFormat

◆ ShaderTechniqueTags

◆ ShaderVariation

Enumeration Type Documentation

◆ MeshAttribute

enum MeshAttribute : uint8
strong
Enumerator
Position 

float vec3

Normal 

float vec3

Tangent 

float vec3

Color 

float vec3

UV 

float vec2

UV2 

float vec2

Weights 

float vec4

Bones 

int vec4

◆ ShaderParamType

enum ShaderParamType : uint8
strong
Enumerator
Texture 

Texture resource (some of RHI texture 2d, array, cube and etc.)

Data 

Raw data value (some of vec of int, float values and etc.)

Unknown 

Unspecified

◆ ShaderTechniqueTag

enum ShaderTechniqueTag
strong

Function Documentation

◆ Build()

void ShaderParams::Build ( )
protected

Define params layout and build look-up structure

◆ GetDataParamsInfo()

BRK_API const std::vector<DataParamInfo>& ShaderParams::GetDataParamsInfo ( ) const
inline
Returns
Data params info

◆ GetDataSize()

uint32 ShaderParams::GetDataSize ( ) const
inline

Byte size of buffer required to pack all data params

◆ GetDefaultDataValues()

BRK_API const std::vector<unsigned char>& ShaderParams::GetDefaultDataValues ( ) const
inline
Returns
Default data params values

◆ GetParam() [1/2]

const ShaderParam * ShaderParams::GetParam ( const StringName name) const

◆ GetParam() [2/2]

const ShaderParam & ShaderParams::GetParam ( uint32  id) const

◆ GetParamId()

uint32 ShaderParams::GetParamId ( const StringName name) const

◆ GetParamLight() [1/2]

const ShaderParams::ShaderParamLight * ShaderParams::GetParamLight ( const StringName name) const

◆ GetParamLight() [2/2]

const ShaderParams::ShaderParamLight & ShaderParams::GetParamLight ( uint32  id) const

◆ GetParamLookUp()

BRK_API const std::unordered_map<StringName, uint32>& ShaderParams::GetParamLookUp ( ) const
inline
Returns
Look-up info

◆ GetParams()

BRK_API const std::vector<ShaderParam>& ShaderParams::GetParams ( ) const
inline
Returns
Params list

◆ GetParamsLight()

BRK_API const std::vector<ShaderParamLight>& ShaderParams::GetParamsLight ( ) const
inline
Returns
Params list

◆ GetTextureParamsInfo()

BRK_API const std::vector<TextureParamInfo>& ShaderParams::GetTextureParamsInfo ( ) const
inline
Returns
Texture params info

◆ GetTexturesCount()

uint32 ShaderParams::GetTexturesCount ( ) const
inline

Total number of textures (includes array size factor)

◆ HasParam()

bool ShaderParams::HasParam ( const StringName name) const
Returns
Check if has param

◆ InitDefaults()

void ShaderParams::InitDefaults ( )
protected

Define default values

◆ MeshGetAttributeInfo()

MeshAttributeInfo MeshGetAttributeInfo ( MeshAttribute  attribute)
inline
Returns
Attribute info

◆ ShaderParams()

BRK_NS_BEGIN ShaderParams::ShaderParams ( std::vector< ShaderParam params)
explicit

CreateFromImage params layout from list of params

◆ ~ShaderParams()

BRK_API ShaderParams::~ShaderParams ( )
overridedefault

Variable Documentation

◆ arraySize [1/2]

uint32 ShaderParam::arraySize = 1

Size of array (if more than 1 value within a param)

◆ arraySize [2/2]

uint32 ShaderParams::ShaderParamLight::arraySize = 0u

◆ defaultValue

String ShaderParam::defaultValue

Optional default param value

◆ description

String ShaderParam::description

Optional param description

◆ info [1/2]

uint32 ShaderParam::info = 0xffffffff

[Internal]

◆ info [2/2]

uint32 ShaderParams::ShaderParamLight::info = 0xffffffff

◆ INVALID_ID

const uint32 ShaderParams::INVALID_ID = 0xffffffff
static

◆ name

StringName ShaderParam::name

Name of the param to set in material

◆ offset [1/2]

uint32 ShaderParams::DataParamInfo::offset = 0

◆ offset [2/2]

uint32 ShaderParams::TextureParamInfo::offset = 0

◆ size

uint32 ShaderParams::DataParamInfo::size = 0

◆ type [1/2]

Type of param

◆ type [2/2]

ShaderParamType ShaderParams::ShaderParamLight::type = ShaderParamType::Unknown

◆ typeData [1/2]

[Internal] RHI type of variable

◆ typeData [2/2]

RHIShaderDataType ShaderParams::ShaderParamLight::typeData = RHIShaderDataType::Unknown

◆ typeParam [1/2]

[Internal] RHI type of variable

◆ typeParam [2/2]

RHIShaderParamType ShaderParams::ShaderParamLight::typeParam = RHIShaderParamType::Unknown

◆ uiName

StringName ShaderParam::uiName

Optional param name displayed for the user