Instance Methodmigueldeicaza.swiftgodot 0.45.0SwiftGodot
getAspect
Returns the X:Y aspect ratio of this Projection
’s viewport.
func getAspect() -> Double
Other members in extension
Types
Type members
init(
) Constructs a default-initialized
Projection
set toIDENTITY
.init(from: Projection
) Constructs a
Projection
as a copy of the givenProjection
.init(from: Transform3D
) Constructs a Projection as a copy of the given
Transform3D
.init(xAxis: Vector4, yAxis: Vector4, zAxis: Vector4, wAxis: Vector4
) Constructs a Projection from four
Vector4
values (matrix columns).static var godotType: Variant.GType
static let identity: Projection
A
Projection
with no transformation defined. When applied to other data structures, no transformation is performed.static let planeBottom: Int
The index value of the projection bottom clipping plane.
static let planeFar: Int
The index value of the projection’s far clipping plane.
static let planeLeft: Int
The index value of the projection’s left clipping plane.
static let planeNear: Int
The index value of the projection’s near clipping plane.
static let planeRight: Int
The index value of the projection’s right clipping plane.
static let planeTop: Int
The index value of the projection’s top clipping plane.
static let zero: Projection
A
Projection
with all values initialized to 0. When applied to other data structures, they will be zeroed.static func createDepthCorrection(flipY: Bool
) -> Projection Creates a new
Projection
that projects positions from a depth range of-1
to1
to one that ranges from0
to1
, and flips the projected positions vertically, according toflipY
.static func createFitAabb(AABB
) -> Projection Creates a new
Projection
that scales a given projection to fit around a givenAABB
in projection space.static func createForHmd(eye: Int64, aspect: Double, intraocularDist: Double, displayWidth: Double, displayToLens: Double, oversample: Double, zNear: Double, zFar: Double
) -> Projection Creates a new
Projection
for projecting positions onto a head-mounted display with the given X:Y aspect ratio, distance between eyes, display width, distance to lens, oversampling factor, and depth clipping planes.static func createFrustum(left: Double, right: Double, bottom: Double, top: Double, zNear: Double, zFar: Double
) -> Projection Creates a new
Projection
that projects positions in a frustum with the given clipping planes.static func createFrustumAspect(size: Double, aspect: Double, offset: Vector2, zNear: Double, zFar: Double, flipFov: Bool
) -> Projection Creates a new
Projection
that projects positions in a frustum with the given size, X:Y aspect ratio, offset, and clipping planes.static func createLightAtlasRect(Rect2
) -> Projection Creates a new
Projection
that projects positions into the givenRect2
.static func createOrthogonal(left: Double, right: Double, bottom: Double, top: Double, zNear: Double, zFar: Double
) -> Projection Creates a new
Projection
that projects positions using an orthogonal projection with the given clipping planes.static func createOrthogonalAspect(size: Double, aspect: Double, zNear: Double, zFar: Double, flipFov: Bool
) -> Projection Creates a new
Projection
that projects positions using an orthogonal projection with the given size, X:Y aspect ratio, and clipping planes.static func createPerspective(fovy: Double, aspect: Double, zNear: Double, zFar: Double, flipFov: Bool
) -> Projection Creates a new
Projection
that projects positions using a perspective projection with the given Y-axis field of view (in degrees), X:Y aspect ratio, and clipping planes.static func createPerspectiveHmd(fovy: Double, aspect: Double, zNear: Double, zFar: Double, flipFov: Bool, eye: Int64, intraocularDist: Double, convergenceDist: Double
) -> Projection Creates a new
Projection
that projects positions using a perspective projection with the given Y-axis field of view (in degrees), X:Y aspect ratio, and clipping distances. The projection is adjusted for a head-mounted display with the given distance between eyes and distance to a point that can be focused on.static func getFovy(fovx: Double, aspect: Double
) -> Double Returns the vertical field of view of the projection (in degrees) associated with the given horizontal field of view (in degrees) and aspect ratio.
static func != (lhs: Projection, rhs: Projection
) -> Bool Returns
true
if the projections are not equal.static func * (lhs: Projection, rhs: Projection
) -> Projection Projects (multiplies) the given
Vector4
by thisProjection
matrix.static func * (lhs: Projection, rhs: Vector4
) -> Vector4 Projects (multiplies) the given
Vector4
by thisProjection
matrix.static func == (lhs: Projection, rhs: Projection
) -> Bool Returns
true
if the projections are equal.
Instance members
var w: Vector4
The projection matrix’s W vector (column 3). Equivalent to array index
3
.var x: Vector4
The projection matrix’s X vector (column 0). Equivalent to array index
0
.var y: Vector4
The projection matrix’s Y vector (column 1). Equivalent to array index
1
.var z: Vector4
The projection matrix’s Z vector (column 2). Equivalent to array index
2
.subscript(Int64
) -> Vector4 func determinant(
) -> Double Returns a scalar value that is the signed factor by which areas are scaled by this matrix. If the sign is negative, the matrix flips the orientation of the area.
func flippedY(
) -> Projection Returns a copy of this
Projection
with the signs of the values of the Y column flipped.func getFarPlaneHalfExtents(
) -> Vector2 Returns the dimensions of the far clipping plane of the projection, divided by two.
func getFov(
) -> Double Returns the horizontal field of view of the projection (in degrees).
func getLodMultiplier(
) -> Double Returns the factor by which the visible level of detail is scaled by this
Projection
.func getPixelsPerMeter(forPixelWidth: Int64
) -> Int64 Returns the number of pixels with the given pixel width displayed per meter, after this
Projection
is applied.func getProjectionPlane(Int64
) -> Plane Returns the clipping plane of this
Projection
whose index is given byplane
.func getViewportHalfExtents(
) -> Vector2 Returns the dimensions of the viewport plane that this
Projection
projects positions onto, divided by two.func getZFar(
) -> Double Returns the distance for this
Projection
beyond which positions are clipped.func getZNear(
) -> Double Returns the distance for this
Projection
before which positions are clipped.func inverse(
) -> Projection Returns a
Projection
that performs the inverse of thisProjection
’s projective transformation.func isOrthogonal(
) -> Bool Returns
true
if thisProjection
performs an orthogonal projection.func jitterOffseted(offset: Vector2
) -> Projection Returns a
Projection
with the X and Y values from the givenVector2
added to the first and second values of the final column respectively.func perspectiveZnearAdjusted(newZnear: Double
) -> Projection Returns a
Projection
with the near clipping distance adjusted to benewZnear
.