Rename Rect3 to AABB to sync with Godot

This commit is contained in:
Ruslan Mustakov 2017-11-20 06:52:37 +07:00
commit bf5bd54356
13 changed files with 195 additions and 195 deletions

73
godot/core/aabb.nim Normal file
View file

@ -0,0 +1,73 @@
# Copyright (c) 2017 Xored Software, Inc.
import internal.godotinternaltypes, internal.godotstrings
import godotcoretypes, gdnativeapi
proc initAABB*(pos, size: Vector3): AABB {.inline.} =
AABB(position: pos, size: size)
proc `$`*(self: AABB): string {.inline.} =
$getGDNativeAPI().aabbAsString(self)
proc area*(self: AABB): float32 {.inline.} =
getGDNativeAPI().aabbGetArea(self)
proc hasNoArea*(self: AABB): bool {.inline.} =
getGDNativeAPI().aabbHasNoArea(self)
proc hasNoSurface*(self: AABB): bool {.inline.} =
getGDNativeAPI().aabbHasNoSurface(self)
proc intersects*(self, other: AABB): bool {.inline.} =
getGDNativeAPI().aabbIntersects(self, other)
proc encloses*(self, other: AABB): bool {.inline.} =
getGDNativeAPI().aabbEncloses(self, other)
proc merge*(self, other: AABB): AABB {.inline.} =
getGDNativeAPI().aabbMerge(self, other)
proc intersection*(self, other: AABB): AABB {.inline.} =
getGDNativeAPI().aabbIntersection(self, other)
proc intersectsPlane*(self: AABB; plane: Plane): bool {.inline.} =
getGDNativeAPI().aabbIntersectsPlane(self, plane)
proc intersectsSegment*(self: AABB; start, to: Vector3): bool {.inline.} =
getGDNativeAPI().aabbIntersectsSegment(self, start, to)
proc contains*(self: AABB; point: Vector3): bool {.inline.} =
getGDNativeAPI().aabbHasPoint(self, point)
proc getSupport*(self: AABB; dir: Vector3): Vector3 {.inline.} =
getGDNativeAPI().aabbGetSupport(self, dir)
proc getLongestAxis*(self: AABB): Vector3 {.inline.} =
getGDNativeAPI().aabbGetLongestAxis(self)
proc getLongestAxisIndex*(self: AABB): cint {.inline.} =
getGDNativeAPI().aabbGetLongestAxisIndex(self)
proc getLongestAxisSize*(self: AABB): float32 {.inline.} =
getGDNativeAPI().aabbGetLongestAxisSize(self)
proc getShortestAxis*(self: AABB): Vector3 {.inline.} =
getGDNativeAPI().aabbGetShortestAxis(self)
proc getShortestAxisIndex*(self: AABB): cint {.inline.} =
getGDNativeAPI().aabbGetShortestAxisIndex(self)
proc getShortestAxisSize*(self: AABB): float32 {.inline.} =
getGDNativeAPI().aabbGetShortestAxisSize(self)
proc expand*(self: AABB; toPoint: Vector3): AABB {.inline.} =
getGDNativeAPI().aabbExpand(self, toPoint)
proc grow*(self: AABB; by: float32): AABB {.inline.} =
getGDNativeAPI().aabbGrow(self, by)
proc getEndpoint*(self: AABB; idx: cint): Vector3 {.inline.} =
getGDNativeAPI().aabbGetEndpoint(self, idx)
proc `==`*(a, b: AABB): bool {.inline.} =
getGDNativeAPI().aabbOperatorEqual(a, b)

View file

@ -29,7 +29,7 @@ type
z*: float32
w*: float32
Rect3* {.byref.} = object
AABB* {.byref.} = object
position*: Vector3
size*: Vector3

View file

@ -1,73 +0,0 @@
# Copyright (c) 2017 Xored Software, Inc.
import internal.godotinternaltypes, internal.godotstrings
import godotcoretypes, gdnativeapi
proc initRect3*(pos, size: Vector3): Rect3 {.inline.} =
Rect3(position: pos, size: size)
proc `$`*(self: Rect3): string {.inline.} =
$getGDNativeAPI().rect3AsString(self)
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)

View file

@ -55,11 +55,11 @@ proc xformVector3*(self: Transform; v: Vector3): Vector3 {.inline.} =
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 xformAABB*(self: Transform; rect: AABB): AABB {.inline.} =
getGDNativeAPI().transformXformAABB(self, rect)
proc xformInvRect3*(self: Transform; rect: Rect3): Rect3 {.inline.} =
getGDNativeAPI().transformXformInvRect3(self, rect)
proc xformInvAABB*(self: Transform; rect: AABB): AABB {.inline.} =
getGDNativeAPI().transformXformInvAABB(self, rect)
proc `==`*(self: Transform; b: Transform): bool {.inline.} =
getGDNativeAPI().transformOperatorEqual(self, b)

View file

@ -80,7 +80,7 @@ proc newVariant*(s: string): Variant {.inline.} =
godotStr.deinit()
import basis, nodepaths
import planes, quats, rect2, rect3, rids
import planes, quats, rect2, aabb, rids
import transforms, transform2d, vector2
import vector3, colors
@ -108,9 +108,9 @@ proc newVariant*(quat: Quat): Variant {.inline.} =
new(result, variantFinalizer)
initGodotVariant(result.godotVariant, quat)
proc newVariant*(rect3: Rect3): Variant {.inline.} =
proc newVariant*(aabb: AABB): Variant {.inline.} =
new(result, variantFinalizer)
initGodotVariant(result.godotVariant, rect3)
initGodotVariant(result.godotVariant, aabb)
proc newVariant*(basis: Basis): Variant {.inline.} =
new(result, variantFinalizer)
@ -207,8 +207,8 @@ proc asPlane*(self: Variant): Plane =
proc asQuat*(self: Variant): Quat =
self.godotVariant.asQuat()
proc asRect3*(self: Variant): Rect3 =
self.godotVariant.asRect3()
proc asAABB*(self: Variant): AABB =
self.godotVariant.asAABB()
proc asBasis*(self: Variant): Basis =
self.godotVariant.asBasis()