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.

refactor(render): remove CacheAsBitmap and the bitmap-cache helpers

esengineed0c5936fe01
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e95dd8b57..eb2399312 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -79,6 +79,19 @@ published separately; it ships inside the editor.
authors the clip, the distances and `playOnAwake`, and the code only moves the
entity.
+### Removed
+
+- **`CacheAsBitmap` and the bitmap-cache helpers.** The component, `CacheBitmap`,
+ and the per-entity cache store had exactly one consumer between them: their own
+ two test files. Nothing in any render path read them, no scene in the corpus
+ carried one, and the component sat in Add Component offering a performance
+ trade it could not make — its `dirty` flag was runtime state in an authored
+ document. `RenderTexture`, which is what the helpers wrapped, is unchanged and
+ documented; caching a subtree by hand goes through it. All four of
+ check-component-fields' declared gaps were this component's fields, and that
+ list is now empty.
+
+
### Fixed
- **A spatial source is heard where it IS.** Audio read `Transform.position` —
diff --git a/docs/astro/src/content/docs/graphics/sprites.mdx b/docs/astro/src/content/docs/graphics/sprites.mdx
index d4df9a068..45f9d7d9a 100644
--- a/docs/astro/src/content/docs/graphics/sprites.mdx
+++ b/docs/astro/src/content/docs/graphics/sprites.mdx
@@ -476,49 +476,6 @@ matrix and a viewport rectangle) for code that manages its own camera math — t
interactive **UI**, don't hand-roll any of this: `Interactable` + `UIEvents` do
picking for you (see [UI](/docs/ui/overview/)).
-## Cache as bitmap
-
-**`CacheAsBitmap`** supports rendering an entity's expensive content **once** into
-an offscreen texture and drawing that single quad afterwards — the classic
-cache-as-bitmap trade: GPU memory (`width × height` RGBA) for per-frame draw cost.
-It pays when content is costly to draw every frame (many vector paths, lots of
-text or shapes) but **rarely changes**; it does nothing for you if the content
-changes every frame — you'd re-render the cache each time *and* pay the extra blit.
-
-| Field | Default | Description |
-|---|---|---|
-| `enabled` | `true` | Whether caching is active for this entity. |
-| `dirty` | `true` | Set `true` to request a re-render of the cache. |
-| `width` / `height` | `256` | Cache texture size in pixels. |
-
-The component is the **bookkeeping half** — the SDK does not ship a system that
-walks the scene and caches subtrees automatically. You drive the refresh with the
-exported helpers: a per-entity cache store (`getCacheForEntity`,
-`setCacheForEntity`, `removeCacheForEntity`, `clearAllCaches`) and `CacheBitmap`,
-a thin render-target wrapper (`create`, `beginDraw`/`endDraw`, `resize`,
-`release`):
-
-```typescript
-import { CacheBitmap, getCacheForEntity, setCacheForEntity, Draw } from 'esengine';
-
-// Refresh (only when dirty):
-let cache = getCacheForEntity(entity);
-if (!cache) {
- cache = CacheBitmap.create(512, 256);
- setCacheForEntity(entity, cache);
-}
-CacheBitmap.beginDraw(cache, viewProjection); // an ortho matrix framing the content
-// … draw the expensive content once, with Draw / Graphics …
-CacheBitmap.endDraw();
-
-// Every frame thereafter: one textured quad instead of the whole redraw.
-Draw.texture(pos, { x: 512, y: 256 }, cache.textureId);
-```
-
-`cache.textureId` is an ordinary texture handle — it also works as a
-`Sprite.texture`. Under the hood this is a [RenderTexture](/docs/graphics/drawing/)
-without a depth buffer.
-
## In the editor
- **Create → Sprite** adds a sprite entity, or **drag an image** from the Content
diff --git a/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx b/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx
index 7c85a8c3e..7f0ceff4b 100644
--- a/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx
+++ b/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx
@@ -424,44 +424,6 @@ const hit = pointInHitArea(p.x - t.worldPosition.x, p.y - t.worldPosition.y, hul
交互式 **UI**,别手写这些:`Interactable` + `UIEvents` 会替你做拾取(见
[UI](/docs/zh-cn/ui/overview/))。
-## 位图缓存(Cache as bitmap)
-
-**`CacheAsBitmap`** 支持把实体上昂贵的内容**渲染一次**进离屏纹理,之后只画这一个
-四边形——经典的 cache-as-bitmap 交换:用 GPU 内存(`width × height` RGBA)换每帧
-绘制开销。当内容每帧都画很贵(大量矢量路径、很多形状或文字)但**很少变化**时划算;
-内容每帧都变则毫无收益——你每次都得重渲缓存,*还*多付一次贴图开销。
-
-| 字段 | 默认 | 说明 |
-|---|---|---|
-| `enabled` | `true` | 该实体的缓存是否生效。 |
-| `dirty` | `true` | 设为 `true` 请求重新渲染缓存。 |
-| `width` / `height` | `256` | 缓存纹理的像素尺寸。 |
-
-这个组件是**记账的一半**——SDK 不内置自动遍历场景缓存子树的系统。刷新由你用导出的
-辅助函数驱动:逐实体缓存仓库(`getCacheForEntity`、`setCacheForEntity`、
-`removeCacheForEntity`、`clearAllCaches`)加 `CacheBitmap`——一个轻薄的渲染目标
-包装(`create`、`beginDraw`/`endDraw`、`resize`、`release`):
-
-```typescript
-import { CacheBitmap, getCacheForEntity, setCacheForEntity, Draw } from 'esengine';
-
-// 刷新(仅在 dirty 时):
-let cache = getCacheForEntity(entity);
-if (!cache) {
- cache = CacheBitmap.create(512, 256);
- setCacheForEntity(entity, cache);
-}
-CacheBitmap.beginDraw(cache, viewProjection); // 一个框住内容的正交矩阵
-// … 用 Draw / Graphics 把昂贵内容画一次 …
-CacheBitmap.endDraw();
-
-// 此后每帧:画一个贴图四边形,而不是整套重绘。
-Draw.texture(pos, { x: 512, y: 256 }, cache.textureId);
-```
-
-`cache.textureId` 是普通的纹理句柄——也可以直接当 `Sprite.texture` 用。底层就是一个
-不带深度缓冲的 [RenderTexture](/docs/zh-cn/graphics/drawing/)。
-
## 在编辑器里
- **创建 → 精灵** 添加一个精灵实体,或从内容浏览器**把图拖**进视口,生成一个已带纹理的精灵。
diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.json
index bd7e70a5a..9b21c9c0a 100644
--- a/docs/astro/src/data/apiStability.generated.json
+++ b/docs/astro/src/data/apiStability.generated.json
@@ -3,10 +3,10 @@
"counts": {
"public": 114,
"beta": 101,
- "experimental": 1843,
+ "experimental": 1835,
"deprecated": 3
},
- "total": 2058,
+ "total": 2050,
"subsystems": [
{
"id": "ecs",
diff --git a/docs/astro/src/data/componentDocs.ts b/docs/astro/src/data/componentDocs.ts
index 2b4fc6fc8..e924743e1 100644
--- a/docs/astro/src/data/componentDocs.ts
+++ b/docs/astro/src/data/componentDocs.ts
@@ -65,7 +65,6 @@ export const COMPONENT_DOCS: Record<string, ComponentDoc> = {
BitmapText: { category: 'graphics', summary: 'Text drawn in world space from a bitmap font, sorted alongside sprites (UI text is `Text`).', doc: 'graphics/sprites', anchor: 'bitmap-text-in-the-world', anchorZh: '世界空间位图文字' },
ShapeRenderer: { category: 'graphics', summary: 'A filled or stroked primitive — rectangle, circle, capsule — with no texture asset.', doc: 'graphics/sprites', anchor: 'shapes-without-a-texture', anchorZh: '不带纹理的图元' },
TrailRenderer: { category: 'graphics', summary: 'A ribbon trailing the entity as it moves, tapering and fading over its lifetime.', doc: 'graphics/sprites', anchor: 'motion-trails', anchorZh: '拖尾' },
- CacheAsBitmap: { category: 'graphics', summary: 'Renders an expensive subtree once into a texture and reuses it until marked dirty.', doc: 'graphics/sprites', anchor: 'cache-as-bitmap', anchorZh: '位图缓存cache-as-bitmap' },
Camera: { category: 'graphics', summary: 'A view onto the world — projection, zoom, viewport rect, clear flags and render priority.', doc: 'graphics/camera', anchor: 'the-camera-component', anchorZh: 'camera-组件' },
FollowTarget: { category: 'graphics', summary: 'Makes a camera chase an entity, with an offset, a dead zone and eased catch-up.', doc: 'graphics/camera', anchor: 'follow-a-target', anchorZh: '跟随目标' },
CameraBounds: { category: 'graphics', summary: 'The world rectangle a camera may not look outside of, so the level edge stays at the screen edge.', doc: 'graphics/camera', anchor: 'keep-the-camera-inside-the-level', anchorZh: '把相机限制在关卡内' },
diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.json
index 3558a63e2..67a3eb48d 100644
--- a/docs/astro/src/data/components.generated.json
+++ b/docs/astro/src/data/components.generated.json
@@ -338,36 +338,6 @@
}
]
},
- {
- "name": "CacheAsBitmap",
- "source": "ts",
- "fields": [
- {
- "key": "enabled",
- "type": "boolean",
- "default": "true"
- },
- {
- "key": "dirty",
- "type": "boolean",
- "default": "true"
- },
- {
- "key": "width",
- "type": "number",
- "default": "256"
- },
- {
- "key": "height",
- "type": "number",
- "default": "256"
- }
- ],
- "animatable": [
- "width",
- "height"
- ]
- },
{
"name": "Camera",
"source": "cpp",
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 334a6ae85..d45a8f4fc 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 114 public · 94 beta · 1682 experimental · 3 deprecated
+Symbols: 114 public · 94 beta · 1674 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
@@ -1335,15 +1335,6 @@ p2y: number
| { kind: 'virtual'; id: string }
```
-## BitmapCache — interface @experimental
-```
-_rt: RenderTextureHandle | null
-height: number
-textureId: number
-valid: boolean
-width: number
-```
-
## BitmapText — const @experimental
```
BuiltinComponentDef<BitmapTextData>
@@ -1664,24 +1655,6 @@ CollisionBrush[]
"hit"
```
-## CacheAsBitmap — const @experimental
-```
-ComponentDef<CacheAsBitmapData>
-```
-
-## CacheAsBitmapData — interface @experimental
-```
-dirty: boolean
-enabled: boolean
-height: number
-width: number
-```
-
-## CacheBitmap — const @experimental
-```
-{ create(width: number, height: number): BitmapCache; release(cache: BitmapCache): void; beginDraw(cache: BitmapCache, viewProjection: Float32Array): void; endDraw(): void; resize(cache: BitmapCache, width: number, height: number): void; }
-```
-
## Camera — const @beta
```
BuiltinComponentDef<CameraData>
@@ -10969,11 +10942,6 @@ BtPlugin
(pitch: number, min: number, max: number): number
```
-## clearAllCaches — function @experimental
-```
-(): void
-```
-
## clearAnimatorControllerStore — function @experimental
```
(): void
@@ -11854,11 +11822,6 @@ GameplayPlugin
(key: string): BtDefinition | undefined
```
-## getCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## getComponent — function @experimental
```
(name: string): AnyComponentDef | undefined
@@ -12979,11 +12942,6 @@ PrefabsPlugin
(def: BtDefinition, id: string): BtDefinition
```
-## removeCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## removeNode — function @beta
```
(g: MaterialGraph, id: string): MaterialGraph
@@ -13309,11 +13267,6 @@ ServicesPlugin
(world: World, entity: Entity, state: string): void
```
-## setCacheForEntity — function @experimental
-```
-(entityId: number, cache: BitmapCache): void
-```
-
## setControllerPage — function @experimental
```
(world: World, entity: Entity, name: string, page: string): boolean
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index 5cfac2901..be39e1a2b 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.native
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 114 public · 99 beta · 1701 experimental · 3 deprecated
+Symbols: 114 public · 99 beta · 1693 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
@@ -1335,15 +1335,6 @@ p2y: number
| { kind: 'virtual'; id: string }
```
-## BitmapCache — interface @experimental
-```
-_rt: RenderTextureHandle | null
-height: number
-textureId: number
-valid: boolean
-width: number
-```
-
## BitmapText — const @experimental
```
BuiltinComponentDef<BitmapTextData>
@@ -1664,24 +1655,6 @@ CollisionBrush[]
"hit"
```
-## CacheAsBitmap — const @experimental
-```
-ComponentDef<CacheAsBitmapData>
-```
-
-## CacheAsBitmapData — interface @experimental
-```
-dirty: boolean
-enabled: boolean
-height: number
-width: number
-```
-
-## CacheBitmap — const @experimental
-```
-{ create(width: number, height: number): BitmapCache; release(cache: BitmapCache): void; beginDraw(cache: BitmapCache, viewProjection: Float32Array): void; endDraw(): void; resize(cache: BitmapCache, width: number, height: number): void; }
-```
-
## Camera — const @beta
```
BuiltinComponentDef<CameraData>
@@ -11177,11 +11150,6 @@ BtPlugin
(pitch: number, min: number, max: number): number
```
-## clearAllCaches — function @experimental
-```
-(): void
-```
-
## clearAnimatorControllerStore — function @experimental
```
(): void
@@ -12087,11 +12055,6 @@ GameplayPlugin
(key: string): BtDefinition | undefined
```
-## getCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## getComponent — function @experimental
```
(name: string): AnyComponentDef | undefined
@@ -13222,11 +13185,6 @@ PrefabsPlugin
(def: BtDefinition, id: string): BtDefinition
```
-## removeCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## removeNode — function @beta
```
(g: MaterialGraph, id: string): MaterialGraph
@@ -13552,11 +13510,6 @@ ServicesPlugin
(world: World, entity: Entity, state: string): void
```
-## setCacheForEntity — function @experimental
-```
-(entityId: number, cache: BitmapCache): void
-```
-
## setControllerPage — function @experimental
```
(world: World, entity: Entity, name: string, page: string): boolean
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index fae8666fe..97c03ce10 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.node
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 114 public · 96 beta · 1681 experimental · 3 deprecated
+Symbols: 114 public · 96 beta · 1673 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -1330,15 +1330,6 @@ p2y: number
| { kind: 'virtual'; id: string }
```
-## BitmapCache — interface @experimental
-```
-_rt: RenderTextureHandle | null
-height: number
-textureId: number
-valid: boolean
-width: number
-```
-
## BitmapText — const @experimental
```
BuiltinComponentDef<BitmapTextData>
@@ -1659,24 +1650,6 @@ CollisionBrush[]
"hit"
```
-## CacheAsBitmap — const @experimental
-```
-ComponentDef<CacheAsBitmapData>
-```
-
-## CacheAsBitmapData — interface @experimental
-```
-dirty: boolean
-enabled: boolean
-height: number
-width: number
-```
-
-## CacheBitmap — const @experimental
-```
-{ create(width: number, height: number): BitmapCache; release(cache: BitmapCache): void; beginDraw(cache: BitmapCache, viewProjection: Float32Array): void; endDraw(): void; resize(cache: BitmapCache, width: number, height: number): void; }
-```
-
## Camera — const @beta
```
BuiltinComponentDef<CameraData>
@@ -10964,11 +10937,6 @@ BtPlugin
(pitch: number, min: number, max: number): number
```
-## clearAllCaches — function @experimental
-```
-(): void
-```
-
## clearAnimatorControllerStore — function @experimental
```
(): void
@@ -11849,11 +11817,6 @@ GameplayPlugin
(key: string): BtDefinition | undefined
```
-## getCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## getComponent — function @experimental
```
(name: string): AnyComponentDef | undefined
@@ -12984,11 +12947,6 @@ PrefabsPlugin
(def: BtDefinition, id: string): BtDefinition
```
-## removeCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## removeNode — function @beta
```
(g: MaterialGraph, id: string): MaterialGraph
@@ -13314,11 +13272,6 @@ ServicesPlugin
(world: World, entity: Entity, state: string): void
```
-## setCacheForEntity — function @experimental
-```
-(entityId: number, cache: BitmapCache): void
-```
-
## setControllerPage — function @experimental
```
(world: World, entity: Entity, name: string, page: string): boolean
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index 862d7b17a..dcc75cdb7 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/minigame
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 114 public · 94 beta · 1703 experimental · 3 deprecated
+Symbols: 114 public · 94 beta · 1695 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -1330,15 +1330,6 @@ p2y: number
| { kind: 'virtual'; id: string }
```
-## BitmapCache — interface @experimental
-```
-_rt: RenderTextureHandle | null
-height: number
-textureId: number
-valid: boolean
-width: number
-```
-
## BitmapText — const @experimental
```
BuiltinComponentDef<BitmapTextData>
@@ -1659,24 +1650,6 @@ CollisionBrush[]
"hit"
```
-## CacheAsBitmap — const @experimental
-```
-ComponentDef<CacheAsBitmapData>
-```
-
-## CacheAsBitmapData — interface @experimental
-```
-dirty: boolean
-enabled: boolean
-height: number
-width: number
-```
-
-## CacheBitmap — const @experimental
-```
-{ create(width: number, height: number): BitmapCache; release(cache: BitmapCache): void; beginDraw(cache: BitmapCache, viewProjection: Float32Array): void; endDraw(): void; resize(cache: BitmapCache, width: number, height: number): void; }
-```
-
## Camera — const @beta
```
BuiltinComponentDef<CameraData>
@@ -11218,11 +11191,6 @@ BtPlugin
(pitch: number, min: number, max: number): number
```
-## clearAllCaches — function @experimental
-```
-(): void
-```
-
## clearAnimatorControllerStore — function @experimental
```
(): void
@@ -12108,11 +12076,6 @@ GameplayPlugin
(key: string): BtDefinition | undefined
```
-## getCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## getComponent — function @experimental
```
(name: string): AnyComponentDef | undefined
@@ -13243,11 +13206,6 @@ PrefabsPlugin
(def: BtDefinition, id: string): BtDefinition
```
-## removeCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## removeNode — function @beta
```
(g: MaterialGraph, id: string): MaterialGraph
@@ -13573,11 +13531,6 @@ ServicesPlugin
(world: World, entity: Entity, state: string): void
```
-## setCacheForEntity — function @experimental
-```
-(entityId: number, cache: BitmapCache): void
-```
-
## setControllerPage — function @experimental
```
(world: World, entity: Entity, name: string, page: string): boolean
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index 84750d916..b7a6350f2 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/wechat
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 114 public · 94 beta · 1693 experimental · 3 deprecated
+Symbols: 114 public · 94 beta · 1685 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -1330,15 +1330,6 @@ p2y: number
| { kind: 'virtual'; id: string }
```
-## BitmapCache — interface @experimental
-```
-_rt: RenderTextureHandle | null
-height: number
-textureId: number
-valid: boolean
-width: number
-```
-
## BitmapText — const @experimental
```
BuiltinComponentDef<BitmapTextData>
@@ -1659,24 +1650,6 @@ CollisionBrush[]
"hit"
```
-## CacheAsBitmap — const @experimental
-```
-ComponentDef<CacheAsBitmapData>
-```
-
-## CacheAsBitmapData — interface @experimental
-```
-dirty: boolean
-enabled: boolean
-height: number
-width: number
-```
-
-## CacheBitmap — const @experimental
-```
-{ create(width: number, height: number): BitmapCache; release(cache: BitmapCache): void; beginDraw(cache: BitmapCache, viewProjection: Float32Array): void; endDraw(): void; resize(cache: BitmapCache, width: number, height: number): void; }
-```
-
## Camera — const @beta
```
BuiltinComponentDef<CameraData>
@@ -10992,11 +10965,6 @@ BtPlugin
(pitch: number, min: number, max: number): number
```
-## clearAllCaches — function @experimental
-```
-(): void
-```
-
## clearAnimatorControllerStore — function @experimental
```
(): void
@@ -11877,11 +11845,6 @@ GameplayPlugin
(key: string): BtDefinition | undefined
```
-## getCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## getComponent — function @experimental
```
(name: string): AnyComponentDef | undefined
@@ -13007,11 +12970,6 @@ PrefabsPlugin
(def: BtDefinition, id: string): BtDefinition
```
-## removeCacheForEntity — function @experimental
-```
-(entityId: number): BitmapCache | undefined
-```
-
## removeNode — function @beta
```
(g: MaterialGraph, id: string): MaterialGraph
@@ -13337,11 +13295,6 @@ ServicesPlugin
(world: World, entity: Entity, state: string): void
```
-## setCacheForEntity — function @experimental
-```
-(entityId: number, cache: BitmapCache): void
-```
-
## setControllerPage — function @experimental
```
(world: World, entity: Entity, name: string, page: string): boolean
diff --git a/sdk/src/core-sys.ts b/sdk/src/core-sys.ts
index 3d50d2ea3..c37c34cea 100644
--- a/sdk/src/core-sys.ts
+++ b/sdk/src/core-sys.ts
@@ -69,15 +69,6 @@ export { setEntityVisible, isEntityVisible, hasVisibility, setEntityActive, isEn
export { entityWorldBox, uiNodeWorldBox, meshWorldBox, entityBoxCorners, entityBoxRayHit, type EntityBox, type EntityBoxOptions, type ReadableWorld, type LayoutWorld } from './ecs/entityBox';
export { pickEntitiesByRay, type EntityPickOptions, type PickWorld } from './ecs/entityPick';
-export { CacheBitmap, type BitmapCache } from './render/cacheBitmap';
-export {
- CacheAsBitmap,
- getCacheForEntity,
- setCacheForEntity,
- removeCacheForEntity,
- clearAllCaches,
- type CacheAsBitmapData,
-} from './render/cacheAsBitmap';
export { pointInHitArea, type HitAreaShape } from './input/hitArea';
// =============================================================================
diff --git a/sdk/src/render/cacheAsBitmap.ts b/sdk/src/render/cacheAsBitmap.ts
deleted file mode 100644
index ed2806b84..000000000
--- a/sdk/src/render/cacheAsBitmap.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-/**
- * @file cacheAsBitmap.ts
- * @brief CacheAsBitmap component for caching entity subtrees as bitmaps
- */
-
-import { defineComponent, type ComponentDef } from '../ecs/component';
-import type { BitmapCache } from './cacheBitmap';
-
-// =============================================================================
-// Component
-// =============================================================================
-
-export interface CacheAsBitmapData {
- enabled: boolean;
- dirty: boolean;
- width: number;
- height: number;
-}
-
-export const CacheAsBitmap: ComponentDef<CacheAsBitmapData> = defineComponent('CacheAsBitmap', {
- enabled: true,
- dirty: true,
- width: 256,
- height: 256,
-});
-
-// =============================================================================
-// Cache Store
-// =============================================================================
-
-const cacheStore = new Map<number, BitmapCache>();
-
-export function getCacheForEntity(entityId: number): BitmapCache | undefined {
- return cacheStore.get(entityId);
-}
-
-export function setCacheForEntity(entityId: number, cache: BitmapCache): void {
- cacheStore.set(entityId, cache);
-}
-
-export function removeCacheForEntity(entityId: number): BitmapCache | undefined {
- const cache = cacheStore.get(entityId);
- if (cache) {
- cacheStore.delete(entityId);
- }
- return cache;
-}
-
-export function clearAllCaches(): void {
- cacheStore.clear();
-}
-
-export function getCacheStoreSize(): number {
- return cacheStore.size;
-}
diff --git a/sdk/src/render/cacheBitmap.ts b/sdk/src/render/cacheBitmap.ts
deleted file mode 100644
index c794d9791..000000000
--- a/sdk/src/render/cacheBitmap.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { RenderTexture, type RenderTextureHandle } from './renderTexture';
-
-export interface BitmapCache {
- textureId: number;
- width: number;
- height: number;
- valid: boolean;
- _rt: RenderTextureHandle | null;
-}
-
-export const CacheBitmap = {
- create(width: number, height: number): BitmapCache {
- const rt = RenderTexture.create({ width, height, depth: false, filter: 'linear' });
- return {
- textureId: rt.textureId,
- width,
- height,
- valid: true,
- _rt: rt,
- };
- },
-
- release(cache: BitmapCache): void {
- if (cache._rt) {
- RenderTexture.release(cache._rt);
- cache._rt = null;
- }
- cache.textureId = 0;
- cache.valid = false;
- },
-
- beginDraw(cache: BitmapCache, viewProjection: Float32Array): void {
- if (!cache._rt || !cache.valid) return;
- RenderTexture.begin(cache._rt, viewProjection);
- },
-
- endDraw(): void {
- RenderTexture.end();
- },
-
- resize(cache: BitmapCache, width: number, height: number): void {
- if (cache._rt) {
- const newRt = RenderTexture.resize(cache._rt, width, height);
- cache._rt = newRt;
- cache.textureId = newRt.textureId;
- cache.width = width;
- cache.height = height;
- }
- },
-};
diff --git a/sdk/tests/cache-as-bitmap.test.ts b/sdk/tests/cache-as-bitmap.test.ts
deleted file mode 100644
index f68ae950a..000000000
--- a/sdk/tests/cache-as-bitmap.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { describe, it, expect, beforeEach } from 'vitest';
-import {
- CacheAsBitmap,
- getCacheForEntity,
- setCacheForEntity,
- removeCacheForEntity,
- clearAllCaches,
- getCacheStoreSize,
-} from '../src/render/cacheAsBitmap';
-import type { BitmapCache } from '../src/render/cacheBitmap';
-
-function mockCache(id: number): BitmapCache {
- return { textureId: id, width: 256, height: 256, valid: true, _rt: null };
-}
-
-describe('CacheAsBitmap', () => {
- beforeEach(() => {
- clearAllCaches();
- });
-
- it('component has correct defaults', () => {
- const defaults = CacheAsBitmap._default;
- expect(defaults.enabled).toBe(true);
- expect(defaults.dirty).toBe(true);
- expect(defaults.width).toBe(256);
- expect(defaults.height).toBe(256);
- });
-
- describe('cache store', () => {
- it('set and get cache', () => {
- const cache = mockCache(1);
- setCacheForEntity(10, cache);
- expect(getCacheForEntity(10)).toBe(cache);
- });
-
- it('returns undefined for missing entity', () => {
- expect(getCacheForEntity(999)).toBeUndefined();
- });
-
- it('remove cache', () => {
- const cache = mockCache(1);
- setCacheForEntity(10, cache);
- const removed = removeCacheForEntity(10);
- expect(removed).toBe(cache);
- expect(getCacheForEntity(10)).toBeUndefined();
- });
-
- it('clearAllCaches empties store', () => {
- setCacheForEntity(1, mockCache(1));
- setCacheForEntity(2, mockCache(2));
- expect(getCacheStoreSize()).toBe(2);
- clearAllCaches();
- expect(getCacheStoreSize()).toBe(0);
- });
- });
-});
diff --git a/sdk/tests/cache-bitmap.test.ts b/sdk/tests/cache-bitmap.test.ts
deleted file mode 100644
index 5e1d6e457..000000000
--- a/sdk/tests/cache-bitmap.test.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { describe, it, expect, vi } from 'vitest';
-import { CacheBitmap } from '../src/render/cacheBitmap';
-
-vi.mock('../src/render/renderer', () => ({
- Renderer: {
- createRenderTarget: vi.fn(() => 1),
- getTargetTexture: vi.fn(() => 42),
- releaseRenderTarget: vi.fn(),
- begin: vi.fn(),
- end: vi.fn(),
- resize: vi.fn(),
- setViewport: vi.fn(),
- setClearColor: vi.fn(),
- clearBuffers: vi.fn(),
- beginFrame: vi.fn(),
- },
-}));
-
-vi.mock('../src/render/renderTexture', () => ({
- RenderTexture: {
- create: vi.fn(() => ({ _handle: 1, textureId: 42, width: 256, height: 256, _depth: false, _filter: 'linear' })),
- release: vi.fn(),
- begin: vi.fn(),
- end: vi.fn(),
- },
-}));
-
-describe('CacheBitmap', () => {
- it('should create a cache with correct dimensions', () => {
- const cache = CacheBitmap.create(256, 256);
- expect(cache).toBeDefined();
- expect(cache.textureId).toBe(42);
- expect(cache.width).toBe(256);
- expect(cache.height).toBe(256);
- });
-
- it('should release cache', () => {
- const cache = CacheBitmap.create(128, 128);
- CacheBitmap.release(cache);
- expect(cache.textureId).toBe(0);
- });
-
- it('should track valid state', () => {
- const cache = CacheBitmap.create(64, 64);
- expect(cache.valid).toBe(true);
- CacheBitmap.release(cache);
- expect(cache.valid).toBe(false);
- });
-});
diff --git a/tools/check-component-fields.mjs b/tools/check-component-fields.mjs
index c2263127e..d6f880bb9 100644
--- a/tools/check-component-fields.mjs
+++ b/tools/check-component-fields.mjs
@@ -28,13 +28,6 @@ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
* intended state: a field that earns an entry here is work, not permission.
*/
const DECLARED_GAPS = {
- 'CacheAsBitmap.enabled': 'the bookkeeping half on purpose (docs graphics/sprites):'
- + ' the engine ships no system that walks the scene and caches subtrees, because'
- + ' it has no way to render ONE subtree to a target — a game drives the refresh'
- + ' with CacheBitmap. An example using it would read these and close all four.',
- 'CacheAsBitmap.dirty': 'see CacheAsBitmap.enabled',
- 'CacheAsBitmap.width': 'see CacheAsBitmap.enabled',
- 'CacheAsBitmap.height': 'see CacheAsBitmap.enabled',
};
const components = JSON.parse(
diff --git a/tools/check-corpus-authoring.mjs b/tools/check-corpus-authoring.mjs
index ae157e99b..63065a030 100644
--- a/tools/check-corpus-authoring.mjs
+++ b/tools/check-corpus-authoring.mjs
@@ -119,7 +119,6 @@ const DISPOSITION = {
// Each reason names where the coverage belongs. —
- CacheAsBitmap: ['owed', 'flattening a static subtree into one texture is a performance decision with no example showing when to take it'],
BitmapText: ['owed', 'Create > Bitmap Text exists; every corpus scene uses Text instead, so the pixel-font path ships unwitnessed'],
SpriteMask: ['owed', 'space-shooter masks from code; masking is authored geometry and belongs in a scene'],
TrailRenderer: ['owed', 'Create > Trail exists and trail-demo builds its trail in code'],
diff --git a/tools/check-gizmo-coverage.mjs b/tools/check-gizmo-coverage.mjs
index 8be410d88..f60d2e324 100644
--- a/tools/check-gizmo-coverage.mjs
+++ b/tools/check-gizmo-coverage.mjs
@@ -134,8 +134,6 @@ const DISPOSITION = {
// Not a length in world space at all.
'Canvas.matchWidthOrHeight': ['not-world', 'a 0..1 blend between two fits, not a length'],
- 'CacheAsBitmap.width': ['not-world', 'the cache texture\'s pixel size'],
- 'CacheAsBitmap.height': ['not-world', 'the cache texture\'s pixel size'],
'UIDropdown.optionHeight': ['not-world', 'a row height inside a laid-out box, resolved by layout rather than placed'],
'SpriteMask.rangeEndOrder': ['not-world', 'the last draw ORDER a mask reaches, not a distance it reaches over'],
'LODGroup.lod1Size': ['not-world', 'a fraction of SCREEN height — a property of the view, not of the entity'],
diff --git a/tools/check-screen-domain.mjs b/tools/check-screen-domain.mjs
index 00bda4a74..42cbe5358 100644
--- a/tools/check-screen-domain.mjs
+++ b/tools/check-screen-domain.mjs
@@ -24,7 +24,7 @@
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
-import { execFileSync } from 'node:child_process';
+import { listTrackedSources } from './lib/sourceRoots.mjs';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const FIELD = /\b(?:worldLeft|worldRight|worldTop|worldBottom)\b/;
@@ -42,8 +42,10 @@ const DECLARED = new Map([
['sdk/src/camera/Camera.ts', 'getWorldBounds is a camera query, not a UI one'],
]);
-const files = execFileSync('git', ['ls-files', 'sdk/src'], { cwd: ROOT, encoding: 'utf8' })
- .split('\n').filter((f) => f.endsWith('.ts'));
+// Through the shared lister: `git ls-files` answers from the INDEX, so a file
+// deleted and not yet staged is still named, and reading it throws. That is
+// already handled there — handling it again here is the second copy that drifts.
+const files = listTrackedSources(['sdk/src']).files.filter((f) => f.endsWith('.ts'));
const found = [];
for (const file of files) {