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