File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
src/main/kotlin/glm/mat4x4/operators Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -72,18 +72,26 @@ interface mat4x4_operators {
72
72
}
73
73
74
74
fun times (res : Vec4 , a : Mat4 , b : Vec4 ): Vec4 {
75
- res[0 ] = a[0 ][0 ] * b.x + a[1 ][0 ] * b.y + a[2 ][0 ] * b.z + a[3 ][0 ] * b.w
76
- res[1 ] = a[0 ][1 ] * b.x + a[1 ][1 ] * b.y + a[2 ][1 ] * b.z + a[3 ][1 ] * b.w
77
- res[2 ] = a[0 ][2 ] * b.x + a[1 ][2 ] * b.y + a[2 ][2 ] * b.z + a[3 ][2 ] * b.w
78
- res[3 ] = a[0 ][3 ] * b.x + a[1 ][3 ] * b.y + a[2 ][3 ] * b.z + a[3 ][3 ] * b.w
75
+ val x = a[0 ][0 ] * b.x + a[1 ][0 ] * b.y + a[2 ][0 ] * b.z + a[3 ][0 ] * b.w
76
+ val y = a[0 ][1 ] * b.x + a[1 ][1 ] * b.y + a[2 ][1 ] * b.z + a[3 ][1 ] * b.w
77
+ val z = a[0 ][2 ] * b.x + a[1 ][2 ] * b.y + a[2 ][2 ] * b.z + a[3 ][2 ] * b.w
78
+ val w = a[0 ][3 ] * b.x + a[1 ][3 ] * b.y + a[2 ][3 ] * b.z + a[3 ][3 ] * b.w
79
+ res.x = x
80
+ res.y = y
81
+ res.z = z
82
+ res.w = w
79
83
return res
80
84
}
81
85
82
86
fun times (res : Vec4 , a : Vec4 , b : Mat4 ): Vec4 {
83
- res[0 ] = a.x * b[0 ][0 ] + a.y * b[0 ][1 ] + a.z * b[0 ][2 ] + a.w * b[0 ][3 ]
84
- res[1 ] = a.x * b[1 ][0 ] + a.y * b[1 ][1 ] + a.z * b[1 ][2 ] + a.w * b[1 ][3 ]
85
- res[2 ] = a.x * b[2 ][0 ] + a.y * b[2 ][1 ] + a.z * b[2 ][2 ] + a.w * b[2 ][3 ]
86
- res[3 ] = a.x * b[3 ][0 ] + a.y * b[3 ][1 ] + a.z * b[3 ][2 ] + a.w * b[3 ][3 ]
87
+ val x = a.x * b[0 ][0 ] + a.y * b[0 ][1 ] + a.z * b[0 ][2 ] + a.w * b[0 ][3 ]
88
+ val y = a.x * b[1 ][0 ] + a.y * b[1 ][1 ] + a.z * b[1 ][2 ] + a.w * b[1 ][3 ]
89
+ val z = a.x * b[2 ][0 ] + a.y * b[2 ][1 ] + a.z * b[2 ][2 ] + a.w * b[2 ][3 ]
90
+ val w = a.x * b[3 ][0 ] + a.y * b[3 ][1 ] + a.z * b[3 ][2 ] + a.w * b[3 ][3 ]
91
+ res.x = x
92
+ res.y = y
93
+ res.z = z
94
+ res.w = w
87
95
return res
88
96
}
89
97
You can’t perform that action at this time.
0 commit comments