draw particles as slices with shadowing
| 289 | |
| 290 | // draw particles as slices with shadowing |
| 291 | void SmokeRenderer::drawSlices() |
| 292 | { |
| 293 | m_batchSize = mNumParticles / m_numSlices; |
| 294 | |
| 295 | // clear light buffer |
| 296 | m_srcLightTexture = 0; |
| 297 | m_lightFbo->Bind(); |
| 298 | m_lightFbo->AttachTexture(GL_TEXTURE_2D, m_lightTexture[m_srcLightTexture], GL_COLOR_ATTACHMENT0_EXT); |
| 299 | glClearColor(1.0f - m_lightColor[0], 1.0f - m_lightColor[1], 1.0f - m_lightColor[2], 0.0f); |
| 300 | glClear(GL_COLOR_BUFFER_BIT); |
| 301 | m_lightFbo->Disable(); |
| 302 | |
| 303 | // clear volume image |
| 304 | m_imageFbo->Bind(); |
| 305 | glClearColor(0.0, 0.0, 0.0, 0.0); |
| 306 | glClear(GL_COLOR_BUFFER_BIT); |
| 307 | m_imageFbo->Disable(); |
| 308 | |
| 309 | glActiveTexture(GL_TEXTURE0); |
| 310 | glMatrixMode(GL_TEXTURE); |
| 311 | glLoadMatrixf((GLfloat *)m_shadowMatrix.get_value()); |
| 312 | |
| 313 | // render slices |
| 314 | if (m_numDisplayedSlices > m_numSlices) |
| 315 | m_numDisplayedSlices = m_numSlices; |
| 316 | |
| 317 | for (int i = 0; i < m_numDisplayedSlices; i++) { |
| 318 | // draw slice from camera view, sampling light buffer |
| 319 | drawSlice(i); |
| 320 | // draw slice from light view to light buffer, accumulating shadows |
| 321 | drawSliceLightView(i); |
| 322 | |
| 323 | if (m_doBlur) { |
| 324 | blurLightBuffer(); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | glActiveTexture(GL_TEXTURE0); |
| 329 | glMatrixMode(GL_TEXTURE); |
| 330 | glLoadIdentity(); |
| 331 | } |
| 332 | |
| 333 | // blur light buffer to simulate scattering effects |
| 334 | void SmokeRenderer::blurLightBuffer() |
nothing calls this directly
no test coverage detected