Use GDNative API struct
This commit is contained in:
parent
cf75723fa1
commit
b62db02d8f
32 changed files with 2846 additions and 1535 deletions
|
|
@ -2,72 +2,59 @@
|
|||
|
||||
import vector3
|
||||
|
||||
import internal.godotstrings
|
||||
import internal.godotinternaltypes, godotcoretypes, gdnativeapi
|
||||
|
||||
type
|
||||
Plane* {.byref.} = object
|
||||
normal*: Vector3
|
||||
d*: float32
|
||||
proc initPlane*(a, b, c, d: float32): Plane {.inline.} =
|
||||
getGDNativeAPI().planeNewWithReals(result, a, b, c, d)
|
||||
|
||||
proc initPlane(dest: var Plane; a, b, c, d: float32) {.
|
||||
importc: "godot_plane_new_with_reals".}
|
||||
proc initPlane(dest: var Plane; v1, v2, v3: Vector3) {.
|
||||
importc: "godot_plane_new_with_vectors".}
|
||||
proc initPlane(dest: var Plane; normal: Vector3; d: float32) {.
|
||||
importc: "godot_plane_new_with_normal".}
|
||||
proc initPlane*(v1, v2, v3: Vector3): Plane {.inline.} =
|
||||
getGDNativeAPI().planeNewWithVectors(result, v1, v2, v3)
|
||||
|
||||
proc initPlane*(a, b, c, d: float32): Plane =
|
||||
initPlane(result, a, b, c, d)
|
||||
|
||||
proc initPlane*(v1, v2, v3: Vector3): Plane =
|
||||
initPlane(result, v1, v2, v3)
|
||||
|
||||
proc initPlane*(normal: Vector3; d: float32): Plane =
|
||||
initPlane(result, normal, d)
|
||||
|
||||
proc toGodotString(self: Plane): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_as_string".}
|
||||
proc initPlane*(normal: Vector3; d: float32): Plane {.inline.} =
|
||||
result = Plane(
|
||||
normal: normal,
|
||||
d: d
|
||||
)
|
||||
|
||||
proc `$`*(self: Plane): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().planeAsString(self)
|
||||
|
||||
proc normalized*(self: Plane): Plane {.inline.} =
|
||||
getGDNativeAPI().planeNormalized(self)
|
||||
|
||||
proc center*(self: Plane): Vector3 {.inline.} =
|
||||
getGDNativeAPI().planeCenter(self)
|
||||
|
||||
proc getAnyPoint*(self: Plane): Vector3 {.inline.} =
|
||||
getGDNativeAPI().planeGetAnyPoint(self)
|
||||
|
||||
proc isPointOver*(self: Plane; point: Vector3): bool {.inline.} =
|
||||
getGDNativeAPI().planeIsPointOver(self, point)
|
||||
|
||||
proc distanceTo*(self: Plane; point: Vector3): float32 {.inline.} =
|
||||
getGDNativeAPI().planeDistanceTo(self, point)
|
||||
|
||||
proc normalized*(self: Plane): Plane {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_normalized".}
|
||||
proc center*(self: Plane): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_center".}
|
||||
proc getAnyPoint*(self: Plane): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_get_any_point".}
|
||||
proc isPointOver*(self: Plane; point: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_is_point_over".}
|
||||
proc distanceTo*(self: Plane; point: Vector3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_distance_to".}
|
||||
proc contains*(self: Plane; point: Vector3;
|
||||
epsilon: float32): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_has_point".}
|
||||
proc project*(self: Plane; point: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_project".}
|
||||
epsilon: float32): bool {.inline.} =
|
||||
getGDNativeAPI().planeHasPoint(self, point, epsilon)
|
||||
|
||||
proc project*(self: Plane; point: Vector3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().planeProject(self, point)
|
||||
|
||||
proc intersect3*(self: Plane; dest: var Vector3;
|
||||
b, c: Plane): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_intersect_3".}
|
||||
b, c: Plane): bool {.inline.} =
|
||||
getGDNativeAPI().planeIntersect3(self, dest, b, c)
|
||||
|
||||
proc intersectsRay*(self: Plane; dest: var Vector3;
|
||||
v, dir: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_intersects_ray".}
|
||||
v, dir: Vector3): bool {.inline.} =
|
||||
getGDNativeAPI().planeIntersectsRay(self, dest, v, dir)
|
||||
|
||||
proc intersectsSegment*(self: Plane; dest: var Vector3;
|
||||
segmentBegin, segmentEnd: Vector3): bool {.
|
||||
noSideEffect, importc: "godot_plane_intersects_segment".}
|
||||
proc `-`*(self: Plane): Plane {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_operator_neg".}
|
||||
proc `==`*(a, b: Plane): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_operator_equal".}
|
||||
segmentBegin, segmentEnd: Vector3): bool {.inline.} =
|
||||
getGDNativeAPI().planeIntersectsSegment(self, dest, segmentBegin, segmentEnd)
|
||||
|
||||
proc `-`*(self: Plane): Plane {.inline.} =
|
||||
getGDNativeAPI().planeOperatorNeg(self)
|
||||
|
||||
proc `==`*(a, b: Plane): bool {.inline.} =
|
||||
getGDNativeAPI().planeOperatorEqual(a, b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue