--- "@arcadekit/three": minor --- A new package: draws an arcadekit game with Three.js. - It draws from arcadekit's own components for where a thing is, `arcadekit/Transform3d` and, for a flat game, `arcadekit/Transform2d`, in the plane of x and y, and has none of its own: the plugins that hold a game's rules, a server and a replay import nothing of this package and install no renderer. - `Three.instances(name, { of, geometry, material })` draws every entity of a kind, where its `Transform3d.Position` says and turned and sized by its `Transform3d.Rotation` and `Transform3d.Scale`, as one instance of one mesh: a system of the frame stage that reads the columns raw and writes one matrix per entity straight into the mesh's buffer. Nothing is allocated per entity per frame: ten thousand moving objects cost about 0.1 to 0.4 ms a frame before Three.js takes over. A `Rotation` of any length is drawn as the turn it stands for, neither skewed nor sized by it. - With `color: Paint`, a component of the game's with the fields `r`, `g` and `b`, each instance is drawn in a colour of its own, read from the columns in the same pass, for about 6 ns more per entity. The package defines no such component: a colour is the game's to say, as a place is. Its numbers are a hex code's, `0xff / 255` in fields of floats or the bytes themselves in fields of whole numbers, converted for the renderer through a table; one that is out of range fails the frame with the entity's name. `colorSpace: "srgb-linear"` hands over the renderer's own numbers as they are. - `Three.objects(name, { of, make, free })` keeps one Object3D per entity, made when the entity first matches and let go when it no longer does, and copies the entity's place into it each frame. - A look that is made of a level's assets: `Three.instances(name, { of, from: Forest, look: ({ bark }) => ({ geometry, material }), free })` draws its entities while the app holds the bundle loaded, in a look made of it once each time it is loaded and handed to `free` when it is let go; `Three.objects(name, { of, from: Forest, make: (entity, assets) => ... })` makes its objects of them the same way. Nothing is drawn with assets that were let go, whatever order the systems run in. `Three.texture(url, { prepare, flipY })` is the asset that is a texture, disposed of with the scope it was loaded in. Which way up it is, is said with `flipY` where it is made: set in `prepare`, which Three.js would not read, it fails the load with an error that says so. - With `smooth: true`, either draws each entity between its last two places, at `Frame.alpha` of the way from where it was a tick ago to where it is, so that a game whose ticks and frames do not line up moves evenly, a tick behind. `snap` is how far an entity may go in a tick and still be drawn on the way. What it keeps is the renderer's own, never the world's. - `Three.plugin` gives an app a scene and a camera, `Three.Scene`, and draws them once per frame with `Three.Render`, through `Three.Renderer`, which comes from outside: `Three.layerWebGL({ canvas })` in a page, fitted to the size the canvas has there, or `Three.layerRenderer(make)` for a renderer of your own. - Models: `Gltf.model(url)`, from `@arcadekit/three/Gltf`, is the asset that is a glTF file, `.glb` or `.gltf`. The buffers and pictures a `.gltf` names are fetched through `Assets.Loader` and handed to Three.js with it, and its geometries, materials and textures are disposed of with the scope it was loaded in. `Gltf.mesh(model, name)` is one of its meshes, for a look. It is a module of its own, so that a game with no models does not carry the loader. - `Three.Render` is in the stage after a frame's own, `"postFrame"`: everything that draws, and a system that moves the camera, has run when it does, with nothing said about order. - All of it runs in the frame stage and reads the world: a game that is drawn has the same hash, log and save as one that is not. - What it knows an entity by is its whole id, which is past what 32 bits hold once the entity's slot has been given out 1,024 times: such an entity keeps its object and its place between two ticks. Nothing breaks: the package is new. It needs `arcadekit`, `effect` and `three` as peers.