Split out linalg.identity between matrices and array-based matrix
This commit is contained in:
1 parent
5dd2e38aff
commit
900fe95ba0
1 file changed
+11
-1
@@ -172,13 +172,23 @@ projection :: proc "contextless" (x, normal: $T/[$N]$E) -> T where IS_NUMERIC(E)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
identity :: proc "contextless" ($T: typeid/[$N][N]$E) -> (m: T) #no_bounds_check {
|
identity_array_based_matrix :: proc "contextless" ($T: typeid/[$N][N]$E) -> (m: T) #no_bounds_check {
|
||||||
for i in 0..<N {
|
for i in 0..<N {
|
||||||
m[i][i] = E(1)
|
m[i][i] = E(1)
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@(require_results)
|
||||||
|
identity_matrix :: proc "contextless" ($T: typeid/matrix[$N, N]$E) -> T #no_bounds_check {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
identity :: proc{
|
||||||
|
identity_array_based_matrix,
|
||||||
|
identity_matrix,
|
||||||
|
}
|
||||||
|
|
||||||
transpose :: intrinsics.transpose
|
transpose :: intrinsics.transpose
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
|
|||||||
Reference in new issue
Block a user