| 357 | } |
| 358 | |
| 359 | void GuiTSCtrl::_internalRender(RectI guiViewport, RectI renderViewport, Frustum &frustum) |
| 360 | { |
| 361 | GFXTransformSaver saver; |
| 362 | Point2I renderSize = renderViewport.extent; |
| 363 | GFXTarget *origTarget = GFX->getActiveRenderTarget(); |
| 364 | S32 origStereoTarget = GFX->getCurrentStereoTarget(); |
| 365 | |
| 366 | if (mCameraZRot) |
| 367 | { |
| 368 | MatrixF rotMat(EulerF(0, 0, mDegToRad(mCameraZRot))); |
| 369 | mLastCameraQuery.cameraMatrix.mul(rotMat); |
| 370 | } |
| 371 | |
| 372 | if (mReflectPriority > 0) |
| 373 | { |
| 374 | // Get the total reflection priority. |
| 375 | F32 totalPriority = 0; |
| 376 | for (U32 i = 0; i < smAwakeTSCtrls.size(); i++) |
| 377 | if (smAwakeTSCtrls[i]->isVisible()) |
| 378 | totalPriority += smAwakeTSCtrls[i]->mReflectPriority; |
| 379 | |
| 380 | REFLECTMGR->update(mReflectPriority / totalPriority, |
| 381 | renderSize, |
| 382 | mLastCameraQuery); |
| 383 | } |
| 384 | |
| 385 | GFX->setActiveRenderTarget(origTarget); |
| 386 | GFX->setCurrentStereoTarget(origStereoTarget); |
| 387 | GFX->setViewport(renderViewport); |
| 388 | |
| 389 | // Clear the zBuffer so GUI doesn't hose object rendering accidentally |
| 390 | GFX->clear(GFXClearZBuffer, ColorI(20, 20, 20), 1.0f, 0); |
| 391 | |
| 392 | GFX->setFrustum(frustum); |
| 393 | mSaveProjection = GFX->getProjectionMatrix(); |
| 394 | |
| 395 | if (mLastCameraQuery.ortho) |
| 396 | { |
| 397 | mOrthoWidth = frustum.getWidth(); |
| 398 | mOrthoHeight = frustum.getHeight(); |
| 399 | } |
| 400 | |
| 401 | // We're going to be displaying this render at size of this control in |
| 402 | // pixels - let the scene know so that it can calculate e.g. reflections |
| 403 | // correctly for that final display result. |
| 404 | gClientSceneGraph->setDisplayTargetResolution(renderSize); |
| 405 | |
| 406 | // Set the GFX world matrix to the world-to-camera transform, but don't |
| 407 | // change the cameraMatrix in mLastCameraQuery. This is because |
| 408 | // mLastCameraQuery.cameraMatrix is supposed to contain the camera-to-world |
| 409 | // transform. In-place invert would save a copy but mess up any GUIs that |
| 410 | // depend on that value. |
| 411 | MatrixF worldToCamera = mLastCameraQuery.cameraMatrix; |
| 412 | worldToCamera.inverse(); |
| 413 | GFX->setWorldMatrix(worldToCamera); |
| 414 | |
| 415 | mSaveProjection = GFX->getProjectionMatrix(); |
| 416 | mSaveModelview = GFX->getWorldMatrix(); |
nothing calls this directly
no test coverage detected