# 0.4.0

## Summary

- Folder cleanup: moved the grown-up features that were in src/experimental (3D, toon 3D, animation, collections and more) to the same folders as the Rust vanilla-engine. Games that use import.js keep working as is, and games that imported files directly by path switch to the new paths.
- From games into the engine: general-purpose features that the shipped games (webgame-rimminer, aberrant, steamgame-apocalypsesurvival, space-creature, retrogame-foundyou) had built separately are now part of the engine. These include window stacking (UIWindowLayer, UIWindow, UIConfirmWindow), loading, saving and time (AssetLoader, LoadingProgress, LocalStorage, PersistedStore, FixedStepper), input actions (InputActions), the sound table (SoundSystem), language packs and fonts (LanguagePack, UIFont), button and toast motion (ButtonMotion, ToastMotion) and the mouse cursor (PointerCursor).
- Toon 3D: rebuilt toon shading and the screen-space outline (ToonScreenOutline) in the standard form of real-time toon rendering. Toon effects (ToonVfx), HDR finishing (ToonPostProcess) and the shadow atlas (ShadowAtlas) are also in.
- Rendering: sprite batching and off-screen culling are on by default. Graphic used directly outside the engine loop is also drawn when that task ends, because the engine draws the remaining batch (the same as a 2D canvas). Call flushBatch() first only when inserting a pass that touches WebGL directly.
- Matching the Rust version: brought in the general-purpose features that only the Rust version had so the public APIs of the two engines match, and fixed the bugs the two engines shared in both.
- UI: UIInputField handles word movement, word deletion and word boundaries like Chrome, and supports multiline input like a Chrome textarea (setMultiline) and engine undo and redo. UIDocument writes registered names so a minified bundle gives the same document, and registerEditorTypes() registers the UI editor's types in one call.
- Scene and Engine: widgets on nodes receive touches whatever the scene type. The view transform is applied before each scene draws, which fixes scenes that directly extend Scene drawing only in the top-left quarter of the canvas on screens with a device pixel ratio of 2.
- Docs: the data the site builds each version's documentation from (the public API docs/api/0.4.0.json, the guide docs/guide/0.4.0) and the tool that extracts it, tools/apidoc.cjs.
- Performance and stability: a lost WebGL context is restored, a shader build failure is reported to the game, and toon body shader feature variants with prewarming (combination lists, hand off and draw with the default body), framebuffer clears, a GL state cache and the glyph atlas cut frames on real devices (Safari on iPhone and iPad). GPU memory tracking is off by default.
- Migration: where the public API or its usage changed, everything a game has to change is collected in the 'How to migrate' section at the end. (Scene touch, FbxLoader names, scene draw coordinates, Singleton, Color, JsonAsset.load, List and Dictionary callbacks, ToonScreenOutline, toon shading, isVisible, ToonVfx position, image path, Scene background, viewScaleMode default)


## New features and changes

- WebGL context lost handling (the standard: the webglcontextlost and webglcontextrestored handling of Unity and browser games): when the context is lost the engine accepts the restore with preventDefault, does not draw while lost (it only updates scenes, and the exceptions thrown every frame from GL returning null no longer pile up), reports once through the engine error path (console.error), and passes lost to the listeners. When it comes back the engine rebuilds the base resources it made (the default shader program, vertex array, white texture, batching, particles, blend shaders, image textures, glyph atlases), resumes drawing and passes restored. Added: Engine.addGraphicContextEventListener, removeGraphicContextEventListener, dispatchGraphicContextEvent, the enum GraphicContextEvent (lost, restored), Graphic.isContextLost(). GL objects the game made (its own shader programs, render targets, ToonRenderer and its meshes, shadow maps) belong to the lost context and the engine cannot rebuild them, so the game rebuilds them on restored. Before, the engine did not call preventDefault, so it could not come back, and it threw an exception every frame
- Shader build failure notification (the standard: the same shape as Unity's shader compile error reporting): when the engine cannot build a shader program (a ToonRenderer material, a ScreenEffect pass, a Graphic.resolveShaderProgram program, the ToonView3D renderer) it reports { kind, name, error } once to the graphic error listeners, in addition to the engine error path (console.error). Added: Engine.addGraphicErrorListener, removeGraphicErrorListener, dispatchGraphicError, the enum GraphicErrorKind (shaderBuildFailed). A program that failed to build is still not rebuilt and is skipped when drawing, as before. A failure after the context was already lost (gl.isContextLost()) is not the shader's fault, so it is neither reported nor remembered, and the program is rebuilt after the context comes back (before, a null was remembered here and that material was never drawn again even after the restore)
- GPU memory tracking (like the Unity Profiler memory module, see the GPU memory that textures, renderbuffers and buffers use): added Graphic.readGpuMemoryUsage(), Engine.readGpuMemoryUsage() and the class GpuMemoryTracker (attach a context made outside the engine with GpuMemoryTracker.attach). It intercepts texImage2D, texStorage2D, generateMipmap, renderbufferStorage(Multisample), bufferData and the delete functions on the context, records bytes per object, and returns { totalBytes, canvasBytes, kindTable (count and bytes per texture, renderbuffer, buffer), ownerList (per owner, largest first) }. The owner is the top three frames of the call stack that created the object. Bytes are nominal values computed from format and size (multisample is multiplied by the sample count, the canvas multisample is assumed to be 4, driver alignment is unknown). It is for development and the picture is unchanged. It is off by default (zero per-frame CPU, and the GL create calls stay the browser's native functions). To turn it on, set EngineConfiguration.trackGpuMemory = true (counts the resources the engine creates first), or call Engine.enableGpuMemoryTracking() or Graphic.enableGpuMemoryTracking() later (counts what is created afterwards); attach a context made outside the engine with GpuMemoryTracker.attach. isGpuMemoryTrackingEnabled() tells whether it is on, and readGpuMemoryUsage() turns it on when it is off and counts what is created after that
- Toon body shader feature variants (the standard way, like Unity shader keyword variants: unused branches are removed from the program, picture unchanged): the renderer looks at what a draw uses (base, emissive, decal, matcap and angel ring textures, and from the light set a ramp texture, two or more shade stops, the two rim lights, light intensity limit) and builds the body fragment shader for those feature bits. Code of unused branches is gone at compile time, so each pixel costs less (iPhone SE2 frame interval of the miner game with outline and shadow off: 28.6-31.6 ms before vs 24.7-25.3 ms, and with the point light also off 24.5-25.5 vs 21.9-22.6 ms, the all-on version is the same). A variant is built the first time it is drawn (one frame may hitch then; ToonRenderer.prepareMaterial only prebuilds the default program) and the number of variants is the number of used bit combinations. The default program keeps every branch on. There is nothing for games to do and no API change. composeToonProgramSources gained a trailing parameter disabledFeatures (default none)
- Canvas antialias advice for games that use a post process (docs only, behavior unchanged): ToonPostProcess draws into its own MSAA target, so a game that uses it builds with EngineConfiguration.antialias set to false. With true, the canvas itself is MSAA, so the pass that copies to the screen and the UI blend per sample and cost more (Mac mini, 2560x1440 toon post process scene, GPU throughput 6.89 → 6.49 ms, with it off 6.81 → 5.22 ms)
- GPU throughput measurement (viewing the time the GPU spends drawing separately, like the GPU module of the Unity Profiler or Unreal's stat gpu): added Engine.measureGpuThroughput(frameCount = 120). It draws the current scene repeatedly without scene updates (tick) through the same drawing path as an engine frame (the same function split out of the engine loop's scene drawing), waits for the GPU with a 1-pixel readPixels, and returns the wall-clock time per frame ({ frameCount, chunkFrameCount, millisecondsPerFrame, chunkMillisecondsPerFrame }). It is the share of the slowest stage among the renderer, the GPU process and GPU execution, so when the GPU is the slowest it is the time the GPU actually spends drawing. The GPU process main thread time in a Chrome trace is CPU time for decoding commands, so it barely moves even when the amount the GPU draws changes (1.98 and 1.99 ms with the outline on and off in the lobby-like scene). From the next rAF, after 10 warm-up frames it draws one chunk of 30 frames per rAF so it does not block for long at once; while measuring, engine time, input, engine frame callbacks, the frame number, canvas resizing and capture stand still, and when it finishes the engine loop continues. Because the same state is drawn repeatedly, caches such as onChange shadows do not rebake. Added --throughput [frame count 120] to the measuring tool tools/perftrace.mjs, which calls this function through the page's global engine after the trace and prints a '(6) GPU throughput' row (same for --attach and measureAttached(page, { throughput: 120 }); 'unknown' if there is no engine or the engine version lacks this function). On a Mac mini M2 Pro in headless Chrome at 1280x720, tests/graphics3d/toonlobbyengine.html, which runs the lobby-like scene in the engine loop (ToonPostProcess RGBA16F, MSAA 4, five bloom levels), has a throughput of 3.15 ms, and 1.58 ms with the outline off (?outline=0). The toonpost example is 1.17 ms, toonshowcase 0.92 ms and panelayout 0.24 ms. (tests/core/gputhroughputchrome.test.mjs)
- 3D color space setting (the same shape as Color Space: Gamma/Linear in Unity's Player Settings): add EngineConfiguration.colorSpace and the enum ColorSpace (gamma, linear). The default is gamma, and the screen is byte-identical to before. With linear, toon 3D draws on the standard linear path. ToonRenderer.createTexture uploads color textures (base color, glow, decal, matcap, angel ring, ramp) as SRGB8_ALPHA8 so the GPU decodes them to linear (filtering and mipmaps in linear space), the shader no longer applies pow 2.2 to those textures, and passed colors (vertex color, tint, glow color, decal color, outline color) are converted to linear with the sRGB standard curve (IEC 61966-2-1) before multiplying and mixing (base color x tint, tintAmount mixing, decal). Screen output, ToonPostProcess after tone mapping, the hull outline and ToonScreenOutline line color in HDR, and the GLB base color (baseColorFactor to the sRGB vertex color) use the same curve. Data textures such as normals and masks are uploaded as is to RGBA8 with isColorData: false of createTexture (not distinguished in gamma). With linear, #define VANILLA_COLOR_SPACE_LINEAR 1 is added to the 3D shaders the engine builds, and material chunks get toSurfaceColor(vec3), which converts an sRGB color to the space of ToonSurface.baseColor. ToonRenderer, ToonPostProcess and ToonScreenOutline take options.colorSpace (default is the engine's value, gamma without an engine) and report it with getColorSpace. composeToonProgramSources, ToonRenderer.readProgramSources, ToonScreenOutline.readProgramSources, readGlbArrays and readGlbNodeArrays take a last colorSpace argument. Add Engine.getColorSpace and Graphic.getColorSpace. 2D (Graphic's 2D batch, text, UI) composites in gamma space either way. The five toon examples and the two measurement scenes are byte-identical to before in gamma, and in linear byte-identical to the branch that switched everything to sRGB (jstoonsrgb). (tests/graphics3d/tooncolorspacechrome.test.mjs)
- Toon uniform block buffers are no longer created per value or deleted all at once (a buffer pool that never modifies a buffer still in use): the frame block (ToonFrame) used to create a new GPU buffer whenever its values changed. It now reuses the buffers it has made. A buffer holding the same values is bound as is (no upload), and new values are written with bufferSubData into a buffer unused for eight beginFrame calls (a buffer the GPU may still read is never modified, a new one is created when none is free). Static scenes issue the same GL calls as before. (Selecting slots of one buffer with bindBufferRange was also measured and raised the GPU process median in the static lobby and miner scenes, so each buffer holds one block) Material and outline blocks used to delete the whole cache and forget the option entries when the cache limit (1024) was reached. They now evict one least recently used block (clock algorithm) and write the new values into its buffer (an entry holding an evicted block resolves its values again on the next draw). With a moving camera the old code created one buffer per changed pass and deleted all 1024 in one frame when the cache filled (about every 500 frames in the lobby scene). That no longer happens. Lobby scene with an orbiting camera (lobbymove, toondrawbench.mjs, 240-frame totals): createBuffer 983 -> 521 (507 of them building the scene, the old code also piles 1024 deleteBuffer calls into one frame at about frame 512). Room scene with an orbiting camera (roommove): 642 -> 180 (167 of them building the scene). The four static scenes (lobby, room, roomitem, miner) issue the same GL calls except three bufferSubData calls when a frame block is first written. GPU process main thread (tools/perftrace.mjs 10 s, two runs alternating with the old code, headless Chrome, Mac mini, 960x540): lobbymove median 1.70, 1.95 -> 1.27, 1.70 ms, p95 2.94, 3.77 -> 1.84, 3.04 ms, max 6.73, 6.44 -> 2.94, 3.84 ms, roommove median 1.27, 1.19 -> 1.03, 1.20 ms, max 6.92, 7.95 -> 2.19, 3.92 ms, frames over 5 ms in 600 frames lobbymove 1, 3 -> 0, 0, roommove 1, 1 -> 0, 0, static lobby median 1.62, 1.66 -> 1.61, 1.70 ms (unchanged). All six scenes (lobby, lobbymove, room, roomitem, roommove, miner) render the same bytes. (tests/graphics3d/toonuniformblockchrome.test.mjs, lobbymove, roommove and the 240-frame totals in toondrawbench.mjs, toonscenepage.html)
- Thin-line path for the toon screen outline (the same shape as Unity URP screen-space outlines, sampling the neighbours inside the width radius at once): up to a width of about 3.24 pixels (2 x sqrt(4.5) - 1), ToonScreenOutline skips jump flooding (seed, gather and three expand passes). It picks a target holding the first edge side of the contour and crease lines per pixel in the same order as the seed pass (one R8UI byte), and the composite looks at the seeds of the surrounding 3 x 3 pixels in the same order as the last jump flooding step (nine reads, branch-free selection) to take the coverage from the distance to the nearest one. All widths used by the Miner game (1.7 to 2.7 pixels) take this path. The full-screen passes after the line target go from six (seed, gather, three expands, composite) to two (mask, composite), and the targets written per pixel go from three RGBA16UI (24 bytes) to one R8UI (1 byte). Thick lines and the line color table keep the current path, and the seed and expand targets are built the first time a thick line is drawn (never when only thin lines are used). Passes that overwrite a whole target (mask, seed, gather, expand, coverage) clear the target first (clearBufferuiv, clearBufferfv) so tile GPUs do not load the old contents. invalidateFramebuffer is not used: on iPad mini 6 and iPhone SE2 Safari it added about 10 to 25 ms per frame when called on these targets (iPad, miner values, scale 0.75: outline share 31.7 down to about 5.5 ms, SE2 12.4 down to 1.6 ms, measured by drawing the same frame back to back). Clearing does not add that cost and the image is the same. Line positions and widths are the same (where two IDs with different line colors meet, the order of picking among segments at the same distance differs, so only the color of a few pixels changes). readProgramSources returns seven (the thin-line mask and thin-line composite are added at the end). getLineTarget gains edgeMaskTexture and outlinePath, and seedTexture and jumpFloodTextures are empty until a thick line is drawn. For the same reason, ambient occlusion (the three passes of ToonPostProcess.drawAmbientOcclusion) and bloom (BloomEffect bright pass and blur, MultiLevelBloomEffect extract and downsample, not the upsample that adds to the level above) also clear the target before passes that overwrite a whole target (the image is the same).
- Sound streaming load (the same shape as Unity AudioClip's Load Type, Unreal sound wave streaming, and on the web an HTMLMediaElement connected into the graph with a MediaElementAudioSourceNode): added the load type AudioLoadType (automatic, decompressOnLoad, streaming) and setLoadType, getLoadType, isStreaming, getStreamUrl to AudioAsset. Until now every sound was fully decoded to PCM with decodeAudioData, so one 3 minute stereo background track held about 61 MiB (float32). Streaming lets a media element decode the compressed file bit by bit, and AudioPlayer connects one media element per player to the same GainNode. Play, stop, loop, volume, mute, rate (pitch changes too), position (getTime, setTime) and end (isPlaying turns false) behave the same as a fully decoded sound, and when the audio context stops (hidden tab, mute) the media element pauses too and then resumes. The AudioAsset default stays fully decompressing (decompressOnLoad, the same as the Unity AudioClip Load Type default), and only assets that choose automatic stream files larger than 1 MiB (AUTOMATIC_STREAMING_BYTE_THRESHOLD) (it checks the Content-Length header first and does not download the body). The engine SoundSystem sound table takes a loadType field, and without it background music (isMusic) uses streaming and sound effects use decompressOnLoad. Code that uses AudioAsset directly calls setLoadType to stream. Checked on real devices (iPhone SE 2 and iPad mini 6, iOS 27.2.1): sound plays after the first tap (RMS 0.07 to 0.14), media element play() was rejected 0 of 62 times, playback resumes after the tab is hidden and shown again, looping works, and loading took 137 ms on the SE 2 against 8,618 ms for full decoding. Measured with a 3 minute 128 kbps MP3 in headless Chrome on Mac: full decoding took 169 ms to load and +154 MB of Chrome process memory, streaming took 7 ms to load (metadata only) and +11 MB (+29 MB while playing), and sound started within 5 ms in both.
- Three UIInputField IME fixes (DOM input, single and multi line): composing with a selection now shows [text before the selection, composition, text after the selection] (getDisplayText, drawing, caret and underline position; it used to keep the selection and insert at the old cursor). On compositionstart, if the DOM selection differs from the engine selection (moved or selected by keys before the tick synced it) the engine selection is synced and the undo group is cut (same as beforeinput; the committed text used to join the previous typing group so Cmd + Z skipped the value before the replacement). setText during composition clears the composing state and composition text (it used to stay stuck composing with the engine value out of sync with the DOM input).
- Bone pose hook (the same shape as Unreal AnimBP's Transform (Modify) Bone and bone overrides in Unity's LateUpdate): added a seventh argument poseAdjust to writeSkinPose. After the animation is sampled and blended, and before the skin matrices are built, it modifies each bone's local transform (translation, rotation, scale). A function is called with (locals, skeleton) and makes the changes (the arrays in locals belong to that call only, so modifying them in place does not change the skeleton's rest pose), and an array is applied as a per-bone modification table ({ nodeIndex or name, translation, rotation, scale, mode, weight }). Added adjustBones(locals, skeleton, modifiers), which applies the table, and the modification mode BoneModifyMode (add adds translation in parent space, multiplies rotation after in the bone's own space and multiplies scale, replace sets the given value). weight is the ratio between before and after the modification. Without a hook the result is bit-for-bit the same as before, and modifying one bone changes only that bone and the bones below it.
- 3D camera shake (the shape of Unity Cinemachine Impulse and Unreal Camera Shake): added CameraShake. Each shake from add(options) takes the strength of 3 position axes and 3 rotation axes (pitch, yaw, roll) (amplitude, rotationAmplitude, per-axis shares positionAxes, rotationAxes), frequency (frequency, default 10), duration (duration), attack (attack), decay ((1 - age / duration) to the power decayExponent, default 2), age (age, an event seen late added with that age continues with the same values as if added from the start, negative starts later) and seed (seed). The signal is two sine waves with slightly different frequencies per axis, live shakes are summed, and the same seed gives the same values. It has update(seconds), read() ({ position, rotation } in camera local axes), isShaking and clear. As places to apply it, added Camera3D.setViewOffset(position, rotation) (an offset in camera local axes applied last to the view matrix, on both the computed path and raw matrices, getEyePosition is the value before the offset) and createOffsetViewMatrix(viewMatrix, position, rotation), which applies it to a view matrix the game computed. ToonVfx's 2D shake (addShake, readShake) and Shaker are unchanged.
- glTF quantized mesh reading (KHR_mesh_quantization): the toon GLB readers (readGlbArrays, readGlbNodeArrays, readGlbNodeInfos) and SkinnedModel read GLB files whose vertex attributes are stored as integers. Normalized integers are divided with the glTF spec formulas (signed ones as max(c / 127, -1), max(c / 32767, -1)) and non-normalized integers are read as is. Position dequantization comes from the node transform or inverseBindMatrices, and texture coordinates get the material texture's KHR_texture_transform baked in. Normalized integer rotations in animations are read too. An unnamed mesh node belongs to the part of its named parent node (the leaf node a quantizer adds for the dequantization transform). If extensionsRequired lists an extension the reader cannot read (EXT_meshopt_compression, KHR_draco_mesh_compression and others), it throws a clear error. The Rim Miner mining ship model with gltfpack's default quantization (no compression) goes from 1.78 MB to 1.15 MB as a file and from 1.06 MB to 0.58 MB zipped. (tests/graphics3d/meshquantization.test.mjs)
- glTF primitives without normals (glTF 2.0 specification 'Using Primitive Data': without normals the primitive has flat normals and tangents are ignored): the toon GLB readers (readGlbArrays, readGlbNodeArrays) used to skip primitives without normals, so the example fox (fox.glb) drew nothing. Now vertices are split per triangle in index order, and each triangle's (p1 - p0) x (p2 - p0) scaled to length 1 is given to its three corners (0 for a triangle with zero area). The outline shell rebuilt from the body also includes those primitives. SkinnedModel used to build smooth normals at upload when normals were missing (for an indexed mesh, face normals summed and averaged per vertex), which differed from the specification. Now interpretContent splits the vertices with the same math and gives flat normals, and indices is null (positions, texture coordinates, joints, weights and morph deltas are split too). The mesh builder's normal lengths (normals in addPart, addTriangles, addTriangleShell and the sum in the outline push) are computed as sqrt(x * x + y * y + z * z) like the Rust version, so even the shell values at points where normals cancel on a symmetric model are byte-identical to the Rust version. The arrays of GLB files with normals (the examples, the mining ship, the mannequin and their quantized versions) stay byte-identical. (tests/graphics3d/meshquantization.test.mjs, modelreading.test.mjs)
- GameScene loading no longer relies on a hook that can be overridden: the loading time and the loading screen press before the first frame are now taken by an engine frame callback that load registers (a place the engine calls every loading frame), not by drawOnLoad. Fixed load never finishing and initialize never being called, without any error, when a game overrode drawOnLoad without super. (tests/core/gamesceneloadchrome.test.mjs)
- Capture mode determinism (same as the Rust edition): in capture mode (?capture=), the 0.3 second loading screen wait after a scene loads (SceneManager.loadScene's setTimeout 300) and the minimum display time wait of GameScene and UIScene (what setTimeout 50 watched; Date.now in UIScene) are counted every engine frame on the engine clock (1/60 second per frame). The scene is initialized at the head of the frame where the 0.3 seconds are reached (before the scene update) and drawn from that frame, as in the Rust edition. Images are uploaded at once, not split by a time limit. While loading (anything that takes real time, such as downloading assets, up to loadAssets for GameScene and UIScene), the frame number and the clock do not advance, so counting starts once everything has arrived. Capturing the same example twice gives byte-identical images for the same frame number. (tests/core/capturedeterminismchrome.test.mjs)
- Removed the toon 3D namespaces ToonMesh and ToonGlb. The functions and classes of the mesh builder (meshbuilder.js) and the GLB reader (glbmeshreader.js) are exported directly by name (same as the Rust version). In the Rust version ToonMesh is the renderer's mesh (what ToonRenderer creates), so the same name is not reused for another meaning. flushSpriteBatch is removed too.
- Top-level names as the same set as the Rust version: import.js no longer exports the deprecated Camera (Camera2D covers it), SceneManager (internal to the engine, Engine.getSceneManager is hidden too), List, Dictionary, Queue, Stack (use the language Array and Map, the Rust version uses Vec, HashMap, VecDeque) or Singleton. Added Engine.getAllLoadedScenes() (Rust get_all_loaded_scenes). The toon mesh builder and GLB reading functions are exported by name as in the Rust version (MeshBuilder, shape functions such as createBoxGeometry, createPartMatrix, readColorValues, readGlbArrays, readGlbImages, decodeGlbImage, readGlbNodeArrays, readGlbNodeInfos, readAnimationSwing, writeSkinPose). The namespaces ToonMesh and ToonGlb stay as deprecated and are removed in the next version (ToonMesh in the Rust version is the renderer's mesh, so one name does not get two meanings).
- Public features that existed only in the Rust version (same names): ViewManager.limitRenderPixelRatio(devicePixelRatio) (the ratio with the cap applied, used by calculateViewRect), GraphicsQualityGovernor.applyPageQuery(liteKey) (override from the query of the current page URL, same as applySearchText(location.search)), DevTools.inspectNode(node) (shows the panel, switches to the Node Hierarchy tab, expands the ancestors and selects the node), Graphic.measureTextWithFontString(fontString, text) (measures without changing the current font), LocalStorage.setStorageDirectory(storageDirectoryPath) (the save folder of the Rust version on desktop, does nothing in this version because it uses the browser storage).
- UIDocument becomes an instance without global state (same as Rust UIDocument::new): the type tables (components, nodes), the image resolver and the lists that hold node references and images, which were module globals, are held by each document object. new UIDocument() registers the engine's default types, and setImageResolver, resolveImage, serializeNode, deserializeNode, toJsonText, fromJsonText, collectGeneratedComponentTypes, getComponentTypeNames, registerNodeType, registerComponentType, registerEditorTypes, saveByReflection and loadByReflection, which were static, become instance methods. getReflectedProperties, findNodePath and findNodeByPath have no state and stay static. Added under the same names as Rust: loadImages(jsonText) (requests an ImageAsset for each imagePath in the document and returns the list of load promises), bindPendingImages() (sets the pending images and returns how many are still loading, fromJsonText and deserializeNode call it at the end), createComponent(node, typeName) and getNodeTypeName(node). serializeNode and deserializeNode write and connect node references as paths from that node, like Rust. An image that is not found gives a warning. getComponentType, getSerializeRootNode, saveNodeReferences and loadNodeReferences are now private (internal functions Rust does not have). Added UIListView.setTemplateNodeWithDocument(templateNode, uiDocument) (setTemplateNode uses a new document), and Visual.createNode takes a document (same as Rust create_node). UI Editor and Visual Editor each hold one document.
- ToonView3D screen rectangle and output (same as Rust Rect and ToonViewOutput): getScreenRect() returns a Rect (a copy) instead of an { x, y, width, height } object. The draw function becomes (renderer, camera, screenRect, webGL2RenderingContext, output): screenRect is the Rect to draw in, and outputFramebuffer and outputViewport, which rode on the screen rectangle object, move to the fifth argument, an output object ({ outputFramebuffer, outputViewport }).
- Public functions only the original had (same surface as Rust): WorldNode.isComponentDrawCulled, Camera3D.refreshMatrices and LocalStorage.readStorage, used only internally, are now private (Rust does not expose them either; the getters recompute the matrices themselves). UIButton.setStateEvent, which did nothing, is removed. Rust gains WorldNode::copy_content_size_to and ShadowAtlas::get_light_count with the same names.
- Default font (same as Rust default_font_url and the font name "default"): the default of EngineConfiguration.defaultFontUrl changes from the DOSGothic address on jsDelivr to an empty string, so the engine no longer always fetches a font it does not use. When an address is given, that font is added under the font name "default" (before, "DOSGothic"). Text with no font (Text, ShadowText, DynamicFont, buildFontString(null)) uses the engine default font chain DEFAULT_FONT_FAMILY_STRING ('"default", ' followed by SYSTEM_FONT_STRING) instead of the system font chain, so like Rust "32px default" it picks the default font when there is one and the system font otherwise. The statistics overlay also draws with "16px default".
- Baked components keep colours as Color (same as Rust ShadowText, SoftShade, ShadowImage): ShadowText, SoftShade and ShadowImage keep colours as Color instead of a "#rrggbb" string. The setters still take both a Color and a colour string, and copy the Color they get. SoftShade.getColor() returns a Color, ShadowImage.getImageColor() returns a Color or null, and UIDocument writes ShadowImage's ImageColor as an array of four numbers ([r, g, b, a]) like Rust (old documents with a colour string still load). The alpha of ShadowText's text colour is the text opacity. The module function readColorText is now readColor (returns a Color), and buildRGBAString takes a Color.
- Screen fade hold (same as Rust ScreenFadeHold, fade_screen_with_hold): added ScreenFadeHold (release, isReleased) and GameScene.fadeScreenWithHold(onDark). When the screen is fully dark, onDark receives a new hold and the screen stays dark until it is released. fadeScreen's onDark may also return a ScreenFadeHold instead of a Promise to stay dark until release (as Rust fade_screen takes an Option<ScreenFadeHold>). import.js exports ScreenFadeHold.
- No reserved-word names (same names as Rust): neither engine uses a reserved word (use, move, loop, in) as a name. Cooldown.use() is removed in favour of activate() (Rust activate), FullscreenPass.use() and ShaderProgram.use() are useProgram() (Rust use_program), PointerGesture.move(x, y) is movePointer(x, y) (Rust move_pointer), Action.loop(condition, inner) is repeatWhile(condition, inner) (Rust repeat_while), and Tween.easingFunction's in, out, inOut are easeIn, easeOut, easeInOut (Rust ease_in, ease_out, ease_in_out). Easing names in timeline data (such as "quadratic.in") are a data format and stay the same.
- Top-level names aligned (same names as Rust): the developer tools class is renamed from DEVTools to DevTools (same as Rust DevTools). Text antialiasing is a Graphic method in both engines: Graphic.setTextAntialiasEnabled(boolean), isTextAntialiasEnabled() (Rust Graphic::set_text_antialias_enabled, is_text_antialias_enabled). Text antialiasing applies only to that Graphic, and after a change even text already made is drawn in the new form from its next draw (before, it was one value shared by every Graphic and applied only to text baked after the change).
- UIInputField multiline input and undo (same as set_multiline, set_line_height, set_tab_size, get_scroll_top, set_scroll_top, can_undo, can_redo and the TextEditBuffer grouping rules of the Rust edition): with setMultiline(true) it is a multiline input like a Chrome textarea (DOM input uses a hidden textarea). Text is split by line break characters and width like white-space: pre-wrap, overflow-wrap: break-word, and line break opportunities are read from Chrome's own line breaking, giving the same lines as the Rust edition (the same computation as the 30 texts captured from a Chrome 158 textarea). Enter inserts a line (no submit), up and down keep the horizontal position of the first vertical move, and PageUp, PageDown, Home, End (start and end of the visible line), Ctrl (Cmd on Mac) + Home, End (up, down on Mac) and the Mac Home, End, PageUp, PageDown scrolling match the Rust edition. When it overflows it scrolls to keep the caret visible, scrolls with the wheel and by dragging the thumb, and draws a thumb. With classic scrollbars (Windows, Linux, Mac classic setting) the text width shrinks by the scrollbar thickness when it overflows, like a Chrome textarea. Added setLineHeight (null for CSS normal), setTabSize (default 8), getScrollTop and setScrollTop. Undo and redo use an engine history in both canvas mode and DOM input (Ctrl (Cmd on Mac) + Z, Ctrl (Cmd on Mac) + Shift + Z, Ctrl + Y on Windows and Linux, also Alt + Backspace on Windows, consecutively typed characters are one group, moving the cursor breaks the group, paste and cut are separate groups, up to 1000). DOM input blocks the browser undo keys and historyUndo, historyRedo and uses the engine history, so a paste from the context menu can be undone too. It does not undo during IME composition, and committed text joins the preceding insert text group. Added canUndo() and canRedo(). setText clears the lists
- Image decoding and uploading moved to load time (the same shape as Unity and Unreal uploading at load time, and createImageBitmap on the web): when ImageAsset loads, it receives the bytes and decodes them off the main thread with createImageBitmap alongside the image element (Chrome decodes a Blob on a worker thread), and uploads that on the first upload and then closes it. Uploading the image element with texImage2D made Chrome decode it again on the main thread right there, so the first drawn frame of a new screen hitched. SceneManager uploads the loaded images to the GPU during the loading screen after a scene's load finishes, split 2 milliseconds per frame (Unity asyncUploadTimeSlice default) (Graphic.prepareLoadedImages, overlapping the minimum 0.3 second wait). Canvases made in code are uploaded in the scene's load with Graphic.prepareImage. The screen result is unchanged: only formats whose ImageBitmap result is byte-identical to uploading the image element are pre-decoded (8-bit PNGs that have no alpha, no color chunk or only an sRGB chunk, JPEG, WebP without alpha or animation), and the rest (PNGs with alpha and a non-sRGB color profile, 16-bit PNGs, WebP with alpha, GIF, AVIF, SVG) upload the image element at load time. Chrome 158 decodes an ImageBitmap premultiplied and then converts color, while texImage2D decodes unpremultiplied, converts color and then premultiplies, so such images differed by up to 6/255. The first drawn frame of an image-heavy scene (16 PNGs of 1024, 8 JPEGs of 2048, Mac mini M2 Pro headless Chrome 158 ANGLE Metal) went from 336 ms to 1.4 ms.
- Rust-edition shape alignment (eight small items): added Graphic.resolveShaderProgram(groupName, programName, () => [vertexSource, fragmentSource]) (caches by name; if building fails it reports once and caches null, same as the Rust edition resolve_shader_program). ShaderSprite uses it. Added Color.create(red, green, blue, alpha). Animation.setFramesFromRects now accepts canvases, OffscreenCanvas and ImageBitmap as well as HTMLImageElement (before, anything that was not an image was silently ignored). UIInputField now attaches its context menu and input handles through Engine.getEngine() even when setEngine was not called. Removed the em dash from LayoutSolver error messages (same text as the Rust edition LayoutError). Inner functions of UIInputField, ToonRenderer and ToonVfx (attachDOMInput, handleCanvasKeydown, createProgramSet, drawBands and the like) are now @private and left out of the API data. No game called them.
- Capture mode time (same as the Rust VANILLA_CAPTURE_*): capture mode set with the ?capture query advances TimeManager time by 1/60 s per frame instead of real time for deterministic captures (frame number x 1000 / 60 ms, the same arithmetic as the Rust version, so the time at the same frame is bit-identical). Capture mode skips the maximum FPS limit, because the repeated timestamp would keep the limit from passing frames. The draft tilemap addTileset documentation now says that tilesets are assets shared by several maps and must not be modified after adding (the Rust version makes the same promise with Rc<Tileset>)
- Visibility flag (the same as the Rust edition's WorldNode::set_visible, is_visible, NodeTree::is_visible_in_hierarchy): added TransformNode.setVisible(boolean). It is a flag kept separate from active (setActive) and opacity, and when false the node and its descendants are not drawn and do not receive TouchRaycaster presses. (Updates still run) isVisible() now returns only that flag. (Until now it was true when active and opacity above 0) The new isVisibleInHierarchy() is true when this node and all ancestors are active, have the flag set, and have local opacity above 0
- ToonVfx position and defaults (the same as the Rust edition's position: [f32; 3] in ToonParticleOptions, ToonFireballOptions, ToonGlintOptions and alpha default 1 in ToonRibbonOptions, ToonBeamOptions): emitParticles, addFireball, queueGlint take the position as position: [x, y, z] instead of three fields x, y, z. ([0, 0, 0] if omitted) queueRibbon and queueBeam (and queueLightning, which draws with it) use alpha 1 when alpha is omitted. (Until now they drew nothing) The default size of queueGlint is 0.2
- Image path (the same as the Rust edition's set_image_path, get_image_path): added setImagePath(path) and getImagePath() to Sprite, ShadowImage, UIImageView. They only record the path and do not load the image. UIDocument and the visual editor use them instead of the expando component.imagePath they attached to components. The imagePath field in document JSON is unchanged
- Scene background (the same as the Rust edition SceneBase's set_scene_background_color, get_scene_background_color, draw_scene_background): setSceneBackgroundColor(a Color or color text), getSceneBackgroundColor(), drawSceneBackground(graphic) moved from GameScene and UIScene to Scene. GameScene and UIScene fill it in preDraw as before, and a scene that extends Scene directly fills it the same way by calling drawSceneBackground in its preDraw. setSceneBackgroundColor stores a copy of the given color
- EngineConfiguration.viewScaleMode (the same as the Rust edition's EngineConfiguration::view_scale_mode, default StretchShort): revived the field that was commented out. The default is ViewScaleMode.stretchShort, and the engine puts it into the view manager when created. UIScene and GameScene switch to their own mode (setViewScaleMode, default none) in initialize as before. Before that (the loading screen) the configured mode applies
- UIScene safe area (the same as GameScene and the Rust edition's compute_safe_area_rect): computeSafeAreaRect and the layout guide insets read ViewManager.getSafeAreaInsets instead of measuring env(safe-area-inset-*) separately. setSafeAreaOverride, ?safeArea= in the URL, and setIgnoredSafeAreaSides now reach UIScene too
- Public API that the Rust edition had: Color.from(a Color or color text, Rust edition From<&str> for Color), and setters that take a color (the Rust edition's impl Into<Color> places) also accept color text. UIScene.getDevTools, and import.js exports GameScene and isViewPositionInsideNode. WorldNode.convertNodePositionToViewPosition, convertViewPositionToNodePosition (null if it cannot be inverted), UIDropdown.getOptionList, getPopupNode, getOptionNodes, UIDialog.getPopupMotion, getOverlayNode, getPanelNode, getConfirmNode, getCancelNode
- runExternalPass: even if the external pass returns with the stencil test disabled or the stencil write mask changed, the test and mask are set again so the DECR that erases shader clips reaches the stencil, and without shader clips the stencil clip state is restored (later stencil clips used to break). The batchclipchrome test covers the case
- Changing the render pixel ratio cap (ViewManager.setMaxRenderPixelRatio) while running made one frame black: resizing the canvas in tick or draw clears the drawing buffer, but that frame still drew with the old viewport set at the start of the frame. Now it only stores the value and the engine resizes the canvas at the start of the next frame through the same path as a window resize (Engine.resize). Scenes also receive the screen area change (they did not before). The same value does nothing. Added ViewManager.isViewRectPending(). In headless Chrome (device pixel ratio 2), setting a cap of 1 while running used to make that frame's pixels (0, 0, 0).
- 3D render scale (ToonView3D.setRenderScale, getRenderScale, same meaning as Unity URP renderScale and Unreal screen percentage): when the scale is not 1 (default, unchanged), ToonView3D clears a target of the on-screen content size x scale (with depth, multisampled with 4 samples when the canvas is anti-aliased) to transparent, draws the 3D into it and stretches it on through the 2D drawing path with linear filtering and source-over. The UI stays at device pixels, so text does not blur (ViewManager.setMaxRenderPixelRatio covers the whole canvas and blurs the UI too). It follows 2D clipping, and the 2D below shows where the 3D does not cover. The target has its own depth, so reusing earlier 3D depth with setDepthCleared(false) only works at scale 1. The rect passed to the draw function gained outputFramebuffer (the framebuffer bound now, null for the canvas) and outputViewport (the GL viewport inside it, integers, bottom-left origin). examples/toonview shows it with ?renderScale=0.5. Combined with ToonPostProcess.setResolutionScale the two scales multiply. So that translucent objects accumulate correctly in the target, the ToonRenderer translucent blend (ToonBlendMode.alpha) now builds the alpha channel as premultiplied over (SRC_ALPHA, ONE_MINUS_SRC_ALPHA, ONE, ONE_MINUS_SRC_ALPHA, Unity Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha) and additive leaves alpha unchanged (ONE, ONE, ZERO, ONE). The canvas has no alpha, so colors are the same (same pixels before and after in headless Chrome). (reason: on Rimminer on a Galaxy Fold3 a canvas pixel ratio cap of 2 went from 33 ms to 19 ms but blurred the UI text as well)
- Anti-aliasing on and off: added EngineConfiguration.antialias (default true, same look as before). Turning it off creates the canvas WebGL context with antialias: false so the default framebuffer has no multisampling (MSAA). It removes the per-frame resolve cost on high-resolution mobile devices (on the Rimminer test device iPad mini 6, 2266 x 1316, MSAA cost 3 to 9 ms per frame, a heavy scene went from 35.7 ms to 26.2 ms). The web only chooses on or off and the browser picks the sample count. It is passed as the third Graphic constructor argument (antialias, default true).
- Font family name default (same as the Rust edition): the family name default (case and quotes ignored) in font strings (Graphic.setFontString, measureTextWithoutGraphic, glyph baking) is read as the engine default font chain. That position only looks up a font registered under the name default, and the SYSTEM_FONT_STRING chain is appended to the end of the list (the Rust edition looks up the default font and then the system font chain after the family list). Until now an unquoted default was a reserved word in CSS, so the canvas dropped the whole font string and measured and drew with the previous font and size (in headless Chrome the width of "16px default" was 417, measured with the previous 40px serif; it is now 139). DynamicFont without an asset also bakes with SYSTEM_FONT_STRING instead of "-apple-system, sans-serif" (same as the Rust edition's initial family name default and Text). New test tests/core/defaultfontchrome.test.mjs
- Sun shadow bias follows the shadow texel size (in the style of the texel-unit Depth Bias and Normal Bias, receiver normal bias and slope-scaled bias of Unity URP): the normal offset 0.02 (world) and depth bias 0.0015 (depth) that ToonRenderer had baked into the shader are replaced by the new ShadowMap setBias(depthBias, normalBias), getDepthBias and getNormalBias (in texels, default 1 and 1). They are multiplied by the world size of one texel (light matrix width / resolution) and the 1.5 texel radius of the 3x3 PCF, and a slope-scaled bias that grows as the light grazes the surface (2.5 texels x tan, tan clamped at 10) is added. The baked values did not follow the extent and resolution: at extent 40, faces grazed by the sun (84 degrees, down to 73 degrees at resolution 512) received their own shadow entirely (acne), and with near 1 and far 100 the depth bias was 0.15 in world units, so a caster 0.1 high cast no shadow at all (peter panning). A new Chrome test (tests/graphics3d/shadowbiaschrome.test.mjs) checks both. Point and spot light shadows (ShadowAtlas) already use a normal bias scaled by texel size and slope and are unchanged.
- Toon instance buffers shared by several passes (in the style of Unity's Graphics.RenderMeshInstanced with GraphicsBuffer and Godot's MultiMesh): added ToonDrawQueue.addMeshInstanceBuffer(mesh, instanceBuffer, instanceCount, options). The body and outline shell, the shadow depth and the screen-space outline's line target share a buffer uploaded once with ToonRenderer.createInstanceBuffer and do not upload it again. (addMeshInstanced culls per instance and the body, shadows and line target each upload the same array every frame) ToonScreenOutline.drawMeshInstanceBuffer(mesh, instanceBuffer, instanceCount, lineId, options) draws line IDs with the same buffer. The per-instance line ID is read from the new reserved instance layout name instanceLineId (size 1, TOON_INSTANCE_LINE_ID_NAME, its location is the last user attribute location TOON_INSTANCE_LINE_ID_LOCATION, with it up to two user attributes fit, ToonInstanceLayout.hasLineId), otherwise options.lineId. The emission slots of the bottom row of the affine matrix (3, 7, 11, 15) and the tint stay as they are. ToonRenderer.updateInstanceBufferRange(instanceBuffer, firstInstance, data) changes only part with bufferSubData (throws when out of range). A buffer's generation grows by 1 each time it is changed or deleted, and the shadow cache (ShadowUpdateMode.onChange) compares the buffer and generation in its caster record and bakes again on the frame it changed. It is culled as a whole by the bounds of the entire buffer (bounds, computed from positions and the largest scale on creation and on change). drawMeshInstanceBuffer now also culls as a whole with the same bounds (not culled if options.isCulled is false, and not culled when the layout has no matrix because the bounds are unknown). New functions readInstanceBufferSphere(mesh, instanceBuffer) and isSphereInFrustum(planes, sphere). Drawing with a deleted buffer draws nothing. Measured with the benchmark tool (tests/graphics3d/tooninstancebufferbench.mjs) on a miner mid style scene (tests/graphics3d/toonminerscene.mjs, 460 rocks of three kinds, twenty buildings, sun shadow, screen-space outline, Mac mini M2 Pro headless Chrome): uploads per frame (bufferData, bufferSubData) go from 6 to 0 with three instance batches and from 36 to 0 with eighteen batches split into chunks (the frame that changes one rock adds one bufferSubData), and draw calls stay the same (73, 118). The median script time (array and buffer alternated, nine times each) goes from 0.200 to 0.095 ms with three batches (the same at a machine load of 68), and with eighteen batches from 0.27 to 0.17 ms at load 4 (line target 0.085 to 0.035, instanced body draws 0.09 to 0.045, shadows 0.015 to 0.005 ms), while at load 55 to 69 it goes from 0.24 to 0.29 ms (only buffer splits between 0.145 and 0.34 ms per repeat, the cause is not found yet), and the frame that changes one rock goes from 0.635 to 0.355 ms (three batches). A Chrome test (tests/graphics3d/tooninstancebufferchrome.test.mjs) draws the same scene both ways for 75 frames and checks the pixels are the same to the byte (including per-instance line IDs and setLineColor colors, emission and shadows), that changing one rock shows on that frame and adds only one bufferSubData, and that the shadow cache draws nothing on unchanged frames and bakes again on the changed frame (deliberately not reading the line ID is caught on the first frame).
- Toon draw queue auto-instancing and a frame block (in the style of Unity GPU instancing and the SRP Batcher, and Unreal auto-instancing): ToonDrawQueue groups plain meshes (addMesh) that end up next to each other after sorting and share the model and the material values (the same material block; separate option objects are fine) into one instanced draw (drawElementsInstanced). The body, the outline shell, the shadow depth (drawShadows, and every tile of drawLocalShadows) and the line pass of the screen-space outline use the same groups. The matrices go into a batch slot instance buffer, which is uploaded again only when its values change (the body and the outline shell share a slot, so still objects upload nothing). The tint is 1 and the emission 0, so the screen is byte-identical to drawing each mesh on its own (the instanced shader path is the same arithmetic in the same program and only reads the model matrix from attributes). The line pass culls and adds to the focus distance in the order things were added, then draws the meshes with the same model and line settings (hasCreaseLine, hasScreenOutline, indexStart, indexCount) together, with a line id per instance; things it does not group keep their place in the added order. Meshes are not grouped when the material (ToonMaterial), the model, the material values, the textures, the light set or the drawn range differ, when the winding is flipped (negative determinant, isMirrored), when they have bone matrices or onBeforeDraw, or when they are transparent (transparent things are still drawn one at a time, far to near). Off-screen meshes are culled one by one first. The material block is now the fourth sort key (material, model, base color texture, material block) so that equal looks end up next to each other. The line pass uploads its instanced, instanceLineIds, skinned and lineFlags uniforms only when they change. The eighteen frame values that every program uploaded every frame (view projection, light matrix, camera position and forward, view rotation, camera roll, HDR, sun shadow switch, strength, texel and bias, outline distance scale and fade distance, point light shadow atlas and tiles, screen origin of the ambient occlusion texture) now live in one std140 block ToonFrame (binding 2): the values are written once per pass and, like the material blocks, a block with the same values is looked up and bound (built buffers are never modified, so nothing is uploaded while the camera and lights stay still; a first version that rewrote one buffer with bufferSubData every pass made the frame that bakes an onChange shadow differ from everyFrame, which the shadowcachechrome test caught; the cause was not isolated). A Chrome trace shows why: before this change, 2.05 ms of the 2.94 ms frame script time of the lobby-like scene was the renderer waiting for room in the GPU process command buffer (CommandBufferHelper::WaitForAvailableEntries) while the GPU process was busy decoding the commands (2.89 ms), so the frame time is set by the number of GL calls and draws, not by JavaScript. Measured (Mac mini M2 Pro, headless Chrome, alternating three times with the copy from before the change, one-minute load average 5.5 to 8.9): the lobby-like scene goes from 4929 to 1761 GL calls per frame, draw calls 773 → 276 (renderer draw calls 484 → 230), uniform calls 2980 → 383, vertex array binds 388 → 277, texture binds 205 → 205, program changes 41 → 41, buffer uploads 0 → 38, block binds 0 → 163, median script time 1.36 → 1.02 ms, and in the trace (40 frames with tracing on) the frame script time goes from 2.94 to 0.66 ms, GPU process command decoding from 2.89 to 0.64 ms and the renderer waiting for the command buffer from 2.05 to 0.15 ms. The Miner mid-like scene (instance buffers, six chunks): GL calls 849 → 453, draw calls 118 → 67, uniform calls 395 → 92, script time 0.41 → 0.10 ms. Both scenes and the five toon examples (toonstyle, toonshowcase, toonview, toonmaterial, toonfx) are byte-identical to before. A Chrome test (tests/graphics3d/toonautoinstancechrome.test.mjs) checks that only the same model and material values are grouped and that a different material, model, tint or flipped winding is not (the list of instance counts), that the screen is byte-identical to a draw queue that does not group, and that a batch slot is not uploaded again when the matrices stay the same.
- Toon screen outline batch slots (ToonScreenOutline.drawMeshBatch, in the style of Unity GPU instancing keeping instance buffers across frames): the line pass auto-instancing batches used to upload into the per-mesh instance buffer (mesh.instanceBuffer) every frame, while the body side kept its values in batch slots and skipped equal ones. The line pass now has its own batch slots too (a buffer per slot and a vertex array per mesh; the draw queue hands out slot numbers in the same order every frame) and uploads nothing when the matrices and line ids equal the previous frame (the line id lives in the tint column, so the values differ from the body slots and the slots stay separate). The code that builds a body vertex array moved into a module function that both sides use (the renderer behaves as before). Measured (headless Chrome, Mac mini M2 Pro, line pass bufferData count and bytes per frame, before to after): lobby-like scene 30 calls 21840 bytes to 1 call 720, room-like scene 36 calls 17280 to 12 calls 5760 (matrices change every frame in that scene, so the same count as the body side), Miner-like scene (instance buffers, six chunks) 2 calls 1520 to 0. The screen hashes of frames 6 and 11 of the lobby, room, room moving and Miner scenes equal the ones before the change. A Chrome test (tests/graphics3d/toonlinebatchchrome.test.mjs) checks that a still frame uploads nothing in the line pass and keeps the same screen, and that changing one matrix uploads only that batch and the screen is byte-identical to a fresh draw.
- Toon screen-outline batching of mirrored items (ToonDrawQueue, the isMirrored slot of ToonScreenOutline.drawMeshBatch, for games that draw a reflection by queueing the same actor again with a matrix flipped about the floor): items whose winding flips (a negative determinant or isMirrored) were drawn one by one, in the screen-outline board only (the body, the outline shell and the shadow already batched mirrored items among themselves). The screen-outline board now batches mirrored items of the same mesh and line style into one instanced draw too, and every item in a batch is drawn with the same winding (frontFace is set once per batch). Splitting the Aberrant lobby (Mac mini M2 Pro, 2560x1440, 78 mirror items) shows the mirror's 1.55 ms of GPU time is not the screen-outline board (skipping it: 6.90 vs 6.97, the same), not shadows (never queued), and not overdraw (moving the mirror to the end of the body pass: 6.94, drawing everything front to back: 7.10); it is the shader work that paints the mirror's pixels in the body pass (drawing the mirror's body with the depth shader only gives 5.39, the same as 5.41 without the mirror; a flat color gives 5.75, no lighting 6.12, no point lights 6.76, and turning off shadows, specular and rim light or removing ambient occlusion changes nothing). So the only saving that keeps the screen identical is on the CPU side: the renderer thread time went from 1.72 to 1.39 ms. The Chrome test (tests/graphics3d/toonautoinstancechrome.test.mjs) checks that three mirrored items become one batch in the screen-outline board too, and that the screen is byte-identical to the one drawn without batching.
- Toon ambient occlusion (screen-space AO, GTAO: Jimenez, Wu, Pesce, Jarabo 2016 "Practical Realtime Strategies for Accurate Indirect Occlusion", applied only to indirect light like Unity URP SSAO): added ToonPostProcess.setAmbientOcclusion(isEnabled, intensity, radius, resolutionScale) (off by default, intensity 0.5, radius 0.5 world length, half resolution), getAmbientOcclusion, isAmbientOcclusionEnabled, drawAmbientOcclusion(lineTarget, viewMatrix, projectionMatrix), getAmbientOcclusionTexture, getAmbientOcclusionPrepass, and ToonRenderer.setAmbientOcclusionTexture, getAmbientOcclusionTexture, ToonDrawQueue.setPostProcess, getPostProcess. For each half-resolution cell it turns four screen-space slices, finds the highest horizon six steps to each side, and integrates the cosine-weighted visibility with the projected normal in closed form (falloff from 0.6 times the radius to the radius). Slice angles and steps are scattered with interleaved gradient noise (Jimenez 2014) as a fixed pattern, so a still screen does not shimmer. It blurs with 7 horizontal taps while preserving edges by tangent plane distance and normal angle, then blurs with 7 vertical taps in two columns while upsampling to full resolution, choosing by the pixel's depth and normal (Kopf 2007 joint bilateral style). Depth is resolved with the inverse projection matrix, so perspective and orthographic (raw matrices given with setMatrices too) both work. Normals and depth reuse the screen outline's line target, and scenes without outlines draw only the line target with no lines (ToonScreenOutline skips seeds and flooding when both outline and crease widths are 0, and drawOutline draws nothing). ToonDrawQueue computes it after the line target and before bodies, sets it on the renderer and clears it after endFrame. The body shader switches to a body program with TOON_AMBIENT_OCCLUSION defined (sharing the outline and shadow depth programs) and multiplies the visibility at the screen position only into the ambient light (sky and ground light). Sun bands, fill light, point lights, specular and rim light stay as they are, so the bands stay clean. Transparent things and surfaces whose depth differs from the line target (by more than 2^-16) are not multiplied. The texture unit is 16 (materials that use all 8 material textures are drawn without AO on devices with 16 fragment shader units). The engine's existing AmbientOcclusionEffect resolves depth only from a perspective field of view and takes RGB normals with coverage alpha in a hemisphere-sample form, so it does not fit orthographic cameras and the line target (octahedral normals) and was not used. Cost (test scene 640 x 360, Mac mini M2 Pro headless Chrome): GL calls per frame go 92 → 249 in the scene without outlines (draws 5 → 12, four prepass draws and three AO passes) and 278 → 368 in the outline scene (draws 14 → 17, only the three AO passes), and body program switches do not increase (the AO body program takes the default body's place). The frame wall clock waiting for the end with readPixels is 0.20 ~ 0.41 ms off and 0.49 ~ 0.80 ms on (wall clock because there is no GPU timer extension, larger resolutions not measured). Open surfaces divide visibility by 0.96 and clamp at 1, so they are exactly 1 and the screen stays the same. With it off, bodies are drawn with the default body program, which does not read the texture (the ambient expression is unchanged), so the screen is byte-identical to before. A Chrome test (tests/graphics3d/toonambientocclusionchrome.test.mjs) draws a room corner, a crate and a two-legged robot in perspective, orthographic and with outlines, and checks that off and turned-on-then-off screens are byte-identical to the repository before the change (TOON_AO_BASE_PATH), that with it on the wall and floor junctions, beside the crate and under the robot's feet get darker while open floor stays the same, that the sun band edge on the robot head is byte-identical, and that the AO from the outline's line target equals the AO from the prepass.
- Toon outline low steps (in the style of Unity and Unreal depth-normal edge detection, which matches the threshold to the measurement error): when ToonScreenOutline separates occluded silhouettes within the same ID, it now uses the distance of the occluding pixel from the occluded pixel's tangent plane. Until now it used the smaller of the two pixels' tangent-plane distances; when the occluding side is the silhouette of a round surface, its tangent plane contains the line of sight, so the distance shrank below one pixel and lines such as the seam of a dome sitting on a body broke into dashes. The fixed margin added to the threshold (twice the pixel size at that depth) is replaced by a margin proportional to the measured error: the angular error of the 8-bit octahedral normal (at most 0.0165 rad, measured over 2 million random samples) x the distance between the two pixel positions, one pixel x the sine of the angle between the two normals for pixels on either side of a crease, and one step of the 24-bit depth. So a step between two parallel faces is caught even when it is lower than one pixel, and slanted planes and bumpy surfaces only get a margin as large as the normal error. Added the margin factor setDepthMargin, getDepthMargin (default 2) and getDepthThreshold. The normal target stays RGBA8 (two 16-bit channels would give an angular error of 0.00006 rad but double the line-target writes and seed reads, while the 8-bit error term is 0.02 of a pixel on a face at 45 degrees and does not get in the way of separating steps). With the defaults, of the six engine examples (toonstyle, toonview, toonfx, toonpost, toonshowcase, toonmaterial) only toonstyle changes, where the two ends of the donut's inner silhouette continue 16 pixels further; the others are byte-identical. In scenes of low steps, slanted planes and bumpy surfaces built with a single ID (perspective and orthographic, DPR 1, 2, 3), at a threshold of 0.05 the gaps in the silhouettes of round surfaces and rocks over the floor are joined (-0.1 ~ +13 % line pixels, the decrease being at most 34 pixels at the ends of the glass panel's lower edge) and no stray lines appear inside planes and rocks.
- Direct lighting strength for toon ambient occlusion (in the form of Direct Lighting Strength in Unity URP SSAO and HDRP ScreenSpaceAmbientOcclusion.directLightingStrength): added a fifth argument directLightingStrength (0 to 1, default 0) to ToonPostProcess.setAmbientOcclusion, getAmbientOcclusionDirectLightingStrength, a directLightingStrength field in getAmbientOcclusion, a second argument to ToonRenderer.setAmbientOcclusionTexture and getAmbientOcclusionDirectLightingStrength. After the band (brightness step) is chosen, the body shader multiplies the diffuse and specular of the sun band light, fill light, point lights and spotlights by 1 - strength x (1 - visibility). URP multiplies the direct light color (light.color) by lerp(1, ssao, strength), so diffuse and specular drop together, and HDRP applies the same strength to direct diffuse and direct specular. Rim light, glow, matcap and angel ring stay as they are, and the ambient light is still multiplied by the full visibility. It does not touch the band coordinate, so band edges do not move. The value is uploaded in ambientOcclusionDirectLightingStrength at the end of the ToonFrame frame block (slot 168, block 168 → 172 floats). In scenes with strong sunlight, corners were hardly visible when only the ambient light was multiplied; the strength makes them stronger. Strength 0 and off are byte-identical to before (six screens of the test scene: perspective, orthographic and outlines, on and off). A Chrome test (tests/graphics3d/toonambientocclusionchrome.test.mjs) checks that with strength 0, 0.25, 0.5 and 1 the darkening of the wall corner grows 4.9, 5.9, 7.3, 9.8 and under the robot's feet 4.2, 6.0, 8.1, 12.1, and that open floor and the robot head (sun band edge) stay byte-identical to off even at strength 1.
- Opacity layer (group opacity like CSS opacity): Graphic's beginOpacityLayer and endOpacityLayer (Rust edition begin_opacity_layer, end_opacity_layer) gather what is drawn between them in a screen-sized buffer and lay it down at once with the current global alpha. A node with setOpacityLayer(true) (Rust edition set_opacity_layer) and opacity below 1 is drawn with its descendants as a layer, so overlapping children do not show through each other (the same as Chrome CSS opacity). Clips (Mask) inside the layer still work and layers can be nested. Both engines are the same. The Rust edition's desktop Pane draws CSS opacity with this layer, matching the web DOM. In headless Chrome the overlap was (64, 0, 128) without the layer and (0, 0, 128) with it, so the lower box does not show through
- GameScene loading (the same as the Rust edition): the minimum loading time is measured with the engine clock (TimeManager.getRealtimeSinceStartup) instead of Date.now, and if the engine clock has not started yet (before the first frame) it is measured from the first loading screen frame. A press on the loading screen is read from engine input (InputManager.isTouchPressed) instead of window pointerdown, and drawOnLoad looks at it every frame.
- Developer tools memory fields (the same rule as the Rust edition): all three fields are "(N/A)" if the in-use and reserved heap of performance.memory cannot be read, and only that field if just the limit (jsHeapSizeLimit) cannot be read. The Rust desktop shows values with the same meaning read through operating system APIs in the same fields.
- Action: added startWith(target) and stepWith(target, timeDelta), which pass the target every time without holding it (paired with start_with and step_with in the Rust edition). start(target), step(timeDelta) and getTarget still hold the target and pair with start(node_tree, Some(node_id)), step(node_tree, time_delta) and get_target in the Rust edition. The inner actions of repeat, forever and loop run with startWith and stepWith like the Rust edition and do not hold the target.
- Input field context menu: right-clicking a direct-touch field (setUseDirectTouch) opens the same engine context menu as other fields instead of the browser edit-field menu. (the default action of the DOM input's contextmenu is blocked) The menu gains select all (when there is text), and UIInputFieldMenuAction.selectAll is added. It has the same four items as the Rust edition
- The input field context menu is drawn by the engine: the right-click context menu is no longer a DOM element attached to body (CSS box-shadow) but is drawn on the canvas as the last child node of the root (a UIInputFieldContextMenu component). It follows the same code path and the same sizes as the Rust edition (width 140, item 34, 14px text, corner 8), and its shadow bakes CSS 0 4px 16px rgba(0, 0, 0, 0.18) as a sigma 8 Gaussian like Blink (new src/core/blurshadow.js, the same math as the Rust core/blurshadow.rs). The menu is placed in view coordinates and follows the view scale. The arguments of showContextMenu changed from (clientX, clientY) to viewPosition (a Vector2 in view coordinates). Right-clicking outside the field closes an open menu.
- FBX with several materials: an FBX mesh with several materials (the Materials of LayerElementMaterial, MappingInformationType ByPolygon or AllSame) is split into sub-meshes by each polygon's material number and drawn as one drawable per material. (three.js FBXLoader groups, Unity and Unreal sub-meshes) Before, the material number was looked up by polygon vertex index instead of polygon index, and each mesh was drawn with only the first material of its owner node, so the Quaternius mannequin (M_Main, M_Joints) came out all orange. Added the static function SkinnedModel.splitFbxCornersByMaterial, materialName (the FBX material name, as with glb) on the FBX mesh description and drawables, and name on FbxLoader materials. The same as the Rust edition. Document images ancient-mountain, and shader-sprite and screen-effect after the shader hash change, were captured again (1280 x 720, cwebp -q 85). The bundle and the UI editor were rebuilt.
- Engine.alert, confirm, prompt (and alertAsync, confirmAsync, promptAsync), isModalDialogOpen: with the same names and behavior as the Rust Engine, they open a dialog drawn by the engine on top of the canvas (the same look as the Chrome tab modal dialog, with the title "This page says" and button labels in the browser UI language) and return a ModalDialogHandle (isFinished, getResult, isConfirmed, getPromptText, setCallback). The browser window.alert, confirm and prompt are not called. The handle finishes when the dialog is answered; while it is open isModalDialogOpen is true and the engine does not update scenes (the frozen screen is still drawn and only the dialog receives keys). The shadow bakes the two Chrome bubble_border layers with the new src/core/blurshadow.js. New modules src/core/modaldialog.js (ModalDialogKind, ModalDialogResult, ModalDialogHandle) and src/core/browseruitext.js (the Chrome translation table, the same locale selection as the Rust edition). The DevTools Local Storage tab also asks with the engine dialog instead of browser dialogs (same as the Rust DevTools).
- Scene.setTouchDispatchEnabled(isEnabled), isTouchDispatchEnabled(): a switch for the scene's default touch passing (tickTouch passing to nodes through the raycaster). Same as the Rust SceneBase.set_touch_dispatch_enabled. Same effect as setTouchRaycaster(null), and the raycaster is kept.
- SpriteAnimator: in the same form as the Rust engine, there is the static SpriteAnimator.play(node, clipName, options) (formerly playOnNode; plays with the node's animator and puts the first frame in right away) and the instance playClip(clipName, options) (the Rust play_clip). The instance play is removed. (To migrate: change the instance animator.play(clipName, options) to animator.playClip(clipName, options))
- InputActions: like the Unity Input System, it updates once in update at the start of the frame and reads the same values within that frame. readGamepadStick and readMoveAxis no longer look at the input manager again when reading, they read the move keys and pad axes recorded in update. (same as the Rust engine)
- Sine, cosine, tangent: the engine Math.sin and cos (a 10-term Taylor series) and tan (sin / cos) now call the browser Math.sin, cos and tan. Chrome 158 returns correctly rounded results (the double nearest the true value), and the Rust engine computes the same, so both engines give the same bits for the same input. Last digits change. (For example sinusoidal.inOut at 0.5 is 0.49999999999999994 instead of 0.5000000000000017, and the timeline color #ff000080 → #0000ffff at 1 second is #80007fc0 instead of #7f0080c0)
- Shader hash: hash21 (ScreenEffect, ShaderSprite) and hashPoint (toon VFX) now use an integer hash that mixes the float bits with the fmix32 finalizer of MurmurHash3 (Austin Appleby, public domain). It replaces forms whose source text could not be confirmed (Hash without Sine and the sin hash that spread from Shadertoy). The patterns of film grain, glitch, value noise and toon VFX noise change. (The brightness distribution and how to use them are the same)
- Human skin environment BRDF: instead of the Karis approximation, it uses a formula fitted to a split-sum integral the engine computes directly (GGX, Smith Schlick-GGX with k = alpha / 2, Schlick Fresnel). The RMS error against the integral table drops from 0.071 in scale and 0.029 in bias to 0.002 and 0.006. The environment reflection changes. (Roughness 0.5 head-on gets brighter, 0.72 to 0.89, and roughness 1 head-on gets darker, 0.45 to 0.31)
- Scene touch: a node's widgets receive touches regardless of the scene type. (Like Unity's EventSystem, same as the Rust version's SceneBase.tick) Scene.tickTouch first hands the touch to the frontmost pressable node through the scene's touch raycaster (the TouchRaycaster made in create), and then calls the touch hooks (touchPress, touchMove, touchRelease, touchCancel, touchWheel). The wheel is also handed to the frontmost scroll area at that position. Added Scene.setTouchRaycaster(touchRaycaster or null), getTouchRaycaster(). UIScene and GameScene keep handing touches to their own TouchRecognizer in the touch hooks as before (the developer tools, fades and gameplay input checks sit before and after the hand-off), and the scene's default hand-off is turned off so touches are not handed over twice. (The getTouchRaycaster of both scenes is that TouchRecognizer)
- FbxLoader: strips the binary FBX type suffix ("\u0000\u0001Model", "\u0000\u0001AnimStack") from node (Model) and animation stack names. A clip name is "Take 001", not "Take 001\u0000\u0001AnimStack", and a bone name is "mixamorig:Hips". (In three.js FBXLoader, BinaryReader.getString cuts at the first null byte, and Assimp converts to "AnimStack::Take 001" and then FBXConverter strips "AnimStack::", "Model::"; the Rust version was changed too) Bone name matching when adding FBX animations to a model read from glTF (addAnimationsFromFbx*) also matches by these names.
- Folder cleanup: moved the grown-up features that were in src/experimental to their proper places. The folders are the same as in the Rust vanilla-engine. Games that use import.js keep working as is, and games that imported files directly by path switch to the new paths. (old path → new path, contents unchanged)
  - src/experimental/graphics/*.js (3D) → src/graphics3d/*.js
  - src/experimental/graphics/toon/*.js (toon 3D) → src/graphics3d/toon/*.js
  - src/experimental/graphics/fullscreenpass.js → src/core/fullscreenpass.js
  - src/experimental/animation/animator.js, timeline.js → src/animation/animator.js, timeline.js
  - src/experimental/action.js → src/animation/action.js
  - src/experimental/indicator.js → src/misc/indicator.js
  - src/experimental/visual/visual.js → src/misc/visual.js
  - src/experimental/bunchasset.js → src/resource/bunchasset.js
  - src/experimental/visual/visualasset.js → src/resource/visualasset.js
  - src/experimental/collection/*.js (List, Dictionary, Queue, Set, Stack) → src/base/collection/*.js
  - src/experimental/camera.js → src/deprecated/camera.js
  - src/experimental/aabb.js, transform2d.js, graphics/gl2d.js, graphics/webgl2.js (dead code, not exported) → src/deprecated/
- Engine: applies view coordinates (viewManager.applyViewRect) before each scene draws (preDraw, or drawOnLoad while loading). Until now scenes were called with no transform applied, so scenes that directly extend Scene (not UIScene or GameScene) drew in the actual pixels of the drawing buffer, and on screens with a device pixel ratio of 2 (Retina Macs, high-density phones) they drew only in the top-left 1/4 of the canvas and were also out of line with touch coordinates. Ratio 1 screens and UIScene, GameScene are unchanged. How to migrate: scenes that drew in actual pixels call graphic.setTransform(1, 0, 0, 1, 0, 0) in preDraw
- UIInputField canvas mode word movement and deletion: like Chrome, Ctrl on Windows and Linux and Option on Mac, with the left and right arrows (with Shift, extends the selection), Backspace and Delete, moves and deletes by word. (On Mac also Option + Ctrl + Backspace, B, F) Positions follow Blink's NextWordPosition, PreviousWordPosition; going right lands before the next word only on Windows (on Mac and Linux, at the end of the current word), and on Mac a selection being extended does not cross its anchor end. If there is a selection, only the selection is deleted. (Previously Ctrl + arrow did nothing, and Mac Option + arrow moved one character at a time)
- UIInputField word boundaries: like Chrome, a period joins only between digits ("www.example.com" is five pieces, "3.14" is one word), and a colon does not join. (Chromium ICU wordbrk.patch; double-clicking in the DOM input selects the same word as Chrome even in browsers other than Chrome)
- UIDocument: writes node and component type names in the document as the name registered in the table instead of the class name (constructor.name). The document is the same even if a bundler shortens class names (esbuild --minify). (Only unregistered types use the class name as before; until now, in a minified bundle WorldNode was written as something like "o" and could not be read back)
- UIDocument.registerEditorTypes(): registers the types the UI editor registers (35 components, 12 node types) at once. Games that read documents saved by the editor call it once before fromJsonText. Names already registered are left as they are. (Same as Rust register_editor_types) Reading a node type or component not in the table reports it with console.warn. (Until now they were silently read as WorldNode or skipped, so UIInputField, UIScrollBar became empty nodes and UISnapScrollView was dropped)
- UIDocument: when reading back, components and children made by the node constructor or a widget (like UIWindow's title bar, or the Sprite that UIImageView attaches) receive the document's values if their order and type (name for children) match from the start of the document, instead of being made again on top. Reading and writing again gives the same document. (Until now they were made again on top, so reading a UIWindow gave two sets of nodes and components; same as Rust)
- Version: extends the engine Object. (version.js did not import Object and only re-exported it, so it extended JavaScript's built-in Object)
- Enum.readonly(dictionary): returns the frozen dictionary. (Like Object.freeze; until now undefined)
- Format.formatCompactNumber: moves up to the next unit when rounding reaches 1000. (999999 is "1M", not "1000K", same as Intl's compact notation)
- Singleton: throws when new is called again on a class that already has an instance. Get it with getInstance(). (The subclass constructor re-ran its own fields and constructor body on the first instance returned by super(), overwriting the first instance, and it was a TypeError if there were private fields)
- Node.setParent, addChild: does not attach under itself or its own descendants and returns false. (If it formed a cycle, upward computations like isActiveInHierarchy never ended; what used to throw an empty error for itself is also false now) true if attached or detached. removeChild detaches only when it is its own child. (Same as Rust NodeTree)
- ObjectPool.release: releasing an object that has already been returned and is idle is ignored. (Releasing twice made two users borrow one object next time)
- Platform.getSafeAreaRect(canvas): measures with the canvas CSS size (clientWidth, clientHeight). The returned rectangle is all in CSS pixels, and its width and height are 0 or more. (The insets are CSS pixels but were subtracted from the drawing buffer size width, height, mixing units on high-resolution screens)
- Color: stores components as they are without clamping them to 0 ~ 1. (HDR colors above 1 such as glowing colors, like Unity Color, same as the Rust version) Only when output as 0 ~ 255 text (toRGBAString, toHEXString) are components clamped to 0 ~ 255 and the rgba alpha to 0 ~ 1. How to migrate: code that created colors with 0 ~ 255 values like new Color(255, 128, 0) switches to Color.createFromBytes or 0 ~ 1 values. (Previously they were clamped to 1 and came out white; now they are stored as is)
- UINode: isInteractable, setInteractable, contains, getWorldCorners, convertToViewPosition, touchPress, touchMove, touchRelease, touchCancel. A UIButton attached to a UINode is pressed at the position the solver resolved. (TouchRaycaster hit only WorldNode and UINode had no press test, so it could not be pressed; in Rust UINode is a component of WorldNode, so it was always pressable) UIButton turns interactable on when attached, if the node has setInteractable
- UIScrollBar: auto hide hides the node while keeping it enabled instead of disabling it. (When disabled its update stopped, so it did not come back even when the content grew longer or setAutoHide(false) was called) While hidden it does not draw or receive presses. Added isAutoHidden()
- LanguagePack, UIFont: since JsonAsset.load now rejects on failure, a fetch failure is taken as a failed load. (Warns and gives null, false as before) Brought the list form in the UIFont header comment in line with the code ({ fonts: [...] }, { faces: [...] })
- ShaderSprite.isDrawnInsideContent: true even when flipped. (Same as Sprite, which now draws inside the content area even when flipped)
- Sprite.setImage: also accepts HTMLCanvasElement, OffscreenCanvas. (Previously it ignored anything other than HTMLImageElement and ImageAsset; an OffscreenCanvas passed through UIImageView.setImage now draws too)
- Graphic.drawPolyline, drawLine, drawLineLoop, drawStrokeRoundRect, drawConvexPolygon: when the vertex buffer (4096 vertices) fills up, draws what has accumulated and keeps writing. Previously everything from the 683rd segment (the 1366th triangle for convex polygons) on was dropped.
- Graphic.setCullingEnabled: brought the default in the header comment in line with the actual one (on, true).
- SoundSystem: if a sound table row has no volume, plays at 1. (Previously it became NaN, so 0, and no sound played)
- TouchRaycaster: hits nodes of any type instead of only WorldNode. Every node with isInteractable and contains is hit and receives presses.
- ParticleSystem.applyDescription: reads the description's imageDataUrl (the data: URL of the image chosen in the particle editor) and sets it as the particle image. (null or empty text removes the image) The chosen image comes back even when a saved description is loaded again in a game.
- ParticleEmitterShape: brought the edge direction in the header comment in line with the actual one (downward +y).
- FontAsset.load(assetPath): it only set the path and did not load; now it actually loads. Calls loadFont with the file name minus its extension as the family name. ("DOSGothic" for "assets/DOSGothic.woff")
- JsonAsset.load: rejects when the fetch or parse fails. (Same as TextAsset, ImageAsset) How to migrate: code that assumed it resolves even on failure and checked whether data was null after await is wrapped in try/catch. SpriteAtlas.load still reports and resolves on JSON failure.
- Asset.unload: it returned undefined when loaded and a resolved promise when not; now both branches return nothing. (Subclasses that override it too, same as Rust)
- LayoutSolver: an expression containing a term with no variable (LayoutTerm(null), value 0) threw a TypeError in updateVariables. Such terms are now skipped like terms with a coefficient of 0. (5 == 0 with only such terms left is a contradictory constraint; 0 == 0 is accepted)
- UISnapScrollView: setSnapToNearest, setVelocityThreshold only stored values and were not used in the snap computation. Now in one-item mode (default), on release, if the drag velocity is at or above setVelocityThreshold (default 200, scroll offset pixels per second), it moves one item in the direction of the velocity regardless of the dragged distance (fling); otherwise it decides by the setPageChangeThreshold ratio as before. setSnapToNearest(true) does not clamp to the item range while dragging, and on release the snap offset goes to the nearest item. Added getDragVelocity(). (The scroll-axis offset velocity of the last dragged tick, negative toward the next item) The existing behavior for slow drags is unchanged
- ImageScroller: setImage(ImageAsset) used ImageAsset without an import, giving a ReferenceError. Now for an ImageAsset it holds its getImage(), and other images (HTMLImageElement, canvas and so on) are held as they are. (Works even where there is no HTMLImageElement global)
- NodeLayout: the builder's anchoredPosition was applied before attaching to the parent and ignored the anchor. Now build applies it after attaching to the parent, relative to the anchor point of the parent's contentSize. (The anchor is the anchor at the time anchoredPosition is called, and a localPosition called later wins, same as the Rust version) Removed the leftover old "Creates a layout instance" comment block with no declaration
- Camera2D: the usage line camera.follow([heroPosition], 6) in the header comment was missing timeDelta, so using it as is gave a NaN position. Fixed to camera.follow([heroPosition], 6, timeDelta). Gave setPosition its own header comment. (Previously the "Accessors." section header was read as its description)
- LanguagePack: if a row in the languages.json read by loadLanguageList had no aliases, matchLanguageTag threw a TypeError. Now the list read from the file also goes through setLanguageList. Rows whose code is not text are dropped, missing aliases and countries become empty arrays, and text is lowercased. (Same as the Rust version)
- DEVTools: Show FPS in Settings was only saved and never used. When on, it draws an "FPS <value>" box (the frame count of the last 1 second, canvas-native coordinates) at the top left of the window even with the panel closed. When the panel is visible, it draws on top of the panel
- UIListView: filled in descriptions, @param, @returns and examples (a 500-row template list, a create function, end notification) for the public API
- UIInputField cursor and deletion: the left and right arrows and Delete move and delete by grapheme cluster (extended grapheme cluster, Intl.Segmenter) like Chrome. Backward deletion ports Blink's BackspaceStateMachine, deleting one code point at a time but deleting CR LF, emoji variation selectors with their base, skin tone modifiers, ZWJ emoji, flags, keycaps and tag sequences as a whole. Fixed a bug that split surrogate pairs. (Matches the execCommand results of a headless Chrome textarea)
- UIInputField: with a selection, the left and right arrows without Shift collapse to the start or end of the selection like Chrome. The pressed position (measureIndexAtLocalX) lands only on grapheme cluster boundaries. Giving moveCursor a position in the middle of a surrogate pair treats it as after that character.
- Added UIInputField.deleteRange(startIndex, endIndex). deleteCharAt(index) deletes one grapheme cluster starting at that position. (Previously one UTF-16 unit)
- UIInputField maximum length: setText truncates up to where it does not split a surrogate pair, and insertion (replaceSelection, paste, typing) inserts only as much of the inserted text as the remaining length allows, like a Blink input field. (Previously the whole value was truncated, which could delete the text after the cursor)
- UIInputField.setFont uses the fontFace of a FontAsset when given one. (Previously it held the FontAsset as is, so before the font loaded the CSS font for text measurement was broken) Text measurement, selection and cursor drawing build it with the same buildFontString as UILabel.
- UIInputField DOM input, like a Chrome input field, selects a word (on Windows including the trailing space) on a mouse double-click and the whole text on a triple-click, and dragging after that extends by word. The click count is the detail of the canvas mousedown.
- List, Dictionary: changed the callbacks of find, findAll, which received the index or key as this, to the standard form. List takes callback(element, index, list) (like Array.prototype.find), Dictionary takes callback(value, key, dictionary) (like Map.prototype.forEach). How to migrate: where a function callback read the index or key from this, receive it as the second argument. (Callbacks that used only the first argument keep working)
- Animator: completed the skeleton that did not change states into a standard state machine. AnimationState gets speed (setSpeed, getSpeed), looping (setLoop, isLoop, follows the clip when null), getDuration, getNormalizedTime, getFrameIndex. AnimationTransition gets exit time (setExitTime, getExitTime, normalized time, below 1 on a looping state means every cycle), blend time (setDuration, getDuration, crossfade), setCanTransitionToSelf, canTransitionToSelf, conditions (addCondition(name, comparison mode, threshold), getConditions), isExitTimeReached, and from being null means from any state (Any State). New AnimationConditionMode (if, ifNot, greater, less, equals, notEqual). Animator gets parameters (setFloat, getFloat, setInteger, getInteger, setBool, getBool, setTrigger, resetTrigger, getTrigger, getParameters), play, findTransition, startTransition, isConditionSatisfied, getCurrentStateIndex, getCurrentNormalizedTime, getCurrentFrame, isInTransition, getNextStateIndex, getNextNormalizedTime, getNextFrame, getTransitionWeight. tick advances the state time, checks Any State first and then the current state's transitions in the order they were added, and takes the first one that matches (triggers used as conditions are reset; no new transitions are checked while blending). Starts in the first state added. How to migrate: setProperty, getProperty, getProperties are gone. Replace them with setFloat, setInteger, setBool, setTrigger and their getters according to the type. The internal Animation handler (getAnimation) is also gone. Read the selected frame with getCurrentFrame, getNextFrame and getTransitionWeight.
- Visual: added document text (setDocumentText, getDocumentText) and createNode. createNode builds a new node tree from the document and sets the root's local position to location. Filled in descriptions and examples for the public API.
- Localization.isRightToLeft: like setRightToLeft, reads in lowercase with underscores as hyphens. (It did not catch "ar_EG" as a right-to-left language)
- Material.createFromDescription: if an intermediate image cannot be decoded, deletes the textures built so far and rejects. createTexture builds the texture after the image is fully decoded, so if decoding fails no texture is left behind, and even if another texture is bound while waiting, it uploads to its own texture. (Previously it bound before waiting, so it could upload to another texture bound in the meantime)
- ShaderProgram: when fragment shader compilation or linking fails, deletes the shader (and program) built earlier
- UINode.addConstraint: constraints the solver did not accept (already added, contradictory) are not kept in the list. (The next setSolver stopped with the same error)
- UISpinner.calculateDotOpacity: with no dots (dotCount 0), it does not become NaN from dividing by 0
- UIListView.setHorizontal: when it changes, re-measures the scroll area and re-places the visible items on the new axis
- Camera (src/deprecated/camera.js): to be deprecated. Camera2D (src/misc/camera2d.js) covers everything including rotation and begin, end. import.js still exports it as Camera, and it may be dropped in the next version
- Moves general-purpose features that webgame-rimminer had built and used separately on the game side into the engine. (Game code was not touched; the game keeps using its own as before)
- Outline: a component that draws only the border. (Paint only fills the inside) Rounded rectangle border (setRoundSize) or circle border (setCircle); the line stays inside the content size. setColor(Color or "#rrggbb", "rgba(...)"), setLineWidth
- UIProgressRing: progress ring component. Following the node's shape (rounded rectangle; a circle when the roundness is half the size), draws the filled portion (setRatio) clockwise from the top center in the fill color and the rest in the background color. Perimeter points are computed only when the size, roundness or thickness changes
- UIHitArea: hit area expansion. UIHitArea.attach(buttonNode, minimumSize) places a transparent hit area as the sibling right behind the button, expanding its width and height to at least minimumSize. Pressing the expanded area calls the button's click notification, and it follows the button when the button is disabled or cannot be pressed. Tracks the button's position, size and pivot every frame. setClipNode can clip the expanded area to within a window or scroll area
- FrameProbe: slow device detection. After a wait period in seconds, observes frame intervals for a measurement period in seconds; the device is slow if 25% or more of frames exceed 1.4 times the target interval. (Constantly skipping every other frame, like 60 FPS on a 90 Hz display, is not counted as slow) restart, measureAgain; values are changed with setSeconds, setSlowFrameThreshold
- PointerCursor: mouse cursor. When enabled (PointerCursor.getInstance().setEnabled(true)), the engine sets the canvas cursor at the end of every frame. Over a UIButton (including while pressed) it is the button's cursor (pointer by default), otherwise the cursor set with setScreenCursor. registerImageCursor adds image cursors at 1x and 2x. Leaves the cursor untouched on touch devices. When disabled (default), behaves as before
- UIButton: notifies PointerCursor while the mouse is over it or it is being pressed. (Nothing happens if PointerCursor is disabled)
- Platform: isDesktopWeb() (not mobile, and not an iPad presenting as a Mac with multi-touch input), isCoarsePointer() (CSS pointer: coarse)
- ViewManager: getCssPixelScale(). How many CSS pixels one view unit spans on screen. (Used to compute the scale for enlarging only the UI layer on small screens)
- SoftShade, SoftShadeShape: soft shade component. Darkens the area behind text so it stays readable on bright backgrounds. Bakes a band (darkest in the middle, fading toward the top, bottom and sides) or a floor (vertical gradient, darkest at the bottom) into a small canvas and draws it stretched to the content size. Rebakes only when the size, shape, color or strength changes
- ShadowText: single-line text component with a shadow underneath. Bakes the text over the shadow into a single canvas and draws it, so the node's opacity applies to text and shadow as one layer. (With two Text layers, the shadow underneath shows through when faded) The shadow can be blurred (shadowBlur of setShadow), and on overflow the text shrinks down to setFitMinimumRatio to fit. Horizontal alignment and position use the same calculation as Graphic.drawTextEntry; vertical is centered. setFontFace, setTextDirection
- ShadowImage: image component with a shadow underneath. Draws the image (or an atlas piece via setImage(image, imageRect)) centered in the node preserving its aspect ratio, paints a shadow under the image's shape, and bakes them into one layer. setImageColor can tint the image a single color
- buildRGBAString(colorText, opacity): builds a canvas rgba color string from "#rrggbb" and opacity. (shadowtext.js)
- CameraGestures: camera gestures. Reads gestures for rotating, panning and zooming a 3D board or map independently from the canvas DOM events. Right mouse drag (horizontal rotates, screen width is one full turn; vertical tilts; releasing without dragging is a right click), middle drag (pan), two fingers (pan, pinch to zoom, twisting past a threshold rotates). Accumulated amounts are taken every frame with takePan, takeRotation, takeTilt, takeZoom, getZoomAnchor. isGestureActive during a gesture. Emulated mouse events right after fingers are lifted are ignored. setThresholds changes the thresholds and dispose detaches
- SoundSystem, setSoundSystem, readSoundSystem: background music and sound effects managed through a sound table. (Uses AudioManager's shared AudioContext and AudioAsset) Each row is { id, path or paths, volume, minimumInterval, isMusic, maximumVoices, pitchVariation, playSeconds, fadeOutSeconds }. Picking a recording different from the previous one among several, limiting simultaneous instances of the same sound, pitch variation, playing only the first few seconds and fading out, background music crossfade and continued playback, music and effect buses. Mute engages if any one of these holds: the user button, the page being hidden, window focus loss on touch devices (prevents iPhone audio freezing and repeating on app switch), or an external mute supplied via setExternalMuteProvider (platform SDK, ads); meanwhile the AudioContext is suspended. If it does not resume after unmuting, it is woken again periodically. setAutoplayAllowedProvider can prevent waking before a tap. update() every frame
- LanguagePack: language bundles kept as asset JSON. (Functions under the LanguagePack import name) Reads languages.json (language list, fallbackLanguage, and per language code, name, englishName, fontGroup, direction, aliases, countries, file) and the table for each language. If the language in settings is empty, uses the language given via setPreferredLanguageTag (reported by the platform), then the device language, and the default language if not in the list. A missing key falls back to the default language's text, and if missing there too, to the key itself. translate, formatText({name}), readTextDirection, isolateText (direction isolation), the html lang and the tab title (setDocumentTitleKey). setLanguagePaths sets the paths, and setLanguageLoadedHandler sets what to do after a language is loaded (fetching that language's font). Localization (in-code tables) is unchanged
- UIFont: groups font subsets for multiple scripts under one font name. (Functions under the UIFont import name) Registers a FontFace for each subset split by Google Fonts with that subset's character range (unicode-range), so only subsets containing characters used on screen are downloaded. The selected language's group is placed right before Latin so Han characters render in that language's font, while digits and English letters always use the Latin font. Weights are registered as only two, selected together through a range. Subsets for characters to be used are fetched in advance (loadUiFontText, requestUiFontText), and the first subsets are waited for only up to a set time. The remaining groups are fetched a little later. configureUiFont sets the name, list path, weights and wait time, and readUiFontFace reads the FontFace to give to Text and ShadowText
- ToastMotion, attachToastMotion, readToastSeconds: enter and exit motion attached to a notification node. show(text, seconds, applyText) slides in from the outer side (setEnterSide, top or bottom) while growing slightly and settling back, then after staying, floats up, fades out and disables the node. If different text arrives while shown, the previous one moves aside quickly; if the same text arrives again, only the time is refilled and it pops. Movement stays only around the placed position as the reference. readToastSeconds lengthens the stay time for longer text. (UIToast builds queued pill notifications by itself; this animates a notification node built by the game)
- ButtonMotion, ButtonMotionStyle, attachButtonMotion, setButtonMotionArea, shakeButton: button feedback. Attached after UIButton, it reads the button state and scales the node up and down around its center. The normal style grows on hover, shrinks while pressed and pops on release. The inset style (inside windows) does not grow; while hovered it brightens the background and adds a white inner border. When not pressable, shakeButton shakes it left and right. The style is set per button (setStyle) or on an ancestor node with setButtonMotionArea. Touch devices do not use hover. When there is no feedback, the node is left untouched so it does not conflict with other effects. To make decorations on the button light up in their own shape, set a function with setLitHandler
- ToonMesh(graphics3d/toon/meshbuilder.js): builds vertex arrays for drawing toon 3D (clay-like single-color material and outlines). Puts box, rounded box, cylinder, sphere, lathe, capsule, torus and octahedron shapes into MeshBuilder as one mesh, transformed by position, rotation and scale. Vertices are position 3, normal 3, color 3 (sRGB), material 2 (emissive, unlit), pattern 4 (pattern index and color, meaning defined by the shader). Outlines are stored separately as a shell pushed out by the same thickness at every point (inverted hull), pushed so it does not stick out too far at corners. Triangle winding is corrected using the normal so the outside is the front face. Skinned models store bone indices and weights separately
- ToonGlb(graphics3d/toon/glbmeshreader.js): reads GLB painted with material colors without textures into MeshBuilder arrays. (readGlbArrays, per node readGlbNodeArrays, node info readGlbNodeInfos) Reads baseColorFactor as sRGB, emissiveFactor as emissive, and outline and basic from material extras. Reads the skeleton (skin) and motion (animations, extras), and writeSkinPose computes bone matrices for a single moment. (Blending with the previous pose, sway scale) Separate from the engine's SkinnedModel (textured PBR)
- ToonRenderer(graphics3d/toon/toonrenderer.js): toon renderer that draws ToonMesh and ToonGlb arrays. Sun (direction, color) and ambient light blending sky and ground colors, cel shading bands with setBandCount, per-vertex emissive and unlit, per-model tint and opacity; the outline shell draws back faces only. For skeletons, bone matrices from writeSkinPose are passed to drawMesh as jointMatrices. (Up to 96, same as the engine SkinnedModelRenderer) beginFrame records the previous draw state and endFrame restores it, so it can be inserted between engine 2D drawing (after flushBatch). readProgramSources provides the sources to pass to ShaderWarmer. Rebuilt from the board renderer of webgame-rimminer with game-specific parts such as ground patterns and screen-space lines removed
- ToonPostProcess: HDR finishing. Applies BloomEffect to the scene drawn into a half-float RenderTarget, and outputs to the screen with exposure, approximate ACES tonemapping and sRGB gamma. (begin, end, setExposure, setBloom) Same setup as the Rust vanilla-engine
- Graphic.drawRoundRect: computes the cos / sin of the 36 vertices from a table built once at module load, and writes vertices directly from coordinates written into a reused slot instead of creating a Vector2 array. (Removes 72 trigonometric calls, 36 Vector2 and 4 corner objects per node per frame) The table is built with the same formula as before (cos / sin of engine base/math.js), so vertex values are bit-identical. buildRoundRectPositions also uses the table. (The returned Vector2 array is still newly created as before) drawRoundRect no longer goes through buildRoundRectPositions
- Graphic: writeRoundRectPositionData(rect, roundSize), drawRoundRectPositionData(color). Writes rounded rectangle coordinates into a module slot, and draws the fill from that slot. (Used by drawRoundRect)
- Paint.draw: instead of creating one Rect (including its inner Vector2) and a copy of the content size on every draw, reuses a single rectangle kept in the module and receives the size via WorldNode.copyContentSizeTo. The rectangle passed to graphic's draw functions changes when the next Paint is drawn. (Nothing in the engine holds on to the received rectangle)
- WorldNode: copyContentSizeTo(target). Writes the content size into target without a copy. For subclasses that override getContentSize (UINode etc.), writes the value that function returns
- pushTransform of TransformNode, WorldNode: reads position, scale, pivot and content size without copies. (Four Vector2 per node per frame) TransformNode.applyLocalTransform(graphic) applies the local position, rotation and scale. Subclasses that override those getters are still read through the getters as before
- TransformMatrix: rotate(0) and scale(1, 1) return without computing the matrix. (The result is the same; they are called on every draw even for nodes that do not rotate)
- Graphic.pushState / popState: instead of creating a matrix copy and a state object on every save, writes the current matrix object and its values into a slot pre-created for each stack depth. On restore, writes the values back into the matrix object from save time and makes it the current matrix again. So a matrix obtained via getTransformMatrix() is still the current matrix after restore. (Previously, restore switched to the saved copy, so a previously obtained matrix was no longer the current matrix)
- TransformNode.setLocalPosition / setLocalScale, WorldNode.setPivot / setContentSize: copy the values into the owned vector instead of cloning the given vector. Getters still return clones as before, so the owned vector does not leak out
- Rect: the constructor and create() no longer clone freshly created Vector2 a second time through setters. (Rect.create goes from eight Vector2 to two)
- Color.clone(): creates a new Color by copying rgba directly, without going through Reflection.clone. (Like Rect.clone, returns a Color rather than a subclass; there are no Color subclasses in the engine) Called on every draw in places such as setFillColor
- Reflection.clone: scans the list of property names that have both a getter and a setter only once per prototype and reuses it. (Previously walked the prototype chain on every call) Copy order and values are the same
- Graphic.drawVertices: looks up uniform locations (modelMatrix, mainColor, tintColor, globalAlpha) only when the shader program changes, rather than by name on every draw call. (uploadDrawUniforms) The default program's tint and global alpha are not uploaded again if equal to the last uploaded values. Uploaded values are forgotten at frame start (applySettings) and when the program changes, and are always uploaded for a swapped-in program (setShaderProgramOverride). If a game uploads the default program's tintColor, globalAlpha uniforms directly, the next draw call may not correct those values. (Nothing in the engine does so)
- Engine: Counts the maximum FPS limit (EngineConfiguration.maximumFramePerSecond) by the number of processed frames. The number of frames processed since counting started sets the slot of the next frame (start time + count × interval), and only frames arriving more than 4 ms before their slot are skipped. Backlog is processed on the next frame so the average reaches the maximum FPS. Previously, a frame was skipped if less than the interval minus 4 ms had passed since the last processed frame, and the reference was reset to the time of the processed frame, forgetting the backlog, so the limit was off when the refresh rate was not divisible by the maximum FPS. (At 60 FPS, 90 Hz skipped every other frame for 45, 144 Hz gave 72, 75 Hz skipped none for 75) When behind by more than one frame (window hidden and restored, etc.), does not catch up in a burst and restarts counting from that time. Processing a frame that arrives less than 1 ms before its slot restarts counting from that time, so on displays whose refresh rate is almost the same as the maximum FPS (60.05 Hz, etc.), small leads no longer accumulate into an occasional skipped frame. Changing the maximum FPS restarts counting. 60 FPS on a 60 Hz display and maximum FPS values that divide the refresh rate (30 FPS at 90 Hz, etc.) are the same as before.
- UIDocument: getReflectedProperties(component) exposes the list of a component's matching get (or is)/set properties. (Used by the editor's inspector) Added Outline, SoftShade, ShadowText, UIProgressRing to the component type table
- Rendering: Skips calls that rebind the same shader program and the same texture. Graphic remembers the program it last put in use and the texture bound to texture unit 0, and does not call useProgram, bindTexture when they are the same. (useShaderProgram, bindTexture) Batched drawing (flushBatch) and particle drawing (drawColoredQuads) no longer switch back to the default program after drawing and leave it to the next drawer to use its own program, so consecutive batches do not switch programs back and forth. The rendered result is the same. (Capturing the same frames with a fixed clock and random numbers from the examples uishowcase, uisample, spriteeffects, particleeffects, timelineshowcase and a test scene mixing external GL, ShaderSprite, ScreenEffect, two scenes and mipmap switching gives pixels identical to before the change with batching both off and on)
- Engine: Forgets Graphic's binding cache before each scene draws (preDraw, or drawOnLoad while loading). (External WebGL may have changed textures between the previous scene's draw and this scene's update)
- Text: Keeps the array of wrapped lines and re-splits only when the text, font, size, bold, italic, width or wrap mode changes, a web font finishes loading (loadingdone), or font faces are added to or removed from the document. (readWrappedLines) The per-word and per-character measureText on every draw is gone
- Sprite.draw: Removes the four Vector2 created on every draw (position, content size copy, flip, multiplied size) and the Rect when there is no image rect. Reuses module vectors, gets the size with WorldNode.copyContentSizeTo, and draws the whole image directly when there is no rect. Graphic.drawImageWithImageRect also no longer creates a Rect when there is no rect
- Graphic.beginClipRect: Does not copy the rect and transform matrix, writes the values into slots preallocated per clip depth. endClipRect copies only the values instead of making that slot the current matrix object. (popState restoring the matrix from begin is unchanged) Mask.beginClip also no longer creates a new clip rect
- TextStringTextureCache.getEntry: Does not build a key string on every lookup, compares the remaining values (mode, direction, scale, stroke width, color, font) in the per-string entry list. The key string is built once when baking and stored in the entry. (LRU order and limit, invalidateFontFaces are unchanged)
- ParticleSystem: Instead of removing expired particles one by one with splice (shifting the rest each time), compacts the living ones toward the front. (Draw order is unchanged) Image particles no longer create two Vector2 on every draw
- Graphic: isCullingEnabled(), isLocalRectVisible(rect) (whether a rect transformed by the current transform overlaps the drawing buffer), addCulledNodeCount(count), getLastFrameCulledNodeCount(). Added a culledNodes line to the engine statistics (useStatistics)
- HeatHazeEffect(experimental): Rewrote the Canvas2D-era code, which called the nonexistent graphic.getCanvasRenderingContext(), for the current WebGL Graphic. Draws pending batches first, then captures the screen bounding box of the node area into a texture with copyTexSubImage2D, and draws one quad per row with vertex color quads (drawColoredQuads), shifted along a sine curve. (Same approach as Rust vanilla-engine, with zero wobble the pixels are identical to the screen without the effect) When the area goes off screen, the edge pixels are stretched. Uses content size and pivot, so it inherits WorldNode instead of TransformNode. (TransformNode has no setContentSize, getWorldBounds, so it crashed on creation) The captured texture is deleted by destroy()
- Input: Moves the input that released games (retrogame-foundyou, steamgame-apocalypsesurvival, space-creature, aberrant, webgame-rimminer) each built separately on the game side into the engine defaults. (Game code was not touched, the games keep using their own as now)
- GamepadKind, readGamepadKind(gamepadId): Classifies the kind by pad name (Gamepad.id). PlayStation (054c, playstation, dualshock, dualsense, sony), Nintendo (057e, nintendo, joy-con, pro controller), Xbox (045e, xbox, xinput, microsoft), anything else other
- GamepadManager.vibrate(strongMagnitude, weakMagnitude, seconds): Vibrates all connected pads with the browser vibrationActuator dual-rumble. Magnitudes are clamped to 0 ~ 1. Pads and browsers without a vibration actuator are skipped
- GamepadManager.getActiveGamepadId(): The name of the pad that pressed a button or tilted an axis more than 0.5 in the last update. (Empty string if none, for telling which device was used last)
- GamepadManager.setInputLogEnabled, isInputLogEnabled: Turns off and on the console.log printed on every button and axis change. Changed default behavior: off by default, so button and axis logs are no longer printed. (Moving a stick even slightly flooded the log every frame, and no game relies on the log) Connection and disconnection logs are still printed
- InputManager: Held state and this frame's press and release of the three mouse buttons (MouseButton.left, middle, right) (setMouseButtonDown, isMouseButtonDown, isMouseButtonJustPressed, isMouseButtonJustReleased). A press and release between frames is also caught in that frame. Same form as Rust vanilla-engine
- InputManager.setTouchFromLeftButtonOnly: When on, only the left mouse button is passed as touch. When off (default), any button is touch as before
- InputManager.setContextMenuPrevented, isContextMenuPrevented: Whether to block the canvas right-click menu. Initially true, same as before
- InputManager.isKeyJustPressed, isKeyJustReleased changed behavior: Instead of comparing key snapshots at frame end, accumulates and checks key events (pushKey, popKey) that arrived since the end of the last frame. Fixed missing keys pressed and released between frames. (In that case isKeyPressed is false and isKeyJustPressed and isKeyJustReleased are both true) Key repeat while held (keydown repeat) is not a new press. updateFrameSnapshot clears the accumulated events
- TouchPoint, TouchPhase, InputManager.getTouchPoints(), getEndedTouchPoints(): list of fingers currently touching. Per finger: identifier (Touch.identifier), phase (began, moved, stationary), canvasNativePosition, viewPosition. Fingers lifted this frame stay in getEndedTouchPoints for one frame as ended or cancelled. The engine calls beginTouchPoint, moveTouchPoint, endTouchPoint for each changed finger of touchstart, touchmove, touchend, touchcancel, and removes fingers missing from the event's touches as cancelled. The first finger still goes to touch as before
- ViewManager.convertClientToView(clientX, clientY): converts a DOM event's screen coordinates to view coordinates
- InputDevice, InputManager.getLastInputDevice, getLastGamepadKind (setLastInputDevice, setLastGamepadKind): the last used device (keyboard, mouse, touch, gamepad) and gamepad kind. A key press means keyboard, mouse buttons, wheel and movement over 6 pixels mean mouse (excluding emulated mouse events within 0.8 seconds after a finger is lifted), fingers mean touch, gamepads mean gamepad and its kind via getActiveGamepadId. Initially touch on finger devices (pointer: coarse), otherwise keyboard
- InputManager.setPreventedKeys(keys), getPreventedKeys, isKeyPrevented, isTypingInTextField: keys whose default browser behavior is prevented (such as focus movement on Tab, page scrolling on Space). Not prevented while focus is in a text field (the text input, textarea, contenteditable of Engine.isTextInputFocused, and select). Empty by default, so behavior is unchanged
- InputActions (inputactions.js): input actions. InputManager holds one (getInputActions) and updates it in tick. Binds keys (bindKey), gamepad buttons (bindGamepadButton), and one side of a gamepad axis (bindAxis(action, axisIndex, direction), pressed when tilted by setAxisPressThreshold) to action names, and unbinds with unbindAction. isPressed, isJustPressed, isJustReleased, readValue (0 ~ 1), readAxis(negativeAction, positiveAction), readGamepadStick(xAxisIndex, yAxisIndex), readMoveAxis (the longest of WASD and arrow keys, left stick, and external sources, length at most 1). The dead zone (setDeadZone, default 0.2) is removed and the rest is rescaled to 0 ~ 1. Actions with setRepeat(action, delaySeconds, intervalSeconds) have isJustPressed true on repeats while held, and do not repeat in bulk after a long frame stall. External sources (addSource, removeSource) are objects with readActionValue(action), readMoveAxis(), readGamepadKind(), through which games plug in platform SDK gamepads. Keys are ignored while typing in a text field (setKeysIgnoredWhileTyping). A key pressed and released between frames still counts as one press
- Engine: also releases the three mouse buttons when the window loses focus (blur). (InputManager.clear also clears the finger list, mouse buttons, and input actions)
- Camera3D (graphics3d): perspective (setPerspective) and orthographic (setOrthographic), aspect ratio (setAspectRatio), lookAt, and view and projection matrices cached and recomputed only when values change (getViewProjectionMatrix, getInverseViewProjectionMatrix). projectToView(x, y, z, viewRect) computes a world point's position inside the 3D drawing rectangle and whether it is in front of the camera (isInFront), unprojectToPlane(viewPosition, planeHeight, viewRect) computes the point where the ray from a position in the rectangle meets the horizontal plane y = planeHeight, and readViewDepth computes view-space depth. The renderer and 2D overlays use the same camera. (Replaces webgame-rimminer, aberrant, steamgame-apocalypsesurvival rebuilding createLookAt, createPerspective per screen and computing projection by hand)
- ToonRenderer: setScreenRect(x, y, width, height), clearScreenRect, getScreenRect. Draws only inside the node rectangle. beginFrame moves the clip space of view and projection into the rectangle and cuts off the outside with scissor, and endFrame releases the scissor. Off-screen culling uses the frustum before the move. beginFrameWithCamera(Camera3D), drawMeshOutline (draws only the outline, not counted). Without a screen rectangle, behavior is unchanged
- ToonDrawQueue: collects the models to draw in a frame, then draws opaque bodies, outlines of opaque ones, and translucent ones (farthest from the camera first, depth write off) in that order. addMesh, addMeshInstanced, drawShadows(renderer, shadowMap), draw(renderer, camera). (From the queued drawing of steamgame-apocalypsesurvival ModelRenderer3D)
- Graphic: runExternalPass(callback, { clearDepth }) and clearDepthBuffer(). Inserts a WebGL pass between 2D draws. Draws the preceding 2D batch (flushBatch), clears depth, then calls callback, and when done (even if it throws) calls restoreRenderState. Clearing depth after setting a clip (stencil) once caused no 3D to be drawn at all on Galaxy Fold3 (Adreno 660) (webgame-rimminer), so nodes that draw 3D inside a clip call clearDepthBuffer before beginClipRect and pass clearDepth: false. (Four game nodes wrote the same sequence by hand)
- ToonView3D (component): draws toon 3D inside the node rectangle. Transforms the content area with the current transform into a drawing buffer rectangle, and inside runExternalPass sets the renderer's screen rectangle and calls the draw function (setDrawCallback). The renderer is created on first draw, and on devices where it cannot be created it is not retried and the 2D setFallbackDrawCallback draws instead. To share one renderer across multiple nodes, setRenderer. The aspect ratio of the camera (getCamera) is matched to the rectangle on every draw. Inside a parent Mask, setDepthCleared(false) and clearDepthBuffer avoid the pitfall above
- ToonPostProcess: setColorGrade(saturation, contrast, tint color, tint amount, haze color, haze amount), setVignette (darken edges). Applied after tone mapping and gamma. The tint color is multiplied after normalizing its brightness to 1, and haze lifts darker areas more toward its color. With default values (saturation 1, contrast 1, the rest 0) there is no grading, so behavior is unchanged. To output to a node rectangle, call resize (rectangle size), then pass the rectangle as the viewport of end. Bloom is the existing setBloom. (From the color grading of steamgame-apocalypsesurvival SceneEffects3D)
- ToonMesh: MeshBuilder.combine(pieces) offsets multiple static pieces ({ arrays, offset: [x, y, z] }) and joins them into one array. Outline shells, shell reference positions, and inner ranges are also offset and joined, skeletons are not joined. createFacetedChunkGeometry(radius, vertex scale, axis scale) is a faceted rock made by stretching and shrinking each of the 12 icosahedron vertices, with separate vertices per face. (steamgame-apocalypsesurvival combineMeshArrays, webgame-rimminer meshbuilder.js)
- GraphicsQualityGovernor, GraphicsQuality(auto, high, low): decides the lite path (isLite) in the order override (?light of applySearchText, setLiteOverride) → setting (low always, high never) → auto (setAutoLiteDefault, or FrameProbe measures the device as slow). update(frame seconds, maximum frame) measures only in auto and returns true on the frame the lite path changes. setRenderPixelRatioLimits(normal, lite path) and applyRenderPixelRatio(viewManager) apply the render pixel ratio cap only when it changes. What to reduce on the lite path is up to the game. (webgame-rimminer readIsLite, aberrant isLight)
- Loading, saving, and time features that shipped games built separately are added as engine defaults. (The games' screen looks and release platform code were not brought over, the only changed default behavior is LocalStorage reads)
- TimeManager: setMaximumTimeDelta(seconds), getMaximumTimeDelta(). Changes the cap on a single frame interval. (Previously hardcoded at 0.25 seconds, the default is unchanged) Games where water or physics must not advance in large steps lower it to 0.1, 0.05. Below 0 or not a number gives 0.25
- Engine: setMaximumFramePerSecond(n), getMaximumFramePerSecond(). Changes the maximum FPS at runtime. Writes to EngineConfiguration.maximumFramePerSecond, and the engine reads that value every frame and restarts counting from the frame it changes. (Same result as games editing the configuration object directly) Below 0 or not a number gives 0 (no limit)
- FixedStepper: fixed step. advance(timeDelta, stepFunction) of new FixedStepper(stepSeconds, maximumStepsPerFrame) calls stepFunction(stepSeconds) for the accumulated time and returns the remaining fraction (0 ~ 1, used to blend the previous and current step when drawing). If steps remain after running up to the per-frame cap, the remaining time is discarded (so slow devices do not catch up in bulk), and if stepFunction returns false, that frame stops there and the time stays accumulated. getAlpha, getLastStepCount, reset, setStepSeconds, setMaximumStepsPerFrame
- LocalStorage: reads (getString, getBoolean, getNumber) no longer write the default value for missing keys. (This changes default behavior) Merely reading created the key in storage, so after a default changed in a new version the old default remained as if it were a saved value, and containsKey was always true. Of the six shipped games, only pipemania uses the engine LocalStorage, and it only uses read values and does not check whether keys exist (containsKey, getKeys), so it does not rely on this behavior. (2026-11-25 grep of game code) Keys that were only read no longer appear in the storage panel of developer tools
- PersistedStore: setStorageBackend(backend), getStorageBackend(). Places just one store elsewhere (an object with getItem, setItem, removeItem). Swapping re-reads from there and notifies subscribers, and access there is also wrapped in try. Reading at construction no longer creates empty keys in storage either, due to the LocalStorage change above
- AssetLoader: concurrent asset loading. Add with addImage, addJson, addText, addBlob, addAudio, addFont(family, path, descriptors), addAsset(asset, path), addTask(path, loadFunction), and await load() fetches setConcurrency (default 6) at a time. Does not stop on failure and returns the failure list ({ path, error }). getProgress (finished count / total count), getLoadedCount, getFinishedCount, getTotalCount, getFailedList, isFinished, setProgressHandler, setCompleteHandler
- GameScene: loading screen customization. setLoadingColors(background, gauge background, gauge, outer) changes only the colors, setLoadingDrawer((graphic, viewSize, progress, elapsedSeconds) => ...) replaces the whole drawing over the background. When progress is reported with setLoadingProgress(progress) or trackAssetLoader(assetLoader), the gauge smoothly follows that progress instead of the elapsed minimum display time (LoadingProgress of getLoadingProgress), and fills to 1 when loadAssets finishes. If nothing is set, behavior is unchanged. (black background, #333333 and #ffffff gauge, elapsed time gauge)
- ToonScreenOutline, ToonOutlineWidthUnit: toon screen-space outline. (Brings into the engine the shader outlines that webgame-rimminer boardrenderer3d.js and aberrant scenerenderer3d.js wrote separately) Draws ToonRenderer models once more with the same matrices to write normals, line ids, and depth into a line buffer (beginLineIds, drawMesh, drawMeshInstanced, endLineIds), writes a line intensity mask in one pass, then blends it onto the screen with drawOutline. Lines appear outside silhouettes, where different ids meet, and at creases within one id. Which id to give which model and part (indexStart, indexCount), and per-instance ids (instances[i].lineId), are decided by the caller. Width in world length or pixels (setWidth, perspective world width at the distance of setFocusDistance, or the average distance of drawn models if not given), depth tells orthographic from perspective by the projection matrix and is linearized to meters for perspective. setDepthThreshold, setCrease(angle, intensity, continuation pixels), setResolutionScale(0.25 ~ 1), setSampleCount(outline 4 ~ 28, crease 0 ~ 4), setColor, setHdrOutput. Uses the viewport at beginLineIds as the drawing area, so it also fits 3D drawn on part of the screen. Can be used together with shell outlines
- ToonVfx, ToonVfxSlot, ToonVfxLook, ToonVfxShape, ToonVfxDecalMode: base for toon 3D GPU effects. (General-purpose parts of webgame-rimminer boardvfx.js and aberrant effects.js, effect recipes and ramp colors belong to the games and were not brought over) An atlas built in code without image files (16-cell smoke flipbook, particle, streak, light ray, shock band, beam texture, scorch, crater, rim glow, eight color ramp rows), instanced GPU particles (emitParticles: shapes point, sphere, ring, disc, cone, line, drag, gravity, stopping at the floor, stretching along velocity, ramps, seven looks), fireballs (addFireball), shockwave bands and floor glow (addShockwave), floor marks (addDecal, queueDecal, scorch, glow, flowing ring, expanding growth), smoke plumes (addPlume), lathe beams (queueBeam), ribbons (queueRibbon) and coiling downward lightning (queueLightning), glints (queueGlint). An internal clock advanced by update(seconds), a particle cap (constructor, setParticleCapacity, oldest overwritten first when exceeded) and an emission count ratio (setCountRatio, phones and lite path), ramp colors (setRamps), a floor height callback (setFloorHeightReader, marks, shockwaves, plumes are placed at that height and isGrounded particles stop). draw(view, projection) faces beams and ribbons toward the camera position in perspective and toward the camera direction in orthographic, and restores the draw state
- Window stacking and screen frames that shipped games (webgame-rimminer, aberrant, steamgame-apocalypsesurvival, space-creature) built separately were moved into engine defaults. (Panel looks, themes, presentation, and release platform code were not brought over, games keep using their own as before)
- UIWindowLayer: window stacking. openWindow stacks a window on top and only the top window is visible. closeWindow removes it from the list immediately (pressed and covered states are released immediately) and detaches it after the PopupMotion close motion finishes. (covered windows immediately) closeAllWindows, closeTopWindow (back navigation, does not close windows with outside close disabled), getTopWindow, findWindow, hasOpenWindow, getWindowCount. Calls the function of setWindowChangeEvent when a window opens or closes (pausing play). The layer scales by UIScale.read (setUIScaleOptions, null for no scaling, getUIScale) and tells windows the area size divided by that (setViewSize) and the safe area width (setViewBleed). Wheel goes to the top window's handleWheel, or if not handled, to the scroll view at that position (scrollWindowAt)
- UIWindow: a single window. Shows a panel centered over a dim (which swallows presses) covering the whole area and the safe area. The panel widens to the area width but not beyond setMaximumWidth (default 480), its height is the value returned by layoutContent(panelWidth) (default setPanelHeight), and if larger than the area the whole panel is scaled down. Pressing outside closes it (disabled per window with setOutsideCloseEnabled). close, setCloseEvent (notified when it goes down). The panel look is a single Paint, and games subclass it to attach decorations to the frame (getFrameNode) and override layoutPanel, applyMotion, setCovered, handleWheel, dispose to swap them. getPanelNode, getPanelPaint, getDimPaint, getPopupMotion
- UIConfirmWindow: Confirmation window. Title, message, and two buttons, cancel and confirm. Text wraps at the panel width, and when it exceeds the area height, only the text area scrolls. With setRightToLeft(true), the button order is reversed (confirm on the left). Confirm closes after setConfirmEvent, and closing via the cancel button, an outside press, closeTopWindow or closeAllWindows calls setCancelEvent. setTitle, setMessage, setButtonTexts. (UIDialog is left as is)
- UIScale.read(viewWidth, viewHeight, options): Scale that enlarges only the UI layer when one view unit is smaller than minimumCssScale(0.8) CSS pixels. (1 to maximumScale 1.8, short screens are not enlarged below minimumLayerHeight (not checked when it is 0, the default), portrait screens (width at most portraitRatio 1.1 times the height) have no upper limit, ViewManager.getCssPixelScale if cssPixelScale is not given) UIScale.isPortrait
- GameScene: fadeScreen(onDark). Calls onDark when fully dark, and if it returns a Promise, stays dark until it ends (even on failure), then brightens. false if already fading. setScreenFadeColor(default black), setScreenFadeSeconds(default 0.35), isScreenFading, getScreenFadeAlpha. The overlay is drawn in postDraw over the whole canvas including the safe area, and moves with unscaled time. While the overlay is up, presses and wheel are not accepted
- GameScene: isUserInterfaceAt(viewPosition) (whether there is a pressable node at that position, the previously hidden touch recognizer raycast), setPlayInputHandler({ press, move, release, wheel }) (passes presses not taken by the UI, the moves and releases of those presses (including cancel), and wheel outside the UI, as play area coordinates relative to the top-left of the safe area), convertViewToPlayArea. Wheel pointing inside the window layer is passed to UIWindowLayer.scrollWindowAt
- GameScene: setPlayAreaReference(fixedLength, isLandscape). Extends the reference resolution so that the fixed-side length of the play area excluding the safe area is always fixedLength. (canvas length : length excluding the safe area = reference resolution length : fixedLength, the view scale mode is also set to stretchWidthExpandHeight for horizontal fixed and stretchHeightExpandWidth for vertical fixed, recalculated in resize and initialize)
- ViewManager: setIgnoredSafeAreaSides(sides), getIgnoredSafeAreaSides. getSafeAreaInsets returns 0 for those sides. (The game passes which sides to ignore)
- GameScene behavior change: computeSafeAreaRect reads ViewManager.getSafeAreaInsets instead of measuring env(safe-area-inset-*) separately. Until now, setSafeAreaOverride, the URL's ?safeArea=, and (new) setIgnoredSafeAreaSides did not reach the GameScene safe area node. Games that use only env values are the same, except that insets are no longer truncated to integers. (Games that override computeSafeAreaRect are unchanged)
- The text, node convenience, and drawing features and optimizations that the shipped games (webgame-rimminer, space-creature, aberrant, retrogame-foundyou, Doomsday Survival) built and used separately are added to the engine defaults. (The games' screen look and presentation were not brought over, game code is unchanged)
- Text, UILabel: setFitWidth(width, minimumRatio = 0.55), getFitWidth, getFittedFontSize. When single-line text overflows the fit width, it is drawn shrunk from the original size down to the minimum ratio in steps of 0.1. The set size (getFontSize) stays the same, and it refits when the text, font, weight or width changes or a web font is loaded. If it still overflows at the minimum ratio, it is drawn overflowing. Wrapping text and rich text are not fitted
- Text, UILabel: setLetterSpacing(letterSpacing), getLetterSpacing. Spacing added after each grapheme cluster (pixels, same meaning as CSS letter-spacing, negative narrows, initially 0). The text width grows by cluster count x spacing (also added after the last character), and wrapping, fit width, alignment and underline measure with that width. Positions are set by measuring the previous/next pair per cluster, so pair kerning is kept, and the width matches what the Chrome canvas letterSpacing measures. Right-to-left text and rich text do not use the spacing. Same as the Rust version's set_letter_spacing and get_letter_spacing
- Engine.openUrl(url): opens an outside URL in a new tab (window.open(url, "_blank", "noopener")). It opens only when called inside user input (click, tap, key) handling; called regardless of input (timer, frame), the browser blocks it. Only http, https, mailto and tel are opened; other forms (such as javascript: and file:) return false. The Rust version's Engine::open_url opens with the OS default program on desktop (macOS open, Windows ShellExecuteW, Linux xdg-open) and with window.open on the web
- UIView.setBackdropBlur(blurRadius), getBackdropBlur: backdrop blur (same meaning as CSS backdrop-filter: blur() and Unreal UMG BackgroundBlur, initially 0 meaning off). The argument is a standard deviation equal to the N of CSS blur(Npx) (in node coordinate units; on screen, device pixels after the transform scale). When on, as this view is drawn, the screen drawn before it is blurred over this view's content area only with ScreenEffectType.gaussianBlur (separable Gaussian, horizontal then vertical, out to 3 sigma, linear sampling halving the taps, mirrored edges), and the (translucent) background color is laid on top. The average pixel difference from Chrome's CSS backdrop-filter is under 1 (standard deviations 3, 8, 20, tests/ui/uibackdropblurcss.test.mjs). It works only when drawing to the screen, and the geometry cache is not used while it is on. When off, the screen is byte for byte unchanged. Same as the Rust version's UIView::set_backdrop_blur and get_backdrop_blur (pixel-identical across the two engines)
- UIView.setBackdropCornerRadius(cornerRadius), getBackdropCornerRadius: rounded corners (CSS border-radius) for the backdrop blur and the background color. While the blur is on, the blurred area and the background color are laid only inside the rounded rectangle. Initially 0 (a rectangle). Rust version: set_backdrop_corner_radius, get_backdrop_corner_radius
- ScreenEffectType.gaussianBlur: Gaussian blur by standard deviation (parameters = [standard deviation in pixels], the same meaning as CSS filter: blur()). The existing blur is unchanged. Rust version: ScreenEffectType::GaussianBlur
- Engine.readLocalTime(minuteOffset = 0): returns the calendar time { year, month (1 to 12), day, hour, minute, second, weekday (0 is Sunday) } of now plus the minute offset, read in this machine's time zone. Daylight saving time at the added moment is applied (same as new Date(Date.now() + offset)). When a game needs local time for a clock display or logs, both engines read it with the same name. The Rust version's Engine::read_local_time reads it with Date on the web, localtime_r on Mac and Linux, and SystemTimeToTzSpecificLocalTime on Windows
- Bone matrix uniform block (the same road as Unity's GPU skinning constant buffer and Unreal's bone buffer): 96 bone matrices are 384 vec4 slots, which exceeds the minimum vertex uniform limit WebGL2 guarantees (MAX_VERTEX_UNIFORM_VECTORS 256 slots), so it ran on desktop (4096) but failed to link on Android (Galaxy Z Fold3). Bone matrices now go through the std140 uniform block JointBlock (6144 bytes, within the guaranteed MAX_UNIFORM_BLOCK_SIZE of 16384 bytes). Added: JOINT_BLOCK_GLSL (the declaration to put in a shader), JOINT_BLOCK_MAXIMUM (96), JOINT_BLOCK_NAME, JOINT_BLOCK_BINDING (3), JointBlockBuffer, MORPH_WEIGHT_VECTOR_COUNT (24), SkinnedModelRenderer.uploadJointMatrices. The toon renderer, toon outline, skinning renderer, and skin renderer all use this road, and ShaderProgram binds the JointBlock block to the same place after linking. The morph weight array went from 96 floats (96 slots) to 24 vec4 slots. tests/graphics3d/uniformlimitchrome.test.mjs checks in Chrome that every program the engine builds stays within the limits (256 vertex, 224 fragment). The screen is unchanged
- Text, UILabel: measureText(text, fontSize) (if not given, the current text and set size). Width measured with that Text's font, bold and italic
- Text.setText, UILabel.setText: skipped if the text is the same. (For UILabel, when not in rich text mode, it does not trigger an intrinsic size recalculation) Text.setTextColor: does not re-parse if the color string is the same and the held color is unchanged
- Text drawing: passes Color directly to Graphic instead of converting the color to a "#rrggbb" string. (No more string creation and parsing every frame) Colors that do not fall on 8 bits (such as 0.5 alpha in rgba) may differ within 1/255
- Graphic: setTextBakeMotionScaleStep, getTextBakeMotionScaleStep(default 0.25), setTextBakeScaleMoving, isTextBakeScaleMoving, readNodeTextBakeScaleMoving. When the text bake scale step (setTextBakeScaleStep) is 0 and the transform scale of the drawn node differs from the previous frame (ButtonMotion, PopupMotion, tweens, camera zoom), text is baked at a scale quantized to this step, and rebaked at the exact scale when it stops. (Text is not rebaked every frame during scale motion, a button growing from 1 to 1.09 goes from as many bakes as frames to 2) A node drawn for the first time is treated as not moving. When the step is not 0 (default), nothing is computed. ShadowText and ShadowImage use the same scale too
- TransformNode: setLastDrawnMaximumScale, getLastDrawnMaximumScale (used by Graphic.drawNode)
- ShadowText, ShadowImage, SoftShade: Baked images with the same shape are shared per key. The number of components using each key is counted, ones in use are not discarded, and ones no longer used by anyone are kept up to 128 and evicted least recently used first. Released when detached from the node (detach), and components collected without releasing are released by FinalizationRegistry. (acquireSharedBake, releaseSharedBake, readSharedBakeCount in sharedbakecache.js) ShadowImage assigns a number to each image to use as the key, and assigns a new number on setImage
- WorldNode: setContentSizeXY(width, height), setRect(x, y, width, height) (sets local position and content size, accounting for the pivot, so that the top-left is at (x, y), the anchor is not part of the local position calculation and stays as is), convertViewToLocal(viewPosition) (view coordinates through the parent transforms to coordinates relative to the top-left of the content area, same four-corner calculation as contains). TransformNode: setLocalPositionXY(x, y), setLocalScaleXY(x, y). XY functions do not create Vector2
- LanguagePack: isRightToLeft(), mirrorLayoutX(x, width, parentWidth), readLayoutTextAlign(align). When the current language is written right to left, flips the horizontal layout position and the left and right of alignment
- TouchRaycaster.touchWheel: The wheel is taken by the frontmost scroll view in draw order among those covering that position. (Taken even when scrolled over non-pressable things such as text or images inside the view, until now only ancestors of pressable nodes were searched, so wheel over text inside a view was lost) If the frontmost is a pressable node, the scroll view of that node and its ancestors takes it as before. true if a view took it. findWheelScrollView, findScrollViewComponent
- GameScene.touchWheel: Returns true if a scroll view took it. Overriding game scenes that pass to the game (map zoom, etc.) only when super.touchWheel is false do not conflict with window scrolling
- Graphic: drawRing(center, innerRadius, outerRadius, startRadian, endRadian) (setFillColor), drawArc(center, radius, startRadian, endRadian, lineWidth) (setStrokeColor). Joins one quad per segment without overlap and draws in one pass, so seams do not darken even when translucent. Segment count follows the on-screen radius like drawCircle (16 to 64 per full turn), in proportion to the drawn angle. Angle 0 is right, clockwise
- Graphic: drawLineSegments(positionValues, size) (setStrokeColor). Draws multiple line segments at once from one number array (x0, y0, x1, y1 per segment). Does not create Vector2, and when the vertex buffer fills, draws up to there and continues filling
- SpriteAtlas: Atlas reading. load(jsonPath), loadData(data, baseDirectory), readFrame(name) (Frame, null if missing), hasFrame, applyFrame(sprite, name), getPageImages, getFrameNames. Reads the JSON from tools/atlas.cjs and the { pagePaths, frames: { name: [page, x, y, width, height] } } form. Names are also found with the extension removed. Multiple atlases are searched in the order added with SpriteAtlas.addSearchAtlas (findFrame, applySearchFrame, removeSearchAtlas, clearSearchAtlases)
- Sprite.setFrame(frame): Sets the Frame's image and region together. (null clears the image)
- ParticleSystem: isFinished(nothing more to emit and no particles left, for non-looping when duration has passed and all bursts have been emitted), getParticlePositionList(list of particle positions, for same-seed comparison and testing). With the same seed as the Rust version, the same particle positions result
- HeatHazeEffect: Moved from an experimental node to an effect component. (src/effect/heathazeeffect.js, exported from import.js) Attach with node.addComponent(HeatHazeEffect), and when attached, if the node content size is empty, it is set to 300 x 300. getTimer, calculateRowOffset
- ScreenEffect: destroy also deletes the pass program and vertex array along with the render target
- Material.createTexture: Loads images with straight alpha and no color profile conversion. (premultiplyAlpha and colorSpaceConversion of createImageBitmap set to "none") Until now, with browser defaults alpha was premultiplied, making the color of alpha 0 texels black, and the edges of the hair and beard cards in OLD FACE were dark
- ToonRenderer, SkinnedModelRenderer, HumanSkinRenderer: Bind a 1x1 comparison depth texture to the shadow unit when not receiving shadows. (Prevents the Mac driver's "sampler type (Depth)" warning and the WebGL sampler mismatch) SkinnedModelRenderer.getEmptyShadowTexture, ToonRenderer.destroy
- ToonVfx: rim for light particles and light dots (0 is additive light, 1 is covering with a rim, negative is a faintly covering halo), glow bleed color for ribbons and lightning, setRimColor, lightning that re-bends over its life addLightning(life), screen flash addFlash, camera shake computed with the engine Shaker addShake, readShake, isShaking. lightningCount, flashCount in getActiveCounts. draw also restores the depth function. (Only the general-purpose part of the effects of the game aberrant, game colors and recipes as parameters)
- SkinnedModel: Loading from bytes, separate parsing and upload, createWithoutShaderProgram(pose computation only), destroy. Default morph weights are read from glTF node weights. Material.createImageDescription, destroy. destroy for ShadowMap, FullscreenPass and screen-space effects (also deletes the fullscreen pass). FbxLoader reads 64-bit ids above 2^53 exactly and skips missing nodes
- Camera2D: Rotation (setRotation, getRotation, degrees, axis at the screen center). The draw transform, screenToWorld, worldToScreen, panByScreen, fling and zoomAt follow the rotation, and the bounds clamp is measured with the box enclosing the rotated view (getVisibleHalfExtent). convertScreenDeltaToWorld, begin, end (pushState and applyTransform, popState). Covers all features of deprecated/camera.js (formerly experimental/camera.js). (Also fixed the clamp argument bug in Camera.setZoom)
- Tween: setTarget(node), getTarget, writes TweenProperty (localPosition, localScale, localRotation, localOpacity, contentSize) values directly to the node, applyTweenProperty, Tween.createNodeTween. Ends without callbacks when the target is detached from the node tree it first ran in. duration of 0 or less ends immediately. Scene.getTweenCount
- Animator: AnimationState setClip, getClip, AnimationTransition setFrom, setTo, getFrom, getTo (state index), getAnimation, addState, getStates, addTransition, getTransitions
- Indicator: getRadius, getRotation, buildTeethSegments, exported from import.js. Removed the unused argument of Visual.getLocation. VisualAsset setVisual, getVisual
- UI branch: Removes UI feature differences with the Rust vanilla-engine. Adds general-purpose features that existed only in Rust
- UIButton.fireClickEvents(): Calls the clicked and click notifications in order as if a click occurred, without pressing. UIHitArea uses this when passing on clicks in its enlarged area
- UILineChart.calculatePoints(width, height), UIBarChart.calculateBarRects(width, height): Compute the polyline points and bar rectangles at the same positions as drawing. draw uses these
- UISpinner: calculateDotOpacity(dotIndex), getDotColor, getRotationSpeed, getDotNodes
- UIScrollBar: getAxis, getThumbRect (null if the thumb is off)
- ToastMotion.getPhase(), ToastPhase exported. PopupMotion.isInstantEnabled(). UIImageView.getColor()
- UILabel: getWrapMode, getVisibleCharacterCount. UIInputField: getPlaceholder, getMaxLength, getFontSize, getPadding, getBackgroundColor, getRoundSize, getTextColor, getPlaceholderColor, getCursorColor, getCursorIndex, getSelectionStart, getComposition, isComposing
- UIWindow: setDimColor, setPanelColor (Paint colors of the dim and the panel)
- UIListView: setCreateItemEvent(() => WorldNode) accepts a function that creates item nodes instead of a template. If the item size is not set, reads the size of the first created item. isHorizontal()
- TouchRecognizer: getTouchTarget (the scroll view node if the drag was handed over), isTouching
- GameScene: setSafeAreaInsets({ top, right, bottom, left }) sets the safe area insets directly in CSS pixels. (null uses the view manager value, the play area reference also uses this value) Static calculateSafeAreaRect(viewSize, targetResolutionScale, insets). setPlayInputEnabled(true) collects play input, and takePlayInputs() takes out { kind, position, wheelDelta }. (Can be used together with the handler) setLoadingOutsideColor, hasLoadingDrawer, isLoadTouchedToSkip, getDevTools
- UIScene: when EngineConfiguration.useDevTools is off, does not create the developer tools, like GameScene. (Previously always created them)
- Aligned text and fonts with the Rust version (vanilla-engine):
  - Visible character count (Text.setVisibleCharacterCount) and Typewriter count in grapheme clusters. (Previously in UTF-16 units, so emoji and combining marks were split) Fixed multi-line text drawing the whole next line when the remaining count dropped below zero. (At 0, nothing from the next line on is drawn) Typewriter's character reveal notification receives grapheme clusters. countGraphemes, sliceGraphemes
  - Text.calculateDrawnRect: wrapped text also knows its rectangle. (Off-screen culling) getMeasuredLineCount
  - RichText: uses text direction. Determines the paragraph direction from the joined text of the segments (this text's direction, or the Graphic's direction if "inherit"), and places segments from the right when right-to-left. Alignment "start" / "end" is also resolved in that direction. (Previously did not apply direction to segments)
  - ShadowText: setItalic, setUnderline, setStrikethrough and getters, isBold. Underline and strikethrough are baked together with the shadow. "auto" for text direction (by the first strong character of the text)
  - Graphic: exports detectTextDirection(text). (Equivalent to setTextDirection("auto"))
  - DynamicFont: when adding characters with buildAtlas, re-places all contained characters on the new canvas. (Previously only new characters were placed on the new canvas, misaligning previously baked characters) Grapheme cluster units, rebuildAtlas, measureText. import.js exports DynamicFont, GlyphInfo
  - LanguagePack: setLanguageList(data), setLanguageTexts(code, texts, fallbackTexts) (set directly without files)
  - import.js: splitGraphemes, splitWords, countGraphemes, sliceGraphemes, detectTextDirection
  - Rebuilt the visual editor (tools/visualeditor/visualeditor.html) with the engine above
- Core, platform, foundation branch. Brings in general-purpose features that existed only in the Rust version (vanilla-engine) to align the public APIs of the two engines.
- Color.createFromBytes(red, green, blue, alpha) (0 ~ 255), withAlpha(alpha) (new color with only alpha changed), Color.lerp(from, to, time)
- Math.easeOutQuad(time)
- Matrix4.writeToArray(array), writeToSlice(array, offset): writes the 16 column-major elements into the array (at offset)
- Vector2: addScalar, subtractScalar, multiplyScalar, divideScalar, moduloScalar. Vector3: addScalar, subtractScalar, multiplyScalar, divideScalar. (Same as add(number))
- Rect.intersects(other): whether they overlap. Edges that only touch do not count as overlapping. (overlaps counts touching as overlapping)
- Cooldown.activate(): same as use()
- TransformMatrix.invert(): returns a new inverse matrix. (null if the determinant is 0)
- Platform.applyUserAgent(userAgent): determines platform, browser, and mobile status from the given user agent string. (getPlatformInfo calls it with the browser's string)
- Engine: setTitle(title), writeClipboardText(text), readClipboardText() (Promise, null if there is no text or access is blocked), isCoarsePointer(), loadScene, unloadScene, unloadAllScenes (same as SceneManager), isExitRequested()
- Engine page events: PageEvent(hidden, visible, blurred, focused, pointerDown), addPageEventListener(listener), removePageEventListener(listener), isPageHidden()
- Engine frame capture for verification: requestFrameCapture(frameNumber) passes the canvas as a PNG data URL after that frame is fully drawn. (Promise, the current frame if the number has already passed) URL query ?capture=120,240 saves those frames as downloads, captureName is the file name ("{frame}" is the number, default capture_{frame}.png), captureExit=1 calls exitApplication after the last save
- InputManager: isTouchDown() (true from the press frame until release, true even when held without moving), isWheelWithCtrl() (whether the last wheel was scrolled with Ctrl, touchpad pinch), isTouchInput() (whether the last input was a finger)
- Component.isTickNeeded(): if false, the node does not call that component's tick. By default, determined by whether tick is overridden. Sprite, Text only draw, so false (true if a subclass overrides tick), components without tick such as Paint are also false
- ImageAsset.loadFromBytes(assetPath, bytes), TextAsset.loadFromBytes, JsonAsset.loadFromBytes, BlobAsset.loadFromBytes (assetPath, bytes), AudioAsset.loadFromBytes(bytes), FontAsset.loadFontFromBytes(family, bytes, descriptors): loads from bytes already in hand. (Embedded data or directly downloaded data, the passed bytes are not modified)
- SpriteAtlas.getPageCount(), SpriteAtlas.findFrameInOrder(atlasList, name), applyFrameInOrder(atlasList, sprite, name): searches the given atlases in order instead of using the search atlas list
- SoundSystem: addSoundAsset(soundId, audioAsset) (appends a sound built in memory to the recording group of that id, volume and interval follow the sound table row), getEffectVoiceCount()
- Collision2D.findNearestIndexInRadius(targetList, getPositionHandler, center, radius): index version of findNearestInRadius. (-1 if none)
- Localization: selectLanguage(candidateList, supported, default) (matches by stripping subtags from the end of the tag, detectLanguage also uses this. "zh-Hant-TW" matches "zh-hant"), setLanguageAliases, setRightToLeft, isRightToLeft, mirrorLayoutX, readLayoutTextAlign, isolateText, textNamed(key, values) (named placeholder filling, same as LanguagePack.formatText), setTableFromJson(languageCode, tableJson)
- PersistedStore.unsubscribe(subscription): unsubscribes by passing what subscribe returned. (Same as calling the returned unsubscribe function)
- SpriteAnimator.getCurrentFrameIndex(), SpriteAnimator.playOnNode(node, clipName, options) (play with the node's animator)
- WebSocketClient: without a receive callback, collects received JSON, retrieved with takeReceivedMessages(). (Up to 1024, oldest discarded first on overflow) Binary messages are also received if they are UTF-8 JSON. tick() (no-op, for writing the same code as on other platforms). Fixed getReceiveEvent() returning the WebSocket, now returns the receive callback
- AudioBus (src/core/audiobus.js, exported from import.js): AudioManager.createAudioBus(), AudioBus.createAudioPlayer() (a player that plays through that bus), setVolume, getVolume, mute, unmute, isMuted, isAvailable, getGainNode. A single GainNode connected to the output, and players created from a bus connect to the bus instead of the output. The AudioPlayer constructor takes the output node (outputNode) as its second argument. (audioContext.destination if omitted) Same shape as the Rust version
- SoundSystem.getMusicBus(), getEffectBus() return AudioBus instead of GainNode. (The node via getGainNode()) The settings volume is applied to that GainNode with setTargetAtTime as before. Players created from a bus also follow the settings volume and mute
- Platform.getResourceUsage(): added the correct name. The old name getResouceUsage() remains as an alias that calls the same thing
- Node.findDescendantByName(name): same as findChildRecursiveByName. Node.destroyChildrenWhere(predicate): detaches and destroys the direct children matching the condition and returns their count. (Same names as the Rust version's find_descendant_by_name, destroy_children_where)
- GamepadManager.isButtonJustPressed, isButtonJustReleased: whether the button was just pressed or released in this update. (Same as the Rust version)
- General-purpose features that existed only in the Rust version:
  - DEVTools: setVisible, getActiveTab, setActiveTab, getSelectedNode, setSelectedNode, isNodeExpanded, setNodeExpanded, getPanelRect. (F2 calls setVisible)
  - UIDialog.requestDismiss(isConfirmed): closes on the next tick
  - UIInputField.getDisplayText() (the value with the composition text inserted at the cursor position), requestMenuAction(menuAction) (cut / copy / paste on the next tick), UIInputFieldMenuAction (exported from import.js)
  - AmbientOcclusionEffect.buildSampleKernel(), SubsurfaceScatteringEffect.buildKernel(falloffColor, strengthColor): static functions that build kernels without WebGL. computeKernel uses them
  - FbxLoader.parseNodeRecords(arrayBuffer) (header check and top-level node records, the first part of parse), FbxLoader.readVersion(arrayBuffer) (static, the version number in the header)
- AudioManager.getContextTime() (AudioContext clock, 0 if none), AudioAsset.getLoadError() (reason for the last load failure, null if none), AssetLoader.getInFlightCount() (number being downloaded by workers). Same role as the Rust version's get_context_time, get_load_error, get_in_flight_count
- Graphic.setBlendMode: correctly draws the 17 modes that were drawn as source-over instead. All 26 SpriteBlendMode modes now work
  - source-out, source-atop, destination-atop, xor are set with blendFunc using the Porter-Duff coefficients of W3C Compositing and Blending Level 1 as is
  - overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity copy only the area to be drawn (the bounding box of the vertices) from the current framebuffer with blitFramebuffer on each draw and blend in the shader. The formulas follow W3C as is (separable blending, non-separable blending, Cs' = (1 - αb) x Cs + αb x B(Cb, Cs) followed by source-over compositing) and are also correct on render targets with backdrop alpha (RGBA8, RGBA16F). darken, lighten blend in the shader because blendEquation MIN / MAX differs from the W3C formula for translucent pixels
  - Shader blend modes are not batched. One area copy and one draw call per draw (about 0.065 ms per draw on M2 Pro at 1280x720, mostly the cost of the copy breaking the render pass)
  - Images, shapes, text, nine-slice, clipping, particles, and swapped-in shaders (ShaderSprite) all work. Particles are grouped into mutually non-overlapping quads that are copied once and drawn, so like Canvas2D each quad blends over the previous quads. Swapped-in shaders do not know the blend function, so they are first drawn into an overlay buffer (RGBA16F, RGBA8 if unavailable) and then blended while being transferred
  - Comparing the same scene as Chrome Canvas2D (translucent images, rectangles, polygons over multicolored backgrounds) across the 26 modes, the difference inside shapes is within 2 levels. Canvas2D also clears outside the drawn shape for source-in, source-out, destination-in, destination-atop, copy, whereas Graphic changes only the inside of the shape as before
  - Changed the warning text for unknown names to "unknown blend mode"
- Extends toon post-processing, effects, and the camera so that aberrant and webgame-rimminer can use the engine as is. (With new options at their defaults, output is identical to the current screen down to the pixel, same API and same shader text in both engines, game recipes and color values are taken as parameters)
- BloomEffect.setUseFloatColor: builds the ping-pong buffers as RGBA16F so bright values above 1 are not clipped. (Default stays RGBA8)
- ToonPostProcess: constructor options { sampleCount, useFloatColor, depthBits, useDepthTexture }, isFloatColorSupported (devices that cannot use float buffers take the LDR path with RGBA8 buffers, in which case the scene draws screen colors and compositing applies only bloom and color grading, without tone mapping and gamma), setSampleCount, setResolutionScale (draws only the 3D buffer at output size x scale and upscales it with the viewport in end, UI stays at device pixels), setBloomLevels (level count, threshold, knee, 0 for the default half-resolution 9 taps), setBloomFloatColor, setBrightness, setLitArea and clearLitArea (reconstructs the world position of each pixel from the scene depth texture, brightness 1 within the horizontal distance from that position), getSampleCount, getUseFloatColor, getResolutionScale, getBloomLevelCount. Brightness, saturation, and lit areas that webgame-rimminer applied in LDR inside its shader can be applied as post-processing on the LDR path. (The luminance weights for saturation are the engine's Rec. 709, webgame-rimminer uses Rec. 601)
- Toon color space convention: the scene buffer is linear. (ToonRenderer.setHdrOutput(true), ToonScreenOutline.setHdrOutput(true), ToonVfx colors are also treated as linear) Games that, like aberrant, wrote gamma-encoded values g into a float buffer and converted them back with g^2.2 in compositing convert the values to linear when porting. Colors become c^2.2, and a brightness multiplier k applied on the gamma side becomes linear k^2.2. (1.37 becomes 2, 1.6 becomes 2.81, 2.08 becomes 5, brightness 1.6 with multiplier 1.6 becomes 7.9) Bloom threshold 1 and knee 0.25, exposure 1, intensity 0.6 stay as they are, since they are the values aberrant used after converting back to linear
- Camera3D.setMatrices(view, projection): uses the raw matrices computed by the game as is. (like the tilted orthographic view of webgame-rimminer) Extracts eye, target, up and whether it is orthographic from the matrices, and projectToView, unprojectToPlane, readViewDepth, ToonRenderer.beginFrameWithCamera run on those matrices. hasRawMatrices, clearRawMatrices; setPerspective, setOrthographic and lookAt discard the raw matrices
- ToonVfx: options.age for emitParticles, addFireball, addShockwave, addDecal, addPlume, addLightning, addFlash (seconds already elapsed, an effect seen late starts from that age, a negative value delays it by that much) and options.key (event key, a key already emitted is not emitted again, clear forgets it, registerEventKey), setLookGain and getLookGain (brightness multiplier per particle and glint look, default 1), setGlintCapacity and getGlintCapacity (glint limit per frame, default 96), floor mark looks stain (covers with tint, the rim edge is stained with the rim color), sheen (oil sheen), shade (shadow fading out in a circle) and mark options.flicker (flicker half period in seconds), queueBlobShadow({ x, z, radius, alpha }) (shadow under the feet), options.rim for fireball, shockwave, ribbon, lightning (share of the look that covers the body and outlines the edge with the rim color, for bright backgrounds, 0 is the current additive light). Shake (addShake) is the exponential decay of Shaker, so for an event seen late pass intensity x exp(-9 x age)
- Added general-purpose features that existed only in the Rust version. Text.calculateFittedFontSize(), UILabel.calculateFittedFontSize() (measures the draw-time size on the spot, this version measures without Graphic so the value equals getFittedFontSize), Text.wrapLinesWithoutGraphic(maximumWidth) (list of lines split with the current text and font, null if there is no canvas to measure with), measureTextWithoutGraphic(fontString, text) (exported from import.js, same as measureTextMetrics)
- Graphic.readFramebufferPixels() (the currently drawn screen as { width, height, pixels }, top-to-bottom RGBA, alpha 255), getDrawingBufferWidth(), getDrawingBufferHeight() (last set viewport), getImageSmoothingQuality()
- ToonRenderer extension points and light model: standard features come first so that aberrant and webgame-rimminer can move onto the engine toon renderer without modifying the renderer per game, with a place to insert shader chunks only for patterns the standard features cannot do. With the new options at their defaults the screen is the same as now. (verified by drawing the same frozen scene as the old renderer: LDR with 3 cel bands has pixel difference 0, HDR float buffer has maximum 3.8e-4)
  - ToonLightSet(toonlightset.js): one bundle of light values. The renderer holds a default set, and setLight, setSunDirection, setFillLight, setRimLight, setSpecular, setPointLights, setPointLightLimit, setBandCount, setBandRamp, clearBandRamp, setLightModel modify it. createLightSet, getLightSet, options.lightSet per draw. Each modification bumps a version number, so it is uploaded only when changed
  - Meaning of sun direction: the direction light travels (from the sun to the surface, same as three.js DirectionalLight). The received share is max(dot(N, -sunDirection), 0). Code that used the direction from the surface toward the sun passes it with the sign flipped
  - Fill light setFillLight(direction, color): a second directional light without shadows. Rim light setRimLight(color, power): adds pow(1 - max(dot(N, V), 0), power) like light. Specular setSpecular(intensity, exponent default 48): Blinn-Phong of the sun, receives shadows
  - Point lights setPointLights([{ position, color (linear), intensity, range, decay, rangeExponent, wrap }]): up to 8 (TOON_MAXIMUM_POINT_LIGHTS), setPointLightLimit reduces it on lightweight paths. Attenuation = window (1 - (d / range)^rangeExponent) clamped and squared x 1 / max(d^decay, 0.01). The defaults decay 2, rangeExponent 4 are the form used by three.js, Unreal, Godot 4, and decay 0, rangeExponent 1 gives (1 - d / range)^2. The received share is wrap lighting (dot + wrap) / (1 + wrap)
  - Bands: setBandCount is unchanged (rounds the sun share into n steps). setBandRamp(thresholds, values, half Lambert) splits by thresholds into a value per step (up to 8 steps, TOON_MAXIMUM_BAND_STEPS), also applied to the point light share. The 4-step half Lambert of webgame-rimminer is setBandRamp([0.25, 0.5, 0.75], [0.3725, 0.6471, 0.8627, 1], true)
  - Light model setLightModel({ isEnergyNormalized }): divides base color x light by π (Lambert BRDF, the same convention as three.js physical lights, which give light intensity as illuminance, and glTF lights). Specular is then normalized Blinn-Phong (exponent + 8) / 8π. The default false is the same as now
  - Draw options (drawMesh, drawMeshInstanced, drawMeshInstanceBuffer, ToonDrawQueue.addMesh): tintAmount (mixes the tint in sRGB instead of multiplying), glowScale (multiplier on vertex glow), colorScale (multiplier on the final linear color), emissiveColor and emissiveIntensity, baseColorTexture (multiplies the base color, alpha goes to opacity), emissiveTexture, uvTransform([u offset, v offset, u scale, v scale]), decalTexture, decalColor, decalEmission, decalUvTransform (covers the base color by alpha and glows with that color, one cell of an atlas), alphaCutoff, blendMode (ToonBlendMode.alpha default, premultiplied, additive, anything other than alpha is translucent), softEdge (pow(|dot(N, V)|, softEdge) into opacity), isMirrored (if not given, flips the winding automatically when the model matrix determinant is negative, and also when the view matrix is mirrored), indexStart, indexCount, outlineIndexStart, outlineIndexCount
  - ToonMaterial(toonmaterial.js): createMaterial({ name, uniformChunk, surfaceChunk, lightChunk, vertexChunk }) as options.material. Surface chunk applySurface(inout ToonSurface), light chunk applyLight(ToonSurface, inout ToonLighting), vertex chunk applyVertex(inout ToonVertex, all three of body, outline, shadow depth). ToonSurface has sRGB base color, alpha, linear glow, world normal, vertex glow, unlit, four pattern values (vertexDetail), UV, local position, world position, view direction. options.textures({ uniform name: texture }, from unit 7, TOON_MAXIMUM_MATERIAL_TEXTURES 9), options.onBeforeDraw(program, gl, ToonProgramKind). Builds and caches a program per material and instance layout (if it fails to build, reports it and skips that draw). prepareMaterial, deleteMaterial, getSolidProgram(material). Passed to ShaderWarmer via readProgramSources(material, instanceLayout) and composeToonProgramSources
  - Instance layout: createInstanceLayout([{ name, size }]) (instanceMatrix 16, instanceTint 4 are read by the engine, up to three other user attributes at locations 13 ~ 15, read by name in the vertex chunk), createInstanceBuffer(layout, count, ToonBufferUsage.static | dynamic) persistent buffer, updateInstanceBuffer, deleteInstanceBuffer, drawMeshInstanceBuffer(model, buffer, count, layout). The vertex array binding the model and buffer is built on the first draw and kept. The current drawMeshInstanced (filters and uploads every frame) is unchanged
  - Textures: createTexture(ImageBitmap, canvas, image, ImageData or { width, height, data }, { isMipmapped, isRepeated, isFiltered }), deleteTexture. UV (0, 0) is the top left of the image (same as glTF). Uses units shadow 3, base color 4, emissive 5, decal 6, material 7 ~ 15, and binds a 1x1 white texture to slots not given
  - Frame: beginFrameWithMatrices(view, projection) (without Camera3D, raw orthographic matrices), getFrameCamera, readFrameCamera (eye position from view and projection, view direction if orthographic, whether mirrored), applyFrameState, createReflectionMatrix(point on plane, normal), readMatrixDeterminant
  - Performance: per program, frame values (view and projection, camera, shadow, HDR, outline color) and the light set are uploaded only when changed, and only values that change per draw are uploaded every time. Texture units are set once when the body program is built
  - Shaders: the three vertex shaders share the same header (position, normal, color, material, pattern, UV) and ToonVertex, and the body shader passes local position, world position, four pattern values, UV to the fragment stage. vertexUv(12) in TOON_ATTRIBUTE_LOCATIONS. The shader source is identical to the Rust version
- ToonDrawQueue: addPass(ToonDrawStage.beforeOpaque | afterOpaque | afterOutline | afterTransparent, callback(renderer, gl)) stage callbacks (planar mirror, screen-space outline blending, effect slots, draw state is reapplied after the call), addMesh options group and isDepthPrepassed (sorts translucent items as one group by center depth, draws depth only first and then colors only at equal depth so overlapping parts do not brighten twice), blendMode other than alpha goes to the translucent order, drawWithMatrices(renderer, view, projection). clear also empties the stage callbacks
- ToonMesh: texture coordinates uvData (2 per vertex, an empty array if no vertex was given one, 0 for vertices without them when mixed). createBoxGeometry (0 ~ 1 per face) and createSphereGeometry (longitude and latitude) build uvs and addPart stores them. The last optional argument uvs of addTriangles, addMaterialRange; combine joins uvData and materialRanges
- ToonGlb: stores TEXCOORD_0 as uvData, and per-primitive material ranges materialRanges({ name, materialIndex, nodeName, indexStart, indexCount, extras, alphaMode, alphaCutoff, baseColorFactor, emissiveFactor, baseColorImage, emissiveImage, hasUv }). If emissiveTexture is present, vertex glow is left at 0 and passed via the material range. readGlbImages (image name, mimeType, data), decodeGlbImage (ImageBitmap). Cells inside a part (accent color, display panel) are selected by material name or extras and drawn with indexStart, indexCount
- WorldNode.setPosition: added the inverse of getPosition. Until now TransformNode.setPosition did not undo the position of the parent pivot point (parent contentSize x parent pivot), so when the parent content size and pivot were nonzero, the position set with setPosition differed from getPosition. (with parent 100x60, pivot centered, 90 degrees, scale 2, placing at (280, 200) read back as (340, 100)) On axes where the parent scale is 0, it places at the parent pivot point. (fixed together with the Rust version)
- When drawing multiply to a render target (while a framebuffer is bound), the area under the draw region is copied and blended in a shader per the W3C formula (B(Cb, Cs) = Cb x Cs). Fixed blending (DST_COLOR, ONE_MINUS_SRC_ALPHA) drops the cs x (1 - αb) term when the backdrop alpha is below 1 and leaves the alpha as the backdrop alpha, differing from Chrome Canvas2D by up to 221 on render targets with a translucent backdrop. (now 0 inside shapes) The default framebuffer (alpha: false) always has backdrop alpha 1, so it is drawn as before with fixed blending and batching, and the screen, draw calls and copy count are unchanged. multiply on a render target, like the 13 shader blend modes, costs one region copy and one draw call per draw. Added blendModeIndex 14 to the blend shader source. (fixed together with the Rust version)
- The value "MediaPlay" of KeyCode.audioplay is a name not in the W3C KeyboardEvent.code table (2025-04-22 Recommendation). Changed it to "MediaPlayPause", the name in the table that Chrome emits for the common play/pause key (USB 0x0C00CD, Windows scan code 0xE022). Chrome emits "MediaPlay" only for the play key on Linux and ChromeOS (USB 0x0C00B0). (fixed together with the Rust version)
- ToonScreenOutline: rebuilt the screen-space outline in the standard form of real-time toon rendering. (It is the engine's baseline, not a form fitted to one game)
  - Detection: checks once at each boundary between a pixel and its four direct neighbors in the line buffer (normal, line id, depth), and places the line at the middle of that boundary. (The G-buffer edges of Saito, Takahashi 1990, the four-neighbor check of the Unity Shader Graph example) Until now crease lines were checked with the normal of a single point creaseRadius away from the center pixel, so bands appeared on both sides of a crease, enlarging the half-size buffer produced dotted lines and a parallel second line, and one more band appeared inside the silhouette of round surfaces
  - Depth: unprojects the two neighboring pixels to view-space positions and detects occluded silhouettes by the distance from each other's tangent plane. No false lines appear on floors seen at a grazing angle or around round surfaces. (The Roystan approach, which adjusts the threshold by viewing angle, done with the tangent plane) It uses the distance of the occluding pixel from the occluded pixel's tangent plane (when the occluding side is the silhouette of a round surface, that tangent plane contains the line of sight), and adds to the threshold the measured error (8-bit normal angular error x the distance between the two positions, one pixel x the sine at a crease, one 24-bit depth step) times the margin factor (setDepthMargin, default 2)
  - Widening: propagates the distance to the boundary segments with jump flooding (Rong, Tan 2006). The number of steps is log2 regardless of width. (Ben Golus, The Quest for Very Wide Outlines) Outer lines and crease lines are propagated separately so they get separate widths. The previous 3-pixel radius limit is gone
  - Blending: each pixel of the drawing area is covered by clamp(width / 2 - distance + 0.5, 0, 1), from the distance to the nearest boundary. Since the distance is measured in the drawing area even when the line buffer is reduced, widened lines do not break up
  - Per model: options.hasScreenOutline of drawMesh, drawMeshInstanced (when false, it emits no lines and only occludes the lines behind it), options.hasCreaseLine, options.isMirrored (if not given, the winding is flipped by the determinant)
  - readJumpFloodSteps(distance): list of jump flooding steps. (From the largest down to 1)
- ToonScreenOutline per-ID line color: setLineColor(lineId, color), removeLineColor(lineId), clearLineColors(), getLineColorCount(). (The Unreal Custom Stencil form, the color is picked by the ID already in the line target) The table is a 128 x 128 lookup texture covering every line ID, so there is no limit on how many are set. A line where two IDs touch takes the color of the nearer ID, and IDs not in the table keep the setColor color. With an empty table the composite is pixel-identical to before. (For highlighting only the lines of chosen models, like the rock highlight of Rimminer #169)
- ToonRenderer per-instance emission: emissiveColor ([r, g, b] sRGB) and emissiveIntensity (linear multiplier, default 1) on the instances of drawMeshInstanced. Added on top of that instance's shading and pattern so only that instance brightens. (The tint is a multiply and could only darken)
  - The instance data stays 20 values. The matrix is read as an affine 3x4 and the emission goes into the four values of the bottom row (elements 3, 7, 11, 15). (The 3x4 matrix form of Godot MultiMesh and Unity BatchRendererGroup) The instanceMatrix of ToonInstanceLayout is the same, and in the vertex chunk it is vertex.emissive. Storing Matrix4 elements as they are leaves the bottom row 0, 0, 0, 1, so there is no emission and the screen is unchanged.
- ToonDrawQueue: setScreenOutline(ToonScreenOutline or null), getScreenOutline(). When one is given, draw and drawWithMatrices draw the opaque items into the line buffer before the bodies (the id is options.lineId, the order added + 1 if not given, and for instances instances[i].lineId comes first), and blend it after the outline shells, before the afterOutline stage. Per model options.hasScreenOutline, options.hasCreaseLine. Translucent items are not drawn into the line buffer. If there is a screen rectangle (setScreenRect), that rectangle is used as the line buffer's drawing area. Code that has been calling drawOutline in an afterOutline stage callback can switch to this
- Fixes to the original made while matching the Rust version's reflection (#[reflect])
  - Visual, UIListView: the constructors did not call setComponentType, so getComponentType was "Component" and they were written with ComponentType "Component" in UI documents and reflection saves. Now they are "Visual", "UIListView"
  - UIScrollBar: getTrackColor, getThumbColor (the colors of the track and thumb Paint, same as the Rust version)
  - UIDocument: added ShadowImage to the table. Like Sprite, it is written and read in the reflection save form after imagePath. (Until now it was not in the default table, so unless registered separately as the editor does, it was skipped when reading)
  - UIDocument.loadByReflection: also reads properties whose current value is missing (null) by the saved form. (Arrays of four numbers as Color, arrays of two numbers as Vector2, numbers, text and booleans as they are) Until now the number, text, boolean and array values of properties whose current value was null were skipped
  - Regenerated docs/api/0.4.0.json and the translation table
- Rebuilt toon shading in the standard form of real-time toon rendering. (A form chosen by comparing the Unity Toon Shader, Unreal Substrate Toon BSDF, Godot's diffuse_toon, Team Fortress 2 and Guilty Gear Xrd, not fitted to one game)
  - Shade ramp: multiplies the lit share (half Lambert by default) by the shadow and looks it up on the ramp to pick the color. Each cell has a position, linear color and softness (Step and Feather), and boundaries are kept free of stair-stepping with fwidth. Shadows come in as the shade color, not black
    - ToonLightSet.setShade({ step, feather, color, secondStep, secondFeather, secondColor, isHalfLambert }): base, first shade, second shade. The default is two steps splitting at half Lambert 0.5 (a cool purple shade)
    - setShadeRamp(positions, colors, softness, half Lambert): sets the cells directly (up to 8 cells), clearShadeRamp(): smooth Lambert
    - setRampTexture(texture, half Lambert): reads the ramp texture horizontally instead of cells. (The warp of Team Fortress 2, the ramp texture form of Genshin Impact and Honkai)
    - setBandCount, setBandRamp still work but are built with the same ramp. (Gray cells, boundaries without stair-stepping)
  - Per light: the sun receives the full ramp color, so the shade is also tinted with the sun's color. The fill light, point lights and spotlights receive the ramp's brightness level (bottom cell 0, top cell 1), so they do not light faces turned away. Until now the fill light did not go through the bands
  - Highlight: setSpecular(strength, exponent, softness, color). From a hard toon spot splitting Blinn-Phong at 0.5 (softness 0, default) to a soft highlight (1). Appears for the sun, point lights and spotlights alike, and is masked by the lit level. (Until now only the sun, only the soft form, and masked only by shadows with no light-side masking)
  - Rim light: setRimLight(color, power, softness, sun-side mask). From a hard rim to a soft rim, and it can be limited to the side lit by the sun. It is added to the base color instead of multiplied by it. (Same as the Rim Light of the Unity Toon Shader; until now it was multiplied by the base color like light)
  - Spotlight: giving a point light direction, innerConeAngle, outerConeAngle makes it a spotlight. (The angular attenuation of glTF KHR_lights_punctual)
  - Draw options: receivesShadow (default true), shadeOffset (shifts the shade boundary), specularScale, rimScale (per-material highlight and rim multipliers), matcapTexture, matcapStrength, matcapBlend (ToonMatcapBlend.multiply, add), outlineColor, outlineWidthScale (per-draw color and width multiplier for shell outlines)
  - Added shadeOffset, specularMask, rimMask to the surface chunk (ToonSurface), and rim, sunLevel to the light chunk (ToonLighting). Composition is base color x irradiance + specular x specularMask + rim x rimMask + glow
  - Transforms normals by the transpose of the inverse of the model matrix and bone matrices. Corrected the lighting and screen-space outline creases that were wrong on stretched and squashed models (scale that differs per axis). Code in vertex chunks that compensated by dividing normals by the squared scale must be removed
  - Changed the default lights. Sun [0.9, 0.85, 0.8] → [0.84, 0.8, 0.74], sky [0.45, 0.5, 0.6] → [0.3, 0.33, 0.42], ground [0.2, 0.18, 0.16] → [0.17, 0.16, 0.15]. (So lit faces do not go far above 1, matched to the two-step shade)
- ToonMatcapBlend: how a matcap is blended. (multiply, add)
- Filled in comments and examples for every file in the toon folder (graphics3d/toon). Header comments and JSDoc @param, @returns descriptions for every public API, and @example <caption>title</caption> on modules, classes and members whose usage is not obvious (the examples use only import.js names and were checked to run without errors in headless Chrome)
- Filled out toon up to the level Unity and Unreal provide by default. (Followed the formulas in the Unity Toon Shader source)
  - ShadowMap: fixed building a ShadowMap after building models leaving the depth texture on a texture unit, so drawing gave GL INVALID_OPERATION (feedback loop). Restores the previous texture and framebuffer bindings when building. Fixed the light matrix breaking when the light travels almost straight down or up (the up vector parallel to the light). In that case the z axis is taken as up
  - ShadowAtlas, SHADOW_ATLAS_MAXIMUM_LIGHTS(4): real-time shadows for point lights and spotlights. In the form of the Unity URP additional light shadow atlas, one depth texture is split into tiles; a spotlight draws into one perspective tile, and a point light draws the six cube faces into six tiles. updateLights(point light list) picks the lights with castsShadow true and computes the tiles and the view and projection for each tile. The toon shader multiplies that point light's lit share by the shadow and feeds it into the shade ramp (the same form as the sun, 3x3 PCF) The receiving position is pushed toward the normal by (1 + 3 x (1 - dot(N, L))) tile texels to prevent shadow acne on surfaces slanted to the light
  - ToonRenderer: setLocalShadows(ShadowAtlas, strength), beginShadowAtlasPass(atlas), setShadowAtlasTile(atlas, tile index) (ends with endShadowPass). ToonDrawQueue.drawLocalShadows(renderer, atlas)
  - Point lights: castsShadow (default false), shadowNear (default 0.05; the far distance is range, 30 if 0)
  - Light color usage: ToonLightSet.setLightColorUsage({ base, shade, highlight, rim, shadeRim, matcap, angelRing, outline }) (also on the renderer). Chooses for each color whether to multiply by the light color. When off, base, shade and highlight receive only the light's luminance, and the rest receive no light. (The Is_LightColor_* of the Unity Toon Shader, all on by default) Rim, matcap and shell outlines now also multiply by the sun's color by default. The previous look is setLightColorUsage({ rim: false, matcap: false, outline: false })
  - Shade-side rim: ToonLightSet.setShadeRimLight(color, power) (also on the renderer). Adds a rim on the side facing away from the sun by (rim - half Lambert). (The Antipodean Rim Light of the Unity Toon Shader)
  - Shell outlines: with setOutlineFadeDistance(near distance, far distance), the width becomes 0 when far. (The Nearest, Farthest Distance of the Unity Toon Shader, from the model's position to the camera) Per draw, outlineOffsetZ pushes it away from the camera so it does not show through in front of the body. (Offset Z)
  - Angel ring: draw options angelRingTexture, angelRingColor (default white), angelRingOffsetU (default 0), angelRingOffsetV (default 0.3), isAngelRingAlpha. u is the x of the view-space normal, and v is the y of the second UV blended with the y of the view normal by offsetV. (The Angel Ring of the Unity Toon Shader, a hair reflection band attached to the camera)
  - Second UV: MeshBuilder shape uvs1, addTriangles uvs1, readArrays uv1Data, and ToonGlb reads TEXCOORD_1. The shader's vertexUv is vec4(UV, second UV), and ToonVertex.uv1, ToonSurface.uv1 were added. Exports readUvData
  - Texture units: the point light shadow atlas uses unit 0 and the angel ring uses 7. Material textures are 8 ~ 15, and TOON_MAXIMUM_MATERIAL_TEXTURES changed 9 → 8. Unit 0 is the unit the engine's 2D drawing remembers, so beginFrame records its binding and endFrame restores it
  - Shader uniforms: lightColorUsage, lightColorUsageExtra, shadeRimLight, angelRingSettings, angelRingColor, localShadow* , pointLightShadowSlots, and for shells outlineFadeDistance, outlineOffsetZ, outlineLightColor, cameraForward
- Angel ring: rotates the UV back by the camera roll. (The same computation as the Camera Rolling Stabilizer in the Unity Toon Shader source; exports readCameraRoll, shader uniform cameraRoll) The ring stays on the head even when the camera is tilted
- Light intensity limit: ToonLightSet.setLightIntensityLimited(boolean), isLightIntensityLimited() (also setLightIntensityLimited on the renderer). The same computation as the Limit Light Intensity of the Unity Toon Shader, and on by default like the Unity Toon Shader default
  - The sun and fill light are clamped to 1 per channel, and point lights and spotlights are divided by the intensity when the intensity of the color multiplied through attenuation (0.299 R + 0.587 G + 0.114 B) exceeds 1. If the light model is isEnergyNormalized, the share after dividing by π is limited
  - Scenes that used a sun above 1 or strong point lights look different. (Those that used strong lights for HDR bloom) The previous look is setLightIntensityLimited(false)
  - When porting an old game shader (one that did not limit light intensity), or when using point lights above intensity 1 or HDR bloom, use setLightIntensityLimited(false)
  - The intensity received by colors with light color usage off was also changed to 0.299 R + 0.587 G + 0.114 B, the same as the Unity Toon Shader. The sun color multiplied into shell outlines is divided by its intensity when the intensity is 1 or more (the Unity Toon Shader outline)
- Toon GLB accessor reading: an accessor that reads outside the binary chunk throws an error ("GLB accessor N reads outside the binary chunk.") instead of yielding an empty model, and an accessor without a bufferView is filled with zeros per the glTF spec (same as the Rust edition)
- Added six to the top-level exports (same as Rust): import.js now exports AudioManager, DevTools, Pane, PaneStyle, PaneTheme and WebSocketClient (same as the pub use in the Rust lib.rs). Docs and examples are filled in too.
- The toon body shader's readShadeLevel no longer reads the dynamic index shadeStopColors[shadeStopCount - 1] when there are zero shade stops; it finds the last stop with a loop: on iPhone SE2 (A13, iOS 27.2.1) Safari the first draw with a toon program containing that read killed the GPU process and lost the WebGL context (the next shader build then showed 'compile failed: null'). A scene with two or more shade stops computes the same values, byte for byte. Migration: none.

## Performance

- Less CPU in the toon draw queue and the GPU memory tracker (picture unchanged): ToonRenderer.findDrawEntry looks the options object's remembered entry up in the WeakMap once (it used to look it up twice, has then get). GpuMemoryTracker no longer formats and parses the call stack when a GL object is created; it only captures the frames and resolves the owner name once, when readUsage reads the owners (building the stack text cost time every time a material block or texture was created mid-frame). The ownerList result is the same.
- Toon program variant prewarm (the standard way, like Unity ShaderVariantCollection.WarmUp and Unreal PSO caches: build before the first draw, picture unchanged): body feature variants were built in the first frame that drew a combination not seen before, which could hitch once (about 250 ms right after a round starts in Aberrant on iPhone 15). Added ToonRenderer.prewarmDrawQueue(queue). It builds, without drawing and with the same keys, the variants the items in a draw queue will use (material, instance layout, body feature bits, ambient occlusion body, outline, shadow depth). With KHR_parallel_shader_compile it only hands off compiling and finishes the compiled ones a few per frame so the main thread is not blocked; without it, it builds inside the call. The returned ToonProgramPrewarm tells the end with isReady() and wait() (a Promise). Drawing before it finishes is fine, and a variant not built yet is built on the spot as before. ShaderProgram gained the last constructor parameter isDeferred, isBuildComplete(), finishBuild() and the static isParallelCompileSupported(gl) (default behavior unchanged). On headless Chrome on a Mac, the first draw frame of a scene with three variants and one instance layout took 61 ms without prewarm (20 compileShader calls, 10 linkProgram calls) and 0.5 ms after it (0 calls), with a byte-identical picture. (tests/graphics3d/toonprogramprewarmchrome.test.mjs)
- Toon body variants: reduced the hitch when a combination first appears mid-scene (a light set turning on rim, shade rim or a ramp texture changes the body feature bits) (issue #2). The body feature bits change through five light set bits (ramp texture, shade stops, rim, shade rim, light intensity limit) and six draw options bits (five textures, receive shadow). (a) prewarmDrawQueue(queue, options) gained the optional argument options. Pass the combinations the game will use, like Unity ShaderVariantCollection, with options.lightFeatureList (per combination, an array of the light feature names that turn on additionally, e.g. [["rim"], ["rim", "shadeRim"]]), options.lightSetList (the light sets to be used) and options.queueList (draw queues holding materials and instance layouts that appear later), and those combinations are prewarmed. (b) Added ToonRenderer.setAsyncProgramBuild(isAsync) and isAsyncProgramBuild() (default true). With KHR_parallel_shader_compile, a body variant first seen mid-scene only has its compiling handed off and is drawn with the default body program (every feature on) until it finishes, so the frame is not blocked (the default body gives the same picture, checked by a test, byte-identical). Without the extension it is built on the spot as before. On headless Chrome on a Mac, per-frame draw time of a scene whose light changes four times: built on the spot 7.6, 7.5, 9.7, 9.8 ms; prewarmed with a combination list 0.1, 0, 0, 0 ms (0 builds); handed off and drawn with the default body 0.3, 0.2, 0.1, 0.1 ms. (tests/graphics3d/toonprogramprewarmchrome.test.mjs)
- Toon body shader skips the point-light loop body outside the light radius : outside the radius (lightRange > 0, rangeExponent > 0 and lightDistance >= lightRange) the attenuation window is exactly 0 and the contribution is 0, yet the body shader still ran two pow calls, the shadow read and the shade-level reads for every such pixel. Derivatives (fwidth) are now computed outside the branch where every pixel runs together (derivatives inside a branch are undefined when a quad neighbour skips), and the derivative-free heavy work (attenuation, shade-level reads, color limit) is skipped there. The point-light shadow read feeds the ramp coordinate, so it stays outside the branch. The skipped contribution was exactly 0 (readLimitedLocalColor(0) and readLightColor(0) are 0, the shade values are clamped finite numbers), so the screen is byte-identical. The miner game (iPad mini 6, one lantern, range 2.6) bisected it: one point light cost about 4 ms per frame.
- Fewer activeTexture calls in toon drawing: ToonRenderer switched the active texture unit back to 0 after every draw, so the next draw called activeTexture(4) and activeTexture(0) again even when only the base color (unit 4) changed. Draws no longer switch back (stage callbacks and onBeforeDraw of body draws are still called with unit 0 active, and endFrame restores the previously active unit), saving state does not switch units when unit 0 is already active, and restoring skips the unit 0 binding and active unit when the state cache knows they already match. activeTexture per frame (headless Chrome, 1280x720): room scenes (room, roommove, roomitem) 49 -> 24, lobby 132 -> 28; bindTexture 31 -> 30 and 73 -> 72; the screen is byte-identical. About 17 of the remaining 24 in the room come from ToonScreenOutline's line pass and line drawing. A Chrome test (tests/graphics3d/toontextureunitchrome.test.mjs) checks that a frame whose base color texture changes on every draw makes at most 12 activeTexture calls (26 before the fix, 11 after), that callbacks see unit 0 active, and that the active unit and unit 0's texture are restored after the frame.
- Retained toon draw items and no per-frame allocation in the draw queue (Unity MeshRenderer, Unreal primitive component, no allocation in the frame loop): added ToonDrawItem and ToonDrawQueue.createItem and addItem. Build the mesh, model matrix (copied) and options once and hold them; the draw queue then does not compare or resolve the options object every frame, and only setOption, setOptions and markDirty mark a change. Items with no change are not compared by the shadow cache (onChange) either. The current pattern of passing a new options object to addMesh every frame no longer builds a memory entry per options object: the queue slot keeps its own entry and reuses it when the shallow snapshot is equal (an options object that comes back to the same slot is remembered per object). The queue's lists are written by index and only their length is set instead of being cut to length 0 (V8 releases the backing store at length = 0 and grows it again every frame), and the line pass groups, transparent groups, light key, shadow caster lists and callbacks, instance buffer bounding sphere and identity matrix, and the subarray of batch uploads now reuse their storage. readMatrixDeterminant builds no arrays, and Math.hypot (V8 builds an argument array on every call) is replaced by readHypot with the same arithmetic in the same order (bit-identical on 5 million triples in Node 25). Matrix4 multiply, translate, rotateX/Y/Z and scale reuse a result buffer. Added writeInstanceBufferSphere (bounding sphere into a given array), TransformNode readPosition, readScale, readLocalPosition, readLocalScale and WorldNode readPosition, readContentSize, readPivot (into a given vector, the get functions are unchanged); UINode's transform no longer clones the local scale. WorldNode.contains (the path UIButton uses every frame to ask whether the pointer is over it) does the same arithmetic as getWorldCorners into reused storage and builds no vectors, arrays or OBB (bit and result identical on 1800 nodes of random trees, 36000 tests). Engine allocation per frame in the settings window scroll list (tests/ui/scrolllistbench.mjs, still part) 457 to 75 KB, the miner settings window shape 388 to 59 KB. With no gamepad connected, navigator.getGamepads is not called every frame but scanned once per second (connections come from the gamepadconnected event, the scan picks up pads whose event was missed). The screen outline's line color table is not uploaded again when the same color is set again, or when colors are cleared and the same colors set again. Engine draw queue allocation per frame (headless Chrome, Mac mini, 960x540, CDP HeapProfiler sampling): room scene (36 multi-part models, 216 draws, options rebuilt every frame) 309 to 43 KB, the same room with ToonDrawItem 312 to 43 KB, lobby scene 236 to 55 KB, miner mid scene 78 to 31 KB. Engine JS self time (CDP Profiler, ms per frame) room 0.515 to 0.287, ToonDrawItem 0.508 to 0.248, lobby 0.498 to 0.461, miner 0.114 to 0.064, garbage collector in the room 0.047 to 0.008. All four scenes have the same GL call counts and screen bytes. (tests/graphics3d/toondrawitemchrome.test.mjs, toondrawbench.mjs room, roomitem, allocation sampling)
- Toon screen outline resolution scale (setResolutionScale, default 1, the same meaning as Unity URP renderScale and Unreal's screen percentage): as the name says, every target before the blend (the line target, the mask, the seeds, the jump flood targets) is shrunk to drawing area x scale. It used to shrink only the jump flood targets. The default 1 leaves the screen byte for byte the same. Below 1, a thin line (width x scale up to about 3.24 line-target pixels) computes its coverage (strength times the line-id color, an RGBA8 target, getLineTarget().coverageTexture) once at the mask resolution, and the final blend reads it once with bilinear filtering (nine reads become one). A thick line floods at the line-target resolution and measures the distance in drawing-area pixels when blending. The line width (setWidth) is in drawing-area pixels at any scale. The lineTexture and depthTexture of getLineTarget are drawing area x scale in size (the lineTexture contract stays: RGBA8, the id in b and the low 6 bits of a, flags in the top 2 bits of a, and width 0 draws only the line target). outlinePath gains "thinScaled" and readProgramSources returns nine. To match 1.5 pixels per CSS pixel, pass setResolutionScale(1.5 / (buffer pixels per CSS pixel)) (canvas width / clientWidth, which differs from devicePixelRatio when the engine resolution setting bundles the buffer). On an iPhone SE2 with the miner values (width 2.62, alpha 0.65, 750x990) the outline cost at scale 1, 0.75, 0.5 is 17, 12.5 and 8 ms (counted by drawing the same frame back to back and reading back).
- Batched drawing names same as the Rust version: Graphic.setSpriteBatchingEnabled, isSpriteBatchingEnabled and flushSpriteBatch are now setBatchingEnabled, isBatchingEnabled and flushBatch (Rust set_batching_enabled, is_batching_enabled, flush_batch). A batch holds not only images but also shapes, text and vertex color quads, so 'sprite' narrowed the meaning. flushSpriteBatch is removed.
- Drawing outside the engine loop (the same contract as a 2D canvas): what is drawn into a batching Graphic outside the engine loop (a Graphic made without an engine, your own requestAnimationFrame, an input handler) is now drawn by the engine when that task ends (a microtask). That is before the browser presents the canvas, so it shows without an explicit flush. Until now the batch was flushed only at the end of an engine frame, so the OPTIONS panel of the neonhorizon example, which uses Graphic without the engine loop, was not drawn (0.3.2 drew it). Inside an engine frame it does nothing, because the engine flushes first at the end of the frame.
- Measuring text once: glyph layout goes through the text measure cache when it measures a whole left-to-right string at scale 1. What Text already measured with the same font string and text for its drawn rectangle (off-screen culling) is not measured again. measureText in timelineshowcase, whose time text changes every frame, goes from 2.85 to 1.75 calls per frame. (The rest measures character pairs seen for the first time and stays in the cache, 0.3.2 made 1.05 calls)
- Faster Graphic construction: the grapheme segmenter (Intl.Segmenter) used by glyph layout is now created once, when non-ASCII text is first split, instead of when a Graphic is made, and it is shared. Printable ASCII text has one character per grapheme cluster (UAX #29), so it is split without the segmenter. Chrome takes about 5 ms to create the first Intl.Segmenter. new Graphic(canvas) goes from 14.3 to 8.3 ms (headless Chrome, median of 8, 0.3.2 takes 5.6 ms).
- Does not use discarding attachments at the end of a pass (invalidateFramebuffer); passes that overwrite a whole target clear it first (clearBufferfv): measured per site on real devices in Safari (iPhone SE2, iPad mini 6), no site showed a gain and each added several to tens of ms per frame (frame of the toon post process with bloom and ambient occlusion: 51 ms on SE2 becomes 11 ms with it off, 41 ms becomes 14 ms for the multisample target with multi-level bloom, 90 ms becomes 25 ms on iPad, no difference in desktop Chrome). RenderTarget.resolve() no longer discards attachments after resolving (the argument of resolve(isAttachmentKept) is no longer used and is kept), and the opacity layer (beginOpacityLayer) no longer discards its depth and stencil when it ends. The bloom bright extraction and blur, the multi-level bloom extraction and downsampling, and the four ambient occlusion passes clear their target first (clearing matches not calling anything, checked on SE2). The screen result is unchanged.
- Text drawing uses a glyph atlas (the same model as the Skia glyph cache, Unity TextMeshPro dynamic atlas and Unreal font cache): instead of baking each string whole on a canvas and uploading one texture per string, each grapheme chunk is baked once per font (mode, font string, bake scale, line width) into atlas pages (1024 x 1024, glyphs go into the newest page and a new page opens when it is full, up to 8, beyond that the least recently used page is cleared), and strings are drawn as glyph quads through the sprite batch. A new string bakes only glyphs it has not seen, and text on the same page is one draw call. The pixels match Chrome drawing the whole string with fillText: Chrome (Skia) rasterizes glyphs separately at 4 horizontal subpixel positions (rounding 1/8) and stamps them at integer positions, so glyphs are keyed by (grapheme chunk, 1/8 position slot) and placed where measureText puts them (width of the previous chunk joined with this one minus this chunk's width, kerning included). Latin, Cyrillic and similar letters that can form ligatures are baked per word, right-to-left text (Arabic, Hebrew) and fonts over 256px per string. In headless Chrome (macOS; Korean, English, digits, mixed, emoji, ligatures, Arabic, Thai, Devanagari, Cyrillic, several sizes and weights, outline, device pixel ratio 1 and 2) the pixels that differ from before are 6 at 1:1 (setTextBakeScaleStep(0), setTextPixelSnapEnabled(true)) ratio 1 (at most 4 levels) and 2 at ratio 2 (1 level), from 8-bit compositing where glyph ink overlaps. Text placed at fractional positions or stretched can differ by up to 10 levels where neighbouring glyph ink touches within one texel, because linear filtering runs per glyph (57 pixels with the default settings at ratio 1). The top and bottom row of each cell repeat the edge rows of the string rectangle, so at fractional vertical positions, when ink taller than the line (Arabic and the like) touches the end of the string rectangle, linear filtering no longer samples a different atlas row (9 pixels, up to 15 levels before), and blank chunks (spaces) are not baked. A 50-line text screen goes from 100 draw calls to 1, and 300 new strings made of known characters go from 300 bakes (texture uploads) to 0. The entry from TextStringTextureCache.getEntry holds glyphTextures and glyphRects (left, top, right, bottom, u0, v0, u1, v1 per glyph) instead of texture, and readAtlasStatistics() reports page, glyph and upload counts.
- 2D batching breaks less often (screen output unchanged): (1) Axis-aligned square clips whose edges lie on pixel boundaries (beginClipRect, Mask, UIScrollView) are clipped by the batch shader instead of the stencil, by pixel center, using a clip-rectangle table index carried in the vertices (the Unity RectMask2D and UI Toolkit scheme), so setting and releasing a clip keeps the batch going. Rotated or rounded clips, and clips whose edges are not on pixel boundaries on a multisampled canvas, use the stencil as before (a multisampled stencil half-covers edge pixels, which differs from the pixel-center rule). Draws that are not batched (swapped-in shaders, shader blending, shader-blended particles) get the same rectangle as a scissor, and runExternalPass writes the shader clips into the stencil for its duration. (2) One batch binds several textures (the smaller of the device MAX_TEXTURE_IMAGE_UNITS and 16), so it continues across images, shapes (white texture) and text textures (the PixiJS scheme). (3) drawColoredQuads (particles, heat haze) also joins the same batch under fixed blending and is computed with the same formula as the particle shader. (4) Off-screen culling also checks the bounding box of the active clips, so components of rows outside a scroll view are not drawn (like Unity RectMask2D, automatic, no option). UIView (background only), UIButton and UIProgressView report isDrawnInsideContent like the Rust edition, so such nodes are culled too. Hit testing already skipped descendants outside a Mask. The batch vertex cap is 6 x 8192, the same as the Rust edition. Measured (headless Chrome, pixel ratio 1.5, pixels identical to before): a settings-window scene (one window, UIScrollView, 50 rows, each with text, a button and a shape) 128 draw calls to 1, scrolled 132 to 1, examples/uigallery 61 to 2, devtoolsshowcase 95 to 4, particleeffects 72 to 8, effectgallery 229 to 150. New test tests/core/batchclipchrome.test.mjs (shader and stencil clips match to the pixel with fewer draw calls, rows outside a scroll view are culled)
- UI geometry cache (on by default, screen output unchanged): nodes draw components through Graphic.drawComponent, and components that report their draw inputs through Component.writeGeometryKey (Paint, UIView, the Text of UILabel, the Sprite of UIImageView) have their drawn vertices cached per component. While the inputs (color fields, sizes, text, images, etc. written to GeometryKey) and the scale, rotation, blend and tint stay the same, draw is not called: if the translation and opacity are also the same, the captured device vertices are copied into the batch as is, and if only the translation or opacity changes (scrolling, moving a window, fades), only the new matrix and opacity are applied to the cached local vertices (the model of Unity UGUI keeping each Graphic's mesh in local space and rebuilding only what changed; text recomputes pixel snapping identically). Changes are detected by comparing inputs rather than by dirty flags in setters, so mutating a Color in place is also recomputed. Components that do work outside the batch inside draw (clipping, layers, changing the blend mode, etc.) and subclasses that override draw are drawn every frame as before. Graphic.setGeometryCachingEnabled turns it off, and getLastFrameGeometryCacheHitCount and getLastFrameGeometryRebuildCount count it. Retained batches: each batch is kept in a GPU buffer per draw position in the frame (up to 32 positions), and the vertices put into it are recorded in order as segments (geometry cache segments with their versions, and the vertex counts of spans written directly without a cache). At the same position in the next frame, the same segment at the same place is neither copied nor uploaded (directly written spans have no version, so their vertex values are compared with the span at the same place in the previous frame); only the changed segments, the directly written spans whose values changed, and everything after a segment whose vertex count changed (shifting what follows) are uploaded with bufferSubData (ranges separated by 256 vertices or fewer are merged, at most four calls per batch, otherwise one call from the first range to the last). When everything is the same only the draw call is issued (the way a Unity UGUI Canvas redraws its previous batch mesh and rebuilds only the graphics that changed; draw order, clip slots, texture slots and blending stay the same, so pixels are identical). The first time, when the vertex count grew, or when everything changed, everything is uploaded with bufferData into new storage. ANGLE on Metal (macOS and iOS) does not stall the CPU when bufferSubData changes a buffer the GPU is still using: it writes the changed range into a new buffer and moves the rest with a GPU copy (ANGLE BufferMtl::setSubDataImpl, putDataInNewBufferAndStartUsingNewBuffer). Previously a single uncached draw such as an Outline made the whole batch upload again with bufferData every frame (227 KB per frame in a static UI test scene of 14 rows with 14 outlines, now 0; changing the text of one row every frame uploads 3.7 KB and moving one icon uploads 1.7 KB, each with one bufferSubData, and the screen is byte-identical). Counted with Graphic.getLastFrameRetainedBatchCount (batches that uploaded nothing; with the cache off it also counts batches whose directly written vertices equal the previous frame). The 2D batch array now starts at 512 quads (172 KB) and doubles when needed up to the limit (8192 quads), and the end-of-frame batch buffer no longer reserves storage up front (previously a 2,688 KB CPU array and a 2,688 KB GPU buffer were reserved at the limit from the start). A sprite command whose translation alone changed keeps the first part of the matrix product in Float64 and only adds the translation (same order of operations, bit-identical). Measured (headless Chrome, cache toggled every 10 frames in one page, median CPU time of the scene tree draw plus the end-of-frame batch draw, in parentheses the median on/off ratio of paired 10-frame blocks): 240 visible cells (rounded background and text) static 0.930 to 0.565 ms (0.56), a settings-window-like scene static 0.270 to 0.215 ms (0.81), examples/uigallery 0.255 to 0.230 ms (0.87), the clipping scene (batchclip) 0.185 to 0.170 ms (0.85), settings window while scrolling 0.275 to 0.335 ms (0.94, ratios over several runs 0.94 to 1.02), 240 cells while moving 1.110 to 1.335 ms (ratio 0.73 to 1.20; the previous version also swung from 0.72 to 1.42, so it cannot be told apart while the machine is busy). New test tests/ui/uigeometrycachechrome.test.mjs (cache on and off are identical to the pixel when static, scrolling, and after changing position, color, text, visibility, opacity, scale and rotation, and nothing is recomputed in static and scrolling frames)
- Off-screen subtree culling (on by default, screen output unchanged): each node keeps its subtree draw bounds (the union of its own drawing and the bounds of its active, visible children, in the node's content coordinates) and recalculates them only when something changed, and after drawNode applies a node's transform it skips the draw traversal of that node and its descendants entirely when those bounds are outside the screen and the active clips. Updates (tick) still run. When a transform, content size, pivot, added or removed child, active state, visibility, added, removed, enabled or disabled component, or a value that changes a drawn rectangle such as a Text's text and font changes, a dirty mark spreads to the ancestors (scene graph bound dirtying, the same shape as Unity UGUI SetVerticesDirty and Godot item_rect_changed). A subtree that contains something whose drawing area is unknown (a component that does not report its bounds, a node that overrides draw without reporting calculateDrawnRect, a node that draws gizmos, a node that overrides reading its position or transform, a node that does not report how it is placed in its parent's coordinates) is never skipped. Drawing the scene of a settings-window-like scroll list (120 rows, each with a background, an icon, two texts and three buttons, about 10 rows visible) went from 0.92 ms to 0.26 ms when still and from 0.99 ms to 0.29 ms while scrolling, the same as the game turning off the invisible rows itself (0.26 ms, 0.27 ms) (Mac mini M2 Pro, headless Chrome, tests/ui/scrolllistbench.mjs). New API: Graphic.setSubtreeCullingEnabled, isSubtreeCullingEnabled, getLastFrameCulledSubtreeCount, TransformNode.readSubtreeDrawBounds, calculateSubtreeDrawBounds, markDrawBoundsDirty, markParentDrawBoundsDirty, getLastDrawnFrameNumber, WorldNode.calculateDrawnRect, Component.markDrawnRectDirty, Component.markAllDrawnRectsDirty, Component.getDrawnRectGeneration. Per-node off-screen culling treats update-only components (those that do not override draw, such as ButtonMotion) as drawing nothing. When checking whether a node's text bake scale is moving, a node that was not drawn in the previous frame is treated like one drawn for the first time (setLastDrawnMaximumScale also takes the frame number).
  - Wider drawn-area reporting: UISlider (the thumb circle spills by its radius along the whole range it moves over, a value-independent rectangle), ShadowText, ShadowImage (twice the shadow blur plus the offset), RichText (the joined single line), UILineChart (out-of-range values), UIBarChart, HeatHazeEffect (wobble amplitude), and UIInputField's context menu (shadow) and background and overlay layers (up to the visible text width on a single line) report where they draw through calculateDrawnRect and call markDrawnRectDirty in every setter that changes that rectangle. Subtree bounds calculation moved up to TransformNode, and moving a child into parent coordinates is done per node kind through transformDrawBoundsToParent (WorldNode by position, rotation, scale and pivot, UINode by the solver's placement). UINode now recalculates its bounds when the solver's position or size changes (LayoutVariable.setValueChangedEvent), so it can be skipped. Position, scale, rotation, visibility, pivot and content size setters no longer dirty anything when given the same value. Drawing a scene that carries the engine components of Rimminer's settings window as is (120 rows) went from 0.370 ms to 0.215 ms when still and from 0.390 ms to 0.265 ms while scrolling with culling on (off 0.640 ms, game culling 0.140 ms, tests/ui/scrolllistbench.mjs). New API: TransformNode.calculateDrawnRect, transformDrawBoundsToParent, transformLocalRectToParent, WorldNode.transformDrawBoundsToParent, UINode.transformDrawBoundsToParent, calculateDrawnRect on UISlider, ShadowText, ShadowImage, RichText, UILineChart, UIBarChart and HeatHazeEffect, LayoutVariable.setValueChangedEvent, getValueChangedEvent. ParticleSystem, TrailRenderer and TouchEffect do not report their drawn area yet (their ancestors are not skipped).
  - Culling in parent coordinates first: when a parent calculates its subtree bounds, it writes each child's bounds moved into the parent's coordinates onto the child (TransformNode.readParentDrawBounds, valid until the child's transform or bounds change and the parent recalculates), and drawNode compares those bounds against the visible rectangle in parent coordinates (the screen and active clips moved back by the current transform as a bounding box, one device pixel looser, calculated once per parent while the transform and clip stay the same) before applying the child's transform, skipping the child without applying the transform when it lies outside. Scrolling changes only the parent's transform, so the children's bounds are not recalculated. Rotation and skew stay conservative through bounding boxes, and drawing order is unchanged. Flat lists (hundreds of direct children under one group node) no longer apply a transform to every off-screen child.
  - Drawing only the visible range of children: child drawing is gathered into TransformNode.drawChildren (called by TransformNode.draw and WorldNode.draw). When the subtree bounds are calculated, the parent-coordinate bounds written for each child are kept as the largest bottom and right gathered from the front and the smallest top and left gathered from the back, and at draw time a binary search against the visible rectangle (the new Graphic.readLocalVisibleBounds) skips the children before and after the range without even calling drawNode. It is correct in any child order (rows laid out in order leave only the visible rows), a child with unknown bounds or a hidden child stops the narrowing at its position, and if the node's bounds change while drawing all remaining children are checked. Skipped children are counted as if culled one by one (the new Graphic.addCulledSubtreeCount). Drawing order is unchanged.
  - Subtrees fully inside the visible rectangle (the 'fully inside' flag of frustum culling): when drawNode finds that a node's subtree bounds lie fully inside the visible rectangle (the screen and active clips shrunk by one device pixel; tested in parent coordinates before the transform when the parent transform is axis aligned, and in device coordinates after the transform when there is rotation or skew), its descendants are drawn without the subtree test, component culling or the visible child range search while that node is drawn, and only descendants that draw nothing (bounds of size 0) are skipped. When a new clip (mask, scroll view) is set below it, testing starts again inside that clip (a clip state number that returns to the previous state when the clip ends). Skipped counts and the image are unchanged. New API: Graphic.isInsideVisibleBounds. Empty text (Text, UILabel with text "") reports its drawn area as size 0. It used to be unknown, so a subtree holding an empty label was traversed even off screen (the toggle button of the Rimminer settings window: every off-screen slider row was traversed down to its empty label and drew two text components, 62 per frame in the 120-row scene). Drawing the Rimminer settings window scene (120 rows) with culling on went from 0.280~0.300 ms to 0.190~0.200 ms static and from 0.315~0.330 ms to 0.200~0.205 ms while scrolling, now faster than the game turning off invisible rows (0.210~0.235 ms). Transforms pushed 153 to 60 (game 124), screen tests after the transform 118 to 7 (game 58), component draws 149 to 87 (game 87). Most of the Rimminer gap was the empty text (a build with only that fix draws in 0.190 ms, the same as the game culling). The engine scene went from 0.305~0.310 ms to 0.240~0.290 ms static with culling on (game 0.285~0.335 ms), screen tests 156 to 19 (game 78) (Mac mini M2 Pro headless Chrome, tests/ui/scrolllistbench.mjs, before and after alternated twice).
  - ParticleSystem and TrailRenderer report where they draw (bounds recalculated every frame, as in Unity): the quads of live particles (half the size times √2, head and tail for streak quads, plus the wobble amplitude) and the trail points (half the larger width). They call markDrawnRectDirty when the simulation runs, on emit, on clear, and in setters that change how they draw, so only drawing is skipped when off screen while the simulation (tick) keeps running. World-space particles with manual tick report unknown (not skipped).
- GL state cache (WebGLStateCache, in the style of three.js WebGLState and the state memory of the Chrome GPU command buffer client): right after Graphic creates the context it intercepts the context's state functions (bindFramebuffer, viewport, scissor, enable, disable, clearColor, colorMask, blendFunc, blendFuncSeparate, blendEquation, depthMask, depthFunc, frontFace, cullFace, useProgram, bindVertexArray, activeTexture, bindTexture, pixelStorei and the deletes) and remembers the changed values; getParameter and isEnabled answer from memory without asking GL. In Safari these reads are synchronous round trips to the GPU process, so the reads done while drawing by the engine 2D path (restoring the framebuffer), toon 3D (saving state) and game renderers all go away (about 1.5 ms per frame on the game renderer side of Rimminer on iPad). Limits that never change (MAX_SAMPLES and so on) are asked once. Values that are not remembered (stencil functions, buffer bindings and so on) still go to GL. Unknown values (at first, after arguments that cannot be checked, programs whose link result is unknown) are asked once on the next read. A headless Chrome test (tests/core/webglstatecachechrome.test.mjs) mixes wrong arguments, deletes and context loss over more than 600 random calls and checks that the cache answers match real GL (0 differences) and that GL is asked 0 times while drawing. Context loss is known from a flag set by the webglcontextlost and webglcontextrestored events, so isContextLost is not called for each intercepted getParameter and isEnabled (previously it was called on every read: 40 times per frame in a measured game screen and 64 times in the engine's toon room and lobby scenes, now 0; real getParameter queries to GL are 0 before and after; the test also checks 0 isContextLost calls while drawing). Added the public functions Graphic.getCurrentFramebuffer() (the framebuffer being drawn to, null for the canvas), getCurrentViewport() (the current viewport as a Rect, device pixels, bottom-left origin) and resetGLStateCache() (resynchronize the memory, like three.js resetState).
- Fewer toon 3D draw state changes (in the style of the Unity SRP Batcher and three.js WebGLState and WebGLUniforms): for every draw ToonRenderer asks the GL state cache about the program, the nine texture units, the front face winding and cull face, and the vertex array, and does not set them again when they are the same; for uniforms it remembers the last uploaded value per program and name and skips uploading the same value (bone matrices too; the memory is dropped and everything uploaded again at the start of a frame or shadow pass, after stage callbacks and the screen-space outline, and after that program's onBeforeDraw). ShaderProgram.useProgram() also skips when the state cache remembers that the program is already in use. ToonDrawQueue draws opaque things (bodies, outline shells, shadow depth) sorted by material, model and base color texture (ties keep the added order; transparent things stay farthest first). In a heavy toon scene (58 models and 400 instanced rocks, 6 skinned models, sun shadow and two point light shadows, outline shells and the screen-space outline, headless Chrome on a Mac mini M2 Pro) GL calls per frame went 6146 → 2476 (useProgram 344 → 38, uniform 2918 → 1415, activeTexture 549 → 88, bindTexture 480 → 48, state changes 1353 → 385, draws unchanged at 393), the median CPU frame time 3.1 → 0.8 ms, and the screen is bit-identical. The state cache test checks that whenever a comparison function (isProgramInUse, isTextureBound and so on) answers "same", the real GL value is the same too (518 times, 0 wrong).
- Fewer shadow redraws (in the style of the per light shadow update mode of Unity HDRP and the cached shadow maps of Unreal): added setUpdateMode(ShadowUpdateMode, frame count), getUpdateMode, getUpdateInterval and requestUpdate to ShadowMap and ShadowAtlas. ShadowUpdateMode is everyFrame (everything every frame, the behaviour so far), onChange (default) and interval (everything every N frames, the frames in between keep the previous shadow). With onChange, ToonDrawQueue.drawShadows and drawLocalShadows compare the casters with the previous frame in the order they were added (mesh, material, model matrix and instance matrices, joint matrices, index buffer range, frustum culling, mirroring, light matrices and atlas tiles). Casters unchanged for 30 frames are baked into a separate target, and only the moving ones (and materials with a vertex chunk) are drawn every frame on top after copying the baked target into the shadow target (blitFramebuffer). It bakes again when a baked one changes or is removed or a new one becomes bakeable, and a frame where the light changed draws everything straight into the target. When everything is unchanged nothing is drawn. Depth keeps the nearest with LEQUAL, so the baked and overdrawn target is bit for bit the same as drawing everything at once. In the heavy toon scene (the same scene as above, Mac mini M2 Pro headless Chrome) a frame where everything is still goes from 393 to 168 draws and from 2476 to 1627 GL calls, a frame where six skinned models move goes from 394 to 195 draws and from 2477 to 1825 GL calls, the median CPU frame time goes from 0.8 to 0.4 ms, and the screen is bit for bit the same in both cases. A Chrome test (tests/graphics3d/shadowcachechrome.test.mjs) checks over 110 frames, where a box moves, stops and moves again, an instance moves, the sun and a point light move and a model is removed and comes back, that the screens of everyFrame and onChange are the same every frame (deliberately breaking the check is caught at frame 61).
- Sun shadow focus step (cuts the onChange cache redraws every frame in scenes where the focus follows a moving camera): added setFocusStep(world step) and getFocusStep to ShadowMap. With a step, updateLightMatrix snaps the focus to multiples of the step along each world axis (x, y, z) so the light matrix stays the same inside one cell, and adds the step as margin to the covered width and depth so the area around the focus never leaves the map. Texel snapping still applies on top. The default 0 behaves as before (texel snapping only).
- Lower CPU cost per toon draw (in the style of Unity's SRP Batcher): the nineteen material values of the body program (tintColor, tintAmount, alpha, glowScale, colorScale, emissiveColor, softEdge, alphaCutoff, premultipliedOutput, textureEnabled, uvTransform, decalUvTransform, decalColor, receivesShadow, shadeOffset, highlightScale, matcapSettings, angelRingSettings, angelRingColor) go into one std140 uniform block ToonDrawMaterial, and the six values of the outline shell (outlineColor, outlineLightColor, outlineWidthScale, outlineOffsetZ, alpha, premultipliedOutput) into ToonDrawOutline. Blocks with the same values are built only once (GPU buffers) and each draw picks one with a single bindBufferBase, skipped when it is already bound. The renderer remembers, per draw options object, a shallow copy (property names and order, value references, the contents of number arrays of four or fewer) and the resolved values, so when a game passes the same options object every frame it does not look properties up by name and resolve them again (only present properties are compared with for-in, cheap even in release builds where obfuscation makes named reads expensive). Changing a tint array in place or adding and removing properties shows on that draw. ToonDrawQueue compares each options object only once during draw and drawShadows, following its promise (class header) that options are not changed meanwhile, and also reads transparency, shadows, line ID and group from the resolved values. It reuses item slots every frame, reuses the order when the opaque sort keys (material, mesh, base color texture) are the same as the previous frame, and builds no new options objects when drawing bodies and outline shells. Program set and uniform slot lookups remember the last one found. Measured with the benchmark tool (tests/graphics3d/toondrawbench.mjs, alternating with a copy from before the change) on an Aberrant lobby style scene (tests/graphics3d/toonlobbyscene.mjs, thirty mesh kinds, forty draw looks, four surface chunk materials, 300 objects, sun shadow, screen-space outline, Mac mini M2 Pro headless Chrome): GL calls per frame go from 4929 to 4437 and uniform calls from 2980 to 2227 (material and outline values moved into blocks, adding 261 bindBufferBase), while program switches 41, texture binds 205, vertex array binds 388 and draw calls 484 stay the same. The number of options property reads by the engine (counted with a Proxy) goes from 10454 to 6172 per frame (34.7 to 20.5 per item, about half of the rest is ToonScreenOutline's line target). In the CDP profile, engine self time (ms/frame) goes for drawWithCount from 0.133 to 0.109 and for writeUniformFloats from 0.109 to 0.022, and drawItem 0.120, drawMeshOutline 0.035 and readOpaqueItemList 0.026 drop out of the top fourteen. The median script time (alternating with the copy from before, three times each, machine load 2 to 15) stays at 2.31 to 2.30 ms. Most of the profiled time is inside GL calls (before: uniform4f 1.61, uniformMatrix4fv 0.88, after: bindTexture 1.10, uniformMatrix4fv 0.82, bindBufferBase 0.61 ms), and that share moves to whichever call regardless of the call counts, which we take to be waiting on the GPU process (a guess, not split apart). So in a non-obfuscated build the smaller JavaScript share does not show up as frame time. (An obfuscated build like the release one, where named property reads are expensive, was not measured) Miner mid style scene (instance buffers, six chunks): GL calls go from 849 to 803 and uniform calls from 395 to 345, draw calls stay at 75, and the median script time is about the same at 0.42 to 0.43 ms. The pixels of both scenes and the five toon examples (toonstyle, toonshowcase, toonview, toonmaterial, toonfx) are the same to the byte as before. A Chrome test (tests/graphics3d/toondrawbatchchrome.test.mjs) checks that changed material values show on that frame, that changing values of the same options object in place shows, that the same values upload no new block, that the result matches a new renderer drawing the same values to the byte, and that reusing the sort order or changing the add order keeps the image the same with transparent things in depth order.
- Shared 3D asset cache (SkinnedModelAsset): skinned model instances built from the same file share one copy of the mesh buffers and vertex arrays, the material prototypes and their textures, the morph textures, the node and skin prototypes and the animation clips, by reference count. (like Unity's mesh and sharedMaterial, or three.js clones) SkinnedModel.loadFromUrl and loadFromFbxUrl look the cache up by shader program and normalized path (SkinnedModelAsset.normalizeKey); on a hit they return an instance without fetching or parsing, and concurrent loads of the same file fetch once. Added createInstance(), createFromAsset(asset), getAsset(), getMaterial(index) (Unity Renderer.material: the first call forks a copy that borrows the textures), getSharedMaterial(index), Material.createInstance(), setBaseColorFactor, getTextureByteCount and SkinnedModelAsset (find, register, clearCache, getCachedCount, normalizeKey, retain, release, getReferenceCount, getGpuByteCount and more). An instance's destroy deletes only its own resources (wireframe buffers, forked morph textures and materials) and releases the asset; when the last instance releases it, the asset deletes its GPU resources and leaves the cache. The clip list is shared by the instances, and adding a clip with an existing name through addAnimationsFromFbx* replaces it in place. addMorphTarget forks only that instance's target list and morph texture. Measured (headless Chrome, examples/ancientmountain/assetcache_test.html, 20 copies of one model): fox.glb from 421 ms and 113.8 MB of GPU memory to 20 ms and 5.7 MB, mannequin_female.glb from 250 ms and 32.0 MB to 9 ms and 1.6 MB. The six foxes in examples/ancientmountain now walk out of step, one instance each. Same API and same test as the Rust edition (tests/graphics3d/skinnedmodelasset.test.mjs).
- UILineChart: lowering the cap with setMaxSampleCount drops the samples already held, oldest first. (Previously they stayed until the next pushValue and points went outside the graph width)
- ShaderWarmer: shader pre-linking. At startup, links the same sources in the background with KHR_parallel_shader_compile and leaves them in the browser program cache, so the main thread does not stall when ShaderProgram later builds the same sources. Does nothing if the extension is absent. update() every frame, isFinished(), isSupported(). Attribute locations are given with the same attributeLocationTable as ShaderProgram
- Engine: calls PointerCursor.apply() at the end of the frame (after drawing the batches)
- ToonRenderer: GPU instancing (drawMeshInstanced, per instance { modelMatrix, tintColor }, for both body and outline), off-screen culling (model bounding sphere against the frustum; instances are culled one by one and only the remaining ones are uploaded, options.isCulled), shadows (beginShadowPass, drawMesh draws depth only, endShadowPass restores the framebuffer and viewport, received with 3x3 PCF via setShadow(ShadowMap)), HDR output (setHdrOutput), drawn count, culled count and draw calls for one frame (getFrameStatistics), extractFrustumPlanes
- Rendering: reduces per-frame object creation and per-draw-call work when drawing nodes and Paint. Rendering results are the same and caller usage is the same. (Capturing the bench scene below and the examples uishowcase, uisample, spriteeffects, particleeffects, timelineshowcase at the same frame with a fixed clock gives screen pixels identical to before the change) Measured at the same time in Chrome (headless, real GPU) on a scene of 8,000 moving nodes drawing rounded rectangles with Paint (the same-spec comparison bench of rustgame-test), drawing goes from 78.0 ms to 13.0 ~ 14.4 ms, the frame from 90.1 ms to 23.9 ~ 26.3 ms, and the node count holding 60 FPS from 1,000 to 4,000 ~ 6,000. (Measured on one PC; game logic time is unchanged)
- Graphic: 2D drawing after outside WebGL. Graphic no longer keeps its own memory of the program in use or the bound textures; right before drawing it compares against the state cache (WebGLStateCache) and sets again only what differs. (program, default vertex array and vertex buffer, texture units and the active unit, blend enable, equation and factors, depth test and face culling off, scissor off unless it is the clip scissor, full drawing buffer viewport) Even when a game uses WebGL through the same context outside runExternalPass (a shadow map after graphic.flushBatch and the like), the next 2D draw and ToonView3D draw correctly. Two promises remain: if the game bound its own framebuffer it puts back the one it found, and it does not change the stencil state. Unchanged frames make no extra GL calls. (GL calls per frame in the test scene went from 268 to 219) invalidateRenderStateCache, which forgot that memory, is removed. (there is nothing to forget; after changing state in a way that cannot be intercepted, call resetGLStateCache) The state cache gains isArrayBufferBound, isCapabilitySet, isBlendFunction, isBlendEquation and isViewport. (comparisons that do not ask GL, false when unknown) (webgame-rimminer reported INVALID_OPERATION: uniformMatrix3fv, location is not from the associated program. When a ToonView3D inside a clipped parent wrote the shader clip to the stencil in runExternalPass, it drew with Graphic's program memory, which did not know the program the game had switched to)
- ImageTextureCache, TextStringTextureCache: Take a texture binding function (textureBinder) as the second constructor argument. Graphic passes it, so the bound texture is remembered even when a cache uploads a texture. Without it, binds directly as now. ImageTextureCache.getTexture binds only when creating a texture or reapplying a filter. (Binding for drawing is done by Graphic)
- Off-screen culling: When Graphic.setCullingEnabled(true) (default false, same as before), before a WorldNode draws its components, if all enabled components report that they draw only inside the content area, the node's component drawing is skipped when the bounding box of the content area (expanded by one unit) transformed by the current transform does not overlap the screen. The test uses Graphic's current transform at draw time (including the parent's scale and rotation and anything applied with pushState). Children are checked separately and drawn as usual, and Mask clipping is still applied. Nodes that override draw, TransformNode and UINode are not culled. (Same approach as Rust vanilla-engine, on by default in Rust)
- Component.isDrawnInsideContent(): Whether it draws only inside the node's content area. The default is false, so a node with any enabled component that does not report it is not culled. Only Paint, Sprite and ShaderSprite (when not flipped, including pieces, nine-slice and tiling), Mask, Outline, SoftShade, UIProgressRing report true. Subclasses that override draw fall back to false. Text (Text, RichText, ShadowText can overflow their box), ShadowImage (shadow margin), ParticleSystem, TrailRenderer and UI widgets do not report it
- Graphic: turns on batched drawing (setBatchingEnabled) and off-screen culling (setCullingEnabled) by default. All games using the current engine (webgame-rimminer, space-creature, aberrant, retrogame-foundyou, steamgame-apocalypsesurvival) ran with batched drawing on, and culling only culls components that report drawing only inside the content area (pixels with it on and off were identical in seven example scenes). For the old behavior, setBatchingEnabled(false), setCullingEnabled(false)
- LoadingProgress: the shown value (getShownProgress) smoothly follows the reported progress (setProgress, 0 ~ 1, never decreases). update(timeDelta) every frame, follow speed setFollowRate (default 6 times the remaining distance per second), isFinished, reset
- Text measurement cache: TextStringTextureCache.measureText and Text measurement do not re-measure when the font string and text are the same. (2048 entries, least recently used evicted first, cleared when a web font is loaded or the document's font face count changes) measureTextMetrics(fontString, text) (textstringtexturecache.js). The returned TextMetrics is shared, so do not modify it
- Component.calculateDrawnRect(rect): Lets a component that draws outside the content area report the rectangle it draws. (default false, unknown) WorldNode off-screen culling checks components that report drawing inside the content area together with these rectangles. Text reports the single-line text rectangle (fitted size, that width even when overflowing, outline plus half the font size on both sides, 1.5 times the font size each vertically). RichText reports unknown. UILabel reports drawing only inside the content area (background)
- Behavior change: single-line Text and UILabel nodes, which were not culled until now, are also culled when off-screen. (When culling is on, wrapping text and rich text are still not culled) If a component that draws directly inside the node is attached as well, that component does not report as before, so the node is not culled
- Color.fromCache(colorString): A color cached by color string ("#..", "rgb(..)", "rgba(..)", white otherwise). The same string returns the same instance (1024 entries, least recently used evicted first), do not modify it. Graphic.setFillColor and setStrokeColor use this cache when given a string
- AudioPlayer.setPlaybackRate(playbackRate): playback speed. (1 is unchanged, pitch changes too, from the next play)
- Color.fromHEXCached: like fromCache, discards the least recently used entries beyond 1024. (Previously grew without limit) Color.getCachedColorCount(): number of entries in the fromCache cache (the Rust version's get_cached_color_count)
- RenderTarget: options sampleCount (2 or more draws into a multisample renderbuffer and resolve() resolves into each color texture and the depth texture, reduced to within MAX_SAMPLES and the sample count each format accepts, without multisampling if unsupported or if the framebuffer is incomplete), depthBits (depth renderbuffer 16 or 24), getSampleCount, getResolveFramebuffer, readSupportedSampleCount. When multisampled, getFramebuffer is the multisample framebuffer being drawn to
- MultiLevelBloomEffect: multi-level bloom. Soft knee threshold while extracting at half size (brightness is the largest of the three channels), dual filter halving at each step, upsampling 2x at each step with a 9-tap tent filter and adding to the level above. Level count (setLevelCount), threshold and knee (setThreshold), buffer precision
- ToonRenderer: pushes shell outlines out in the shader. Uploads the base position and the push offset to the vertices (the width MeshBuilder builds by averaging the normals at the same position and keeping corners from sticking out), and per draw outlineColor, outlineWidthScale, setOutlineDistanceScale(reference distance, minimum multiplier, maximum multiplier) adjust the width with distance. (Perspective only, keeps the on-screen width like Guilty Gear Xrd) Shells without a base position (prebuilt in a GLB) are drawn at their built positions as they are
  - Attribute 1 (the vertexNormal slot) of the shell vertex array holds the push offset. If a vertex chunk modifies vertex.localNormal in the outline program, the shell width changes
  - Exports the frame uniform viewRotation (matcap) and the functions readViewRotation, readOutlineVertexData
- ToonScreenOutline: removed the stair-stepping left in the half-size (reduced) buffer. The line buffer and seeds are always taken at drawing area resolution, and only jump flooding runs on the reduced buffer. Each cell of the reduced buffer gathers the nearest of the full-resolution seeds (gather pass), and seed positions are widened as drawing area pixel coordinates as they are, so the distance is measured in the drawing area when blending. (The form Ben Golus described: run jump flooding at low resolution, but resolve by distance instead of bilinearly upscaling positions)
  - The meaning of setResolutionScale changed to the fraction for the line target and the widening buffers (drawing area x scale). The default 1 draws at the drawing area resolution.
  - getLineTarget(): seedTexture (full-resolution seeds), jumpFloodTextures, jumpFloodIndex, jumpFloodWidth, jumpFloodHeight. (seedTextures, seedIndex are gone) readProgramSources gives five (the gather pass)
- ShadowAtlas: made the tile size the same as the Unity URP default. new ShadowAtlas(context, resolution default 2048, tile resolution default 1024) asks for 1024 per tile, and if they do not all fit, halves until they all fit (URP additional light shadow atlas default 2048, resolution tier High default 1024, the light's default tier High). getTileResolution
  - Until now the grid was split by the square root of the tile count, so one point light got 682 and now 512, and one spotlight got 2048 and now 1024. For finer shadows, raise the resolution and tile resolution

## Fixes

- UIInputField trailing tab fix: a tab at the end of a wrapped line now hangs like a trailing space (Chrome white-space: pre-wrap) instead of starting an empty new line when the tab stop passes the line width.
- Toon prewarm: fixed prewarm not advancing on a loading screen that only skips frames while waiting for isReady() without drawing (the game session measured on headless Chrome on a Mac: still not finished after 45 frames, then one 8,183 ms frame when everything was finished at once, and one getProgramParameter completion query took 52 ms). Handed-off compile and link commands may not flow to the GPU process by themselves in frames with no draw or clear (the KHR_parallel_shader_compile spec text says nothing about flush, and the Chromium source was not checked), so prewarmDrawQueue now calls gl.flush() after handing off, and each ToonProgramPrewarm step calls it again while work remains. ShaderProgram.isBuildComplete() no longer asks again once it has seen completion (the query round-trips to the GPU process). The picture is byte-identical and the public API is unchanged. Headless Chrome on this machine finished while not drawing even before the fix (8 to 32 frames), so the stall seen in the game was not reproduced. The test counts gl.flush calls (0 before the fix; after it, 2 at hand-off and 1 per frame) and completion queries went from 78 to 64. (tests/graphics3d/toonprogramprewarmwaitchrome.test.mjs)
- The toon shadow cache (ShadowUpdateMode.onChange) no longer re-bakes on material values such as tint (casters are compared per object, as in Unreal and HDRP cached shadows): drawShadows and drawLocalShadows compared caster records in the sorted order of opaque items. The sort key includes the material block, so a single tint change shifted the order and unchanged casters looked changed, which either re-baked the whole cached map (lobby scene) or never baked at all and redrew everything every frame. Records are now compared in submission order (as the header comment already said), while baked and overlaid casters are still drawn in sorted order so auto-instancing batches stay intact. The compared values (mesh, material, matrices, joints, index range, culling, mirroring) are unchanged; tint, color and emission do not affect depth and do not trigger a re-bake. A moving object still re-bakes in that frame. Lobby scene (tests/graphics3d/toonlobbyscene.mjs, tint cycling every 40 frames) over 600 frames: bakes 30 -> 1 (the first one), room scene shadow draws 122 -> 118, and both scenes are byte-identical on screen. A Chrome test (tests/graphics3d/shadowcasterorderchrome.test.mjs) checks that frames where only a tint changes have every caster baked and draw no shadow depth (before the fix only the ground was baked), that moving a baked box re-bakes in that frame and then overlays only that box, and that the screen matches everyFrame on every frame.
- UIDocument image and node data fixes: a copy written and read with the same document now uses the original's images (serializeNode and toJsonText remember the image of each component that writes an imagePath, keyed by path, and use it when the resolver and the loadImages assets do not find one, like Unity Instantiate). So items cloned with UIListView.setTemplateNode show their images again (after the move to document instances they were cloned with a new document without a resolver and lost their images). bindPendingImages no longer overwrites a component whose image the game set or whose path it changed in the meantime. An image that loadImages failed to read is dropped from the table so the next loadImages requests it again. A node reference to a node that has an earlier sibling with the same name now warns when written (paths are names only, so reading back links to the earlier sibling; same form as the Rust find_node_path). A reflected property whose current value is a Color and whose document value is a string (such as "#rrggbb", the old form) is read with Color.from (it used to be dropped and keep the default color). A hidden node (setVisible(false)) writes visible: false in its node data and reads it back (visible nodes do not write it, so existing documents and expected data are unchanged).
- Drawing and image fixes: drawing with a swapped shader (such as ShaderSprite) and a shader blend mode inside an axis-aligned clip (such as UIScrollView) no longer paints black outside the clip; a runExternalPass(clearDepth: false) 3D pass inside an opacity layer no longer reads the previous layer's depth (each layer clears its depth); ShadowMap.beginRender turns off the scissor test so it no longer clears only part of the map inside a 2D clip (same as ShadowAtlas); with two engines, one engine no longer uploads the images another engine's scene read into its own context and closes their pre-decoded images (only the Graphic that was loading a scene when the image started loading pre-uploads it).
- Shader build failure: when ShaderSprite or ScreenEffect fails to build an effect shader, it no longer throws and stops the frame; like the Rust engine it reports once (console.error) and skips. (ShaderSprite draws as a plain Sprite, ScreenEffect skips that step) ScreenEffect.resolvePass returns null on failure.
- Engine: when the window loses focus (blur), releases keys too, not only touches and mouse buttons. (Through InputManager.clear followed by marking touches as released, same as Rust) Fixed keys staying pressed because keyup never came.
- Sprite: fixed flipping (setHorizontalFlip, setVerticalFlip) drawing outside the content area (on the negative size side); it now mirrors within the content area. Atlas pieces, nine-slice and tiles all flip. (Also fixes nine-slice being drawn small and broken and tiles not flipping) Since isDrawnInsideContent is true even when flipped, it gets off-screen culling.
- Graphic.drawNode: even if drawing throws, try/finally pops the pushed transform so the transform stack does not get out of balance.
- AudioPlayer: fixed a late-finishing earlier request playing sound when stop or play was called again while a suspended AudioContext was being woken. (Request numbers; there is always only one sound) Catches resume rejections so no unhandled rejection is left. getTime advances with the audio context clock during playback. (Multiplied by the playback rate, wrapped by the length when looping, otherwise stopping at the length; when stopped or finished, the start position from setTime)
- ParticleSystem: fixed bursts at the loop seam (repeat boundary) firing only in the first cycle. Bursts at 0 seconds and right before the boundary also fire every cycle, and if one frame passes several cycles they fire that many times. (They do not fire again on a 0-second frame where time is stopped)
- AnimationClip: corrected the frame list type to Rect, which it actually holds. (JSDoc of setFrames, getFrame, getFrames; removed the unused Frame import)
- UIView: fixed setBackgroundColor(null or undefined) throwing. It clears the background. (Resets it to the initial value, white with alpha 0, so it is not drawn)
- UIScrollBar: fixed the thumb default color, Color(255, 255, 255, 0.6) which mixed in 0 ~ 255, to Color(1, 1, 1, 0.6). (It looks the same when drawn, and the getThumbColor value now matches the Rust version) Filled in descriptions, @param, @returns and examples for the public API
- UIInputField hidden DOM input position: fixed a bug where it went out of place when the page was scrolled. Since it is an absolute element attached to body, window.scrollX, scrollY are added to the viewport coordinates (getBoundingClientRect, clientX) to place it in document coordinates.
- VisualAsset: fixed load not reading the file. Fetches the UIDocument JSON (scene, prefab) saved by the visual editor with fetch, checks its form, stores a Visual holding that text, and then counts as loaded. Failed responses and malformed documents are rejected. Added static createVisualFromText; unload also clears the stored Visual.
- Timeline: fixed loadFromUrl not checking failed responses (404 and so on). It now rejects.
- SkinnedModel: fixed an animation FBX with several stacks that have channels giving them all the same clip name, so playAnimation played only the last one. With several stacks, each stack is "clip name/stack name" (the order number if the stack name is empty). With one stack, it is the given name as before.
- HumanSkinRenderer: corrected the swapped eye iris order in the texture unit comment. (12 iris normal, 13 iris color. The behavior was already correct)
- SkinnedModel: fixed calling uploadMeshesAndMaterials again leaking the old drawables' VAO, buffers, morph textures and the materials this model built. (Calls destroy first) uploadWireframeIndices also deletes the line buffer already uploaded and uploads a new one.
- Object: removes the private fields (#instanceId, #isDestroyed). The unique identifier is put into a module WeakMap on the first getInstanceId() call. isDestroyed(), which was always false, is removed. (destroy() did not leave a destroyed flag, and the Rust engine has no such function because a dropped value is gone and the handle of a removed node is None. To migrate: isDestroyed() was always false, so remove that check. To see whether a node is still in a tree, use getParent()) Removes two fields that were filled every time any engine object was created
- Indicator(misc): Fixed calls to the nonexistent graphic.getCanvasRenderingContext() and isVisible() and a broken import path ("./graphic.js"). Draws with Graphic's pushState, drawLine, drawStrokeCircle. (Graphic lines have square ends, so the round ends of the Canvas2D era are gone)
- Math (base/math.js): Fixed sqrt, which computed with 10 iterations of the Babylonian method and was wrong above 10000, to use the built-in square root. (sqrt(1e5) was 317.2, sqrt(1e6) was 1296, since 2026-03-21) The length, normalize, distance (Vector2, Vector3) of vectors longer than 100, Quaternion, TransformMatrix, long Graphic lines (thickness and joins were thin and short) and ParticleSystem calculations that use this sqrt were wrong, so behavior in games may change
- Math: Fixed asin, acos, which used a 100-term series and were wrong near ±1 (asin(0.9999) was 1.5132, correct 1.5567), and pow, which was wrong for fractional exponents (pow(4, 0.5) was 1, pow(2, 2.2) was 4), to use the built-ins. Tween exponential, elastic easing and Vector2.angle change. floor, ceil, round now return infinity as is instead of NaN. (sin, cos, tan match the built-ins within 4e-9 and are left as is)
- Vector2: Fixed modulo doing division instead of remainder, and half returning double instead of half
- Engine: Fixed an exception when returning from the back-forward cache (pageshow persisted) caused by calling the nonexistent dispatchPageProcessRestored. Restores engine state (audio, input) as on resume and calls onPageProcessRestored on each loaded scene
- LocalStorage: wraps every access in try. If storage is blocked (private window, exception on window.localStorage access) or full and cannot be written, it keeps values in memory instead for the lifetime of this page, without exceptions. (isMemoryFallback) setBackend({ getItem, setItem, removeItem, getKeys, clear }) swaps the storage. (Such as a platform SDK's storage, getKeys and clear are optional, null goes back to the browser) getBackend, getItem, setItem (whether it was written to storage), removeItem, getJson(key, defaultValue), setJson(key, value)
- Aligned what differed from the Rust vanilla-engine in effects, 3D and animation. (Added general-purpose features that existed only in Rust, and fixed bugs present in both engines in both)
- Animation: Filled in the empty pause and resume. (gotoAndStop stops) stop returns to the first frame even when stopped. (Bug where the old index remained after setFrames) SpriteAnimator.getCurrentFrameIndex
- Action: Condition functions receive the target. wait with duration 0 or less has progress 1 (NaN bug), repeat 0 times does not run
- Timeline: Bug that discarded stage nodes with the same name (all are attached, the name table gets the later one), attaches to the stage parent if the parent is itself or a cycle. Timeline.loadFromText, createFromJsonAsset
- Scene.tickTouch: fixed missing the release of a press and release within one frame (quick tap, click). Now passes touchRelease after touchPress in the same frame. As before, touchMove is not passed on the press frame
- AssetLoader: fixed workers not increasing for items added while loading after load() was called. (If load started with one item, a single worker downloaded everything added afterward one after another) Now spawns more workers up to the concurrent download count
- Identifier.reset restores the initial value. (Bug where it assigned its own value to itself and did nothing, Enum.begin counts from 1 for each enum)
- KeyCode.audiomute value "AudioMute" is not a name in the W3C KeyboardEvent.code table, so pressing the mute key did not match. Fixed to "AudioVolumeMute". (Fixed together with the Rust version)
- Fixed UI source bugs to match the Rust version:
  - UIDocument only wrote Sprite's nineSlice and never read it. Now reads it by inverting the written form ([left, top, left + right, top + bottom])
  - UIDropdown: the header button tint also captured the dropdown list rows, so after selecting, the selection highlight was overwritten with the old color. Excludes the dropdown list from the header button tint (excludeNodeFromTint), and when the highlight changes, the row buttons recapture the tint's original color
  - UIInputField: on a paste truncated by maxLength, the cursor went past the end of the text. Clamped to the end of the text
  - LayoutSolver: when artificial variable optimization ended in an exception, the artificial rows were left in place instead of cleared. Cleared with try / finally
  - UILabel's background draw order was already correct. (UILabel is attached in an order before the Text, RichText it requires, so it draws the background first)
- Fixed a bug where OBB.overlaps was always false. (It iterated the other's vertices by other.length, so the other's projection range was empty, same as the Rust version)
- Fixed Platform.getSafeAreaRect throwing by calling Window.getComputedStyle (a nonexistent static function), now window.getComputedStyle. (Confirmed that typeof Window.getComputedStyle is "undefined" in headless Chrome)
- NodeLayout.arrangeFan: fixed stopping with a ReferenceError when called because System was not imported, and passing radian values to a degree-based rotation (setLocalRotation). (Same as the Rust version)
- TextAsset, BlobAsset: fixed treating failure responses (404 etc.) as received, now throw. (Included in AssetLoader's failure list) AudioAsset also treats failure responses as failures before decoding
- SoundEffectPool: fixed play throwing on division by zero when the voice count is 0, now does nothing. (Same as the Rust version)
- Wait.nextFrame: fixed it finishing immediately because it did not wait for the Promise it created. It now waits until the next requestAnimationFrame. (same as wait::next_frame in the Rust version)

## Tools, docs and examples

- Engine bundle tool and bundling only what is used: node tools/bundle.cjs builds build/vanilla.js (with its source map) and vanilla.min.js. The readable vanilla.js keeps lines and indentation and drops comments (the original sources and comments are in the source map; esbuild keeps comments in an unminified bundle, and they were about 40% of it). 4,083,510 to 2,209,932 bytes (gzip -9 742,055 to 409,865), and loading only the bundle on a blank page takes 32.8 to 25.0 ms (headless Chrome, median of 12, 0.3.2 takes 16.3 ms). With sideEffects in the package.json at the top of the repository, a game bundled from source drops unused modules entirely. Bundlers treated top-level calls such as System.Object.freeze as side effects, so 3D modules stayed in 2D games (a test entry using only 2D and UI, minified, 345,347 to 250,761 bytes, 14 3D modules dropped).
- import.js: exports TransformMatrix, KeyCode, GamepadButtonCode, GamepadAnalogStickCode, GamepadTriggerCode, ScrollMode, ButtonState, ProgressDirection, SpriteDrawMode, SpriteBlendMode, AssetType, MORPH_TARGET_MAXIMUM, VERTEX_FLOAT_COUNT, SKIN_FLOAT_COUNT and WRINKLE_CHANNEL_COUNT, the same as the Rust engine's top level. (also available straight from the bundle build/vanilla.js)
- Example asset licenses cleaned up: removed the Mixamo original files that have no redistribution permission (Remy.fbx and the clip FBX files of anims in ancientmountain, soldier.glb, which is Mixamo Vanguard from three.js, and the clip FBX files and mixamo_rest.json of toonshading) and replaced them with Quaternius Universal Animation Library 1 and 2 (Standard, CC0). Where they come from and the license text are in README.md of the asset folder and the Example Assets section of THIRD_PARTY_LICENSES.md. The extraction script is examples/ancientmountain/tools/export_quaternius.py (Blender 5.2)
  - ancientmountain: the character is the mannequin mannequin.fbx (meters, so CHARACTER_MODEL_SCALE is 1), and the clips are idle (Idle_Loop), walk (Walk_Loop), run (Jog_Fwd_Loop), fall (Jump_Loop), land (Jump_Land), climb (ClimbUp_1m_RM). The mannequin has no textures, so Remy's PBR maps are gone. A source line for the character and the fox was added at the bottom of the screen. fbx_test.html and glb_test.html use the new assets too
  - toonshading: the clip buttons are IDLE, WALK, RUN, ROLL, YES, TALK, PUNCH, DANCE. (JUMP, GREET, CLAP, CHEER have no equivalent in the CC0 pack, so they became ROLL, YES, TALK, PUNCH) The bone map uses Unreal mannequin names (pelvis, spine_01 and so on), and the T-pose table is computed from the first scene of tpose.fbx (A_TPose) instead of a file
  - The fox.glb credit was corrected. The example comment said CC0, but the Khronos source says the model is PixelMannen CC0, rigging and animation tomkranis CC BY 4.0, and the glTF conversion AsoboStudio and scurest CC BY 4.0. The authors are written on the example screen and in THIRD_PARTY_LICENSES.md
  - The glb examples (the glbmeshreader API example, glb_test) use mannequin_female.glb (female mannequin, Idle, Walk, Run, Dance) instead of soldier.glb. The 15-3d guide and Remy.fbx and soldier.glb in architecture were changed too
  - oldface: restored with the MetaHuman (Walter preset) assets (Epic Games', demo only, examples/oldface/ASSETS_LICENSE.md). Adapted to the engine renames (FullscreenPass.useProgram, Graphic.flushBatch) and added the URL parameters ?expression=name and ?yaw=radians. HumanSkinRenderer itself is unchanged
- License notices: the files moved from other sources (uiinputfield, spatialaudiomath, tween, matrix4, autolayout, subsurfacescatteringeffect, the draft tilemap, physics2d, dynamictree) have the source and a license line at their head. THIRD_PARTY_LICENSES.md gains the public domain and CC0 code (fmix32, Narkowicz's ACES approximation), DOSGothic (MIT full text) and an Example Assets section. tools/project.cjs build copies LICENSE and THIRD_PARTY_LICENSES.md to the output. (Under licenses/vanilla.js/ if the same name exists)
- Drafts out of the bundles: removed the line in import.js that exported the drafts (2D physics, tilemap, 2D skeleton, spatial audio, save slots in src/experimental) as the Experimental namespace. The default bundles and the web tools no longer carry the drafts. build/vanilla.min.js 1,035,048 bytes → 849,276 bytes (about 1011 KB → about 829 KB, about 288 KB → about 235 KB gzipped), build/vanilla.js 4,075,155 → 3,324,094 bytes, UI editor 4,453,945 → 3,666,226 bytes, visual editor 2,340,587 → 2,335,558 bytes. (The particle and timeline editors did not carry the drafts and grew by the header comment) Drafts are imported directly from src/experimental/experimental.js. experimental.js imports import.js first so that the engine modules load in the right order. (Importing a draft module first ran into classes that were not loaded yet) tools/apidoc.cjs reads the draft entry point separately as the Experimental namespace, so --check and --check-examples still check the drafts (they are still left out of the doc data), and draft examples import the engine from ./import.js and the drafts from ./src/experimental/experimental.js. The bundles and the web tool html files start with a one-line engine license comment (/*! vanilla.js | (c) 2026 vanillapunch | MIT License | links to LICENSE and THIRD_PARTY_LICENSES.md */). (--banner:js in the esbuild commands of the README and the guide)
- License: the engine's copyright holder is now vanillapunch. (LICENSE reads "Copyright (c) 2026 vanillapunch", the README and the guide overview read "© vanillapunch", still MIT) Third-party license notices are collected in one file, THIRD_PARTY_LICENSES.md. (The license section of the README)
- Rebuilt bundles: rebuilt build/vanilla.js, vanilla.min.js and the four web tools (the single-file html of tools/uieditor, particleeditor, timelineeditor, visualeditor) from the current source. (The bundles in the repository were from September) The UI editor's edit and result views and the HUDs of the examples ancientmountain, oldface and toonshading use Graphic directly without the engine loop, so they call flushBatch() after drawing. (After sprite batching became the default, the rebuilt UI editor's view came out black, and the last batch of a HUD could slip to the next frame) Changed the cache stamp that the eight deployed examples (ancientmountain, neonhorizon, oldface, particleeffects, spriteeffects, timelineshowcase, toonshading, uishowcase) append to the engine URL to 20261126a. Re-measured the vanilla.min.js size in the README and the guide overview from the current source. (about 1011 KB, about 288 KB gzipped)
- tools/apidoc.cjs: puts the Rust version's counterpart (counterpart: { engine: "vanilla-engine", module, class, name }) into the data. For classes, enums, members, module functions and constants, and enum values. The counterpart table is docs/api/counterpart.<version>.json (the table the Rust version's tool built by name is carried over with --counterpart), and --check checks the counterpart form and count.
- tools/project.cjs build and the vanilla.min.js commands in the README and guide add --keep-names to --minify. (The developer tools and unregistered UIDocument types read class names) Brought the project.cjs header comment, usage output, TOOLS.md and the guide's tools chapter in line with the code. (node tools/project.cjs, the build template's default location tools/buildtemplate, -t and --template, the stage command)
- tools/webm.cjs: if fluent-ffmpeg, ffmpeg-static are missing, shows installation instructions and exits. (Until now it died at the top-level require before showing the instructions)
- tools/apidoc.cjs --gaps: finds detached header comments (old blocks where a header comment and JSDoc are followed by another header comment with no declaration, and a header comment right after a header comment that does not end in "목록" (list)). Removed the old blocks it found (UIButton, UIProgressView, UILabel, Text, Color, LocalStorage, NodeLayout, AnimationClip, SoundSystem) and changed headers used like section headers into member headers (UISlider, PlatformerBody, Camera2D). The descriptions of those members in the API docs are corrected
- Guide: updated chapters 05, 12, 13, 19 and the tools chapter (ko, en) to the changes (--keep-names, UIDocument registered names and registerEditorTypes, UINode presses, Animator state machine)
- import.js: split the old "experimental features" block into collection, animation, shaders and fullscreen pass, 3D graphics, to be deprecated, and experimental blocks. Visual went to the other features block, VisualAsset and BunchAsset to the resources block. The exported names are the same. (The experimental block is only a comment, and the drafts are imported directly from src/experimental/experimental.js)
- README, guide, ARCHITECTURE: updated to the new folders and removed the text calling 3D and toon 3D experimental features. (README's "3D (experimental)" is now "3D")
- Rebuilt the visual editor (tools/visualeditor) like Unity. Docking windows (Hierarchy, Scene, Game, Inspector, Project, Console) below the top menu (File, Edit, Node, View, Window) and the toolbar. Initial layout: hierarchy on the left, scene and game in the center, inspector on the right, project and console at the bottom
  - Docking (docklayout.js): as in Unity or VS Code, dragging a window tab onto another window's tab bar or center merges it as a tab, dropping it on a window edge (30%) splits and docks it on that side, and dropping it on the edge of the whole dock area docks it on the outer side of the whole. While dragging, the dock target is shown as a sliding blue box, and the insertion point between tabs as a bar. Esc cancels. Drag the splitters to resize, double-click a tab to maximize that group. Close a window with the tab's X or the middle button and reopen it from the Window menu (it returns beside the windows it was with when closed). Window > Reset Window Layout. The layout is kept in the browser and restored on reopen
  - The Scene and Game windows share one canvas. When both are visible separately, the canvas is attached to the selected one and the other shows a notice that moves it over when clicked. The scene view keeps the center it was viewing when the window is resized
  - Fixed the scene view drawing only in part of the top left on displays with a pixel ratio other than 1, such as Retina (applyViewRect in EditorScene preDraw)
  - Scene view: lays a grid and the screen frame (reference resolution) on the engine canvas and draws the actual WorldNodes. Click to select, handles to move (W), rotate (E), scale (R), pan (Q, Space, middle and right drag), zoom with the mouse wheel and Ctrl wheel (trackpad pinch), pan with two trackpad fingers. Ctrl snaps to 10 units, Shift to 15 degrees. Arrows move 1 step (Shift 10 steps), F to the selected node, Home to the screen frame
  - Game view (Tab): fits the screen frame to the view without grid and handles, and masks outside the frame. Play switches to the game view, stop returns to the scene view
  - Hierarchy: expand and collapse, double-click to rename, drag to make a child or move before or after a sibling (screen position is kept), search box, right-click to create, copy, paste, duplicate, delete, save as prefab
  - Inspector: enabled and name, transform (position, rotation, scale, content size, pivot, anchor, opacity), per-component property fields gathered by reflection (number, text, boolean, color and alpha, Vector2, dropdown for fixed values). Dragging a number label left or right changes the value. A Sprite's image is set by dragging and dropping an image asset from the project, and the native size button fits the content size to the image. Add and remove components
  - Project: Open Folder (showDirectoryPicker, Chrome-based) reads and writes a real asset folder. Other browsers import by dragging and dropping files and folders. Folder tree and asset grid (image thumbnails), filtering by type (image, sound, JSON, scene, prefab, model, font, text), Import button copies files into the current folder. Selecting an asset shows a preview in the inspector (image and resolution, sound playback, JSON and text contents, font sample, for GLB the mesh, bone and animation counts and a 3D preview drawn with the toon renderer that rotates by dragging)
  - Dropping an image asset in the scene view creates a Sprite node of the image's size at that spot. Prefabs (.prefab.json, a single UIDocument document) are instantiated by dropping or double-clicking, scenes (.scene.json) are opened by double-clicking
  - Scene save and open: .scene.json, the UIDocument format with the editor value frameSize added. Games read it as is with fromJsonText of a new UIDocument(). If a folder is open, writes directly into it, otherwise downloads. A Sprite's image is written as imagePath and looked up and linked in the project
  - Undo and redo (200 steps, consecutive changes to the same value count as one step), copy and paste, duplicate, play and stop (stop restores the state before play), auto-save to the browser 1 second after a change and restore on reopen. The console shows editor messages together with browser warnings and errors
  - Replaced the earlier particle script demo editor with this
- BuildInfo: build version reading. await load() first reads the page's <meta name="build-version">, and if absent fetches version.json without cache (cache: "no-cache"). readText() returns the meta text as is, or "date time (hash)" from version.json (version if there is no hash), or empty text if it cannot be read. readVersionData(), isLoaded(), setMetaName, setVersionJsonPath, BuildInfo.composeText(versionData)
- tools/atlas.cjs: Multiple pages (next page when exceeding --max-size, each page the smallest power of 2 that fits everything), edge extrusion (--extrude), padding (--padding, default 2). Placement changed from shelf to MaxRects, so positions differ from before even for the same images. (Same when read via JSON) Added page to images in the JSON, and pages, extrude, padding to meta. With a single page, the file name is the same as before
- Example cameratour: Rotating Camera2D (drag to pan, wheel to zoom), Tween.createNodeTween, Indicator
- BuildInfo: setPackageVersion, getPackageVersion. The version readText returns when there is neither meta nor version.json. (Same role as the Rust version's build-time version, empty string as before if not set) load also returns the same string as readText
- Updated the documentation to match the current code. (the code is unchanged)
  - README: introduction (bundle size of the current sources about 765 KB, gzip about 215 KB, batching and culling on by default, render target multiply), main features table (this version's items such as input actions, window stacking, motion, toon 3D, assets, sound table), ShaderSprite effect count (49 excluding none), visual editor and atlas.cjs description, examples without a distribution build cameratour, toonmaterial, middle dots replaced with commas
  - ARCHITECTURE: layout, inheritance hierarchy (widgets that are nodes, things that do not inherit Object), ownership structure (InputActions, PointerCursor, AssetLoader, toon 3D), frame loop (maximum FPS, clearing the batch cache, drawing remaining batches, cursor), batching and culling on by default, multiply is blended in a shader on render targets (removed from the known gaps table), unexposed list (AudioPlayer, GamepadManager are now exported), chapter 9 relationship with the Rust version
  - In the header of this version in UPDATE.md, kept one each of the lines both branches had written twice (WebSocketClient, Localization, UILabel.getVisibleCharacterCount)
- Documentation data: keeps in docs/ the data the website uses to build the documentation for each version. (The website builds the HTML)
  - docs/api/<version>.json: the public API exported by import.js (modules, classes, members, module functions and constants, enums). Description fields are { ko, en }; ko is the original source comment and en comes from the docs/api/translation.en.json table (ko original → en). since is the first version in which the member existed in that class, found by scanning tags from v0.0.8
  - tools/apidoc.cjs: generates the data above. (A small tokenizer using only Node built-in modules; --missing lists ko text not in the table, --check validates the format and prints counts) Usage is in tools/TOOLS.md
  - docs/guide/<version>/ko, en: overview, getting started, architecture, tools. (Split from README, ARCHITECTURE, tools/TOOLS.md and NODE.md, repository-relative links turned into GitHub URLs) docs/update/<version>.ko.md, .en.md: this version's update notes
  - README: the file UI Editor saves is .uiasset.json. (It said .ui.json) Corrected that tools/excel.cjs is a collection of functions with no command-line entry point, so running it alone does nothing, and that tools/table.cjs is an empty file. Added apidoc.cjs to the command-line tool table
  - Public API comments and examples: filled the empty ko descriptions (module summaries, members, parameters, returns, enum values) and empty parameter types of the public API, added @returns to functions that return a value but had none, and added header comments to private functions that had none. Descriptions were written from the code as it actually behaves (units, ranges, defaults, what happens with null). Added @example to every class and to every module without a class, and to members whose usage is not obvious from the name. (the examples field of the data, 314 in total) The English for the new text was added to the translation table. The toon 3D folder (graphics3d/toon), visual.js, uilistview.js and uiscrollbar.js are being reworked separately and were not filled this time
  - tools/apidoc.cjs: --gaps (documentation gaps per file), --check-examples (checks the API examples and the guide code blocks for syntax and engine names and runs them in Node workers and headless Chrome, no external dependencies), --only and --exclude filters for --missing, --gaps and --check-examples. The returns of a field only holds the value type, so it is not counted as an empty ko field. A leading hyphen in a description is removed only in the "name - description" form. ("-1 이면" used to be read as "1 이면")
  - docs/guide/<version>/ko, en: added 15 topic chapters. 05 project setup, 06 engine and scenes, 07 nodes and components, 08 drawing, 09 input, 10 loading assets, 11 sound, 12 UI, 13 tweens, animation and timelines, 14 particles, 15 3D, 16 storage, 17 languages, 18 developer tools, 19 authoring tools. (the two-digit number in front of the file name is the order, every chapter has runnable examples and all of them go through the example check)
  - Replaced em dashes and middle dots in the comments of the edited files with commas. (those inside code such as shader strings and error messages are unchanged)
  - examples/assets/beep.wav: a 0.15 second beep used by the sound examples. (PCM generated by a script)
- Example toonstyle: a scene for comparing toon shading and outlines. (Angular box, round ball, crystal with large facets, cluster of crystals with small facets, ring, slanted plate, shadows, point light, ?scale=0.5 for a half-size line buffer, ?toggles=1 for per-model options) The same scene as the Rust example toonstyle
- Example toonmaterial: removed the aberrant body shading formula comparison (verifyAberrantShading). (It is one game's formula and does not belong in an engine example, and since the engine's lighting is now the standard form it no longer gives the same values) Removed the normal scale compensation in the rock vertex chunk. (The engine transforms by the inverse transpose)
- Example toonstyle: three shades, hard highlights, sun-side rim, spotlights, matcap, ?shell=1 for shell outlines (per-draw color and width, distance multiplier)
- Example toonstyle: point light and spotlight shadows, a blue shade-side rim, an angel ring on the dark ball, shell outlines vanishing at 16 meters and pushed along the camera direction
- Example toonstyle: ?roll=radians tilts the camera (undoing the angel ring tilt)
- Rebuilt the visual editor (tools/visualeditor) with the engine above

## How to migrate

- WebGL context lost handling: drop the preventDefault and the drawing pause a game did on webglcontextlost, and rebuild only its own GL objects on restored through addGraphicContextEventListener.
- Shader build failure notification: A game that wants a fallback drawing or an error report receives it through addGraphicErrorListener.
- Toon program variant prewarm: A game that minds the hitch calls it once after adding the scene and before the first frame. (const prewarm = renderer.prewarmDrawQueue(queue); await prewarm.wait();)
- Toon body variants: The default became hand off and draw with the default body, and the picture is the same. To build on the spot as before, call renderer.setAsyncProgramBuild(false). If the light features to turn on mid-scene are known, prewarm them with renderer.prewarmDrawQueue(queue, { lightFeatureList: [["rim"]] }).
- Bone matrix uniform block: in a replacement vertex shader (a shader given to SkinnedModelRenderer, the toon outline shader), put JOINT_BLOCK_GLSL in place of uniform mat4 jointMatrices[96]; (the body's jointMatrices[index] stays). Code that uploaded bone matrices directly (getUniformLocation("jointMatrices[0]") and uniformMatrix4fv) changes to uploadJointMatrices(jointMatrixArray). Where morph weights were uploaded directly, use uniform vec4 morphWeights[24] and uniform4fv in place of uniform float morphWeights[96].
- GPU memory tracking: code that used GPU memory tracking builds with EngineConfiguration.trackGpuMemory = true (to count the engine resources from the start). Games that did not use it need nothing.
- GPU throughput measurement: Games that watched a GPU target without a real device look at (6) from --throughput instead of (3) from perftrace.
- Fewer activeTexture calls in toon drawing: Code that calls GL directly while the toon renderer is drawing (between beginFrame and endFrame) should call activeTexture first instead of expecting unit 0 to be active. (Stage callbacks and onBeforeDraw of body draws still get unit 0)
- 3D color space setting: A game that draws 3D in linear turns it on with engineConfiguration.colorSpace = ColorSpace.linear and gives isColorData: false to createTexture for normal or mask textures. Material chunks that mixed an sRGB color into surface.baseColor convert it with toSurfaceColor(color) first (unchanged in gamma, so the screen is the same). Light intensities and colors tuned in gamma look darker on the dark side in linear, so retune them.
- Retained toon draw items and no per-frame allocation in the draw queue: Games drawing models with many parts build one ToonDrawItem per part once (indexStart, indexCount of the material range in the options), call queue.addItem(item) every frame after queue.clear(), call item.setModelMatrix(matrix) when it moves, and item.setOption(name, value) or item.markDirty() after changing the options object. Code that got a new vector from getPosition or getScale every frame can switch to readPosition(vector) and readScale(vector).
- Thin-line path for the toon screen outline: Code that reads seedTexture from getLineTarget directly sees null when the width is about 3.24 pixels or less. Code that counted five entries from readProgramSources sees seven.
- Toon screen outline resolution scale: Code that already called setResolutionScale below 1 keeps the line position and width and only gets softer edges. Code that counted readProgramSources as seven now counts nine.
- Sound streaming load: background music played through the engine SoundSystem now streams when its sound table row has no loadType, so code that used getAudioBuffer() of that asset directly gives the row loadType: "decompressOnLoad". Code that uses AudioAsset directly has nothing to change (the default is still full decoding) and calls setLoadType(AudioLoadType.streaming) to stream. getAudioBuffer() of a streaming asset is null.
- UIDocument image and node data fixes: Games that relinked template images themselves can drop that code.
- Bone pose hook: Games that copied the engine's writeSkinPose to add a hook delete the copy and pass the same function as the seventh argument of the engine's writeSkinPose.
- 3D camera shake: Games that computed shakes themselves keep one CameraShake, call add per event and update per frame, and apply read() with Camera3D.setViewOffset or createOffsetViewMatrix. Shakes that were added in world axes become camera local axes (x right, y up, z back).
- glTF primitives without normals: A game that added normals to a GLB without normals can read it as is. Code that read SkinnedModel's mesh description for a mesh without normals now gets filled normals and null indices.
- GameScene loading no longer relies on a hook that can be overridden: a game that overrode drawOnLoad moves to setLoadingDrawer. (Overriding no longer stops loading)
- Batched drawing names same as the Rust version: graphic.setSpriteBatchingEnabled(x) becomes graphic.setBatchingEnabled(x), isSpriteBatchingEnabled() becomes isBatchingEnabled(), and flushSpriteBatch() becomes flushBatch().
- Drawing outside the engine loop: Code that calls flushBatch() after drawing outside the loop keeps working. When inserting a pass that touches WebGL directly, call flushBatch() first as before.
- Engine bundle tool and bundling only what is used: replace the two esbuild lines from the README with node tools/bundle.cjs. The public API, import names and vanilla.min.js stay the same.
- Removed the toon 3D namespaces ToonMesh and ToonGlb. The functions and classes of the mesh builder: drop the prefix, so ToonMesh.MeshBuilder becomes MeshBuilder, ToonMesh.createBoxGeometry becomes createBoxGeometry, and ToonGlb.readGlbArrays becomes readGlbArrays. Change import { ToonMesh } to import the names you use. flushSpriteBatch() becomes flushBatch().
- Top-level names as the same set as the Rust version: engine.getSceneManager().getAllLoadedScenes() becomes engine.getAllLoadedScenes(), and loading and unloading scenes use engine.loadScene, unloadScene, unloadAllScenes. Camera becomes Camera2D. List, Dictionary, Queue, Stack become Array and Map. For ToonMesh.MeshBuilder, ToonMesh.createBoxGeometry, ToonGlb.readGlbArrays and the like, delete the leading ToonMesh. or ToonGlb. and import that name.
- UIDocument becomes an instance without global state: where UIDocument was called statically, such as UIDocument.fromJsonText(text), make a document and call it on that document. const uiDocument = new UIDocument(); uiDocument.registerEditorTypes(); uiDocument.setImageResolver(resolver); const rootNode = uiDocument.fromJsonText(text). Registrations and the resolver apply only to that document, so read with the same document. Instead of a resolver you can load the images first with await Promise.all(uiDocument.loadImages(text)). Where UIDocument.getComponentType(name) gave a constructor to attach, attach with uiDocument.createComponent(node, name). Change visual.createNode() to visual.createNode(uiDocument), and list templates with game components to listView.setTemplateNodeWithDocument(template, registeredDocument).
- ToonView3D screen rectangle and output: in draw functions, change screenRect.x, y, width, height to screenRect.position.x, position.y, size.x, size.y, and screenRect.outputFramebuffer, screenRect.outputViewport to the fifth argument output.outputFramebuffer, output.outputViewport. (ToonPostProcess.end(output.outputFramebuffer, output.outputViewport))
- Public functions only the original had: delete camera.refreshMatrices() calls (getViewMatrix and getProjectionMatrix compute on their own). Delete setStateEvent calls (it did nothing). Hook per-state work with setPressedEvent, setReleasedEvent and setClickEvent.
- Default font: games that used DOSGothic give a font address to defaultFontUrl (its name is "default") or add "DOSGothic" with a FontAsset. Places that picked it by name, such as "16px DOSGothic", add it with a FontAsset or change to "16px default".
- Baked components keep colours as Color: where softShade.getColor() or shadowImage.getImageColor() was used as a string, append .toHEXString().
- No reserved-word names: cooldown.use() becomes cooldown.activate(), pass.use() becomes pass.useProgram(), shaderProgram.use() becomes shaderProgram.useProgram(), pointerGesture.move(x, y) becomes pointerGesture.movePointer(x, y), action.loop(...) becomes action.repeatWhile(...), and Tween.easingFunction.quadratic.in becomes Tween.easingFunction.quadratic.easeIn (out and inOut become easeOut and easeInOut). The old names are gone.
- Top-level names aligned: rename DEVTools to DevTools (the old name is gone). Code that called setTextAntialiasEnabled(value) from textstringtexturecache.js directly calls graphic.setTextAntialiasEnabled(value).
- UIInputField multiline input and undo: A game that used Ctrl (Cmd on Mac) + Z itself while a canvas mode field is focused now has the field take that key.
- Image decoding and uploading moved to load time: ImageAsset.getImage().src is a blob: address if the bytes were received (the asset path is getAssetPath). If the bytes cannot be received, as with file://, the address is put in as before. A missing image (404) is rejected right away with Load fail without building an image element.
- Rust-edition shape alignment: change new ScreenEffect(graphic) to new ScreenEffect() (the graphic is passed to begin(graphic) and end(graphic), same as the Rust edition ScreenEffect::new(); a passed argument is not read). CameraGestures.takePan() now returns a Vector2 instead of { x, y } (pan.x and pan.y still read the same).
- Visibility flag: code that used isVisible() to check active and opacity above 0 switches to isVisibleInHierarchy() (including ancestors) or isActive() && getLocalOpacity() > 0 (that node only).
- ToonVfx position and defaults: change { x: 1, y: 2, z: 3 } to { position: [1, 2, 3] }. (The old x, y, z are not read, so the effect appears at the origin) Code that left out alpha to keep a ribbon or beam from drawing passes alpha: 0.
- Image path: code that read or wrote component.imagePath switches to component.getImagePath() and component.setImagePath(path).
- Scene background: games using GameScene or UIScene are unchanged. Code that kept the Color given to setSceneBackgroundColor and modified it to change the background calls setSceneBackgroundColor again after modifying it.
- EngineConfiguration.viewScaleMode: a scene that extends Scene directly changes its view scale from none to stretchShort. To keep the current look, set engineConfiguration.viewScaleMode = ViewScaleMode.none. The same applies to keep the current look of the UIScene and GameScene loading screens.
- Public API that the Rust edition had: Color text that Paint and Outline cannot read is white. Games that imported GameScene from the src/game/gamescene.js path can import it from import.js.
- Text drawing uses a glyph atlas: Code that used entry.texture from getTextStringTextureCache().getEntry directly (none inside the engine) draws each glyph from glyphTextures and glyphRects.
- Off-screen subtree culling: a component that overrides Component.calculateDrawnRect calls markDrawnRectDirty() when a value that changes that rectangle changes. (otherwise a node that was off screen may not be drawn even when its widened drawing comes on screen) A WorldNode that overrides draw is still never skipped; to let it be skipped, override calculateDrawnRect to report the drawn rectangle and call markDrawBoundsDirty() when it changes. To turn it off, Graphic.setSubtreeCullingEnabled(false).
- Off-screen subtree culling: a component that overrides draw (such as a game's skin component) must set isDrawnInsideContent to true if it draws only inside the content area, or add calculateDrawnRect and markDrawnRectDirty if it draws outside, for the ancestors of its node to be skipped.
- runExternalPass: Code that touches WebGL directly and expected something bound on texture unit 1 or above binds the units it uses itself inside runExternalPass (nothing else changes). Subclasses of UIView or UIButton that draw outside the content area without overriding draw override isDrawnInsideContent to return false.
- Changing the render pixel ratio cap: code that read the canvas size, such as getCanvasPixelSize, right after setMaxRenderPixelRatio gets the new value from the next frame. (call calculateViewRect when it must apply right away)
- 3D render scale: in ToonView3D draw functions, replace hand-computed canvas positions such as ToonPostProcess.end(null, [x, drawingBufferHeight - y - height, width, height]) with end(output.outputFramebuffer, output.outputViewport) (output is the fifth argument of the draw function). (same place at scale 1, and the right place with a render scale or inside an opacity layer)
- Anti-aliasing on and off: remove the workaround that created a context with the same attributes but antialias off on the canvas beforehand, and set engineConfiguration.antialias = false.
- GL state cache: GL calls made through the same context object need no notice. Only code that changes state in a way that cannot be intercepted, such as calling WebGL2RenderingContext.prototype functions directly, calls graphic.resetGLStateCache() afterwards. Game code that read the framebuffer and viewport with getParameter gets faster as is; new code uses getCurrentFramebuffer and getCurrentViewport.
- Font family name default: DynamicFont without an asset bakes with Segoe UI and Malgun Gothic instead of sans-serif (Arial) on Windows.
- Fewer toon 3D draw state changes: Opaque faces at exactly the same depth (overlapping planes) may show the other one because the draw order changes; merge them into one model or offset their depth. Code that uploaded the renderer's own uniforms directly to the renderer's programs (through getSolidProgram() and so on) while drawing moves to onBeforeDraw.
- Sun shadow focus step: If there are changes the caster record cannot see (changing the vertices of a mesh, changing shadow depth uniforms in onBeforeDraw), call requestUpdate() on that frame or set setUpdateMode(ShadowUpdateMode.everyFrame). Code that draws with renderer.beginShadowPass without ToonDrawQueue clears and draws every time as before.
- Sun shadow bias follows the shadow texel size: Shadow edges shift slightly (the toon style example differs in 3387 of 576000 pixels, largest difference 37). If shadows need to sit closer or farther as before, pass texel-unit values with shadowMap.setBias(depth, normal).
- Toon instance buffers shared by several passes: Upload long-lived instances (rocks, trees, buildings) once with createInstanceLayout([{ name: "instanceMatrix", size: 16 }, { name: "instanceTint", size: 4 }, { name: "instanceLineId", size: 1 }]) and createInstanceBuffer and add them with addMeshInstanceBuffer. When only one changes, use updateInstanceBufferRange. Adding instanceLineId to a layout that used three user attributes throws (reduce them to two).
- Lower CPU cost per toon draw: The engine material values of the body and outline shell programs are now inside blocks, so names like getUniformLocation("tintColor") return null. (onBeforeDraw is for the material's own uniforms, so no use changes) Pass options as plain objects. (Values changed through class get properties are not detected)
- Toon screen-outline batching of mirrored items: The frame values of the body, outline and depth programs are now inside the ToonFrame block, so names like getUniformLocation("viewProjectionMatrix") return null. (Material chunks still read them by the same names) The line pass draws meshes of the same model together and so can draw in a different order than they were added; merge opaque faces at exactly the same depth (overlapping planes) into one model or offset their depth.
- Toon ambient occlusion: Outlines with width 0 (setWidth(0) and crease width 0) no longer run compositing.
- Toon outline low steps: More lines appear on round-surface silhouettes and low steps within the same ID. Games that lowered depthThreshold to connect seams can go back to the same threshold as the old game (such as 0.05). If stray lines appear on models that build round surfaces from coarse polygons when the threshold is very low, raise setDepthMargin.
- Direct lighting strength for toon ambient occlusion: To make corners in sunlight more visible, pass the fifth argument of setAmbientOcclusion.
- GameScene loading: A press outside the canvas used to skip loading; now only presses the engine input receives skip it.
- Shared 3D asset cache: code that loaded the same path several times and changed material values per model should take a copy with getMaterial(index) and change that. (changing drawableList[i].material or getSharedMaterial changes every instance of the asset) If each load needs its own parsed resources, call SkinnedModelAsset.clearCache() before loading or use loadFromBytes. Adding the same FBX clip from several instances keeps one copy.
- Action: code that expected an inner action's getTarget() to return the outer target should use the target argument the callbacks receive. (an inner action's getTarget is the target given to its own start, or null)
- The input field context menu is drawn by the engine: games that called showContextMenu(clientX, clientY) directly call showContextMenu(view position) instead. (convert viewport coordinates with viewManager.canvasPositionToViewPosition) Remove code that looked for the menu in document as a DOM element. The menu is drawn above the other nodes of the scene.
- The input field context menu is drawn by the engine: Games that relied on the browser menu (spell check, translate, inspect and so on) on direct-touch fields get the engine menu.
- Shader build failure: remove try checks around the build exception. Code that calls resolvePass directly checks for null.
- FBX with several materials: the drawableList of an FBX model grows to the number of materials. Code that expected drawableList[0] to be the whole mesh finds drawables by materialName or materialIndex.
- Engine.alert, confirm, prompt: window.alert(text) becomes engine.alert(text), the boolean of window.confirm(text) becomes await engine.confirmAsync(text) or engine.confirm(text).setCallback(result => result.isConfirmed()), and window.prompt(text, defaultValue) becomes await engine.promptAsync(text, defaultValue) or getText() in setCallback. The answer does not arrive on the spot (it arrives when the dialog closes), so code that read engine.confirm(text).isConfirmed() right away moves to the Async form or setCallback. The same game code then runs on the Rust engine.
- SpriteAnimator: SpriteAnimator.playOnNode(node, ...) becomes SpriteAnimator.play(node, ...).
- InputActions: code (tests) that changed keys or pads within a frame and expected readMoveAxis to return the new value right away calls update once more before reading.
- Sine, cosine, tangent: tests that pinned the last digits of the engine Math sin, cos or tan are regenerated. Calling code is unchanged.
- Drafts out of the bundles: code that used `import { Experimental } from "./import.js"` (or a bundle) switches to `import * as Experimental from "./src/experimental/experimental.js"` and imports the engine from `./import.js`, not a bundle. (The drafts and the engine must share one set of classes) Bundling a game with esbuild bundles the drafts along with it.
- Scene touch: in scenes that directly extend Scene and made a TouchRaycaster or TouchRecognizer to hand touches over in the touch hooks, widgets are now pressed twice. Give what you made to the scene with setTouchRaycaster(it), and remove the hand-off in the hooks and the touchWheel that found the scroll area and called wheel. If a hook needs to intercept touches (like dragging a bar), turn it off with setTouchRaycaster(null) and hand touches over in the hook as before. (In examples, uisample, uishowcase, particleeffects, spriteeffects were changed to the former form, and timelineshowcase to the latter)
- FbxLoader: code that called playAnimation or looked up nodes with the suffixed names uses the names without the suffix.
- How to migrate: code that created a Singleton subclass again with new gets it with getInstance(). Code that detached a node that is not its own child with removeChild detaches it with node.setParent(null). Games that read documents saved by the editor call registerEditorTypes() once on the document they read with
- Value conversion when porting aberrant (the engine stays canonical, converting the game values this way gives the same body shading, on a test page with point lights, ÷π, sun, bounce light and specular, compared against CPU computation in a float buffer with maximum difference 4.1e-8):
  - Sun and bounce light (rim) directions are 'from surface toward light', so flip the sign and pass them to setLight, setFillLight. ÷π is setLightModel({ isEnergyNormalized: true }). Specular intensity times 8 / (48 + 8) (normalized Blinn-Phong)
  - Point lights use decay 0, rangeExponent 1, color as the readLinearColor value as is (intensity 1)
  - min(lit, 1), which clamped the lit share to 1, was not put in the engine. Readjust light intensity, exposure and bloom threshold. (values are identical where it does not clamp)
  - Gamma values written to the HDR buffer: the engine writes linear. Lit bodies give the same values, and min(color x multiplier, 1) of unlit bodies was multiplied in sRGB, so give the engine colorScale or glow multiplier as that multiplier to the power of 2.2. colorScale (mirror 0.6) is also 0.6^2.2 as an engine value
  - Glow multipliers: vertex glow is glowScale (actor multiplier x part multiplier x HDR multiplier), accent color light is emissiveColor and emissiveIntensity (0.45 x 1.6). HDR boosting of bright parts via per-mesh glow intensity
  - Color keys (#ff00ff accent color, display panel key 0.02): split by the material ranges of GLB primitives, giving only those cells tintAmount 1 and the accent color, and display panels UV and decal textures (logo, digits). Animated face screens (expression, gaze, blinking) stay as surface chunks
- ToonScreenOutline: (the public API changed)
  - setCrease(angle, intensity, continuation pixels) → setCrease(angle, width, intensity). Width is in the units of setWidth with default 1, and intensity is 0 ~ 1 with default 1. Continuation pixels (creaseExtent) are gone. (Not needed since only the gap across one pixel is checked) A look similar to the old setCrease(60, 0.5, 2) is setCrease(60, 1, 0.8) in pixel units, and in world units a width about half the outer line width (setCrease(60, 0.011, 0.8) for setWidth(0.022, world)). Because the width is in the units of setWidth, giving 1 in world units makes a line 1 meter wide
  - setDepthThreshold(depth threshold, contact threshold) → setDepthThreshold(depth threshold). Its meaning changed to the tangent-plane distance. (A world length; the same value can be passed as is) The contact threshold (contactTolerance) is gone. Since the line is placed at the middle of the boundary, there is no need to decide which side to draw it on
  - The meaning of setWidth: the width of a single line, covering half on each side with the boundary at the center. (Until now that width was only on the outside of the silhouette) Default 1.5 → 2 pixels. To match the outer thickness of the old look, give twice the value. To match the overall look of the line (the sum of coverage), use about 0.9 times rather than twice. (Compared by running the old shader on the same line target: Aberrant's old values 0.022 m, crease 60 degrees .5 2 px are closest to setWidth(0.020, world), setCrease(60, 0.016, 0.5), setDepthThreshold(0.08); the coverage sums differ by 1 % in the toonstyle scene at 1280 x 720)
  - setSampleCount, TOON_SCREEN_OUTLINE_MAXIMUM_SAMPLES, TOON_SCREEN_OUTLINE_MAXIMUM_CREASE_SAMPLES are gone. (With jump flooding the number of steps is set by the width on its own) For a lightweight path, lower only setResolutionScale
  - getOutlineRadius() → getLineWidths() (drawing area pixels of [outer line, crease line])
  - Line id limit 65535 → TOON_SCREEN_OUTLINE_MAXIMUM_LINE_ID (16383). The top two bits of the line buffer's a channel hold the per-model options
  - The maskTexture of getLineTarget() is gone. Instead seedTextures (two RGBA16UI), seedIndex (the side that finished widening)
  - drawOutline sets the viewport to the drawing area from beginLineIds on its own. (Until now the caller's viewport had to be the same)
- ToonRenderer per-instance emission: code that put values other than 0, 0, 0, 1 in the bottom row of instance matrices (projective instance matrices) is now read as affine. The ToonScreenOutline line target does the same.
- Rebuilt toon shading in the standard form of real-time toon rendering.: (the public API changed)
  - To keep using smooth Lambert (the previous default), clearShadeRamp() or setBandCount(0)
  - clearBandRamp() → clearShadeRamp(). getBandRamp(), getBandCount() are gone. getShadeRamp() gives { positions, colors, feathers, isHalfLambert }
  - setSpecular(strength, exponent) is now a hard toon spot. The previous soft highlight is setSpecular(strength, exponent, 1). getSpecular() is { strength, exponent, feather, color }
  - setRimLight(color, power) keeps the soft rim but is added to the base color instead of multiplied by it. For brightness similar to before, multiply the color by a representative base color. getRimLight() is { color, power, feather, lightMask }
  - Faces turned away from point lights are not lit. (When there is a shade ramp) To have them receive light with Lambert as before, clearShadeRamp()


> https://vanillapunch.com/docs/vanilla.js/0.4.0/update/ (vanilla.js 0.4.0)
