3D Rendering Framework
Credit to @Jamonhyperturbopro and @DadOfMrLog for the tri-filler
Mouse to look around, WASD to move
Try in phosphorus (not a whole lot faster though): http://phosphorus.github.io/#44784782
This is 3D rendering framework for those who are too lazy to make one themselves. Using it is simple:
1) Call Initialize Renderer (3D scale) (fov in degrees)
2) Call Start Frame (camera x) (camera y) (camera z) (camera x rotation) (camera y rotation) // rotation is buggy
3) Call Queue [list v] at (x) (y) (z) // currently model rotation is unimplemented
4) Call End Frame and Render
- Depth sorting is not exactly working completely. Average-z doesn't account for all cases
- Rendering is slow
- Cam rotation is buggy
- Model rotation is unimplemented
When you queue a list, the list must have triangles in the format
xn, yn, zn are coordinates (-Inf to Inf); r, g, b is the triangle color (0 to 255).
If you want to convert Wavefront .OBJ/.MTL files to use with Scratch, you can use my program: https://drive.google.com/file/d/0B0GB5mhVFSzNOUVtSGp5TkFyek0/view?usp=sharing
Use it with java -jar model2scratch.jar <obj file> [-m <mtl file>] <outputfile.txt>
Then import the txt into a Scratch list
I hope this helps someone. Feel free to remix and optimize!
I might be using this for an upcoming game...