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

Method StartSimulation

src/Simulation.cpp:50–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void Simulation::StartSimulation(
51 double fTime,
52 SimulationContext& ctx,
53 bool bUpdateCollMesh,
54 bool bSDFCollisionResponse,
55 bool bAsync
56 )
57{
58 // When we are done submitting sim commands, we will restore this as the default command list.
59 // TODO Maybe pass this explicitly, rather than setting as default and retrieving from there.
60 EI_CommandContext* renderContext = &GetDevice()->GetCurrentCommandContext();
61
62
63 // When running async, we are getting a command list for submission on the async compute queue.
64 // We are only accumulating commands for submission now. There will be a wait for actual
65 // submission after this.
66 EI_CommandContext* simContext = renderContext;
67 if (bAsync)
68 {
69 simContext = &GetDevice()->GetComputeCommandContext();
70 }
71
72 if (bUpdateCollMesh)
73 {
74 // Updates the skinned version of the mesh,
75 // which is input to SDF.
76 // We are using a compute-based skinning system here,
77 // which is not part of the TressFX library.
78 for (size_t i = 0; i < ctx.collisionMeshes.size(); i++)
79 ctx.collisionMeshes[i]->SkinTheMesh(*simContext, fTime);
80
81 UpdateCollisionMesh(*simContext, ctx);
82 }
83
84 RunSimulation(*simContext, ctx);
85
86 if (bSDFCollisionResponse)
87 RunCollision(*simContext, ctx);
88
89
90 for (size_t i = 0; i < ctx.hairStrands.size(); i++)
91 ctx.hairStrands[i]->TransitionSimToRendering(*renderContext);
92
93
94}
95
96void Simulation::WaitOnSimulation()
97{

Callers 1

SimulateMethod · 0.80

Calls 3

SkinTheMeshMethod · 0.80
GetDeviceFunction · 0.50

Tested by

no test coverage detected