Advanced Features
The Scene System
A retained-mode layer over Mako3D's immediate-mode primitives. Instead of hand-writing a draw call per object per frame, spawn objects once and mutate them by handle.
New to coding?
Copy the examples exactly first. Run them. Then change one number or word and run them again. You are not expected to memorize the command lists.
Spawning objects
h = Mako3D.spawn_cube(0, 1, 0, 2, 2, 2, Mako3D.RED);
Mako3D.spawn_sphere(5, 1, 0, 1.5, Mako3D.BLUE);
Mako3D.spawn_cylinder(-5, 0, 0, 0.8, 0.8, 2, Mako3D.GREEN);
Mako3D.spawn_plane(0, 0, 0, 20, 20, Mako3D.DARKGRAY);Mutating by handle
Mako3D.set_object_pos(h, x, y, z);
Mako3D.set_object_color(h, Mako3D.GOLD);
Mako3D.set_object_rotation(h, angle_deg); // Y-axis, v1
Mako3D.set_object_name(h, "player");
Mako3D.remove_object(h);Drawing everything at once
while Mako3D.running() {
Mako3D.begin_3d(cam);
Mako3D.draw_scene(); // every spawned, visible object — one call
Mako3D.end_3d();
}Add a skybox
Use one 4×3 cross-layout image to surround the camera with a sky. Load it once, then draw it first inside the 3D pass.
skybox = Mako3D.create_skybox("Images/Skybox.png");
Mako3D.begin_3d(cam);
Mako3D.draw_skybox(skybox); # Draw the sky behind the world
Mako3D.draw_scene();
Mako3D.end_3d();The path is resolved relative to the running script. Missing files use a fallback sky instead of crashing.
Reading state back
object_info() is the read side of every set_object_* call — the basis of a live inspector panel.
info = Mako3D.object_info(h);
info["shape"]; info["x"]; info["color"]; info["name"];Click-to-select (picking)
Casts a ray from the camera through the mouse and returns whatever it hits.
if Inputs.mouse_pressed("left") {
selected = Mako3D.pick_object(cam);
}Mesh edit mode
A Blender-inspired step deeper than whole-object selection: inspect an object's actual vertices, edges, and faces.
info = Mako3D.mesh_info(h); // {vertex_count, edge_count, face_count}
Mako3D.draw_vertices(h, Mako3D.YELLOW, 0.06);
Mako3D.draw_edges(h, Mako3D.YELLOW);
vi = Mako3D.pick_vertex(cam, h); // nearest vertex to the mouseSave & load a scene
The whole spawned scene round-trips through JSON.
Mako3D.save_scene("scene.json");
Mako3D.load_scene("scene.json"); // clears and respawns everything