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

Function Init

demo/main.cpp:524–966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522#include "benchmark.h"
523
524void Init(int scene, bool centerCamera = true)
525{
526 RandInit();
527
528 if (g_flex)
529 {
530 if (g_buffers)
531 DestroyBuffers(g_buffers);
532
533 DestroyFluidRenderBuffers(g_fluidRenderBuffers);
534 DestroyDiffuseRenderBuffers(g_diffuseRenderBuffers);
535
536 for (auto& iter : g_meshes)
537 {
538 NvFlexDestroyTriangleMesh(g_flexLib, iter.first);
539 DestroyGpuMesh(iter.second);
540 }
541
542 for (auto& iter : g_fields)
543 {
544 NvFlexDestroyDistanceField(g_flexLib, iter.first);
545 DestroyGpuMesh(iter.second);
546 }
547
548 for (auto& iter : g_convexes)
549 {
550 NvFlexDestroyConvexMesh(g_flexLib, iter.first);
551 DestroyGpuMesh(iter.second);
552 }
553
554
555 g_fields.clear();
556 g_meshes.clear();
557 g_convexes.clear();
558
559 NvFlexDestroySolver(g_flex);
560 g_flex = NULL;
561 }
562
563 // alloc buffers
564 g_buffers = AllocBuffers(g_flexLib);
565
566 // map during initialization
567 MapBuffers(g_buffers);
568
569 g_buffers->positions.resize(0);
570 g_buffers->velocities.resize(0);
571 g_buffers->phases.resize(0);
572
573 g_buffers->rigidOffsets.resize(0);
574 g_buffers->rigidIndices.resize(0);
575 g_buffers->rigidMeshSize.resize(0);
576 g_buffers->rigidRotations.resize(0);
577 g_buffers->rigidTranslations.resize(0);
578 g_buffers->rigidCoefficients.resize(0);
579 g_buffers->rigidLocalPositions.resize(0);
580 g_buffers->rigidLocalNormals.resize(0);
581

Callers 15

ResetFunction · 0.85
UpdateFrameFunction · 0.85
InputArrowKeysDownFunction · 0.85
InputKeyboardDownFunction · 0.85
mainFunction · 0.85
InitMethod · 0.85
InitMethod · 0.85
InitMethod · 0.85

Calls 15

RandInitFunction · 0.85
DestroyBuffersFunction · 0.85
AllocBuffersFunction · 0.85
MapBuffersFunction · 0.85
ColourClass · 0.85
GetParticleBoundsFunction · 0.85
GetShapeBoundsFunction · 0.85
DegToRadFunction · 0.85
UnmapBuffersFunction · 0.85
resizeMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected