[swift-users] An OpenGL math library in pure Swift
jnosh at jnosh.com
Tue Jan 5 17:12:11 CST 2016
> On 05 Jan 2016, at 04:11, David Turnbull via swift-users <swift-users at swift.org> wrote:
> I've been working on a math library for SwiftGL. It's looking good. Vector2, Vector3, Vector4, Matrix2x2, Matrix3x3, Matrix4x4 are implemented with all arithmetic. You can even swizzle just like GLSL.
> var myVec = vec4(1, 2, 3, 4)
> myVec.ab = vec2(99, 98)
> print(myVec) //=> (1, 2, 98, 99)
> There's still a lot to do. I hope to have feature parity with GLSL done this week. But it's ready to set free and get feedback.
> https://github.com/AE9RB/SwiftGL <https://github.com/AE9RB/SwiftGL>
> And a couple questions. Is there any way to make import SwiftGL.Math work? Note the dot. Also, is there anything reasonable I can do to improve the compile time? 3.5 minutes for 2000 lines of code can't be right.
To find out which parts of your code are causing issues add `-Xfrontend -debug-time-function-bodies` in "Other Swift Flags".
When building Xcode will print the compile times of functions in the build log.
The main culprits seem to be the `*`, `inverse` and `determinant` functions of `Matrix3x3` and `Matrix4x4` where type inference probably runs amok. Breaking these calculation up into smaller statements should drastically reduce the compile times.
> -David "Expression was too complex to be solved" Turnbull
> swift-users mailing list
> swift-users at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users