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/pasta.h | |
| download | flex-ad3d90fafe5ee79964bdfe1f1e0704c3ffcdfd5f.tar.xz flex-ad3d90fafe5ee79964bdfe1f1e0704c3ffcdfd5f.zip | |
Initial 1.1.0 binary release
Diffstat (limited to 'demo/scenes/pasta.h')
| -rw-r--r-- | demo/scenes/pasta.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/demo/scenes/pasta.h b/demo/scenes/pasta.h new file mode 100644 index 0000000..3852029 --- /dev/null +++ b/demo/scenes/pasta.h @@ -0,0 +1,47 @@ + +class Pasta : public Scene +{ +public: + + Pasta(const char* name) : Scene(name) {} + + virtual void Initialize() + { + float radius = 0.1f; + float length = 15.0f; + int n = 20; + + for (int i = 0; i < n; ++i) + { + float theta = k2Pi*float(i) / n; + + Rope r; + CreateRope(r, 0.5f*Vec3(cosf(theta), 2.0f, sinf(theta)), Vec3(0.0f, 1.0f, 0.0f), 0.25f, int(length / radius), length, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide)); + g_ropes.push_back(r); + } + + g_numSubsteps = 3; + + Mesh* bowl = ImportMesh(GetFilePathByPlatform("../../data/bowl.obj").c_str()); + bowl->Normalize(2.0f); + bowl->CalculateNormals(); + bowl->Transform(TranslationMatrix(Point3(-1.0f, 0.0f, -1.0f))); + + NvFlexTriangleMeshId mesh = CreateTriangleMesh(bowl); + AddTriangleMesh(mesh, Vec3(), Quat(), 1.0f); + + delete bowl; + + g_params.numIterations = 6; + g_params.radius = radius; + g_params.dynamicFriction = 0.4f; + g_params.dissipation = 0.001f; + g_params.sleepThreshold = g_params.radius*0.2f; + g_params.relaxationFactor = 1.3f; + g_params.restitution = 0.0f; + g_params.shapeCollisionMargin = 0.01f; + + g_lightDistance *= 0.5f; + g_drawPoints = false; + } +};
\ No newline at end of file |