| 334 | #endif |
| 335 | |
| 336 | bool GameProcessCameraQuery(CameraQuery *query) |
| 337 | { |
| 338 | GameConnection* connection = GameConnection::getConnectionToServer(); |
| 339 | |
| 340 | if (connection && connection->getControlCameraTransform(0.032f, &query->cameraMatrix)) |
| 341 | { |
| 342 | query->object = dynamic_cast<GameBase*>(connection->getCameraObject()); |
| 343 | query->nearPlane = gClientSceneGraph->getNearClip(); |
| 344 | |
| 345 | // Scale the normal visible distance by the performance |
| 346 | // tuning scale which we never let over 1. |
| 347 | CameraAndFOV::sVisDistanceScale = mClampF( CameraAndFOV::sVisDistanceScale, 0.01f, 1.0f ); |
| 348 | query->farPlane = gClientSceneGraph->getVisibleDistance() * CameraAndFOV::sVisDistanceScale; |
| 349 | |
| 350 | // Provide some default values |
| 351 | query->stereoTargets[0] = 0; |
| 352 | query->stereoTargets[1] = 0; |
| 353 | query->eyeOffset[0] = Point3F::Zero; |
| 354 | query->eyeOffset[1] = Point3F::Zero; |
| 355 | query->hasFovPort = false; |
| 356 | query->hasStereoTargets = false; |
| 357 | query->displayDevice = NULL; |
| 358 | |
| 359 | F32 cameraFov = 0.0f; |
| 360 | bool fovSet = false; |
| 361 | |
| 362 | // Try to use the connection's display deivce, if any, but only if the editor |
| 363 | // is not open |
| 364 | if(!gEditingMission && connection->hasDisplayDevice()) |
| 365 | { |
| 366 | IDisplayDevice* display = connection->getDisplayDevice(); |
| 367 | |
| 368 | query->displayDevice = display; |
| 369 | |
| 370 | // Note: all eye values are invalid until this is called |
| 371 | display->setDrawCanvas(query->drawCanvas); |
| 372 | |
| 373 | display->setCurrentConnection(connection); |
| 374 | |
| 375 | // Display may activate AFTER so we need to call this again just in case |
| 376 | display->onStartFrame(); |
| 377 | |
| 378 | // The connection's display device may want to set the eye offset |
| 379 | if(display->providesEyeOffsets()) |
| 380 | { |
| 381 | display->getEyeOffsets(query->eyeOffset); |
| 382 | } |
| 383 | |
| 384 | // Grab field of view for both eyes |
| 385 | if (display->providesFovPorts()) |
| 386 | { |
| 387 | display->getFovPorts(query->fovPort); |
| 388 | fovSet = true; |
| 389 | query->hasFovPort = true; |
| 390 | } |
| 391 | |
| 392 | // Grab the latest overriding render view transforms |
| 393 | connection->getControlCameraEyeTransforms(display, query->eyeTransforms); |
no test coverage detected