Skip to content

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.

feat(assets): a picture's source is one kind of asset that ships as a texture - an .esimage made in the editor is a recipe an export carries and a game draws, where its type sent it out as a file nothing loads; the editor takes it in a texture field and writes a picture's maps as recipes beside it

yhha40e18ee525f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 73e7f5d72..0ac499bd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,7 @@ published separately; it ships inside the editor.
### Fixed
+- **A picture made in the editor ships as a recipe.** The editor's image tools type an `.esimage` as a picture's source, and an export sent an asset of that type out as a plain file: a scene that named one got a texture nothing could load, and a map's own picture was left out of the package. A picture's source is now that one type everywhere (a file with no `.meta` is adopted as it too), ships as a texture, has a texture's import settings, and the cook follows what it names. In the editor a texture field takes a picture's source, the viewport draws it as a game does, the image tools write a picture's normal and surface maps as recipes beside it (`wall_normal.esimage`, set as data) and answer their refs, and text is set by the same drawer a game uses. Checked in the hidden editor (written, placed on sprites, drawn) and in an export of metas of that type opened twice.
- **A splatmap is read between its pixels.** A `Terrain` asked its splatmap for the nearest pixel. Near the eye a page samples the ground finer than the paint is (a splatmap of 3 m a pixel under pages of under a metre), so every pixel of the splatmap was drawn as a flat square, and a wide fade from grass into sand was a staircase of squares that smeared into streaks at a low angle. The splatmaps are now read between their four nearest pixels, on the workers as here; a ground painted in whole pixels (a brush's own) reads as it did at the pixels themselves.
- **Grass on a hill is not thinned under your feet.** Plants thin with distance, and the distance was measured from their cell, which stood at the `Foliage` entity's own height while the plants stood on the ground. On a meadow 16 m up, with the eye 3 m over it, the grass underfoot was thinned as grass 19 m away: a third of the blades, each grown several times as wide, bare ground between them; on a mountain every blade was at its thinnest at any distance. A cell now stands on the ground under its centre and its plants about that height, so the distance is the one to where they are.
- **A view of many materials no longer loses the WebGPU device.** The WebGPU backend kept 256 bind groups and emptied the whole cache when it filled, on the assumption that a steady scene never fills it. A view that binds more (three imported towns at once: hundreds of materials, each in several passes) made every group again every frame, and on Windows the device was lost with `CreateDescriptorHeap failed with E_OUTOFMEMORY` after 700 frames with three towns in view and 1190 with two; one town was under the limit and ran. The cache holds 4096, is found by hash instead of a walk of every entry, and when full lets go only of the groups neither this frame nor the last bound.
diff --git a/desktop b/desktop
index 2abc33635..d037d5529 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 2abc33635493455146110eba359e646087193cc9
+Subproject commit d037d5529235e1259b453bb4bd48cc635894b301
diff --git a/docs/astro/src/content/docs/assets/textures.mdx b/docs/astro/src/content/docs/assets/textures.mdx
index 02d0931a4..17b3135e2 100644
--- a/docs/astro/src/content/docs/assets/textures.mdx
+++ b/docs/astro/src/content/docs/assets/textures.mdx
@@ -227,7 +227,8 @@ file of its own, two lines that name the picture:
`map` is `normal` or `surface` (roughness in green, metal in blue; one pixel where both are one value everywhere). Save it as an
`.esimage`, give it the import settings a map has (Use: Data or Normal map), and name it where the map goes. The picture it is a map
-of ships with it, named anywhere else or not.
+of ships with it, named anywhere else or not. The editor's image tools write both files beside a picture that has a `material`
+(`wall_normal.esimage`, `wall_surface.esimage`), set as data, and a texture field takes a picture's source as it takes an image.
**What a recipe may name.** A picture it lays in (an `image` layer's `src`: a PNG, or another recipe), and a font file its text is
set in. They ship with the recipe, and a change in any of them draws it again.
diff --git a/docs/astro/src/content/docs/zh-cn/assets/textures.mdx b/docs/astro/src/content/docs/zh-cn/assets/textures.mdx
index dbf6be29b..efa11b102 100644
--- a/docs/astro/src/content/docs/zh-cn/assets/textures.mdx
+++ b/docs/astro/src/content/docs/zh-cn/assets/textures.mdx
@@ -195,7 +195,8 @@ web 包 220 KB(gzip 后 81 KB):导出时只要包里有配方就会自动带上,
```
`map` 是 `normal` 或 `surface`(绿通道粗糙度,蓝通道金属度;两者处处同值时只有一个像素)。存成 `.esimage`,给它贴图该有的导入设置
-(用途:数据或法线贴图),在需要这张贴图的地方引用它。它所指向的那张图会随它一起进包,不管别处有没有引用。
+(用途:数据或法线贴图),在需要这张贴图的地方引用它。它所指向的那张图会随它一起进包,不管别处有没有引用。编辑器的图像工具会在带 `material` 的图旁边写好这两个文件
+(`wall_normal.esimage`、`wall_surface.esimage`),并设为数据;贴图字段可以像选图片一样选图的源文件。
**配方可以引用什么。** 铺进来的图片(`image` 图层的 `src`:PNG 或另一个配方),以及文字所用的字体文件。它们随配方一起进包,其中任何
一个变了,配方都会重画。
diff --git a/pipeline/src/assets/addressableManifest.ts b/pipeline/src/assets/addressableManifest.ts
index c25220fb2..3cbc4ed72 100644
--- a/pipeline/src/assets/addressableManifest.ts
+++ b/pipeline/src/assets/addressableManifest.ts
@@ -37,7 +37,8 @@ interface FlatManifest {
// Editor asset type → AddressableAssetType (sdk/src/assetTypes.ts). Feeds the
// runtime Catalog; an unmapped type degrading to 'binary' is harmless.
const ADDRESSABLE_TYPE: Record<string, string> = {
- texture: 'texture', material: 'material', audio: 'audio', 'bitmap-font': 'bitmap-font',
+ // A picture's source ships as a texture that is drawn where it loads (a recipe): an image to whatever loads it, never one to the cook.
+ texture: 'texture', imageSource: 'texture', material: 'material', audio: 'audio', 'bitmap-font': 'bitmap-font',
prefab: 'prefab', spine: 'spine',
scene: 'json', 'anim-clip': 'json', tilemap: 'json', timeline: 'json', json: 'json', 'sound-event': 'json', 'world-rules': 'json', 'terrain-layer': 'json', 'terrain-tiles': 'json', shader: 'text',
};
diff --git a/pipeline/src/assets/assetDb.ts b/pipeline/src/assets/assetDb.ts
index 69ce91f6a..a38e28698 100644
--- a/pipeline/src/assets/assetDb.ts
+++ b/pipeline/src/assets/assetDb.ts
@@ -239,7 +239,7 @@ const JSON_REF_TYPES = new Set([
'json', 'sound-event', 'world-rules', 'terrain-layer', 'terrain-tiles',
]);
-const isTextureRecipe = (e: { type: string; path: string }): boolean => e.type === 'texture' && e.path.toLowerCase().endsWith('.esimage');
+const isTextureRecipe = (e: { type: string; path: string }): boolean => e.type === 'imageSource' && e.path.toLowerCase().endsWith('.esimage');
/**
* Collect every asset reference in a JSON document:
diff --git a/pipeline/src/image/imageText.ts b/pipeline/src/image/imageText.ts
new file mode 100644
index 000000000..c1a93c4e8
--- /dev/null
+++ b/pipeline/src/image/imageText.ts
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+// The picture code is the SDK's (sdk/src/image), so a game can evaluate a picture as the pipeline does; this is where the pipeline reaches it.
+export * from '../../../sdk/src/image/imageText';
diff --git a/pipeline/src/image/recipeSource.ts b/pipeline/src/image/recipeSource.ts
new file mode 100644
index 000000000..9f39dd1e8
--- /dev/null
+++ b/pipeline/src/image/recipeSource.ts
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+// The picture code is the SDK's (sdk/src/image), so a game can evaluate a picture as the pipeline does; this is where the pipeline reaches it.
+export * from '../../../sdk/src/image/recipeSource';
diff --git a/pipeline/src/project/importSettings.ts b/pipeline/src/project/importSettings.ts
index 76ef3d65a..ab9c9ec58 100644
--- a/pipeline/src/project/importSettings.ts
+++ b/pipeline/src/project/importSettings.ts
@@ -304,6 +304,8 @@ export const IMPORTER_SCHEMAS: Record<string, ImporterFieldSpec[]> = {
panorama: PANORAMA,
texture: TEXTURE,
sprite: TEXTURE,
+ // A picture's source named where a texture goes is sampled as one: its filter, its wrap and whether it is colour are a texture's.
+ imageSource: TEXTURE,
spine: SPINE,
dragonbones: DRAGONBONES,
audio: AUDIO,
diff --git a/tools/assetMetaTable.js b/tools/assetMetaTable.js
index f11601df3..9fff5cd4e 100644
--- a/tools/assetMetaTable.js
+++ b/tools/assetMetaTable.js
@@ -34,7 +34,7 @@ export const EXT_TO_TYPE = Object.freeze({
'.svg': 'texture',
'.ktx2': 'texture',
// A picture's source, drawn into a texture where it is loaded (sdk asset/textureRecipe.ts).
- '.esimage': 'texture',
+ '.esimage': 'imageSource',
// Audio
'.wav': 'audio',
'.mp3': 'audio',
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index e4ced09ba..f407145d8 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -4690,6 +4690,8 @@ export const NOTED = {
{"note": "A texture recipe is drawn on a worker, once."},
"feat(assets): a recipe is read wherever an image is, with its text, its figures and its surface maps - a ground's layers and a field's maps take an .esimage, a map of a picture is a two-line recipe that names it, text is set by the device's canvas and a figure is posed by the bones the pipeline poses, which moved into the SDK; a recipe ships with the pictures and fonts it names and is drawn again when one changes":
{"note": "A recipe is read wherever an image is, with its text, its figures and its surface maps."},
+ "feat(assets): a picture's source is one kind of asset that ships as a texture - an .esimage made in the editor is a recipe an export carries and a game draws, where its type sent it out as a file nothing loads; the editor takes it in a texture field and writes a picture's maps as recipes beside it":
+ {"note": "A picture made in the editor ships as a recipe."},
"fix(terrain): a detail the pages cannot hold no longer cracks the ground - a tree that wanted more nodes than the atlas has pages was drawn in part by coarser pages standing in, which do not meet their finer neighbours' edges, and the pages were fought over every frame; the ground is now drawn at the share of its detail's range that fits, and says so once":
{"note": "A detail the pages cannot hold no longer cracks the ground."},
"fix(foliage): a far plant grows across the ground, not taller - a mesh plant kept in a far version was grown the same every way to cover the ground of those left out, so a flower that stood for ten stood ten times as high and a far meadow was a field of poles; it now grows across the ground only, and Foliage.farGrowUp gives its height a share of the growth back":