Camera::Camera() : m_exposureTime(0.0f), m_visualizationScale(1.0f) { setNearPlaneZ(-0.15f); setFarPlaneZ(-150.0f); setFieldOfView((float)toRadians(90.0f), FOVDirection::HORIZONTAL); m_lastBoxBounds = Box(Point3(), Point3()); m_lastSphereBounds = Sphere(Point3::zero(), 0); }
// Sets the perspective of the camera void Camera::setPerspective( float fieldOfViewDegrees, float aspectRatio, float nearClipDistance, float farClipDistance ) { aspectRatio_ = aspectRatio; nearFieldClip_ = nearClipDistance; farFieldClip_ = farClipDistance; setFieldOfView(fieldOfViewDegrees); }
/*! * Defines a perspective projection based on \a fieldOfView, \a aspectRatio, \a * nearPlane, \a farPlane. */ void QCameraLens::setPerspectiveProjection(float fieldOfView, float aspectRatio, float nearPlane, float farPlane) { Q_D(QCameraLens); bool block = blockNotifications(true); setFieldOfView(fieldOfView); setAspectRatio(aspectRatio); setNearPlane(nearPlane); setFarPlane(farPlane); setProjectionType(PerspectiveProjection); blockNotifications(block); d->updateProjectionMatrix(); }
OsmAnd::MapRenderer::MapRenderer() : _taskHostBridge(this) , currentConfiguration(_currentConfiguration) , _currentConfigurationInvalidatedMask(0xFFFFFFFF) , currentState(_currentState) , _currentStateInvalidated(true) , _invalidatedRasterLayerResourcesMask(0) , _invalidatedElevationDataResources(false) , tiledResources(_tiledResources) , _renderThreadId(nullptr) , _workerThreadId(nullptr) , renderAPI(_renderAPI) { _tileRequestsThreadPool.setMaxThreadCount(4); // Create all tiled resources for(auto resourceType = 0u; resourceType < TiledResourceTypesCount; resourceType++) { auto collection = new TiledResources(static_cast<TiledResourceType>(resourceType)); _tiledResources[resourceType].reset(collection); } // Fill-up default state for(auto layerId = 0u; layerId < RasterMapLayersCount; layerId++) setRasterLayerOpacity(static_cast<RasterMapLayerId>(layerId), 1.0f); setElevationDataScaleFactor(1.0f, true); setFieldOfView(16.5f, true); setDistanceToFog(400.0f, true); setFogOriginFactor(0.36f, true); setFogHeightOriginFactor(0.05f, true); setFogDensity(1.9f, true); setFogColor(FColorRGB(1.0f, 0.0f, 0.0f), true); setSkyColor(FColorRGB(140.0f / 255.0f, 190.0f / 255.0f, 214.0f / 255.0f), true); setAzimuth(0.0f, true); setElevationAngle(45.0f, true); const auto centerIndex = 1u << (ZoomLevel::MaxZoomLevel - 1); setTarget(PointI(centerIndex, centerIndex), true); setZoom(0, true); }
void Z3DCamera::zoom(float factor) { if (factor <= 0.f) return; setFieldOfView(m_fieldOfView / factor); }