MCPcopy Create free account
hub / github.com/GPUOpen-Effects/TressFX / OnCreate

Method OnCreate

src/SceneGLTFImpl.cpp:23–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include <cmath>
22
23void EI_Scene::OnCreate(EI_Device* pDevice, EI_RenderTargetSet * renderTargetSet, EI_RenderTargetSet* shadowRenderTargetSet, const std::string& path, const std::string& fileName, const std::string& bonePrefix, float startOffset)
24{
25 if (m_pGLTFCommon == nullptr)
26 {
27 m_pGLTFCommon = new GLTFCommon();
28 m_pGLTFCommon->Load(path, fileName);
29 }
30
31 m_pDevice = pDevice;
32
33 m_startOffset = startOffset;
34
35 m_pGLTFTexturesAndBuffers = m_pDevice->CreateGLTFTexturesAndBuffers(m_pGLTFCommon);
36 // here we are loading onto the GPU all the textures and the inverse matrices
37 // this data will be used to create the PBR and Depth passes
38 m_pGLTFTexturesAndBuffers->LoadTextures();
39
40 // same thing as above but for the PBR pass
41 m_gltfPBR = m_pDevice->CreateGLTFPbrPass(m_pGLTFTexturesAndBuffers.get(), renderTargetSet);
42
43 m_pDevice->GetVidMemBufferPool()->UploadData(m_pDevice->GetUploadHeap()->GetCommandList());
44 m_pDevice->GetUploadHeap()->FlushAndFinish();
45
46 // Create a depth GLTF pass to render shadows
47 m_gltfDepth = m_pDevice->CreateGLTFDepthPass(m_pGLTFTexturesAndBuffers.get(), shadowRenderTargetSet);
48
49 m_pDevice->GetVidMemBufferPool()->UploadData(m_pDevice->GetUploadHeap()->GetCommandList());
50 m_pDevice->GetUploadHeap()->FlushAndFinish();
51
52 // Init Camera, looking at the origin
53 m_roll = 0.0f;
54 m_pitch = 0.0f;
55 m_distance = 2.0f;
56 m_animationTime = 0.0f;
57
58 // init GUI state
59 m_state.iblFactor = 2.0f;
60 m_state.emmisiveFactor = 1.0f;
61
62 m_bonePrefix = bonePrefix;
63 m_state.camera.SetSpeed(0.5f);
64 ComputeGlobalIdxToSkinIdx();
65}
66
67void EI_Scene::OnDestroy()
68{

Callers

nothing calls this directly

Calls 5

CreateGLTFPbrPassMethod · 0.45
GetVidMemBufferPoolMethod · 0.45
GetUploadHeapMethod · 0.45
CreateGLTFDepthPassMethod · 0.45

Tested by

no test coverage detected