Skip to content
Open
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
5d37ccc
fix(shader-lab): resolve GVec4 generic return type for texture() buil…
zhuxudong Mar 26, 2026
727bcec
fix(shader-lab): simplify resolveGenericReturnType, fix textureCube/t…
zhuxudong Mar 26, 2026
b69233b
implement HorizontalBillboard render mode (#2938)
hhhhkrx Mar 23, 2026
8a0a605
fix(shader-lab): return TypeAny for unresolved generic builtin return…
zhuxudong Mar 26, 2026
889b096
fix(shader-lab): resolve GVec4 generic return type for texture() buil…
zhuxudong Mar 26, 2026
2d25129
fix(shader-lab): simplify resolveGenericReturnType, fix textureCube/t…
zhuxudong Mar 26, 2026
4b3d632
fix(shader-lab): return TypeAny for unresolved generic builtin return…
zhuxudong Mar 26, 2026
2f6712a
fix(shader-lab): transform struct member access in #define values dur…
zhuxudong Mar 26, 2026
a0e6fc8
test(shader-lab): add transformation result assertions for define-str…
zhuxudong Mar 26, 2026
60480bb
test(shader-lab): enrich define-struct-access tests with usage assert…
zhuxudong Mar 26, 2026
d05187b
fix(shader-lab): support global #define with cross-stage struct var t…
zhuxudong Mar 26, 2026
828752d
fix(shader-lab): skip type inference for member access macros in sema…
zhuxudong Mar 26, 2026
7b18aef
test(shader-lab): add Cocos FSInput pattern test for member access ma…
zhuxudong Mar 26, 2026
80e6e3e
fix(shader-lab): handle global struct-typed variables and simplify ma…
zhuxudong Mar 26, 2026
bfe4e9e
fix(shader-lab): add missing semicolon in GLES100 fragment return con…
zhuxudong Mar 26, 2026
b902c21
feat: merge code
cptbtptpbcptdtptp Mar 27, 2026
b714609
fix: temp
cptbtptpbcptdtptp Mar 27, 2026
1749077
fix: temp
cptbtptpbcptdtptp Mar 27, 2026
c662731
fix: entity disable
cptbtptpbcptdtptp Mar 27, 2026
d0dada8
fix: keep mesh data
cptbtptpbcptdtptp Mar 27, 2026
3cf1883
fix(shader-lab): allow logical NOT operator on numeric operands in pr…
zhuxudong Mar 27, 2026
41f024e
fix(camera): make invViewProjMat ignore scale consistently with viewM…
cptbtptpbcptdtptp Mar 27, 2026
63dff37
test(camera): add unit test for invViewProjMat scale consistency
cptbtptpbcptdtptp Mar 27, 2026
ca0d518
fix: use project type
cptbtptpbcptdtptp Mar 28, 2026
13521cc
fix(loader): componentRef 解析支持 clone entity 子树查找
luzhuang Mar 29, 2026
a6156ba
fix(clone): prefab 克隆时自动 deep clone 同类型 Object 属性,防止共享状态
luzhuang Mar 29, 2026
d9a2674
fix(animation): normalize single-root clip binding paths
luzhuang Mar 29, 2026
63c715b
fix(animation): add per-instance speed to AnimatorStatePlayData
luzhuang Mar 30, 2026
13052d2
feat(ui): add SpriteSizeMode to Image component
luzhuang Mar 30, 2026
15b19af
feat: particle bug not fix
luzhuang Apr 1, 2026
207a381
feat(2d): add FilledSpriteAssembler and sprite filled mode support
cptbtptpbcptdtptp Apr 2, 2026
ca5252a
feat: supported filled
cptbtptpbcptdtptp Apr 7, 2026
5c2edee
fix: clone and sibling index
cptbtptpbcptdtptp Apr 15, 2026
40006d9
fix: raycast collider layer
cptbtptpbcptdtptp Apr 15, 2026
4fe4fae
fix(shader): add missing camera_VPMat declaration in Transform.glsl
zhuxudong Apr 15, 2026
3071f90
fix(loader): always create GLTF_ROOT container for consistent animati…
luzhuang Mar 26, 2026
40734f8
fix(e2e): update blendShape e2e tests for GLTF_ROOT nesting
luzhuang Mar 26, 2026
5abb3f5
fix(loader): restore single-root GLTF scene without GLTF_ROOT wrapper
luzhuang Apr 15, 2026
b3bf58a
Revert "fix(loader): restore single-root GLTF scene without GLTF_ROOT…
luzhuang Apr 15, 2026
069f182
fix(loader): normalize gltf wrapper and skin roots
luzhuang Apr 15, 2026
f5be424
fix: raycast and clone
cptbtptpbcptdtptp Apr 15, 2026
5d7e6af
Merge remote-tracking branch 'origin/fix/shaderlab' into fix/shaderlab
cptbtptpbcptdtptp Apr 15, 2026
bc35a61
fix: revert code
cptbtptpbcptdtptp Apr 15, 2026
d5b6dd9
fix(loader): add audio extension to AudioLoader supported types
luzhuang Apr 15, 2026
bdf5490
fix(physics-physx): raycast 和 sweep 跳过 initial overlap
luzhuang Apr 15, 2026
3075f4f
fix: entity set sibling error when without parent
cptbtptpbcptdtptp Apr 20, 2026
acf9c2d
fix(core/ui): propagate reparent dirty to descendants in Transform an…
luzhuang Apr 21, 2026
e5228d7
chore: release v0.0.0-experimental-2.0-game
cptbtptpbcptdtptp Apr 21, 2026
b16d8b5
fix(core): invoke structured Signal listeners with runtime args befor…
cptbtptpbcptdtptp Apr 21, 2026
ae8c7db
chore: release v0.0.0-experimental-2.0-game.1
cptbtptpbcptdtptp Apr 21, 2026
60e9637
fix: clear children bug
cptbtptpbcptdtptp Apr 22, 2026
569c062
fix(entity): remove redundant self-name prefix check in _findChildByN…
GuoLei1990 Apr 22, 2026
83f6657
Merge branch 'fix/shaderlab' of https://github.com/galacean/engine in…
GuoLei1990 Apr 22, 2026
599a7e6
fix(core): evict active scene asset cache on loadScene to avoid self-…
luzhuang Apr 22, 2026
dcae1d7
fix: opt get sprites error
cptbtptpbcptdtptp Apr 22, 2026
ecd7944
Merge remote-tracking branch 'origin/fix/shaderlab' into fix/shaderlab
cptbtptpbcptdtptp Apr 22, 2026
14407d9
fix(audio): restore pending playback correctly
luzhuang Apr 22, 2026
cc0cb66
Merge remote-tracking branch 'origin/fix/shaderlab' into fix/shaderlab
cptbtptpbcptdtptp Apr 22, 2026
27fbf5f
chore: release v0.0.0-experimental-2.0-game.3
cptbtptpbcptdtptp Apr 22, 2026
dd02420
feat(core): GPU Instancing 自动合批(cherry-pick from galacean/engine#2957)
zhuxudong Apr 23, 2026
7c2ed59
feat: atlas support rotate
cptbtptpbcptdtptp Apr 23, 2026
77ce2c6
Merge branch 'fix/shaderlab' of github.com:galacean/runtime into fix/…
cptbtptpbcptdtptp Apr 23, 2026
e634134
fix(shader): scan instance uniforms with macro awareness for raw GLSL
zhuxudong Apr 23, 2026
3c319ec
fix: remove stray console.log in ShaderFactory
zhuxudong Apr 23, 2026
2d3b2d4
chore: release v0.0.0-experimental-2.0-game.4
cptbtptpbcptdtptp Apr 23, 2026
8186bef
Merge remote-tracking branch 'origin/fix/shaderlab' into fix/shaderlab
cptbtptpbcptdtptp Apr 23, 2026
80b8eef
chore: release v0.0.0-experimental-2.0-game.5
cptbtptpbcptdtptp Apr 23, 2026
8048ba9
fix(audio): restore sources after background interruption
luzhuang Apr 24, 2026
af825f0
fix: recover audio after foreground resume
luzhuang Apr 24, 2026
bf57cb1
test(loader): cover stripped entity child attachment
luzhuang Apr 24, 2026
779648d
fix: ui batch render
cptbtptpbcptdtptp Apr 24, 2026
5f00d11
chore: release v0.0.0-experimental-2.0-game.6
cptbtptpbcptdtptp Apr 24, 2026
5c747f0
fix: filled uv
cptbtptpbcptdtptp Apr 26, 2026
08682c1
feat: support mask
cptbtptpbcptdtptp Apr 28, 2026
b87180b
chore: release v0.0.0-experimental-2.0-game.7
cptbtptpbcptdtptp Apr 28, 2026
79b289e
fix: text dirty flag bug
cptbtptpbcptdtptp Apr 29, 2026
d33332c
chore: release v0.0.0-experimental-2.0-game.8
cptbtptpbcptdtptp Apr 29, 2026
aa2442d
feat: support text outline
cptbtptpbcptdtptp Apr 30, 2026
9a1a34b
fix: init outline width
cptbtptpbcptdtptp May 2, 2026
d09c43f
chore: release v0.0.0-experimental-2.0-game.9
cptbtptpbcptdtptp May 3, 2026
27b4bc2
Revert "feat(ui): add SpriteSizeMode to Image component"
cptbtptpbcptdtptp May 4, 2026
0fb25c2
refactor: unify shader file extension from .gs/.gsl to .shader (#2951)
GuoLei1990 Apr 1, 2026
8ef104d
fix: get components order
cptbtptpbcptdtptp May 12, 2026
8b0cabd
feat: opt pointer event data
cptbtptpbcptdtptp May 14, 2026
cf8c320
chore: release v0.0.0-experimental-2.0-game.10
cptbtptpbcptdtptp May 14, 2026
9fad204
fix: outline shader
cptbtptpbcptdtptp May 14, 2026
3b8193c
chore: release v0.0.0-experimental-2.0-game.11
cptbtptpbcptdtptp May 14, 2026
273d181
fix(physics): resolve clone-bypass and runtime native handle desync bugs
luzhuang May 14, 2026
c96cefc
feat(physics): add DynamicCollider.applyForceAtPosition
luzhuang May 14, 2026
9c32650
fix(physics): remove redundant wakeUp in addForce/addTorque + correct…
luzhuang May 14, 2026
e1c0eb5
fix(physics): repair 8 pre-existing test failures (Lite material + Ph…
luzhuang May 14, 2026
f8ad6bf
test(physics): add regression tests for r0 ccd handling and r6 mesh c…
luzhuang May 14, 2026
5ec7e3f
fix(physics): kinematic transform sync via setKinematicTarget; fix Tr…
luzhuang May 15, 2026
ab190ac
chore: release v0.0.0-experimental-2.0-game.12
cptbtptpbcptdtptp May 15, 2026
4a8342b
fix(loader): include skinned mesh nodes in skin root LCA
luzhuang May 16, 2026
b7bf4c0
fix(animation): use per-instance speed during cross fade
luzhuang May 16, 2026
4a56817
fix(loader): compute skinned bounds from non-joint rootBone
luzhuang May 16, 2026
5fa24b1
fix(physics): correct collision contact normal orientation
luzhuang May 19, 2026
489238e
feat(loader): recognize .m4a extension for audioClip loader
GuoLei1990 May 19, 2026
9de8ab0
fix(instancing): use cofactor-form normal matrix to survive singular …
GuoLei1990 May 19, 2026
7c521e2
feat(loader): recognize .aac and .flac extensions for audioClip loade…
GuoLei1990 May 19, 2026
e659773
chore: release v0.0.0-experimental-2.0-game.13
cptbtptpbcptdtptp May 20, 2026
d56aa98
feat: update animator
luzhuang May 20, 2026
1c3318c
fix(particle): only accumulate rotation-over-lifetime onto Z axis
hhhhkrx May 21, 2026
8c07cb8
fix(physics): support kinematic transform teleport sync
luzhuang May 21, 2026
d9b724b
fix(loader): apply scene physics settings
luzhuang May 21, 2026
bab0ae0
fix(physics): teleport collider on re-enable instead of sweeping
cptbtptpbcptdtptp May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ gl_FragColor = vec4(lighting, 1.0);

The engine provides a rich set of built-in variables that can be used directly, such as transformation matrix variables:
```glsl
mat4 renderer_LocalMat; // Local transformation matrix
mat4 renderer_ModelMat; // Model matrix
mat4 renderer_MVMat; // Model-view matrix
mat4 renderer_MVPMat; // MVP matrix
Expand Down
1 change: 0 additions & 1 deletion docs/en/graphics/material/shaderAPI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ vec4 fog(vec4 color, vec3 positionVS);
Provides system variables for model space, view space, world space, and camera coordinates:

```glsl
mat4 renderer_LocalMat;
mat4 renderer_ModelMat;
mat4 camera_ViewMat;
mat4 camera_ProjMat;
Expand Down
1 change: 0 additions & 1 deletion docs/en/graphics/material/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Below are the engine's built-in variables for reference when writing Shaders:

| Name | Type | Description |
| :---------------- | :--- | :--------------------------- |
| renderer_LocalMat | mat4 | Model local coordinate matrix |
| renderer_ModelMat | mat4 | Model world coordinate matrix |
| renderer_MVMat | mat4 | Model view matrix |
| renderer_MVPMat | mat4 | Model view projection matrix |
Expand Down
4 changes: 2 additions & 2 deletions docs/en/script/edit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ For more information about the code editor, please check [Code Editor](/en/docs/

After creating a script asset in the scene editor, double-click the script to open the code editor. Scripts in Galacean need to be written in [Typescript](https://www.typescriptlang.org/), and new scripts are created based on built-in templates by default. Additionally, the Galacean code editor is based on Monaco, with shortcuts similar to VSCode. After modifying the script, press `Ctrl/⌘ + S` to save, and the real-time preview area on the right will show the latest scene effects.

> Tip: The Galacean code editor currently supports `.ts`, `.gs`, and `.glsl` file editing.
> Tip: The Galacean code editor currently supports `.ts`, `.shader`, and `.glsl` file editing.

## File Preview

<Image src="https://mdn.alipayobjects.com/huamei_fvsq9p/afts/img/A*o51FQa9Uh0MAAAAAAAAAAAAADqiTAQ/original" />

1. **File Search** Quickly search for files in the project
2. **Code Filter** Whether to display only code files ( `.ts`, `.gs`, `.glsl` ) in the file tree
2. **Code Filter** Whether to display only code files ( `.ts`, `.shader`, `.glsl` ) in the file tree
3. **Built-in Files** Used to display which files are non-editable internal files
4. **Expand/Hide** Toggle the expansion or hiding of folders
5. **Code Files** Editable code files will display corresponding file type thumbnails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ void frag() {

引擎提供了丰富的内置变量,直接声明使用即可,比如变换矩阵相关变量:
```glsl
mat4 renderer_LocalMat; // 本地变换矩阵
mat4 renderer_ModelMat; // 模型矩阵
mat4 renderer_MVMat; // 模型视图矩阵
mat4 renderer_MVPMat; // MVP矩阵
Expand Down
1 change: 0 additions & 1 deletion docs/zh/graphics/material/shaderAPI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ vec4 fog(vec4 color, vec3 positionVS);
提供了模型空间、视图空间、世界空间、相机坐标等[系统变量](/docs/graphics/material/variables/):

```glsl
mat4 renderer_LocalMat;
mat4 renderer_ModelMat;
mat4 camera_ViewMat;
mat4 camera_ProjMat;
Expand Down
1 change: 0 additions & 1 deletion docs/zh/graphics/material/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Shader 代码中会经常用到内置变量,一种是**逐顶点**的 `attribu

| 名字 | 类型 | 解释 |
| :----------------- | :--- | ------------------ |
| renderer_LocalMat | mat4 | 模型本地坐标系矩阵 |
| renderer_ModelMat | mat4 | 模型世界坐标系矩阵 |
| renderer_MVMat | mat4 | 模型视口矩阵 |
| renderer_MVPMat | mat4 | 模型视口投影矩阵 |
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/script/edit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Galacean Editor 提供了一个功能强大的代码编辑器,提供了代码

在场景编辑器中创建脚本资产后,双击该脚本即可打开代码编辑器。Galacean 中的脚本需使用 [Typescript](https://www.typescriptlang.org/) 语言编写,同时新脚本默认基于内置模板创建。另外,Galacean 的代码编辑器基于 Monaco,快捷键与 VSCode 类似。修改脚本后,按 `Ctrl/⌘ + S` 保存,右侧实时预览区展现最新场景效果。

> 提示:Galacean 代码编辑器目前支持 `.ts` `.gs` 和 `.glsl` 的文件编辑
> 提示:Galacean 代码编辑器目前支持 `.ts` `.shader` 和 `.glsl` 的文件编辑

## 文件预览

<Image src="https://mdn.alipayobjects.com/huamei_fvsq9p/afts/img/A*o51FQa9Uh0MAAAAAAAAAAAAADqiTAQ/original" />

1. **文件搜索** 可快速搜索项目中的文件
2. **代码筛选** 文件树是否仅显示代码文件 ( `.ts` `.gs` `.glsl` )
2. **代码筛选** 文件树是否仅显示代码文件 ( `.ts` `.shader` `.glsl` )
3. **内置文件** 用来显示哪些文件是不可编辑的内部文件
4. **展开/隐藏** 可切换文件夹的展开或隐藏
5. **代码文件** 可编辑的代码文件会显示对应的文件类型的缩略图标
Expand Down
2 changes: 1 addition & 1 deletion e2e/.dev/physx.release.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e/.dev/physx.release.simd.js

Large diffs are not rendered by default.

Binary file modified e2e/.dev/physx.release.simd.wasm
Binary file not shown.
Binary file modified e2e/.dev/physx.release.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions e2e/.dev/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ demoList.forEach(({ file }) => {
fs.outputJSONSync(path.join(__dirname, OUT_PATH, ".demoList.json"), demoSorted);

module.exports = {
publicDir: path.resolve(__dirname, "public"),
server: {
open: true,
host: "0.0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion e2e/case/animator-blendShape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
const { defaultSceneRoot } = asset;
rootEntity.addChild(defaultSceneRoot);
const animator = defaultSceneRoot.getComponent(Animator);
const skinMeshRenderer = defaultSceneRoot.getComponent(SkinnedMeshRenderer);
const skinMeshRenderer = defaultSceneRoot.getComponentsIncludeChildren(SkinnedMeshRenderer, [])[0];
skinMeshRenderer.blendShapeWeights[0] = 1.0;
animator.play("TheWave");

Expand Down
4 changes: 2 additions & 2 deletions e2e/case/animator-multiSubMeshBlendShape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
.then((asset) => {
const { defaultSceneRoot } = asset;
rootEntity.addChild(defaultSceneRoot);
const entity = defaultSceneRoot;
defaultSceneRoot.transform.rotation = new Vector3(-90, -0, 0);
const entity = defaultSceneRoot.children[0];
entity.transform.rotation = new Vector3(-90, -0, 0);
const animator = entity.addComponent(Animator);

animator.animatorController = new AnimatorController(engine);
Expand Down
68 changes: 68 additions & 0 deletions e2e/case/gpu-instancing-auto-batch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @title GPU Instancing Auto Batch
* @category Mesh
*/
import {
AmbientLight,
AssetType,
Camera,
Color,
DirectLight,
GLTFResource,
Logger,
Vector3,
WebGLEngine
} from "@galacean/engine";
import { initScreenshot, updateForE2E } from "./.mockForE2E";

Logger.enable();
WebGLEngine.create({ canvas: "canvas" }).then(async (engine) => {
engine.canvas.resizeByClientSize(2);

const scene = engine.sceneManager.activeScene;
const rootEntity = scene.createRootEntity("Root");

// Camera
const cameraEntity = rootEntity.createChild("Camera");
cameraEntity.transform.setPosition(0, 10, 80);
cameraEntity.transform.lookAt(new Vector3(0, 0, 0));
const camera = cameraEntity.addComponent(Camera);
camera.farClipPlane = 300;

// Light
const lightEntity = rootEntity.createChild("Light");
lightEntity.transform.setRotation(-45, -45, 0);
lightEntity.addComponent(DirectLight).color = new Color(1, 1, 1, 1);

// Load Duck model and ambient light
const [glTF, ambientLight] = await Promise.all([
engine.resourceManager.load<GLTFResource>({
url: "https://gw.alipayobjects.com/os/bmw-prod/6cb8f543-285c-491a-8cfd-57a1160dc9ab.glb",
type: AssetType.GLTF
}),
engine.resourceManager.load<AmbientLight>({
url: "https://mdn.alipayobjects.com/oasis_be/afts/file/A*eRJ8QKzf5zAAAAAAgBAAAAgAekp5AQ/ambient.ambLight",
type: AssetType.AmbientLight
})
]);
scene.ambientLight = ambientLight;

// Clone ducks with fixed seed positions for deterministic output
const count = 500;
const spread = 50;
for (let i = 0; i < count; i++) {
const duck = glTF.instantiateSceneRoot();
// Use deterministic positions based on index
const t = i / count;
duck.transform.setPosition(
Math.sin(t * 137.5) * spread * 0.5,
Math.cos(t * 97.3) * spread * 0.5,
Math.sin(t * 59.1) * spread * 0.5
);
duck.transform.setRotation(t * 360, t * 720, t * 1080);
rootEntity.addChild(duck);
}

updateForE2E(engine);
initScreenshot(engine, camera);
});
100 changes: 100 additions & 0 deletions e2e/case/gpu-instancing-custom-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* @title GPU Instancing Custom Data
* @category Mesh
*/
import {
Camera,
Color,
DirectLight,
Logger,
Material,
MeshRenderer,
PrimitiveMesh,
Shader,
ShaderProperty,
Vector3,
Vector4,
WebGLEngine
} from "@galacean/engine";
import { initScreenshot, updateForE2E } from "./.mockForE2E";

Logger.enable();

// Custom shader: uses renderer_CustomColor (per-instance) for fragment output
Shader.create(
"CustomInstanceShader",
`
#include <transform_declare>
attribute vec3 POSITION;
attribute vec3 NORMAL;

varying vec3 v_normal;

void main() {
gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);
v_normal = normalize((renderer_NormalMat * vec4(NORMAL, 0.0)).xyz);
}
`,
`
uniform vec4 renderer_CustomColor;

varying vec3 v_normal;

void main() {
vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0));
float NdotL = max(dot(v_normal, lightDir), 0.2);
gl_FragColor = vec4(renderer_CustomColor.rgb * NdotL, 1.0);
}
`
);

WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
engine.canvas.resizeByClientSize(2);

const scene = engine.sceneManager.activeScene;
const rootEntity = scene.createRootEntity("Root");

// Camera
const cameraEntity = rootEntity.createChild("Camera");
cameraEntity.transform.setPosition(0, 10, 80);
cameraEntity.transform.lookAt(new Vector3(0, 0, 0));
const camera = cameraEntity.addComponent(Camera);
camera.farClipPlane = 300;

// Light
const lightEntity = rootEntity.createChild("Light");
lightEntity.transform.setRotation(-45, -45, 0);
lightEntity.addComponent(DirectLight).color = new Color(1, 1, 1, 1);

// Shared mesh and material
const mesh = PrimitiveMesh.createCuboid(engine, 1, 1, 1);
const material = new Material(engine, Shader.find("CustomInstanceShader"));
const customColorProperty = ShaderProperty.getByName("renderer_CustomColor");

// Create cubes with deterministic positions and colors
const count = 500;
const spread = 50;
for (let i = 0; i < count; i++) {
const entity = rootEntity.createChild("Cube" + i);
const t = i / count;
entity.transform.setPosition(
Math.sin(t * 137.5) * spread * 0.5,
Math.cos(t * 97.3) * spread * 0.5,
Math.sin(t * 59.1) * spread * 0.5
);
entity.transform.setRotation(t * 360, t * 720, t * 1080);

const renderer = entity.addComponent(MeshRenderer);
renderer.mesh = mesh;
renderer.setMaterial(material);

// Deterministic colors based on index
renderer.shaderData.setVector4(
customColorProperty,
new Vector4(Math.sin(t * 6.28) * 0.5 + 0.5, Math.cos(t * 4.71) * 0.5 + 0.5, Math.sin(t * 3.14) * 0.5 + 0.5, 1.0)
);
}

updateForE2E(engine);
initScreenshot(engine, camera);
});
4 changes: 2 additions & 2 deletions e2e/case/particleRenderer-dream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ WebGLEngine.create({

cameraEntity.addChild(fireEntity);

updateForE2E(engine, 500);
initScreenshot(engine, camera);
// updateForE2E(engine, 500);
// initScreenshot(engine, camera);
});
});

Expand Down
2 changes: 1 addition & 1 deletion e2e/case/shaderLab-mrt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { initScreenshot, updateForE2E } from "./.mockForE2E";

const shaderLab = new ShaderLab();

const shaderSource = `Shader "/custom.gs" {
const shaderSource = `Shader "/custom.shader" {
SubShader "Default" {
UsePass "pbr/Default/ShadowCaster"

Expand Down
Loading
Loading