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) |
Implementation of a GLTF PBR renderer.
void Diligent::GLTF_PBR_Renderer::Begin | ( | IDeviceContext * | pCtx | ) |
Prepares the renderer for rendering objects. This method must be called at least once per frame.
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.
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.
[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. |
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.
[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. |
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.
[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. |