Use GDNative API struct
This commit is contained in:
parent
cf75723fa1
commit
b62db02d8f
32 changed files with 2846 additions and 1535 deletions
|
|
@ -1,13 +1,7 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import basis, vector3, planes, rect3
|
||||
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Transform* {.byref.} = object
|
||||
basis*: Basis
|
||||
origin*: Vector3
|
||||
import godotcoretypes, internal.godotinternaltypes, gdnativeapi
|
||||
import basis
|
||||
|
||||
proc initTransform*(): Transform {.inline.} =
|
||||
result.basis = initBasis()
|
||||
|
|
@ -23,45 +17,54 @@ proc initTransform*(xAxis, yAxis, zAxis,
|
|||
proc initTransform*(basis: Basis, origin: Vector3): Transform {.inline.} =
|
||||
Transform(basis: basis, origin: origin)
|
||||
|
||||
proc toGodotString(self: Transform): GodotString {.
|
||||
importc: "godot_transform_as_string".}
|
||||
|
||||
proc `$`*(self: Transform): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().transformAsString(self)
|
||||
|
||||
proc inverse*(self: Transform): Transform {.inline.} =
|
||||
getGDNativeAPI().transformInverse(self)
|
||||
|
||||
proc affineInverse*(self: Transform): Transform {.inline.} =
|
||||
getGDNativeAPI().transformAffineInverse(self)
|
||||
|
||||
proc orthonormalized*(self: Transform): Transform {.inline.} =
|
||||
getGDNativeAPI().transformOrthonormalized(self)
|
||||
|
||||
proc inverse*(self: Transform): Transform {.
|
||||
importc: "godot_transform_inverse".}
|
||||
proc affineInverse*(self: Transform): Transform {.
|
||||
importc: "godot_transform_affine_inverse".}
|
||||
proc orthonormalized*(self: Transform): Transform {.
|
||||
importc: "godot_transform_orthonormalized".}
|
||||
proc rotated*(self: Transform; axis: Vector3;
|
||||
phi: float32): Transform {.
|
||||
importc: "godot_transform_rotated".}
|
||||
proc scaled*(self: Transform; scale: Vector3): Transform {.
|
||||
importc: "godot_transform_scaled".}
|
||||
proc translated*(self: Transform; offset: Vector3): Transform {.
|
||||
importc: "godot_transform_translated".}
|
||||
proc lookingAt*(self: Transform;
|
||||
target, up: Vector3): Transform {.
|
||||
importc: "godot_transform_looking_at".}
|
||||
phi: float32): Transform {.inline.} =
|
||||
getGDNativeAPI().transformRotated(self, axis, phi)
|
||||
|
||||
proc xformPlane*(self: Transform; v: Plane): Plane {.
|
||||
importc: "godot_transform_xform_plane".}
|
||||
proc xformInvPlane*(self: Transform; v: Plane): Plane {.
|
||||
importc: "godot_transform_xform_inv_plane".}
|
||||
proc xformVector3*(self: Transform; v: Vector3): Vector3 {.
|
||||
importc: "godot_transform_xform_vector3".}
|
||||
proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {.
|
||||
importc: "godot_transform_xform_inv_vector3".}
|
||||
proc xformRect3*(self: Transform; v: Rect3): Rect3 {.
|
||||
importc: "godot_transform_xform_rect3".}
|
||||
proc xformInvRect3*(self: Transform; v: Rect3): Rect3 {.
|
||||
importc: "godot_transform_xform_inv_rect3".}
|
||||
proc scaled*(self: Transform; scale: Vector3): Transform {.inline.} =
|
||||
getGDNativeAPI().transformScaled(self, scale)
|
||||
|
||||
proc `==`*(self: Transform; b: Transform): bool {.
|
||||
importc: "godot_transform_operator_equal".}
|
||||
proc `*`*(a, b: Transform): Transform {.
|
||||
importc: "godot_transform_operator_multiply".}
|
||||
proc `*=`*(a: var Transform, b: Transform) {.inline.} =
|
||||
a = a * b
|
||||
proc translated*(self: Transform; offset: Vector3): Transform {.inline.} =
|
||||
getGDNativeAPI().transformTranslated(self, offset)
|
||||
|
||||
proc lookingAt*(self: Transform; target, up: Vector3): Transform {.inline.} =
|
||||
getGDNativeAPI().transformLookingAt(self, target, up)
|
||||
|
||||
proc xformPlane*(self: Transform; plane: Plane): Plane {.inline.} =
|
||||
getGDNativeAPI().transformXformPlane(self, plane)
|
||||
|
||||
proc xformInvPlane*(self: Transform; plane: Plane): Plane {.inline.} =
|
||||
getGDNativeAPI().transformXformInvPlane(self, plane)
|
||||
|
||||
proc xformVector3*(self: Transform; v: Vector3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().transformXformVector3(self, v)
|
||||
|
||||
proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().transformXformInvVector3(self, v)
|
||||
|
||||
proc xformRect3*(self: Transform; rect: Rect3): Rect3 {.inline.} =
|
||||
getGDNativeAPI().transformXformRect3(self, rect)
|
||||
|
||||
proc xformInvRect3*(self: Transform; rect: Rect3): Rect3 {.inline.} =
|
||||
getGDNativeAPI().transformXformInvRect3(self, rect)
|
||||
|
||||
proc `==`*(self: Transform; b: Transform): bool {.inline.} =
|
||||
getGDNativeAPI().transformOperatorEqual(self, b)
|
||||
|
||||
proc `*`*(self, other: Transform): Transform {.inline.} =
|
||||
getGDNativeAPI().transformOperatorMultiply(self, other)
|
||||
|
||||
proc `*=`*(self: var Transform, other: Transform) {.inline.} =
|
||||
self = self * other
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue