MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / Initialize

Method Initialize

demo/scenes/plasticstack.h:8–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6 PlasticStack(const char* name) : Scene(name) {}
7
8 virtual void Initialize()
9 {
10 g_params.radius = 0.225f;
11
12 g_params.numIterations = 2;
13 g_params.dynamicFriction = 0.5f;
14 g_params.particleFriction = 0.15f;
15 g_params.dissipation = 0.0f;
16 g_params.viscosity = 0.0f;
17
18 AddPlinth();
19
20 const float rotation = -kPi*0.5f;
21 const float spacing = g_params.radius*0.5f;
22
23 // alternative box and sphere shapes
24 const char* mesh[] =
25 {
26 "../../data/box_high.ply",
27 "../../data/sphere.ply"
28 };
29
30 Vec3 lower = Vec3(4.0f, 1.0f, 0.0f);
31 float sizeInc = 0.0f;
32 float size = 1.0f;
33 int group = 0;
34
35 for (int i=0; i < 8; ++i)
36 {
37 CreateParticleShape(GetFilePathByPlatform(mesh[i%2]).c_str(), lower, size + i*sizeInc, rotation, spacing, Vec3(.0f, 0.0f, 0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f, 0.0f, g_params.radius*0.5f);
38
39 lower += Vec3(0.0f, size + i*sizeInc + 0.2f, 0.0f);
40 }
41
42 g_params.plasticThreshold = 0.00025f;
43 g_params.plasticCreep = 0.165f;
44
45 g_numSubsteps = 4;
46
47 // draw options
48 g_drawPoints = false;
49 }
50};

Callers

nothing calls this directly

Calls 4

AddPlinthFunction · 0.85
CreateParticleShapeFunction · 0.85
GetFilePathByPlatformFunction · 0.85
NvFlexMakePhaseFunction · 0.85

Tested by

no test coverage detected