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

Method LoadScene

src/TressFXSample.cpp:141–187  ·  view source on GitHub ↗

TODO: Loading asset function should be called from OnAssetReload?

Source from the content-addressed store, hash-verified

139
140// TODO: Loading asset function should be called from OnAssetReload?
141void TressFXSample::LoadScene(TressFXSceneDescription& desc)
142{
143 // Since GLTF is the first thing we render, we want to clear on load
144 m_activeScene.scene->OnCreate(GetDevice(), m_pGLTFRenderTargetSet.get(), m_pShadowRenderTargetSet.get(), desc.gltfFilePath, desc.gltfFileName, desc.gltfBonePrefix, desc.startOffset);
145
146 // TODO Why?
147 DestroyLayouts();
148
149 InitializeLayouts();
150
151 m_pPPLL.reset(new TressFXPPLL);
152 m_pShortCut.reset(new TressFXShortCut);
153 m_pSimulation.reset(new Simulation);
154
155 EI_Device* pDevice = GetDevice();
156
157 // Used for uploading initial data
158 EI_CommandContext& uploadCommandContext = pDevice->GetCurrentCommandContext();
159
160 for (size_t i = 0; i < desc.objects.size(); ++i)
161 {
162 HairStrands* hair = new HairStrands(
163 m_activeScene.scene.get(),
164 desc.objects[i].tfxFilePath.c_str(),
165 desc.objects[i].tfxBoneFilePath.c_str(),
166 desc.objects[i].hairObjectName.c_str(),
167 desc.objects[i].numFollowHairs,
168 desc.objects[i].tipSeparationFactor,
169 desc.objects[i].mesh, (int)i);
170 hair->GetTressFXHandle()->PopulateDrawStrandsBindSet(GetDevice(), &desc.objects[i].initialRenderingSettings);
171 m_activeScene.objects.push_back({ std::unique_ptr<HairStrands>(hair), desc.objects[i].initialSimulationSettings, desc.objects[i].initialRenderingSettings, desc.objects[i].name.c_str() });
172 }
173
174 for (size_t i = 0; i < desc.collisionMeshes.size(); ++i)
175 {
176 CollisionMesh* mesh = new CollisionMesh(
177 m_activeScene.scene.get(), m_pDebugRenderTargetSet.get(),
178 desc.collisionMeshes[i].name.c_str(),
179 desc.collisionMeshes[i].tfxMeshFilePath.c_str(),
180 desc.collisionMeshes[i].numCellsInXAxis,
181 desc.collisionMeshes[i].collisionMargin,
182 desc.collisionMeshes[i].mesh,
183 desc.collisionMeshes[i].followBone.c_str()
184 );
185 m_activeScene.collisionMeshes.push_back(std::unique_ptr<CollisionMesh>(mesh));
186 }
187 }
188
189void TressFXSample::UpdateSimulationParameters()
190{

Callers

nothing calls this directly

Calls 4

GetTressFXHandleMethod · 0.80
GetDeviceFunction · 0.50
OnCreateMethod · 0.45

Tested by

no test coverage detected