diff options
| author | Miles Macklin <[email protected]> | 2017-03-10 14:51:31 +1300 |
|---|---|---|
| committer | Miles Macklin <[email protected]> | 2017-03-10 14:51:31 +1300 |
| commit | ad3d90fafe5ee79964bdfe1f1e0704c3ffcdfd5f (patch) | |
| tree | 4cc6f3288363889d7342f7f8407c0251e6904819 /demo/scenes/thinbox.h | |
| download | flex-ad3d90fafe5ee79964bdfe1f1e0704c3ffcdfd5f.tar.xz flex-ad3d90fafe5ee79964bdfe1f1e0704c3ffcdfd5f.zip | |
Initial 1.1.0 binary release
Diffstat (limited to 'demo/scenes/thinbox.h')
| -rw-r--r-- | demo/scenes/thinbox.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/demo/scenes/thinbox.h b/demo/scenes/thinbox.h new file mode 100644 index 0000000..a77f258 --- /dev/null +++ b/demo/scenes/thinbox.h @@ -0,0 +1,66 @@ + + +class ThinBox : public Scene +{ +public: + + ThinBox(const char* name) : Scene(name) {} + + int base; + int width; + int height; + int depth; + + virtual void Initialize() + { + float radius = 0.03f; + + width = 16; + height = 8; + depth = 8; + + base = 4; + + float sep = radius; + + CreateParticleGrid(Vec3(0.0f, radius, 0.0f), width, height, depth, sep, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), 0.0f); + + Vec3 upper; + Vec3 lower; + GetParticleBounds(lower, upper); + lower -= Vec3(radius*0.5f); + upper += Vec3(radius*0.5f); + + Vec3 center = 0.5f*(upper + lower); + + float width = (upper - lower).x*0.5f; + float depth = (upper - lower).z*0.5f; + float edge = 0.0075f*0.5f; + float height = 8 * radius; + + AddBox(Vec3(edge, height, depth), center + Vec3(-width, height / 2, 0.0f)); + AddBox(Vec3(edge, height, depth), center + Vec3(width, height / 2, 0.0f)); + AddBox(Vec3(width - edge, height, edge), center + Vec3(0.0f, height / 2, (depth - edge))); + AddBox(Vec3(width - edge, height, edge), center + Vec3(0.0f, height / 2, -(depth - edge))); + AddBox(Vec3(width, edge, depth), Vec3(center.x, lower.y, center.z)); + + g_params.gravity[1] = -9.f; + g_params.radius = radius; + g_params.dynamicFriction = 0.0f; + g_params.fluid = false; + g_params.numIterations = 5; + g_params.numPlanes = 1; + g_params.restitution = 0.0f; + g_params.collisionDistance = radius; + g_params.particleCollisionMargin = radius*0.5f; + + g_params.relaxationFactor = 0.0f; + g_numSubsteps = 2; + + g_lightDistance *= 0.85f; + + // draw options + g_drawPoints = true; + g_warmup = false; + } +};
\ No newline at end of file |