GameAPI Builder — script_ml Handle & Function Reference
1. Handle Types
| Handle | Represents / Points To | Notes / Usage |
|---|---|---|
| ML | MainLoopItem object | Node in the main loop. Returned by creation or rendering functions. Can be attached to MN via move_ml. |
| MN | Move Node (scene transform) | Live transform for single-object placement. Used with move_ml. |
| TF | TinyGLTF resource | Raw GLTF model data (nodes, meshes, animations). Can be decimated (TF→TF). |
| P | Polygon mesh | Geometry data. Combinable via p_or_elem or p_or_array. Renderable via MT → ML. Can be decimated (P→P). |
| MT | Material / render interface | Encapsulates material/shader state. Supports single-object (m_bind) and instanced rendering (m_bind_inst). |
| PTS | Points array | Positions for instanced rendering. Used with m_bind_inst. |
| MS | Matrices array | Transform matrices for instanced rendering. Used with m_bind_inst. |
| O | Volume object | Volumetric data (density, signed distance field). Non-renderable. |
| VX | Voxel object | Renderable voxel mesh derived from volume (O). Can be passed to m_bind or m_bind_inst. |
2. Core Functions
| Function | Signature | Description / Notes |
|---|---|---|
| move_ml | (ML node, MN transform) -> ML | Attaches a main-loop node to a scene transform. Returns updated ML node. |
| m_bind | (P or VX, MT) -> ML | Binds a single polygon or voxel mesh to a material, producing an ML node. |
| m_bind_inst | (P or VX, PTS or MS, MT) -> ML | Binds a mesh to a material for instanced rendering. Positions or matrices define per-instance transforms. |
| p_or_elem | (P, P) -> P | Combines two polygon meshes into one. Used for precalc/mesh preparation. |
| p_or_array | ([P]) -> P | Combines multiple polygon meshes into a single mesh. |
| volume_to_voxels | (O) -> VX | Converts a volumetric object into a renderable voxel mesh (VX). |
| ml_gltf_all | (TF) -> ML | Converts entire GLTF resource into a main-loop node representing the full scene. |
| ml_gltf_all_inst | (TF, PTS or MS) -> ML | Instanced GLTF render: creates multiple scene instances from a GLTF resource. |
| ml_gltf_all_lod | (TF, float[] distances) -> ML | GLTF LOD render: creates an ML node with automatic level-of-detail switching. |
| decimate (TF) | (TF, float ratio) -> TF | Reduces detail of a GLTF resource. ratio ∈ [0..1]. |
| decimate (P) | (P, float ratio) -> P | Reduces polygon count of a mesh. ratio ∈ [0..1]. |
Kommentit
Lähetä kommentti