| 375 | } |
| 376 | |
| 377 | void ParticleSystem::setArray(ParticleArray array, const float *data, int start, int count) |
| 378 | { |
| 379 | assert(m_bInitialized); |
| 380 | |
| 381 | switch (array) { |
| 382 | default: |
| 383 | case POSITION: { |
| 384 | if (m_bUseOpenGL) { |
| 385 | unregisterGLBufferObject(m_cuda_posvbo_resource); |
| 386 | glBindBuffer(GL_ARRAY_BUFFER, m_posVbo); |
| 387 | glBufferSubData(GL_ARRAY_BUFFER, start * 4 * sizeof(float), count * 4 * sizeof(float), data); |
| 388 | glBindBuffer(GL_ARRAY_BUFFER, 0); |
| 389 | registerGLBufferObject(m_posVbo, &m_cuda_posvbo_resource); |
| 390 | } |
| 391 | else { |
| 392 | copyArrayToDevice(m_cudaPosVBO, data, start * 4 * sizeof(float), count * 4 * sizeof(float)); |
| 393 | } |
| 394 | } break; |
| 395 | |
| 396 | case VELOCITY: |
| 397 | copyArrayToDevice(m_dVel, data, start * 4 * sizeof(float), count * 4 * sizeof(float)); |
| 398 | break; |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | inline float frand() { return rand() / (float)RAND_MAX; } |
| 403 |
nothing calls this directly
no outgoing calls
no test coverage detected