I had a go at writing a 3D engine using the Silica emulator, though it is far from perfect:
As you can see there are several glitches with rendering. It does however implement depth testing, so you don't need to sort triangles before drawing. The weird colours are due to the fact that I tried to implement colour blending, which looks much better in Love:
I've also tried to massively optimise it, but it still runs like a snail in CC (but is fine in Love which is even odder). If you want to have a look through the source, it
lives on GitHub but is kinda ugly in places. It uses quite a lot of code generation - the matrix, buffer and graphics library are generated by the build file. This should mean the matrix library is slightly quicker, and also means I can generate triangle rendering code that blends z values, colours or whatever you specify - it would be easy to generate a triangle drawer using texture coordinates instead. This also means I can provide triangles with and without colour blending to speed up triangle rasterisation a bit more. This isn't really a "serious" project though, more of a way for me to learn the basics about 3D graphics.
That being said, I'm happy for people to take this and improve it - it is still pretty buggy. Also alpha blending is a thing, though I see no point of it in CC (also it is very buggy due to overlapping triangles - though I'm not sure where all of those lines have come from).
Update:
A couple of minor optimisations later and this can render a spinning cube at about 30fps - though this isn't really practical for anything advanced. Blitting to the screen is still the slowest part of this: drawing to the buffer (and calculating matricies, etc... ) takes 0.00065 seconds, compared with 0.02793 to draw to the screen.
For those interested, you can see a
video here.
I don't know why it looks so jumpy - my calculations show it is running at 30fps, but it doesn't look like it is. There is also a
pastebin here if people fancy a play (the code is really ugly - see above). I guess my next goal will be to get some sort of maze game working.
Another update:
I messed up some stuff and so started the next-frame timer after rendering not before hand, and so ended up running at 15fps instead (though seeing as CC's refresh rate is 20fps it doesn't really matter).
Edited by SquidDev, 14 November 2015 - 04:34 PM.