INNER CODE UNIT · JavaScript
updateDom
electronicarts/pbmpm · src/main.js:217
function updateDom(gpuContext, inputs)
{
// Update dom to reflect state of grid and particle buffer
document.getElementById('gridStats').innerHTML = `Render resolution: ${inputs.resolution[0]} x ${inputs.resolution[1]} <br>Sim resolution: ${inputs.gridSize[0]} x ${inputs.gridSize[1]}`
if(gpuContext.particleCountDirty)
{
document.getElementById('particleStats').innerHTML =
`Particle count: ${(gpuContext.particleCount/1000).toFixed(1)}k Current / ${(gpuContext.maxParticleCount/1000).toFixed(0)}k Max / ${(gpuContext.particleFreeCount/1000).toFixed(1)}k Free`
gpuContext.particleCountDirty = false;
}
document.getElementById('speedStats').innerHTML = `Simulation speed: ${(getThrottlingRatio()*100).toFixed(0)}%`
if(gpuContext.timingStatsDirty && Object.keys(gpuContext.movingAverageTimeStamps).length != 0)
{
let timingHtml = "<table><tr><th>Name</th><th>Total Time</th></tr>";