| 265 | } |
| 266 | |
| 267 | void ParticleSystem::reset(ParticleConfig config) |
| 268 | { |
| 269 | switch (config) { |
| 270 | default: |
| 271 | case CONFIG_RANDOM: |
| 272 | initCubeRandom(vec3f(0.0, 1.0, 0.0), vec3f(1.0, 1.0, 1.0), vec3f(0.0f), 100.0); |
| 273 | break; |
| 274 | |
| 275 | case CONFIG_GRID: { |
| 276 | float jitter = m_particleRadius * 0.01f; |
| 277 | uint s = (int)ceilf(powf((float)m_numParticles, 1.0f / 3.0f)); |
| 278 | uint gridSize[3]; |
| 279 | gridSize[0] = gridSize[1] = gridSize[2] = s; |
| 280 | initGrid(vec3f(-1.0, 0.0, -1.0), |
| 281 | make_uint3(s, s, s), |
| 282 | vec3f(m_particleRadius * 2.0f), |
| 283 | jitter, |
| 284 | vec3f(0.0), |
| 285 | m_numParticles, |
| 286 | 100.0); |
| 287 | } break; |
| 288 | } |
| 289 | |
| 290 | m_pos.copy(GpuArray<float4>::HOST_TO_DEVICE); |
| 291 | m_vel.copy(GpuArray<float4>::HOST_TO_DEVICE); |
| 292 | } |
| 293 | |
| 294 | // particle emitters |
| 295 | void ParticleSystem::discEmitter(uint &index, |
no test coverage detected