/** * Add all points of an outer or inner ring to a multipolygon. */ void add_points(const osmium::NodeRefList& nodes) { osmium::Location last_location; for (const osmium::NodeRef& node_ref : nodes) { if (last_location != node_ref.location()) { last_location = node_ref.location(); m_impl.multipolygon_add_location(m_projection(last_location)); } } }
void Camera::calculatePerspective(float fieldOfView, float aspectRatio, float zNear, float zFar) { m_projection.setIdentity(); float f = 1.0f / std::tan(fieldOfView * float(M_PI) / 360.0f); m_projection(0, 0) = f / aspectRatio; m_projection(1, 1) = f; m_projection(2, 2) = (zNear + zFar) / (zNear - zFar); m_projection(2, 3) = (2.0f * zFar * zNear) / (zNear - zFar); m_projection(3, 2) = -1; m_projection(3, 3) = 0; }
void Camera::calculateOrthographic(float left, float right, float bottom, float top, float zNear, float zFar) { left *= m_orthographicScale; right *= m_orthographicScale; bottom *= m_orthographicScale; top *= m_orthographicScale; m_projection.setIdentity(); m_projection(0, 0) = 2.0f / (right - left); m_projection(0, 3) = -(right + left) / (right - left); m_projection(1, 1) = 2.0f / (top - bottom); m_projection(1, 3) = -(top + bottom) / (top - bottom); m_projection(2, 2) = -2.0f / (zFar - zNear); m_projection(2, 3) = -(zFar + zNear) / (zFar - zNear); m_projection(3, 3) = 1; }