WASD to move and arrow keys to look. EQ to fly. Supports triangles, ellipses, and .obj files! Move cursor to left of the screen to change sliders Press R to export the scene (only solid color triangles) Pointerlock variable is for Turbowarp experiment only, ALWAYS HAVE THIS AT ZERO ON SCRATCH!! Because there is no z-clipping, it only renders the 3D triangle if all 3 points are in front of the camera. This both looks cool and can be very annoying. That is why the ground is rendered as a grid of squares instead of 1 square (I needed the ground to show up). Render sky variable options: 0 = don't render sky or ground 1 = render noon sky and ground 2 = render sunset and ground
Use Turbowarp (or your computer will burst into flames): https://experiments.turbowarp.org/pointerlock/1194830900/ or: https://turbowarp.org/1194830900 TEXTURED TRIANGLES IN VERSION 4+! "DS D Si - Mario Kart DS - Standard MR" (https://skfb.ly/6VMzS ) by Creationed2020 is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/ ). Transform point, add 3D triangle, set pen color to RGB, calculate distances, and set p to xyz blocks are by @CodingBio. 3D projection blocks are by @finnagin5. The triangle filler was created by @-Rex-Test- and @Geotale. I looked at @CodingBio's engine to find how to detect points behind camera. @ggenije for the binary insertion sort. FPS counter inspired by the one in https://scratch.mit.edu/projects/422631818 by @Howtomakeausername. The rotation functions used are by . The textured triangle filler is by . made the STTF filler. (not used) I followed 's tutorial for sorting here Big thanks to . CodingBio's tutorials on 3D really helped me learn about 3D, as well as looking at the code in the last demo in part 5 of the series (This helped with putting some blocks in). Backface culling uses matrices as I found here: https://math.stackexchange.com/questions/1324179/how-to-tell-if-3-connected-points-are-connected-clockwise-or-counter-clockwise The culling is run after the triangle is projected to the screen. Do you want to import an obj file? Click see inside, and show the lists "obj data" and "obj.mtl". Next right click and select import. Turn off filters and select files. Import complete! Don't have an mtl file? If the obj does not use the "usemtl" tag, then you can use the "create material" block in place of the "import mtl" block. These are under the block definition "update objects". Changelog: V 5.0 - New textured filler with UVs, and allowed obj loader to load textures (not reliable at the moment, idk if I need to flip UV coords or not, PLEASE LET ME KNOW) V 4.1 - Fixed some issues with file loaders, most notable is obj loader now supports the o tag, allowing model to be cut up in different sections in more advanced software. Also fixed exporter exporting backwards. V 4.0 - Textured triangles! Thank you for the awesome filler! NOTE: Don't go crazy with textured triangles in a scene, because it will run slow with too many (even on Turbowarp), an example is my version of Minecraft. V 3.6 - Moved all objects related stuff to separate sprite, obj loader is a easier to use. V 3.5 - Added wireframe options, sliders are on the left now and only show if your cursor is there. V 3.4 - Added billboards, arranged objects in example scene to better show the engine's capabilities. V 3.3 - Added my collision system (Just here for other people making projects with the engine.) V 3.2 - Added IMPORTING of mtl files. V 3.1.2 - Now .obj exporter exports an mtl file with it, meaning that color is saved too. V 3.1.1 - Fixed issues with exporter exporting faces backwards (Making some programs cull faces incorrectly) V 3.1 - Added scene exporting, press R to export the scene as a wavefront obj file V 3.0 - Added backface culling V 2.2.1 - Adjusted control sensitivity, as suggested by V 2.2 - Readded constantly updating objects, because Scratch seems to be able to run it somewhat fine, and runs great on Turbowarp V 2.1 - Added rotation for the .obj importer V 2.0.1 - Added pointerlock support for a Turbowarp experiment V 2.0 - Coded an obj importer! Had to remove constantly updating objects, as I don't want to load the .obj every frame. V 1.4 - Added ellipses! The engine now supports ellipses, but they look weird from some angles. The ellipse filler is shared on my test account V 1.3 - Added constantly updating objects, made ground as an example of how this can be used. The ground only shows if you are rendering sky. V 1.2.1 - Refined sunset skybox. V 1.2 - Sorting now works! Turns out I was using the wrong variable in the calculate distances block. V 1.1 - Tried to add sorting from 's fourth tutorial, but it doesn't seem to be working at the moment. Added skybox. V 1.0 - First version, working but needs z-clipping and sorting.