CONTROLS: Camera Rotation - mouse Model switch - arrow-like buttons LAGS: You can use turbowarp to speed-up rendering: https://turbowarp.org/879581114?hqpen&fps=60&turbo (but even with turbowarp last few scenes may lag) MODEL LOADING: You can (potentially) add own model. Models stored in all_models list. Triangles&data inside them in semicolon-separated format. Order of inner data: x1 y1 z1 x2 y2 z2 x3 y3 z3 color. how color stored - check code (block Color From RGBA) verticies order important (for front side should be counter clockwise - backface culling enabled) So to add new model you need convert them to this format (don't forget scale) and add to list HOW IT WORKS: 1. construct camera transform. in this case - just a rotation (pitch | yaw | roll) 2. transform (project) all triangles from world-space to camera space 3. perform z-distance culling & backface culling 4. z-sort all triangles (sorting for triangle origin location) z-sorting implementing as inserting into list, not a full list sorting (idk why but it works faster) 5. display all triangles (nearest - last) TODO LIST: 1) improve triangle rasterization perf. 2) fix z-distance culling issues 3) use matrix for perspective projection 4) measure z-sorting performance for different sort approaches and choose best 5) do something with semi-transparent rendering? (looks strange now)
Models from: Pot Plant https://poly.pizza/m/OXA1phQZgL Houseplant https://poly.pizza/m/bfLOqIV5uP Jet https://poly.pizza/m/3B3Pa6BHXn1 Hot air balloon https://poly.pizza/m/7Fej0Jd3_Di Stag Statue https://poly.pizza/m/cKloIsNcT8 Camping Stuff https://poly.pizza/m/3GSiSGRuyfT William Tell's Lucky Shot https://poly.pizza/m/d108q13t5g5 Riverbank Section https://poly.pizza/m/bGdIabKXOAB NOTE: some models lost original colors because them stored into textures (not in materials)