/Simple3DSwift

A simple 3D world rendered in ~200 lines of Swift code (no 3D/graphics libraries)

Primary LanguageSwift

Simple 3D Swift

Simple3DSwiftDemo

A quick experiment in minimalist Swift coding and 3D math.

The Goal

To create an interactive 3D wireframe world using minimal Swift code and no 3D or graphics libraries (AppKit is used for keyboard event handling and basic drawing).

Result

The 3D world is composed, rendered, and animated in about 200 lines of Swift (code here), which includes geometry, event handling, and animation.

Discussion

This code could be condensed further, and could certainly be improved in many ways (this is by no means a practical or robust 3D engine). Mostly this was an experiment to see if I could reduce the math for a basic 3D renderer down to the barest essentials.

Author

Matt Reagan - Website: http://sound-of-silence.com/ - Twitter: @hmblebee

License

Source code and related resources are Copyright (C) Matthew Reagan 2019. The source code is released under the MIT License.