A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(assets): a mesh is a reference a scene can hold
esengine1b0b41828ad8
diff --git a/desktop/src/project/assetTypes.ts b/desktop/src/project/assetTypes.tsindex faaedc968..45737e46c 100644--- a/desktop/src/project/assetTypes.ts+++ b/desktop/src/project/assetTypes.ts@@ -18,7 +18,7 @@*/import {Folder, Film, Image, FileImage, PersonStanding, Music,- Component, Blend, FileCode2, Clapperboard, Grid3x3, File, Workflow, Gamepad2, GitBranch, ListTree, Languages, Images, Video, Waypoints, Sparkles, Plug, Type,+ Box, Component, Blend, FileCode2, Clapperboard, Grid3x3, File, Workflow, Gamepad2, GitBranch, ListTree, Languages, Images, Video, Waypoints, Sparkles, Plug, Type,type LucideIcon,} from 'lucide-react';import { ContributionRegistry, type Disposable, type Owner } from '@/contrib/ContributionRegistry';@@ -70,6 +70,8 @@ export const ASSET_TYPES: Record<BuiltinAssetType, AssetTypeDef> = {// Outline fonts a project ships (Text.font). Bitmap fonts (.fnt/.bmfont) are a// different asset — a baked page + metrics for BitmapText — and stay separate.font: { extensions: ['ttf', 'otf', 'woff', 'woff2'], badge: 'FNT', icon: Type, tint: '#9a9fc4' },+ // Geometry that lives on the GPU rather than in a component (.esmesh).+ mesh: { extensions: ['esmesh'], badge: 'MSH', icon: Box, tint: '#8fa9b5' },video: { extensions: ['mp4', 'm4v', 'mov'], badge: 'VID', icon: Video, tint: '#c08fb5' },prefab: { extensions: ['esprefab'], badge: 'PFB', icon: Component, tint: '#c2a274' },// .esmaterial is the real extension (the SDK MaterialAssetLoader only loads it);diff --git a/desktop/src/types.ts b/desktop/src/types.tsindex 2efd86ba8..8c7301b4f 100644--- a/desktop/src/types.ts+++ b/desktop/src/types.ts@@ -254,6 +254,7 @@ export type BuiltinAssetType =| 'behaviortree'| 'locale'| 'font'+ | 'mesh'| 'file';/** A built-in asset type, or one a plugin contributed. */diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.jsonindex 484096e86..85c992798 100644--- a/docs/astro/src/data/components.generated.json+++ b/docs/astro/src/data/components.generated.json@@ -1323,6 +1323,11 @@"type": "boolean","default": "true"},+ {+ "key": "mesh",+ "type": "Asset<mesh>",+ "default": "none"+ },{"key": "geometry","type": "object",diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 87a19f2ad..4324267c6 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -5,7 +5,7 @@ Symbols: 113 public · 55 beta · 1409 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```-"7b8797b9ae911eeb"+"310236a4dffb268f"```## ANCHOR_AXES — const @experimental@@ -629,7 +629,7 @@ type: AssetFieldType## AssetFieldType — type @public```-'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller'+'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller' | 'mesh'```## AssetGroupDef — interface @experimental@@ -4226,6 +4226,7 @@ geometry: Mesh2DGeometrylayer: numberlit: booleanmaterial: number+mesh: numberparallax: Vec2texture: number```diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex da60da4c0..4d3a7d344 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -5,7 +5,7 @@ Symbols: 113 public · 60 beta · 1428 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```-"7b8797b9ae911eeb"+"310236a4dffb268f"```## ANCHOR_AXES — const @experimental@@ -629,7 +629,7 @@ type: AssetFieldType## AssetFieldType — type @public```-'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller'+'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller' | 'mesh'```## AssetGroupDef — interface @experimental@@ -4239,6 +4239,7 @@ geometry: Mesh2DGeometrylayer: numberlit: booleanmaterial: number+mesh: numberparallax: Vec2texture: number```diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex cb32ff7fd..3e0503586 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -624,7 +624,7 @@ type: AssetFieldType## AssetFieldType — type @public```-'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller'+'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller' | 'mesh'```## AssetGroupDef — interface @experimental@@ -4221,6 +4221,7 @@ geometry: Mesh2DGeometrylayer: numberlit: booleanmaterial: number+mesh: numberparallax: Vec2texture: number```diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex e3d9370a7..c1f48907b 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -624,7 +624,7 @@ type: AssetFieldType## AssetFieldType — type @public```-'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller'+'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller' | 'mesh'```## AssetGroupDef — interface @experimental@@ -4221,6 +4221,7 @@ geometry: Mesh2DGeometrylayer: numberlit: booleanmaterial: number+mesh: numberparallax: Vec2texture: number```diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex 5cbff9e1f..9b0fa2c56 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -624,7 +624,7 @@ type: AssetFieldType## AssetFieldType — type @public```-'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller'+'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller' | 'mesh'```## AssetGroupDef — interface @experimental@@ -4228,6 +4228,7 @@ geometry: Mesh2DGeometrylayer: numberlit: booleanmaterial: number+mesh: numberparallax: Vec2texture: number```diff --git a/sdk/src/asset/Assets.ts b/sdk/src/asset/Assets.tsindex daa653d10..21fe148b3 100644--- a/sdk/src/asset/Assets.ts+++ b/sdk/src/asset/Assets.ts@@ -238,6 +238,7 @@ export interface SceneAssetResult {textureHandles: Map<string, number>;materialHandles: Map<string, number>;fontHandles: Map<string, number>;+ meshHandles: Map<string, number>;releaseCallbacks: ReleaseCallback[];missing: MissingAsset[];}@@ -1111,11 +1112,13 @@ export class Assets {const fsmPaths = discovered.byType.get('statemachine') ?? new Set<string>();const btPaths = discovered.byType.get('behaviortree') ?? new Set<string>();const animatorPaths = discovered.byType.get('animatorcontroller') ?? new Set<string>();+ const meshPaths = discovered.byType.get('mesh') ?? new Set<string>();const spinePairs = discovered.spines;const textureHandles = new Map<string, number>();const materialHandles = new Map<string, number>();const fontHandles = new Map<string, number>();+ const meshHandles = new Map<string, number>();const releaseCallbacks: ReleaseCallback[] = [];let loadedCount = 0;@@ -1175,6 +1178,7 @@ export class Assets {);pushHandleLoad(materialPaths, p => this.loadMaterial(p), materialHandles, 'material');pushHandleLoad(fontPaths, p => this.loadFont(p), fontHandles, 'font');+ pushHandleLoad(meshPaths, p => this.loadTyped<{ handle: number }>('mesh', p), meshHandles, 'mesh');// The runtime scene loader owns spine as a two-phase load+apply through the// SpineManager (skeletons must bind to spawned entities); it opts out here so// spine page textures / virtual-FS writes aren't done twice.@@ -1208,11 +1212,11 @@ export class Assets {onProgress?.(++loadedCount, totalCount);});- return { textureHandles, materialHandles, fontHandles, releaseCallbacks, missing };+ return { textureHandles, materialHandles, fontHandles, meshHandles, releaseCallbacks, missing };}resolveSceneAssetPaths(sceneData: SceneData, result: SceneAssetResult): void {- const { textureHandles, materialHandles, fontHandles } = result;+ const { textureHandles, materialHandles, fontHandles, meshHandles } = result;const counter = this.refCounter_;for (const entity of sceneData.entities) {@@ -1282,6 +1286,10 @@ export class Assets {if (counter && handle) counter.addFontRef(path, entity.id);break;}+ case 'mesh': {+ comp.data[field] = meshHandles.get(path) ?? 0;+ break;+ }}}}diff --git a/sdk/src/ecs/bridge/ptrAccessors.generated.ts b/sdk/src/ecs/bridge/ptrAccessors.generated.tsindex a73f91b08..5a877bae5 100644--- a/sdk/src/ecs/bridge/ptrAccessors.generated.ts+++ b/sdk/src/ecs/bridge/ptrAccessors.generated.ts@@ -557,6 +557,7 @@ export interface Mesh2DPtrData {parallax: Vec2;material: number;enabled: boolean;+ mesh: number;}export function fillMesh2D(@@ -570,6 +571,7 @@ export function fillMesh2D(const parallax_ = out.parallax; parallax_.x = f32[(ptr + 28) >> 2]; parallax_.y = f32[((ptr + 28) >> 2) + 1];out.material = u32[(ptr + 36) >> 2];out.enabled = u8[ptr + 40] !== 0;+ out.mesh = u32[(ptr + 44) >> 2];}export function writeMesh2D(@@ -583,6 +585,7 @@ export function writeMesh2D(f32[(ptr + 28) >> 2] = data.parallax.x; f32[((ptr + 28) >> 2) + 1] = data.parallax.y;u32[(ptr + 36) >> 2] = data.material;u8[ptr + 40] = data.enabled ? 1 : 0;+ u32[(ptr + 44) >> 2] = data.mesh;}export function createMesh2DData(): Mesh2DPtrData {@@ -594,6 +597,7 @@ export function createMesh2DData(): Mesh2DPtrData {parallax: { x: 0, y: 0 },material: 0,enabled: false,+ mesh: 0,};}diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.tsindex 3593ed589..47534ca4b 100644--- a/sdk/src/ecs/component.generated.ts+++ b/sdk/src/ecs/component.generated.ts@@ -15,7 +15,7 @@ import type { Dimension, Padding } from '../wasm/wasm.generated';* getAbiLayoutHash(); BuiltinBridge.connect() compares them and refuses to* run on mismatch, because mismatched offsets read the wrong heap bytes.*/-export const ABI_LAYOUT_HASH = '7b8797b9ae911eeb';+export const ABI_LAYOUT_HASH = '310236a4dffb268f';/*** One asset-valued field of a component: which field, and what kind of@@ -335,9 +335,10 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {parallax: { x: 1, y: 1 },material: 0,enabled: true,+ mesh: 0,},renderableField: 'enabled',- assetFields: [{ field: 'texture', type: 'texture' as AssetFieldType }, { field: 'material', type: 'material' as AssetFieldType }],+ assetFields: [{ field: 'texture', type: 'texture' as AssetFieldType }, { field: 'material', type: 'material' as AssetFieldType }, { field: 'mesh', type: 'mesh' as AssetFieldType }],entityFields: [],colorFields: ['color'],animatableFields: ['color.r', 'color.g', 'color.b', 'color.a'],@@ -1004,6 +1005,7 @@ export interface Mesh2DData {parallax: Vec2;material: number;enabled: boolean;+ mesh: number;}/**diff --git a/sdk/src/scene/scene.ts b/sdk/src/scene/scene.tsindex 5f4d82933..6ffeca50e 100644--- a/sdk/src/scene/scene.ts+++ b/sdk/src/scene/scene.ts@@ -122,7 +122,7 @@ export class MissingAssetsError extends Error {** @public*/-export type AssetFieldType = 'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller';+export type AssetFieldType = 'texture' | 'material' | 'font' | 'anim-clip' | 'audio' | 'video' | 'tilemap' | 'tileset' | 'timeline' | 'statemachine' | 'behaviortree' | 'animatorcontroller' | 'mesh';// =============================================================================// Component Query Helpers (read from self-describing ComponentDef)diff --git a/sdk/src/wasm/ptrLayouts.generated.ts b/sdk/src/wasm/ptrLayouts.generated.tsindex 3312e9924..04b80c54e 100644--- a/sdk/src/wasm/ptrLayouts.generated.ts+++ b/sdk/src/wasm/ptrLayouts.generated.ts@@ -172,6 +172,7 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {{ name: 'parallax', type: 'vec2', offset: 28 },{ name: 'material', type: 'u32', offset: 36 },{ name: 'enabled', type: 'bool', offset: 40 },+ { name: 'mesh', type: 'u32', offset: 44 },],},ParticleEmitter: {diff --git a/sdk/src/wasm/wasm.generated.ts b/sdk/src/wasm/wasm.generated.tsindex 29ac7d4bb..c220fc2b2 100644--- a/sdk/src/wasm/wasm.generated.ts+++ b/sdk/src/wasm/wasm.generated.ts@@ -350,6 +350,7 @@ export interface Mesh2D {parallax: Vec2;material: number;enabled: boolean;+ mesh: number;}export interface Parent {diff --git a/sdk/tests/api-baseline-rules.test.ts b/sdk/tests/api-baseline-rules.test.tsnew file mode 100644index 000000000..66e9346c6--- /dev/null+++ b/sdk/tests/api-baseline-rules.test.ts@@ -0,0 +1,50 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file The direction of the api-surface baseline rules.+ *+ * `--check-baseline` forgives some shape changes to a released @public symbol+ * and fails others, and the difference is a DIRECTION: a surface that grew+ * breaks nobody who already used it, a surface that shrank does. The forgiving+ * half is the half that can quietly stop guarding, so it is pinned here — a+ * union that lost a member must still fail.+ */+import { describe, it, expect } from 'vitest';+import { isAdditiveMembers, isWidenedUnion } from '../../tools/lib/apiSnapshot.mjs';++describe('api baseline: what counts as additive', () => {+ const A = "'texture' | 'material' | 'font'";+ const B = "'texture' | 'material' | 'font' | 'mesh'";++ it('a union that gained a member is additive', () => {+ expect(isWidenedUnion(A, B)).toBe(true);+ });++ it('a union that LOST a member is not', () => {+ expect(isWidenedUnion(B, A)).toBe(false);+ });++ it('a union whose member was renamed is not — the old value stopped being legal', () => {+ expect(isWidenedUnion(A, "'texture' | 'material' | 'fonts' | 'mesh'")).toBe(false);+ });++ it('an unchanged union is not additive (nothing was gained)', () => {+ expect(isWidenedUnion(A, A)).toBe(false);+ });++ it('non-literal unions are left alone — widening `string` proves nothing', () => {+ expect(isWidenedUnion('string | number', 'string | number | boolean')).toBe(false);+ });++ it('an interface gaining an OPTIONAL member is additive', () => {+ expect(isAdditiveMembers('a: string', 'a: string\nb: number | undefined')).toBe(true);+ });++ it('an interface gaining a REQUIRED member is not', () => {+ expect(isAdditiveMembers('a: string', 'a: string\nb: number')).toBe(false);+ });++ it('an interface that lost a member is not', () => {+ expect(isAdditiveMembers('a: string\nb: number | undefined', 'a: string')).toBe(false);+ });+});diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cppindex 66f384b47..9c8d19c79 100644--- a/src/esengine/bindings/EditorAPI.generated.cpp+++ b/src/esengine/bindings/EditorAPI.generated.cpp@@ -2,10 +2,10 @@* @file EditorAPI.generated.cpp* @brief Auto-generated editor API with string-dispatched component access* @details Generated by EHT - DO NOT EDIT- * @schema_hash 38c95ef984c14e01+ * @schema_hash 1ff4dcdf319a842c*/-#define ES_EDITOR_API_SCHEMA_HASH "38c95ef984c14e01"+#define ES_EDITOR_API_SCHEMA_HASH "1ff4dcdf319a842c"#include <emscripten/bind.h>#include <string>@@ -255,7 +255,8 @@ std::string editor_getComponentSchema(const std::string& name) {{"key":"parallax.x","type":"float","group":"Mesh2D"},{"key":"parallax.y","type":"float","group":"Mesh2D"},{"key":"material","type":"asset","group":"Mesh2D"},- {"key":"enabled","type":"bool","group":"Mesh2D"}+ {"key":"enabled","type":"bool","group":"Mesh2D"},+ {"key":"mesh","type":"asset","group":"Mesh2D"}])JSON";} else if (name == "Parent") {return R"JSON([@@ -1665,6 +1666,7 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::strif (field == "texture") { c.texture = resource::TextureHandle(static_cast<u32>(value)); }else if (field == "layer") { c.layer = static_cast<i32>(value); }else if (field == "material") { c.material = static_cast<u32>(value); }+ else if (field == "mesh") { c.mesh = resource::MeshHandle(static_cast<u32>(value)); }else { return false; }return true;} else if (comp == "Parent") {@@ -1852,6 +1854,7 @@ i32 editor_getInt(Registry& reg, u32 e, const std::string& comp, const std::striif (field == "texture") { return static_cast<i32>(c.texture.id()); }else if (field == "layer") { return static_cast<i32>(c.layer); }else if (field == "material") { return static_cast<i32>(c.material); }+ else if (field == "mesh") { return static_cast<i32>(c.mesh.id()); }} else if (comp == "Parent") {if (!reg.has<esengine::ecs::Parent>(entity)) return 0;const auto& c = reg.get<esengine::ecs::Parent>(entity);diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cppindex b64e7be2b..4a97285ae 100644--- a/src/esengine/bindings/WebBindings.generated.cpp+++ b/src/esengine/bindings/WebBindings.generated.cpp@@ -446,6 +446,7 @@ struct Mesh2DJS {glm::vec2 parallax;u32 material;bool enabled;+ u32 mesh;};void mesh2dApplyJS(esengine::ecs::Mesh2D& c, const Mesh2DJS& js) {@@ -456,6 +457,7 @@ void mesh2dApplyJS(esengine::ecs::Mesh2D& c, const Mesh2DJS& js) {c.parallax = js.parallax;c.material = js.material;c.enabled = js.enabled;+ c.mesh = resource::MeshHandle(js.mesh);}esengine::ecs::Mesh2D mesh2dFromJS(const Mesh2DJS& js) {@@ -473,6 +475,7 @@ Mesh2DJS mesh2dToJS(const esengine::ecs::Mesh2D& c) {js.parallax = c.parallax;js.material = c.material;js.enabled = c.enabled;+ js.mesh = c.mesh.id();return js;}@@ -1218,7 +1221,8 @@ EMSCRIPTEN_BINDINGS(esengine_components) {.field("lit", &Mesh2DJS::lit).field("parallax", &Mesh2DJS::parallax).field("material", &Mesh2DJS::material)- .field("enabled", &Mesh2DJS::enabled);+ .field("enabled", &Mesh2DJS::enabled)+ .field("mesh", &Mesh2DJS::mesh);value_object<ParentJS>("Parent").field("entity", &ParentJS::entity);@@ -2308,6 +2312,7 @@ static_assert(offsetof(esengine::ecs::Mesh2D, lit) == 24, "ABI offset drift: esestatic_assert(offsetof(esengine::ecs::Mesh2D, parallax) == 28, "ABI offset drift: esengine::ecs::Mesh2D.parallax (EHT expected 28)");static_assert(offsetof(esengine::ecs::Mesh2D, material) == 36, "ABI offset drift: esengine::ecs::Mesh2D.material (EHT expected 36)");static_assert(offsetof(esengine::ecs::Mesh2D, enabled) == 40, "ABI offset drift: esengine::ecs::Mesh2D.enabled (EHT expected 40)");+static_assert(offsetof(esengine::ecs::Mesh2D, mesh) == 44, "ABI offset drift: esengine::ecs::Mesh2D.mesh (EHT expected 44)");static_assert(offsetof(esengine::ecs::ParticleEmitter, rate) == 0, "ABI offset drift: esengine::ecs::ParticleEmitter.rate (EHT expected 0)");static_assert(offsetof(esengine::ecs::ParticleEmitter, burstCount) == 4, "ABI offset drift: esengine::ecs::ParticleEmitter.burstCount (EHT expected 4)");static_assert(offsetof(esengine::ecs::ParticleEmitter, burstInterval) == 8, "ABI offset drift: esengine::ecs::ParticleEmitter.burstInterval (EHT expected 8)");@@ -2512,7 +2517,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif// ABI Hash -- runtime handshake against the SDK bundle// =============================================================================-static const char* kEsAbiLayoutHash = "7b8797b9ae911eeb";+static const char* kEsAbiLayoutHash = "310236a4dffb268f";std::string esengineGetAbiLayoutHash() {return std::string(kEsAbiLayoutHash);diff --git a/src/esengine/ecs/components/Mesh2D.hpp b/src/esengine/ecs/components/Mesh2D.hppindex 0477c1c4d..fe697cc3e 100644--- a/src/esengine/ecs/components/Mesh2D.hpp+++ b/src/esengine/ecs/components/Mesh2D.hpp@@ -74,6 +74,15 @@ struct Mesh2D {ES_PROPERTY()bool enabled{true};+ /**+ * @brief Geometry from an .esmesh, drawn INSTEAD of the inline vertices.+ * @details The difference is where the vertices live: the inline payload is+ * rewritten into every frame, which is a re-upload of anything that+ * does not change every frame.+ */+ ES_PROPERTY(asset = mesh)+ resource::MeshHandle mesh;+// -------------------------------------------------------------------------// Geometry payload — set via mesh2d_setGeometry, streamed by MeshPlugin.// Deliberately un-annotated: variable-size data has no fixed ABI offset, so it@@ -81,15 +90,6 @@ struct Mesh2D {// keep their asserted offsets because these members come last).// -------------------------------------------------------------------------- /**- * @brief GPU-resident geometry; when valid it is drawn INSTEAD of the vertices- * below, which then stay empty.- * @details The difference is where the vertices live, not what they are. The- * inline payload is rewritten into every frame — right for geometry- * that changes every frame, a re-upload of anything that does not.- */- resource::MeshHandle mesh;-/** @brief Local-space vertices (triangle list, indexed). */std::vector<MeshVertex2D> vertices;diff --git a/tools/assetMetaTable.js b/tools/assetMetaTable.jsindex 312592b32..d52ee530d 100644--- a/tools/assetMetaTable.js+++ b/tools/assetMetaTable.js@@ -61,6 +61,7 @@ export const EXT_TO_TYPE = Object.freeze({// only be made by the Content Browser's own button) and a graph written by// any other hand is never adopted by the scan, which types orphans by name.'.esmatgraph': 'materialgraph',+ '.esmesh': 'mesh','.esanim': 'animclip','.esanimclip': 'animclip','.estimeline': 'animation',diff --git a/tools/eht/parser.py b/tools/eht/parser.pyindex 3b7d274c7..d27a7020d 100644--- a/tools/eht/parser.py+++ b/tools/eht/parser.py@@ -80,7 +80,7 @@ class CppParser:#: rather than in the generated file, which nobody may edit.STABILITY_TIERS = frozenset({'public', 'beta', 'experimental'})VALID_ASSET_TYPES = frozenset({- 'texture', 'material', 'font', 'audio',+ 'texture', 'material', 'font', 'audio', 'mesh',# A skeletal runtime's two halves. Recognised as a PAIR (see# metadata.py::_get_skeletal_descriptor), so adding a runtime is these two# entries and nothing else.diff --git a/tools/lib/apiSnapshot.mjs b/tools/lib/apiSnapshot.mjsindex 9d10e080b..08b2265ce 100644--- a/tools/lib/apiSnapshot.mjs+++ b/tools/lib/apiSnapshot.mjs@@ -61,6 +61,24 @@ export function isAdditiveMembers(before, after) {return added.length > 0 && added.every((line) => /:\s.*\|\s*undefined$/.test(line));}+/**+ * A string-literal union that kept every member and gained more. The direction+ * is the rule: every value that was legal still is, while a union that LOST one+ * stays a failure. A note rather than a pass, since an exhaustive switch over+ * the old set does stop compiling — a decision to take knowingly.+ */+export function isWidenedUnion(before, after) {+ // A snapshot body arrives inside a code fence; the union is what is between.+ const members = (s) => s.split('\n').filter((l) => !l.startsWith('```')).join(' ')+ .trim().split('|').map((p) => p.trim()).filter(Boolean);+ const was = members(before);+ const now = members(after);+ const literal = (p) => /^'[^']*'$/.test(p);+ if (was.length < 2 || !was.every(literal) || !now.every(literal)) return false;+ const set = new Set(now);+ return now.length > was.length && was.every((p) => set.has(p));+}+/*** Compare one entry against its released self. Only @public carries a promise,* so only @public produces a failure; @beta is noted because "may adjust" should@@ -84,6 +102,9 @@ export function baselineFindings(was, now) {if (before.kind === 'interface'&& isAdditiveMembers(promisedBody(before.body), promisedBody(after.body))) {notes.push(`${name} — @public interface gained an optional member`);+ } else if (before.kind === 'type'+ && isWidenedUnion(promisedBody(before.body), promisedBody(after.body))) {+ notes.push(`${name} — @public union gained a member`);} else {failures.push(`${name} — @public signature changed`);}