| 309 | } |
| 310 | |
| 311 | void TinyRendererSetup::renderScene() |
| 312 | { |
| 313 | m_internalData->updateTransforms(); |
| 314 | |
| 315 | btVector4 from(m_internalData->m_lightPos[0], m_internalData->m_lightPos[1], m_internalData->m_lightPos[2], 1); |
| 316 | btVector4 toX(m_internalData->m_lightPos[0] + 0.1, m_internalData->m_lightPos[1], m_internalData->m_lightPos[2], 1); |
| 317 | btVector4 toY(m_internalData->m_lightPos[0], m_internalData->m_lightPos[1] + 0.1, m_internalData->m_lightPos[2], 1); |
| 318 | btVector4 toZ(m_internalData->m_lightPos[0], m_internalData->m_lightPos[1], m_internalData->m_lightPos[2] + 0.1, 1); |
| 319 | btVector4 colorX(1, 0, 0, 1); |
| 320 | btVector4 colorY(0, 1, 0, 1); |
| 321 | btVector4 colorZ(0, 0, 1, 1); |
| 322 | int width = 2; |
| 323 | m_guiHelper->getRenderInterface()->drawLine(from, toX, colorX, width); |
| 324 | m_guiHelper->getRenderInterface()->drawLine(from, toY, colorY, width); |
| 325 | m_guiHelper->getRenderInterface()->drawLine(from, toZ, colorZ, width); |
| 326 | |
| 327 | if (!m_useSoftware) |
| 328 | { |
| 329 | btVector3 lightPos(m_internalData->m_lightPos[0], m_internalData->m_lightPos[1], m_internalData->m_lightPos[2]); |
| 330 | m_guiHelper->getRenderInterface()->setLightPosition(lightPos); |
| 331 | |
| 332 | for (int i = 0; i < m_internalData->m_transforms.size(); i++) |
| 333 | { |
| 334 | m_guiHelper->getRenderInterface()->writeSingleInstanceTransformToCPU(m_internalData->m_transforms[i].getOrigin(), m_internalData->m_transforms[i].getRotation(), i); |
| 335 | } |
| 336 | m_guiHelper->getRenderInterface()->writeTransforms(); |
| 337 | m_guiHelper->getRenderInterface()->renderScene(); |
| 338 | } |
| 339 | else |
| 340 | { |
| 341 | TGAColor clearColor; |
| 342 | clearColor.bgra[0] = 200; |
| 343 | clearColor.bgra[1] = 200; |
| 344 | clearColor.bgra[2] = 200; |
| 345 | clearColor.bgra[3] = 255; |
| 346 | for (int y = 0; y < m_internalData->m_height; ++y) |
| 347 | { |
| 348 | for (int x = 0; x < m_internalData->m_width; ++x) |
| 349 | { |
| 350 | m_internalData->m_rgbColorBuffer.set(x, y, clearColor); |
| 351 | m_internalData->m_depthBuffer[x + y * m_internalData->m_width] = -1e30f; |
| 352 | m_internalData->m_shadowBuffer[x + y * m_internalData->m_width] = -1e30f; |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | ATTRIBUTE_ALIGNED16(btScalar modelMat2[16]); |
| 357 | ATTRIBUTE_ALIGNED16(float viewMat[16]); |
| 358 | ATTRIBUTE_ALIGNED16(float projMat[16]); |
| 359 | CommonRenderInterface* render = this->m_app->m_renderer; |
| 360 | render->getActiveCamera()->getCameraViewMatrix(viewMat); |
| 361 | render->getActiveCamera()->getCameraProjectionMatrix(projMat); |
| 362 | |
| 363 | for (int o = 0; o < this->m_internalData->m_renderObjects.size(); o++) |
| 364 | { |
| 365 | const btTransform& tr = m_internalData->m_transforms[o]; |
| 366 | tr.getOpenGLMatrix(modelMat2); |
| 367 | |
| 368 | for (int i = 0; i < 4; i++) |
nothing calls this directly
no test coverage detected