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

Function RenderScene

demo/main.cpp:1191–1417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1189}
1190
1191void RenderScene()
1192{
1193 const int numParticles = NvFlexGetActiveCount(g_flex);
1194 const int numDiffuse = NvFlexGetDiffuseParticles(g_flex, NULL, NULL, NULL);
1195
1196 //---------------------------------------------------
1197 // use VBO buffer wrappers to allow Flex to write directly to the OpenGL buffers
1198 // Flex will take care of any CUDA interop mapping/unmapping during the get() operations
1199
1200 if (numParticles)
1201 {
1202
1203 if (g_interop)
1204 {
1205 // copy data directly from solver to the renderer buffers
1206 UpdateFluidRenderBuffers(g_fluidRenderBuffers, g_flex, g_drawEllipsoids, g_drawDensity);
1207 }
1208 else
1209 {
1210 // copy particle data to GPU render device
1211
1212 if (g_drawEllipsoids)
1213 {
1214 // if fluid surface rendering then update with smooth positions and anisotropy
1215 UpdateFluidRenderBuffers(g_fluidRenderBuffers,
1216 &g_buffers->smoothPositions[0],
1217 (g_drawDensity) ? &g_buffers->densities[0] : (float*)&g_buffers->phases[0],
1218 &g_buffers->anisotropy1[0],
1219 &g_buffers->anisotropy2[0],
1220 &g_buffers->anisotropy3[0],
1221 g_buffers->positions.size(),
1222 &g_buffers->activeIndices[0],
1223 numParticles);
1224 }
1225 else
1226 {
1227 // otherwise just send regular positions and no anisotropy
1228 UpdateFluidRenderBuffers(g_fluidRenderBuffers,
1229 &g_buffers->positions[0],
1230 (float*)&g_buffers->phases[0],
1231 NULL, NULL, NULL,
1232 g_buffers->positions.size(),
1233 &g_buffers->activeIndices[0],
1234 numParticles);
1235 }
1236 }
1237 }
1238
1239 if (numDiffuse)
1240 {
1241 if (g_interop)
1242 {
1243 // copy data directly from solver to the renderer buffers
1244 UpdateDiffuseRenderBuffers(g_diffuseRenderBuffers, g_flex);
1245 }
1246 else
1247 {
1248 // copy diffuse particle data from host to GPU render device

Callers 1

UpdateFrameFunction · 0.85

Calls 15

ProjectionMatrixFunction · 0.85
RadToDegFunction · 0.85
TranslationMatrixFunction · 0.85
Point3Class · 0.85
DegToRadFunction · 0.85
LookAtMatrixFunction · 0.85
SkinMeshFunction · 0.85
DrawShapesFunction · 0.85
sizeMethod · 0.80
UpdateFluidRenderBuffersFunction · 0.50
RotationMatrixFunction · 0.50

Tested by

no test coverage detected