Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::GLTF_PBR_Renderer Class Reference

Implementation of a GLTF PBR renderer. More...

#include <GLTF_PBR_Renderer.hpp>

Classes

struct  ModelResourceBindings
 GLTF Model shader resource binding information. More...
 
struct  RenderInfo
 Rendering information. More...
 
struct  ResourceCacheBindings
 GLTF resource cache shader resource binding information. More...
 
struct  ResourceCacheUseInfo
 GLTF resource cache use information. More...
 

Public Member Functions

 GLTF_PBR_Renderer (IRenderDevice *pDevice, IRenderStateCache *pStateCache, IDeviceContext *pCtx, const CreateInfo &CI)
 Initializes the renderer.
 
void Render (IDeviceContext *pCtx, const GLTF::Model &GLTFModel, const GLTF::ModelTransforms &Transforms, const GLTF::ModelTransforms *PrevTransforms, const RenderInfo &RenderParams, ModelResourceBindings *pModelBindings, ResourceCacheBindings *pCacheBindings=nullptr)
 Renders a GLTF model.
 
ModelResourceBindings CreateResourceBindings (GLTF::Model &GLTFModel, IBuffer *pFrameAttribs)
 Creates resource bindings for a given GLTF model.
 
void InitMaterialSRB (GLTF::Model &Model, GLTF::Material &Material, IBuffer *pFrameAttribs, IShaderResourceBinding *pMaterialSRB)
 Initializes a shader resource binding for the given material.
 
void CreateResourceCacheSRB (IRenderDevice *pDevice, IDeviceContext *pCtx, ResourceCacheUseInfo &CacheUseInfo, IBuffer *pFrameAttribs, IShaderResourceBinding **ppCacheSRB)
 Creates a shader resource binding for a GTLF resource cache.
 
void Begin (IDeviceContext *pCtx)
 
void Begin (IRenderDevice *pDevice, IDeviceContext *pCtx, ResourceCacheUseInfo &CacheUseInfo, ResourceCacheBindings &Bindings, IBuffer *pFrameAttribs)
 

Detailed Description

Implementation of a GLTF PBR renderer.

Member Function Documentation

◆ Begin() [1/2]

void Diligent::GLTF_PBR_Renderer::Begin ( IDeviceContext * pCtx)

Prepares the renderer for rendering objects. This method must be called at least once per frame.

◆ Begin() [2/2]

void Diligent::GLTF_PBR_Renderer::Begin ( IRenderDevice * pDevice,
IDeviceContext * pCtx,
ResourceCacheUseInfo & CacheUseInfo,
ResourceCacheBindings & Bindings,
IBuffer * pFrameAttribs )

Prepares the renderer for rendering objects from the resource cache. This method must be called at least once per frame before the first object from the cache is rendered.

◆ CreateResourceCacheSRB()

void Diligent::GLTF_PBR_Renderer::CreateResourceCacheSRB ( IRenderDevice * pDevice,
IDeviceContext * pCtx,
ResourceCacheUseInfo & CacheUseInfo,
IBuffer * pFrameAttribs,
IShaderResourceBinding ** ppCacheSRB )

Creates a shader resource binding for a GTLF resource cache.

Parameters
[in]pDevice- Render device that may be needed by the resource cache to create internal objects.
[in]pCtx- Device context that may be needed by the resource cache to initialize internal objects.
[in]CacheUseInfo- GLTF resource cache usage information.
[in]pFrameAttribs- Frame attributes constant buffer to set in the SRB.
[out]ppCacheSRB- Pointer to memory location where the pointer to the SRB object will be written.

◆ InitMaterialSRB()

void Diligent::GLTF_PBR_Renderer::InitMaterialSRB ( GLTF::Model & Model,
GLTF::Material & Material,
IBuffer * pFrameAttribs,
IShaderResourceBinding * pMaterialSRB )

Initializes a shader resource binding for the given material.

Parameters
[in]Model- GLTF model that keeps material textures.
[in]Material- GLTF material to create SRB for.
[in]pFrameAttribs- Frame attributes constant buffer to set in the SRB.
[in]pMaterialSRB- A pointer to the SRB object to initialize.

◆ Render()

void Diligent::GLTF_PBR_Renderer::Render ( IDeviceContext * pCtx,
const GLTF::Model & GLTFModel,
const GLTF::ModelTransforms & Transforms,
const GLTF::ModelTransforms * PrevTransforms,
const RenderInfo & RenderParams,
ModelResourceBindings * pModelBindings,
ResourceCacheBindings * pCacheBindings = nullptr )

Renders a GLTF model.

Parameters
[in]pCtx- Device context to record rendering commands to.
[in]GLTFModel- GLTF model to render.
[in]Transforms- The model transforms.
[in]PrevTransforms- The model transforms from the previous frame. This parameter should not be null if motion vectors are enabled.
[in]RenderParams- Render parameters.
[in]pModelBindings- The model's shader resource binding information.
[in]pCacheBindings- Shader resource cache binding information, if the model has been created using the cache.