Implement hash proc for Godot types

This commit is contained in:
Ruslan Mustakov 2018-06-04 11:23:23 +07:00
commit 76de026b4f
15 changed files with 139 additions and 38 deletions

View file

@ -1,6 +1,7 @@
# Copyright (c) 2018 Xored Software, Inc.
import math
import math, hashes
import godotbase, vector3, quats
import godotcoretypes
@ -201,6 +202,9 @@ proc `$`*(self: Basis): string {.inline.} =
result.add(", ")
result.add($self[i][j])
proc hash*(self: Basis): Hash {.inline.} =
!$(self.elements[0].hash() !& self.elements[1].hash() !& self.elements[2].hash())
template cofac(row1, col1, row2, col2: int): float32 =
self.elements[row1][col1] * self.elements[row2][col2] -
self.elements[row1][col2] * self.elements[row2][col1]