Use GDNative API struct
This commit is contained in:
parent
cf75723fa1
commit
b62db02d8f
32 changed files with 2846 additions and 1535 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright 2017 Xored Software, Inc.
|
||||
|
||||
import hashes
|
||||
import internal.godotarrays
|
||||
import internal.godotinternaltypes, internal.godotarrays
|
||||
|
||||
type
|
||||
Array* = ref object
|
||||
|
|
@ -125,8 +125,8 @@ proc delete*(self: var Array; idx: int) {.inline.} =
|
|||
proc setLen*(self: var Array; size: int) {.inline.} =
|
||||
self.godotArray.setLen(size.cint)
|
||||
|
||||
proc rfind*(self: Array; what: Variant; f: int): int {.inline.} =
|
||||
self.godotArray.rfind(what.godotVariant[], f.cint).int
|
||||
proc rfind*(self: Array; what: Variant; fromIdx: int): int {.inline.} =
|
||||
self.godotArray.rfind(what.godotVariant[], fromIdx.cint).int
|
||||
|
||||
proc len*(self: Array): int {.inline.} =
|
||||
self.godotArray.len.int
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@
|
|||
|
||||
import math
|
||||
import godotbase, vector3, quats
|
||||
|
||||
type
|
||||
Basis* {.byref.} = object
|
||||
elements*: array[3, Vector3]
|
||||
import godotcoretypes
|
||||
|
||||
proc setCells*(basis: var Basis, xx, xy, xz, yx, yy, yz, zx, zy, zz: float32) =
|
||||
basis.elements[0].x = xx
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Color* {.byref.} = object
|
||||
r*: float32
|
||||
g*: float32
|
||||
b*: float32
|
||||
a*: float32
|
||||
import godotcoretypes, gdnativeapi
|
||||
|
||||
proc initColor*(r, g, b: float32; a: float32 = 1.0'f32): Color {.inline.} =
|
||||
Color(
|
||||
|
|
@ -19,12 +14,14 @@ proc initColor*(): Color {.inline.} =
|
|||
## Initializes black color with 1.0 alpha
|
||||
initColor(0, 0, 0)
|
||||
|
||||
proc h*(self: Color): float32 {.
|
||||
importc: "godot_color_get_h".}
|
||||
proc s*(self: Color): float32 {.
|
||||
importc: "godot_color_get_s".}
|
||||
proc v*(self: Color): float32 {.
|
||||
importc: "godot_color_get_v".}
|
||||
proc h*(self: Color): float32 {.inline.} =
|
||||
getGDNativeAPI().colorGetH(self)
|
||||
|
||||
proc s*(self: Color): float32 {.inline.} =
|
||||
getGDNativeAPI().colorGetS(self)
|
||||
|
||||
proc v*(self: Color): float32 {.inline.} =
|
||||
getGDNativeAPI().colorGetV(self)
|
||||
|
||||
proc `$`*(self: Color): string {.inline.} =
|
||||
result = newStringOfCap(50)
|
||||
|
|
@ -58,16 +55,20 @@ proc toARGB32*(self: Color): uint32 {.inline.} =
|
|||
result = (result shl 8) or uint8(self.g * 255)
|
||||
result = (result shl 8) or uint8(self.b * 255)
|
||||
|
||||
proc gray*(self: Color): float32 {.
|
||||
importc: "godot_color_gray".}
|
||||
proc inverted*(self: Color): Color {.
|
||||
importc: "godot_color_inverted".}
|
||||
proc contrasted*(self: Color): Color {.
|
||||
importc: "godot_color_contrasted".}
|
||||
proc lerp*(self: Color; b: Color; t: float32): Color {.
|
||||
importc: "godot_color_linear_interpolate".}
|
||||
proc blend*(self: Color; over: Color): Color {.
|
||||
importc: "godot_color_blend".}
|
||||
proc gray*(self: Color): float32 {.inline.} =
|
||||
getGDNativeAPI().colorGray(self)
|
||||
|
||||
proc inverted*(self: Color): Color {.inline.} =
|
||||
getGDNativeAPI().colorInverted(self)
|
||||
|
||||
proc contrasted*(self: Color): Color {.inline.} =
|
||||
getGDNativeAPI().colorContrasted(self)
|
||||
|
||||
proc lerp*(self: Color; b: Color; t: float32): Color {.inline.} =
|
||||
getGDNativeAPI().colorLinearInterpolate(self, b, t)
|
||||
|
||||
proc blend*(self: Color; over: Color): Color {.inline.} =
|
||||
getGDNativeAPI().colorBlend(self, over)
|
||||
|
||||
proc `==`*(a, b: Color): bool {.inline.} =
|
||||
a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Copyright 2017 Xored Software, Inc.
|
||||
|
||||
import hashes
|
||||
import internal.godotstrings, internal.godotdictionaries,
|
||||
internal.godotvariants
|
||||
import internal.godotinternaltypes, internal.godotdictionaries,
|
||||
internal.godotvariants, internal.godotstrings
|
||||
|
||||
type
|
||||
Dictionary* = ref object
|
||||
|
|
|
|||
|
|
@ -2,61 +2,6 @@
|
|||
|
||||
import math
|
||||
|
||||
type
|
||||
Error* {.size: sizeof(cint), pure.} = enum
|
||||
OK,
|
||||
Failed, ## Generic fail error
|
||||
Unavailable, ## What is requested is unsupported/unavailable
|
||||
Unconfigured, ## The object being used hasnt been properly set up yet
|
||||
Unauthorized, ## Missing credentials for requested resource
|
||||
ParameterRangeError, ## Parameter given out of range (5)
|
||||
OutOfMemory, ## Out of memory
|
||||
FileNotFound,
|
||||
FileBadDrive,
|
||||
FileBadPath,
|
||||
FileNoPermission, ## (10)
|
||||
FileAlreadyInUse,
|
||||
FileCantOpen,
|
||||
FileCantWrite,
|
||||
FileCantRead,
|
||||
FileUnrecognized, ## (15)
|
||||
FileCorrupt,
|
||||
FileMissingDependencies,
|
||||
FileEOF,
|
||||
CantOpen, ## Can't open a resource/socket/file
|
||||
CantCreate, ## (20)
|
||||
QueryFailed,
|
||||
AlreadyInUse,
|
||||
Locked, ## resource is locked
|
||||
Timeout,
|
||||
CantConnect, ## (25)
|
||||
CantResolve,
|
||||
ConnectionError,
|
||||
CantAquireResource,
|
||||
CantFork,
|
||||
InvalidData, ## Data passed is invalid (30)
|
||||
InvalidParameter, ## Parameter passed is invalid
|
||||
AlreadyExists, ## When adding, item already exists
|
||||
DoesNotExist, ## When retrieving/erasing, it item does not exist
|
||||
DatabaseCantRead, ## Database is full
|
||||
DatabaseCantWrite, ## Database is full (35)
|
||||
CompilationFailed,
|
||||
MethodNotFound,
|
||||
LinkFailed,
|
||||
ScriptFailed,
|
||||
CyclicLink, ## (40)
|
||||
InvalidDeclaration,
|
||||
DuplicateSymbol,
|
||||
PauseError,
|
||||
Busy,
|
||||
Skip, ## (45)
|
||||
Help, ## user requested help!!
|
||||
Bug,
|
||||
## a bug in the software certainly happened, due to a double
|
||||
## check failing or unexpected behavior.
|
||||
PrinterOnFire, ## the parallel port printer is engulfed in flames
|
||||
WTF ## shit happens, has never been used, though
|
||||
|
||||
# math helpers
|
||||
|
||||
const EPSILON = 0.00001'f32
|
||||
|
|
|
|||
102
godot/core/godotcoretypes.nim
Normal file
102
godot/core/godotcoretypes.nim
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
# Copyright 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Color* {.byref.} = object
|
||||
r*: float32
|
||||
g*: float32
|
||||
b*: float32
|
||||
a*: float32
|
||||
|
||||
Vector3* {.byref.} = object
|
||||
x*: float32
|
||||
y*: float32
|
||||
z*: float32
|
||||
|
||||
Vector2* {.byref.} = object
|
||||
x*: float32
|
||||
y*: float32
|
||||
|
||||
Plane* {.byref.} = object
|
||||
normal*: Vector3
|
||||
d*: float32
|
||||
|
||||
Basis* {.byref.} = object
|
||||
elements*: array[3, Vector3]
|
||||
|
||||
Quat* {.byref.} = object
|
||||
x*: float32
|
||||
y*: float32
|
||||
z*: float32
|
||||
w*: float32
|
||||
|
||||
Rect3* {.byref.} = object
|
||||
position*: Vector3
|
||||
size*: Vector3
|
||||
|
||||
Rect2* {.byref.} = object
|
||||
position*: Vector2
|
||||
size*: Vector2
|
||||
|
||||
Transform2D* {.byref.} = object
|
||||
elements*: array[3, Vector2]
|
||||
|
||||
Transform* {.byref.} = object
|
||||
basis*: Basis
|
||||
origin*: Vector3
|
||||
|
||||
RID* {.byref.} = object
|
||||
data: array[sizeof(int), byte]
|
||||
|
||||
Error* {.size: sizeof(cint), pure.} = enum
|
||||
OK,
|
||||
Failed, ## Generic fail error
|
||||
Unavailable, ## What is requested is unsupported/unavailable
|
||||
Unconfigured, ## The object being used hasnt been properly set up yet
|
||||
Unauthorized, ## Missing credentials for requested resource
|
||||
ParameterRangeError, ## Parameter given out of range (5)
|
||||
OutOfMemory, ## Out of memory
|
||||
FileNotFound,
|
||||
FileBadDrive,
|
||||
FileBadPath,
|
||||
FileNoPermission, ## (10)
|
||||
FileAlreadyInUse,
|
||||
FileCantOpen,
|
||||
FileCantWrite,
|
||||
FileCantRead,
|
||||
FileUnrecognized, ## (15)
|
||||
FileCorrupt,
|
||||
FileMissingDependencies,
|
||||
FileEOF,
|
||||
CantOpen, ## Can't open a resource/socket/file
|
||||
CantCreate, ## (20)
|
||||
QueryFailed,
|
||||
AlreadyInUse,
|
||||
Locked, ## resource is locked
|
||||
Timeout,
|
||||
CantConnect, ## (25)
|
||||
CantResolve,
|
||||
ConnectionError,
|
||||
CantAquireResource,
|
||||
CantFork,
|
||||
InvalidData, ## Data passed is invalid (30)
|
||||
InvalidParameter, ## Parameter passed is invalid
|
||||
AlreadyExists, ## When adding, item already exists
|
||||
DoesNotExist, ## When retrieving/erasing, it item does not exist
|
||||
DatabaseCantRead, ## Database is full
|
||||
DatabaseCantWrite, ## Database is full (35)
|
||||
CompilationFailed,
|
||||
MethodNotFound,
|
||||
LinkFailed,
|
||||
ScriptFailed,
|
||||
CyclicLink, ## (40)
|
||||
InvalidDeclaration,
|
||||
DuplicateSymbol,
|
||||
PauseError,
|
||||
Busy,
|
||||
Skip, ## (45)
|
||||
Help, ## user requested help!!
|
||||
Bug,
|
||||
## a bug in the software certainly happened, due to a double
|
||||
## check failing or unexpected behavior.
|
||||
PrinterOnFire, ## the parallel port printer is engulfed in flames
|
||||
WTF ## shit happens, has never been used, though
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2017 Xored Software, Inc.
|
||||
|
||||
import internal.godotnodepaths, internal.godotstrings
|
||||
import internal.godotinternaltypes, internal.godotnodepaths,
|
||||
internal.godotstrings
|
||||
|
||||
type
|
||||
NodePath* = ref object
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright 2017 Xored Software, Inc.
|
||||
|
||||
import vector2, vector3, colors
|
||||
import internal.godotpoolarrays, internal.godotstrings
|
||||
import godotcoretypes
|
||||
import internal.godotinternaltypes, internal.godotpoolarrays,
|
||||
internal.godotstrings
|
||||
|
||||
template definePoolArrayBase(T, GodotT, DataT, fieldName, newProcName,
|
||||
initProcName) =
|
||||
|
|
@ -51,9 +52,6 @@ template definePoolArray(T, GodotT, DataT, fieldName, newProcName, initProcName;
|
|||
proc add*(self: var T; data: DataT) {.inline.} =
|
||||
self.fieldName.add(data)
|
||||
|
||||
proc addFirst*(self: var T, data: DataT) {.inline.} =
|
||||
self.fieldName.addFirst(data)
|
||||
|
||||
proc insert*(self: var T; idx: int; data: DataT): Error {.inline.} =
|
||||
self.fieldName.insert(idx.cint, data)
|
||||
|
||||
|
|
@ -93,7 +91,7 @@ definePoolArrayBase(PoolStringArray, GodotPoolStringArray, string,
|
|||
godotPoolStringArray, newPoolStringArray,
|
||||
initGodotPoolStringArray)
|
||||
|
||||
import godotbase, arrays
|
||||
import arrays
|
||||
|
||||
definePoolArray(PoolByteArray, GodotPoolByteArray, uint8,
|
||||
godotPoolByteArray, newPoolByteArray,
|
||||
|
|
@ -122,11 +120,6 @@ proc add*(self: var PoolStringArray; data: string) =
|
|||
self.godotPoolStringArray.add(s)
|
||||
s.deinit()
|
||||
|
||||
proc addFirst*(self: var PoolStringArray, data: string) =
|
||||
var s = data.toGodotString()
|
||||
self.godotPoolStringArray.addFirst(s)
|
||||
s.deinit()
|
||||
|
||||
proc insert*(self: var PoolStringArray; idx: int; data: string): Error =
|
||||
var s = data.toGodotString()
|
||||
result = self.godotPoolStringArray.insert(idx.cint, s)
|
||||
|
|
|
|||
|
|
@ -1,91 +1,78 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import vector3
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Quat* {.byref.} = object
|
||||
x*: float32
|
||||
y*: float32
|
||||
z*: float32
|
||||
w*: float32
|
||||
|
||||
proc initQuat(dest: var Quat; x, y, z, w: float32) {.
|
||||
importc: "godot_quat_new".}
|
||||
proc initQuat(dest: var Quat; axis: Vector3; angle: float32) {.
|
||||
importc: "godot_quat_new_with_axis_angle".}
|
||||
import internal.godotinternaltypes, godotcoretypes, gdnativeapi
|
||||
|
||||
proc initQuat*(x, y, z, w: float32): Quat {.inline.} =
|
||||
initQuat(result, x, y, z, w)
|
||||
result = Quat(
|
||||
x: x,
|
||||
y: y,
|
||||
z: z,
|
||||
w: w
|
||||
)
|
||||
|
||||
proc initQuat*(axis: Vector3; angle: float32): Quat {.inline.} =
|
||||
initQuat(result, axis, angle)
|
||||
|
||||
proc toGodotString(self: Quat): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_as_string".}
|
||||
getGDNativeAPI().quatNewWithAxisAngle(result, axis, angle)
|
||||
|
||||
proc `$`*(self: Quat): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().quatAsString(self)
|
||||
|
||||
proc length*(self: Quat): float32 {.inline.} =
|
||||
getGDNativeAPI().quatLength(self)
|
||||
|
||||
proc lengthSquared*(self: Quat): float32 {.inline.} =
|
||||
getGDNativeAPI().quatLengthSquared(self)
|
||||
|
||||
proc normalized*(self: Quat): Quat {.inline.} =
|
||||
getGDNativeAPI().quatNormalized(self)
|
||||
|
||||
proc isNormalized*(self: Quat): bool {.inline.} =
|
||||
getGDNativeAPI().quatIsNormalized(self)
|
||||
|
||||
proc inverse*(self: Quat): Quat {.inline.} =
|
||||
getGDNativeAPI().quatInverse(self)
|
||||
|
||||
proc dot*(a, b: Quat): float32 {.inline.} =
|
||||
getGDNativeAPI().quatDot(a, b)
|
||||
|
||||
proc xform*(self: Quat; v: Vector3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().quatXform(self, v)
|
||||
|
||||
proc slerp*(self: Quat; b: Quat; t: float32): Quat {.inline.} =
|
||||
getGDNativeAPI().quatSlerp(self, b, t)
|
||||
|
||||
proc slerpni*(self: Quat; b: Quat; t: float32): Quat {.inline.} =
|
||||
getGDNativeAPI().quatSlerpni(self, b, t)
|
||||
|
||||
proc cubicSlerp*(self, b, preA, postB: Quat;
|
||||
t: float32): Quat {.inline.} =
|
||||
getGDNativeAPI().quatCubicSlerp(self, b, preA, postB, t)
|
||||
|
||||
proc `*`*(a: Quat, b: float32): Quat {.inline.} =
|
||||
getGDNativeAPI().quatOperatorMultiply(a, b)
|
||||
|
||||
proc length*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_length".}
|
||||
proc lengthSquared*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_length_squared".}
|
||||
proc normalized*(self: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_normalized".}
|
||||
proc isNormalized*(self: Quat): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_is_normalized".}
|
||||
proc inverse*(self: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_inverse".}
|
||||
proc dot*(a, b: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_dot".}
|
||||
proc xform*(self: Quat; v: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_xform".}
|
||||
proc slerp*(self: Quat; b: Quat; t: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_slerp".}
|
||||
proc slerpni*(self: Quat; b: Quat; t: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_slerpni".}
|
||||
proc cubicSlerp*(self, b, pre_a, post_b: Quat;
|
||||
t: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_cubic_slerp".}
|
||||
proc `*`*(a: Quat, b: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_multiply".}
|
||||
proc `*=`*(a: var Quat, b: float32) {.inline.} =
|
||||
a = a * b
|
||||
|
||||
proc `+`*(a, b: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_add".}
|
||||
proc `+`*(a, b: Quat): Quat {.inline.} =
|
||||
getGDNativeAPI().quatOperatorAdd(a, b)
|
||||
|
||||
proc `+=`*(a: var Quat, b: Quat) {.inline.} =
|
||||
a = a + b
|
||||
|
||||
proc `-`*(a, b: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_substract".}
|
||||
proc `-`*(a, b: Quat): Quat {.inline.} =
|
||||
getGDNativeAPI().quatOperatorSubtract(a, b)
|
||||
|
||||
proc `-=`* (a: var Quat, b: Quat) {.inline.} =
|
||||
a = a - b
|
||||
|
||||
proc `/`*(self: Quat; b: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_divide".}
|
||||
proc `/`*(self: Quat; b: float32): Quat {.inline.} =
|
||||
getGDNativeAPI().quatOperatorDivide(self, b)
|
||||
|
||||
proc `/=`*(self: var Quat, b: float32) {.inline.} =
|
||||
self = self / b
|
||||
|
||||
proc `==`*(a, b: Quat): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_equal".}
|
||||
proc `-`*(self: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_neg".}
|
||||
proc `==`*(a, b: Quat): bool {.inline.} =
|
||||
getGDNativeAPI().quatOperatorEqual(a, b)
|
||||
|
||||
proc `-`*(self: Quat): Quat {.inline.} =
|
||||
getGDNativeAPI().quatOperatorNeg(self)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import vector2
|
||||
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Rect2* {.byref.} = object
|
||||
position*: Vector2
|
||||
size*: Vector2
|
||||
import godotcoretypes, internal.godotinternaltypes, gdnativeapi
|
||||
|
||||
proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
||||
Rect2(position: pos, size: size)
|
||||
|
|
@ -15,40 +9,35 @@ proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
|||
proc initRect2*(x, y, sizeX, sizeY: float32): Rect2 {.inline.} =
|
||||
Rect2(position: vec2(x, y), size: vec2(sizeX, sizeY))
|
||||
|
||||
proc toGodotString(self: Rect2): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_as_string".}
|
||||
|
||||
proc `$`*(self: Rect2): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().rect2AsString(self)
|
||||
|
||||
proc area*(self: Rect2): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_get_area".}
|
||||
proc intersects*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_intersects".}
|
||||
proc encloses*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_encloses".}
|
||||
proc hasNoArea*(self: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_has_no_area".}
|
||||
proc clip*(a, b: Rect2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_clip".}
|
||||
proc merge*(a, b: Rect2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_merge".}
|
||||
proc contains*(self: Rect2; point: Vector2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_has_point".}
|
||||
proc grow*(self: Rect2; by: float32): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_grow".}
|
||||
proc expand*(self: Rect2; to: Vector2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_expand".}
|
||||
proc `==`*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_operator_equal".}
|
||||
proc area*(self: Rect2): float32 {.inline.} =
|
||||
getGDNativeAPI().rect2GetArea(self)
|
||||
|
||||
proc intersects*(a, b: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2Intersects(a, b)
|
||||
|
||||
proc encloses*(a, b: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2Encloses(a, b)
|
||||
|
||||
proc hasNoArea*(self: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2HasNoArea(self)
|
||||
|
||||
proc clip*(self, b: Rect2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Clip(self, b)
|
||||
|
||||
proc merge*(self, b: Rect2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Merge(self, b)
|
||||
|
||||
proc contains*(self: Rect2; point: Vector2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2HasPoint(self, point)
|
||||
|
||||
proc grow*(self: Rect2; by: float32): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Grow(self, by)
|
||||
|
||||
proc expand*(self: Rect2; to: Vector2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Expand(self, to)
|
||||
|
||||
proc `==`*(a, b: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2OperatorEqual(a, b)
|
||||
|
|
|
|||
|
|
@ -1,84 +1,72 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import planes, vector3
|
||||
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Rect3* {.byref.} = object
|
||||
position*: Vector3
|
||||
size*: Vector3
|
||||
import godotcoretypes, internal.godotinternaltypes, gdnativeapi
|
||||
|
||||
proc initRect3*(pos, size: Vector3): Rect3 {.inline.} =
|
||||
Rect3(position: pos, size: size)
|
||||
|
||||
proc toGodotString(self: Rect3): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_as_string".}
|
||||
|
||||
proc `$`*(self: Rect3): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().rect3AsString(self)
|
||||
|
||||
proc area*(self: Rect3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_area".}
|
||||
proc hasNoArea*(self: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_has_no_area".}
|
||||
proc hasNoSurface*(self: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_has_no_surface".}
|
||||
proc intersects*(a, b: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersects".}
|
||||
proc encloses*(self, other: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_encloses".}
|
||||
proc merge*(self, other: Rect3): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_merge".}
|
||||
proc intersection*(self, other: Rect3): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersection".}
|
||||
proc intersectsPlane*(self: Rect3; plane: Plane): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersects_plane".}
|
||||
proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersects_segment".}
|
||||
proc contains*(self: Rect3; point: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_has_point".}
|
||||
proc getSupport*(self: Rect3; dir: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_support".}
|
||||
proc getLongestAxis*(self: Rect3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_longest_axis".}
|
||||
proc getLongestAxisIndex*(self: Rect3): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_longest_axis_index".}
|
||||
proc getLongestAxisSize*(self: Rect3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_longest_axis_size".}
|
||||
proc getShortestAxis*(self: Rect3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_shortest_axis".}
|
||||
proc getShortestAxisIndex*(self: Rect3): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_shortest_axis_index".}
|
||||
proc getShortestAxisSize*(self: Rect3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_shortest_axis_size".}
|
||||
proc expand*(self: Rect3; toPoint: Vector3): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_expand".}
|
||||
proc grow*(self: Rect3; by: float32): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_grow".}
|
||||
proc getEndpoint*(self: Rect3; idx: cint): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_endpoint".}
|
||||
proc `==`*(a, b: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_operator_equal".}
|
||||
proc area*(self: Rect3): float32 {.inline.} =
|
||||
getGDNativeAPI().rect3GetArea(self)
|
||||
|
||||
proc hasNoArea*(self: Rect3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3HasNoArea(self)
|
||||
|
||||
proc hasNoSurface*(self: Rect3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3HasNoSurface(self)
|
||||
|
||||
proc intersects*(self, other: Rect3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3Intersects(self, other)
|
||||
|
||||
proc encloses*(self, other: Rect3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3Encloses(self, other)
|
||||
|
||||
proc merge*(self, other: Rect3): Rect3 {.inline.} =
|
||||
getGDNativeAPI().rect3Merge(self, other)
|
||||
|
||||
proc intersection*(self, other: Rect3): Rect3 {.inline.} =
|
||||
getGDNativeAPI().rect3Intersection(self, other)
|
||||
|
||||
proc intersectsPlane*(self: Rect3; plane: Plane): bool {.inline.} =
|
||||
getGDNativeAPI().rect3IntersectsPlane(self, plane)
|
||||
|
||||
proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3IntersectsSegment(self, start, to)
|
||||
|
||||
proc contains*(self: Rect3; point: Vector3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3HasPoint(self, point)
|
||||
|
||||
proc getSupport*(self: Rect3; dir: Vector3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().rect3GetSupport(self, dir)
|
||||
|
||||
proc getLongestAxis*(self: Rect3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().rect3GetLongestAxis(self)
|
||||
|
||||
proc getLongestAxisIndex*(self: Rect3): cint {.inline.} =
|
||||
getGDNativeAPI().rect3GetLongestAxisIndex(self)
|
||||
|
||||
proc getLongestAxisSize*(self: Rect3): float32 {.inline.} =
|
||||
getGDNativeAPI().rect3GetLongestAxisSize(self)
|
||||
|
||||
proc getShortestAxis*(self: Rect3): Vector3 {.inline.} =
|
||||
getGDNativeAPI().rect3GetShortestAxis(self)
|
||||
|
||||
proc getShortestAxisIndex*(self: Rect3): cint {.inline.} =
|
||||
getGDNativeAPI().rect3GetShortestAxisIndex(self)
|
||||
|
||||
proc getShortestAxisSize*(self: Rect3): float32 {.inline.} =
|
||||
getGDNativeAPI().rect3GetShortestAxisSize(self)
|
||||
|
||||
proc expand*(self: Rect3; toPoint: Vector3): Rect3 {.inline.} =
|
||||
getGDNativeAPI().rect3Expand(self, toPoint)
|
||||
|
||||
proc grow*(self: Rect3; by: float32): Rect3 {.inline.} =
|
||||
getGDNativeAPI().rect3Grow(self, by)
|
||||
|
||||
proc getEndpoint*(self: Rect3; idx: cint): Vector3 {.inline.} =
|
||||
getGDNativeAPI().rect3GetEndpoint(self, idx)
|
||||
|
||||
proc `==`*(a, b: Rect3): bool {.inline.} =
|
||||
getGDNativeAPI().rect3OperatorEqual(a, b)
|
||||
|
|
|
|||
|
|
@ -1,31 +1,21 @@
|
|||
import internal.godotobjects
|
||||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
RID* {.byref.} = object
|
||||
data: array[sizeof(int), byte]
|
||||
|
||||
proc initRID(dest: var RID) {.
|
||||
importc: "godot_rid_new".}
|
||||
proc initRID(dest: var RID; obj: ptr GodotObject) {.
|
||||
importc: "godot_rid_new_with_resource".}
|
||||
import godotcoretypes, internal.godotinternaltypes, gdnativeapi
|
||||
|
||||
proc initRID*(): RID {.inline.} =
|
||||
initRID(result)
|
||||
getGDNativeAPI().ridNew(result)
|
||||
|
||||
proc initRID*(obj: ptr GodotObject): RID {.inline.} =
|
||||
initRID(result, obj)
|
||||
|
||||
proc idCInt(self: RID): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_rid_get_id".}
|
||||
getGDNativeAPI().ridNewWithResource(result, obj)
|
||||
|
||||
proc id*(self: RID): uint32 {.inline.} =
|
||||
cast[uint32](self.idCInt())
|
||||
cast[uint32](getGDNativeAPI().ridGetId(self))
|
||||
|
||||
proc `$`*(self: RID): string =
|
||||
proc `$`*(self: RID): string {.inline.} =
|
||||
$self.id
|
||||
|
||||
proc `==`*(a, b: RID): bool {.
|
||||
importc: "godot_rid_operator_equal".}
|
||||
proc `<`*(a, b: RID): bool {.
|
||||
importc: "godot_rid_operator_less".}
|
||||
proc `==`*(a, b: RID): bool {.inline.} =
|
||||
getGDNativeAPI().ridOperatorEqual(a, b)
|
||||
|
||||
proc `<`*(a, b: RID): bool {.inline.} =
|
||||
getGDNativeAPI().ridOperatorLess(a, b)
|
||||
|
|
|
|||
|
|
@ -1,76 +1,73 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import vector2, rect2
|
||||
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Transform2D* {.byref.} = object
|
||||
elements*: array[3, Vector2]
|
||||
|
||||
proc initTransform2D(dest: var Transform2D) {.
|
||||
importc: "godot_transform2d_new_identity".}
|
||||
proc initTransform2D(dest: var Transform2D; rot: float32; pos: Vector2) {.
|
||||
importc: "godot_transform2d_new".}
|
||||
proc initTransform2D(dest: var Transform2D; xAxis, yAxis, origin: Vector2) {.
|
||||
importc: "godot_transform2d_new_axis_origin".}
|
||||
import godotcoretypes, internal.godotinternaltypes, gdnativeapi
|
||||
|
||||
proc initTransform2D*(): Transform2D {.inline.} =
|
||||
initTransform2D(result)
|
||||
getGDNativeAPI().transform2DNewIdentity(result)
|
||||
|
||||
proc initTransform2D*(rot: float32; pos: Vector2): Transform2D {.inline.} =
|
||||
initTransform2D(result, rot, pos)
|
||||
getGDNativeAPI().transform2DNew(result, rot, pos)
|
||||
|
||||
proc initTransform2D*(xAxis, yAxis, origin: Vector2): Transform2D {.inline.} =
|
||||
initTransform2D(result, xAxis, yAxis, origin)
|
||||
|
||||
proc toGodotString(self: Transform2D): GodotString {.
|
||||
importc: "godot_transform2d_as_string".}
|
||||
getGDNativeAPI().transform2DNewAxisOrigin(result, xAxis, yAxis, origin)
|
||||
|
||||
proc `$`*(self: Transform2D): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().transform2DAsString(self)
|
||||
|
||||
proc inverse*(self: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_inverse".}
|
||||
proc affineInverse*(self: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_affine_inverse".}
|
||||
proc rotation*(self: Transform2D): float32 {.
|
||||
importc: "godot_transform2d_get_rotation".}
|
||||
proc origin*(self: Transform2D): Vector2 {.
|
||||
importc: "godot_transform2d_get_origin".}
|
||||
proc scale*(self: Transform2D): Vector2 {.
|
||||
importc: "godot_transform2d_get_scale".}
|
||||
proc orthonormalized*(self: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_orthonormalized".}
|
||||
proc rotated*(self: Transform2D; phi: float32): Transform2D {.
|
||||
importc: "godot_transform2d_rotated".}
|
||||
proc scaled*(self: Transform2D; scale: Vector2): Transform2D {.
|
||||
importc: "godot_transform2d_scaled".}
|
||||
proc translated*(self: Transform2D;
|
||||
offset: Vector2): Transform2D {.
|
||||
importc: "godot_transform2d_translated".}
|
||||
proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_xform_vector2".}
|
||||
proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_xform_inv_vector2".}
|
||||
proc basisXformVector2*(self: Transform2D;
|
||||
v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_basis_xform_vector2".}
|
||||
proc basisXformInvVector2*(self: Transform2D;
|
||||
v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_basis_xform_inv_vector2".}
|
||||
proc xformRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
||||
importc: "godot_transform2d_xform_rect2".}
|
||||
proc xformInvRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
||||
importc: "godot_transform2d_xform_inv_rect2".}
|
||||
proc inverse*(self: Transform2D): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DInverse(self)
|
||||
|
||||
proc affineInverse*(self: Transform2D): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DAffineInverse(self)
|
||||
|
||||
proc rotation*(self: Transform2D): float32 {.inline.} =
|
||||
getGDNativeAPI().transform2DGetRotation(self)
|
||||
|
||||
proc origin*(self: Transform2D): Vector2 {.inline.} =
|
||||
getGDNativeAPI().transform2DGetOrigin(self)
|
||||
|
||||
proc scale*(self: Transform2D): Vector2 {.inline.} =
|
||||
getGDNativeAPI().transform2DGetScale(self)
|
||||
|
||||
proc orthonormalized*(self: Transform2D): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DOrthonormalized(self)
|
||||
|
||||
proc rotated*(self: Transform2D; phi: float32): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DRotated(self, phi)
|
||||
|
||||
proc scaled*(self: Transform2D; scale: Vector2): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DScaled(self, scale)
|
||||
|
||||
proc translated*(self: Transform2D; offset: Vector2): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DTranslated(self, offset)
|
||||
|
||||
proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().transform2DXformVector2(self, v)
|
||||
|
||||
proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().transform2DXformInvVector2(self, v)
|
||||
|
||||
proc basisXformVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().transform2DBasisXformVector2(self, v)
|
||||
|
||||
proc basisXformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().transform2DBasisXformInvVector2(self, v)
|
||||
|
||||
proc xformRect2*(self: Transform2D; rect: Rect2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().transform2DXformRect2(self, rect)
|
||||
|
||||
proc xformInvRect2*(self: Transform2D; rect: Rect2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().transform2DXformInvRect2(self, rect)
|
||||
|
||||
proc interpolateWith*(self, m: Transform2D;
|
||||
c: float32): Transform2D {.
|
||||
importc: "godot_transform2d_interpolate_with".}
|
||||
proc `==`*(a, b: Transform2D): bool {.
|
||||
importc: "godot_transform2d_operator_equal".}
|
||||
proc `*`*(a, b: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_operator_multiply".}
|
||||
c: float32): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DInterpolateWith(self, m, c)
|
||||
|
||||
proc `==`*(a, b: Transform2D): bool {.inline.} =
|
||||
getGDNativeAPI().transform2DOperatorEqual(a, b)
|
||||
|
||||
proc `*`*(a, b: Transform2D): Transform2D {.inline.} =
|
||||
getGDNativeAPI().transform2DOperatorMultiply(a, b)
|
||||
|
||||
proc `*=`*(a: var Transform2D, b: Transform2D) {.inline.} =
|
||||
a = a * b
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import tables
|
||||
|
||||
import internal.godotobjects, internal.godotvariants, internal.godotpoolarrays,
|
||||
internal.godotstrings, internal.godotnodepaths
|
||||
import godotcoretypes
|
||||
import internal.godotinternaltypes, internal.godotvariants,
|
||||
internal.godotstrings
|
||||
|
||||
type
|
||||
Variant* = ref object
|
||||
|
|
@ -267,5 +268,5 @@ proc `<`*(self, other: Variant): bool =
|
|||
proc hashCompare*(self, other: Variant): bool =
|
||||
self.godotVariant.hashCompare(other.godotVariant)
|
||||
|
||||
proc booleanize*(self: Variant; isValid: var bool): bool =
|
||||
self.godotVariant.booleanize(isValid)
|
||||
proc booleanize*(self: Variant): bool =
|
||||
self.godotVariant.booleanize()
|
||||
|
|
|
|||
|
|
@ -1,109 +1,121 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Vector2* {.byref.} = object
|
||||
x*: float32
|
||||
y*: float32
|
||||
import internal.godotinternaltypes, godotcoretypes, gdnativeapi
|
||||
|
||||
proc vec2*(x, y: float32): Vector2 {.inline.} =
|
||||
Vector2(x: x, y: y)
|
||||
|
||||
proc toGodotString(self: Vector2): GodotString {.
|
||||
importc: "godot_vector2_as_string".}
|
||||
|
||||
proc `$`*(self: Vector2): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().vector2AsString(self)
|
||||
|
||||
proc normalized*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_normalized".}
|
||||
proc length*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_length".}
|
||||
proc angle*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_angle".}
|
||||
proc lengthSquared*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_length_squared".}
|
||||
proc isNormalized*(self: Vector2): bool {.
|
||||
importc: "godot_vector2_is_normalized".}
|
||||
proc distanceTo*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_distance_to".}
|
||||
proc distanceSquaredTo*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_distance_squared_to".}
|
||||
proc angleTo*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_angle_to".}
|
||||
proc angleToPoint*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_angle_to_point".}
|
||||
proc lerp*(self, b: Vector2; t: float32): Vector2 {.
|
||||
importc: "godot_vector2_linear_interpolate".}
|
||||
proc cubicInterpolate*(self, b, pre_a, post_b: Vector2; t: float32): Vector2 {.
|
||||
importc: "godot_vector2_cubic_interpolate".}
|
||||
proc rotated*(self: Vector2; phi: float32): Vector2 {.
|
||||
importc: "godot_vector2_rotated".}
|
||||
proc tangent*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_tangent".}
|
||||
proc floor*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_floor".}
|
||||
proc snapped*(self: Vector2; by: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_snapped".}
|
||||
proc aspect*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_aspect".}
|
||||
proc dot*(a, b: Vector2): float32 {.
|
||||
importc: "godot_vector2_dot".}
|
||||
proc slide*(self, n: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_slide".}
|
||||
proc bounce*(self, n: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_bounce".}
|
||||
proc reflect*(self, n: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_reflect".}
|
||||
proc abs*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_abs".}
|
||||
proc clamped*(self: Vector2; length: float32): Vector2 {.
|
||||
importc: "godot_vector2_clamped".}
|
||||
proc normalized*(self: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Normalized(self)
|
||||
|
||||
proc `+`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_add".}
|
||||
proc `+=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a += b
|
||||
proc length*(self: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2Length(self)
|
||||
|
||||
proc `-`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_substract".}
|
||||
proc `-=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a = a - b
|
||||
proc angle*(self: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2Angle(self)
|
||||
|
||||
proc `*`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_multiply_vector".}
|
||||
proc lengthSquared*(self: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2LengthSquared(self)
|
||||
|
||||
proc `*=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a = a * b
|
||||
proc isNormalized*(self: Vector2): bool {.inline.} =
|
||||
getGDNativeAPI().vector2IsNormalized(self)
|
||||
|
||||
proc distanceTo*(self, to: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2DistanceTo(self, to)
|
||||
|
||||
proc distanceSquaredTo*(self, to: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2DistanceSquaredTo(self, to)
|
||||
|
||||
proc angleTo*(self, to: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2AngleTo(self, to)
|
||||
|
||||
proc angleToPoint*(self, to: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2AngleToPoint(self, to)
|
||||
|
||||
proc lerp*(self, b: Vector2; t: float32): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2LinearInterpolate(self, b, t)
|
||||
|
||||
proc cubicInterpolate*(self, b, preA, postB: Vector2;
|
||||
t: float32): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2CubicInterpolate(self, b, preA, postB, t)
|
||||
|
||||
proc rotated*(self: Vector2; phi: float32): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Rotated(self, phi)
|
||||
|
||||
proc tangent*(self: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Tangent(self)
|
||||
|
||||
proc floor*(self: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Floor(self)
|
||||
|
||||
proc snapped*(self: Vector2; by: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Snapped(self, by)
|
||||
|
||||
proc aspect*(self: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2Aspect(self)
|
||||
|
||||
proc dot*(a, b: Vector2): float32 {.inline.} =
|
||||
getGDNativeAPI().vector2Dot(a, b)
|
||||
|
||||
proc slide*(self, n: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Slide(self, n)
|
||||
|
||||
proc bounce*(self, n: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Bounce(self, n)
|
||||
|
||||
proc reflect*(self, n: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Reflect(self, n)
|
||||
|
||||
proc abs*(self: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Abs(self)
|
||||
|
||||
proc clamped*(self: Vector2; length: float32): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2Clamped(self, length)
|
||||
|
||||
proc `+`*(self, other: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2OperatorAdd(self, other)
|
||||
|
||||
proc `+=`*(self: var Vector2, other: Vector2) {.inline.} =
|
||||
self += other
|
||||
|
||||
proc `-`*(self, other: Vector2): Vector2 =
|
||||
getGDNativeAPI().vector2OperatorSubtract(self, other)
|
||||
|
||||
proc `-=`*(self: var Vector2, other: Vector2) {.inline.} =
|
||||
self = self - other
|
||||
|
||||
proc `*`*(self, other: Vector2): Vector2 =
|
||||
getGDNativeAPI().vector2OperatorMultiplyVector(self, other)
|
||||
|
||||
proc `*=`*(self: var Vector2, other: Vector2) {.inline.} =
|
||||
self = self * other
|
||||
|
||||
proc `*`*(self: Vector2, scalar: float32): Vector2 =
|
||||
getGDNativeAPI().vector2OperatorMultiplyScalar(self, scalar)
|
||||
|
||||
proc `*`*(self: Vector2, scalar: float32): Vector2 {.
|
||||
importc: "godot_vector2_operator_multiply_scalar".}
|
||||
proc `*=`*(self: var Vector2, scalar: float32) {.inline.} =
|
||||
self = self * scalar
|
||||
|
||||
proc `/`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_divide_vector".}
|
||||
proc `/=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a = a / b
|
||||
proc `/`*(self, other: Vector2): Vector2 =
|
||||
getGDNativeAPI().vector2OperatorDivideVector(self, other)
|
||||
|
||||
proc `/=`*(self: var Vector2, other: Vector2) {.inline.} =
|
||||
self = self / other
|
||||
|
||||
proc `/`*(self: Vector2; scalar: float32): Vector2 =
|
||||
getGDNativeAPI().vector2OperatorDivideScalar(self, scalar)
|
||||
|
||||
proc `/`*(self: Vector2; scalar: float32): Vector2 {.
|
||||
importc: "godot_vector2_operator_divide_scalar".}
|
||||
proc `/=`*(self: var Vector2; scalar: float32) {.inline.} =
|
||||
self = self / scalar
|
||||
|
||||
proc `==`*(a, b: Vector2): bool {.
|
||||
importc: "godot_vector2_operator_equal".}
|
||||
proc `<`*(a, b: Vector2): bool {.
|
||||
importc: "godot_vector2_operator_less".}
|
||||
proc `-`*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_neg".}
|
||||
proc `==`*(self, other: Vector2): bool {.inline.} =
|
||||
getGDNativeAPI().vector2OperatorEqual(self, other)
|
||||
|
||||
proc `x=`*(self: var Vector2; x: float32) {.
|
||||
importc: "godot_vector2_set_x".}
|
||||
proc `y=`*(self: var Vector2; y: float32) {.
|
||||
importc: "godot_vector2_set_y".}
|
||||
proc x*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_get_x".}
|
||||
proc y*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_get_y".}
|
||||
proc `<`*(self, other: Vector2): bool {.inline.} =
|
||||
getGDNativeAPI().vector2OperatorLess(self, other)
|
||||
|
||||
proc `-`*(self: Vector2): Vector2 {.inline.} =
|
||||
getGDNativeAPI().vector2OperatorNeg(self)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import math
|
||||
import godotbase
|
||||
|
||||
type
|
||||
Vector3* {.byref.} = object
|
||||
x*: float32
|
||||
y*: float32
|
||||
z*: float32
|
||||
import godotbase, godotcoretypes
|
||||
|
||||
proc vec3*(): Vector3 {.inline.} =
|
||||
Vector3()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue