-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support GUI #2375
Support GUI #2375
Changes from 250 commits
08214c2
094b5e6
04eb47c
650b135
3f0cfa0
7e33812
c265204
d442be2
7a09c01
901ba13
b256155
10bb95b
b62df3a
0dbad8d
9e50d30
ebd27df
c98748f
7649de4
68657e8
c95c0c2
8f36498
10fc066
c9ac2a5
5dc393d
d667d99
caa0a38
8f77a72
f08d477
7f4a460
cfe01a5
83cbf4a
c353ee3
fbf6ed1
997f29f
68f8993
96e9621
f9e67ec
48bcccf
c65299a
0acf868
5871137
999e348
fa5a17f
8fae435
332ff64
3710d41
1714428
8bcde48
a0e2dc5
f232172
09e975c
bfb78bc
a35fc8f
169f3eb
436d4b1
ae911ae
2621b7e
0b2b12d
239feed
8388166
520da7b
54ff8f1
d8393e8
836e752
169aa09
c09d5e7
df3b5f8
3ada1f6
6edbf7b
fbaa8aa
26b3b94
bae7a9a
7f613d9
271a77c
9575b36
054ded6
cef8757
1772f93
a1969c3
78059b3
7d57894
59d5c86
531e2b3
67eea0f
41401e4
0e48dbb
4cb99c8
e2a74ca
ef592f6
80e88c8
edc5953
6a0962e
b4748af
3d8cbc2
c880f70
0455188
44447f3
98e7887
4b5dc36
7f6798d
7347e62
59ce725
c502f6d
e0e85c6
70cc80d
8ca4efb
ba35d56
10d4bf5
c100342
e51478c
bbbc3ff
4c9794b
30348f1
8583bf9
43687db
754a7f4
8332c31
6b07a12
1bf8334
3f46739
dc293bd
9860e71
2ab14d6
beb3593
aa0d174
af0f2d7
0b45a7f
7cb710c
e4f0d93
854410d
5cb8b48
ce13c8e
e9f2bee
38edcbf
9d407d2
043d9fa
0aa5514
6475f15
6a7bf93
0b99f79
75bc0c1
beb506b
fdca466
e3f0aae
37359f0
31529a9
1203df7
42dcd13
5fef2a1
78add14
fd2dc9d
c9177bf
e71a6da
1457cdd
c9b3157
477af1f
7ccffd3
11691f6
4934498
f0ebdd0
fa07ecd
7ae6558
52c0d28
5931066
a197c1e
189a1e7
aa6aff8
077e163
40d926f
334bd4a
8d0ee7a
fc9302b
2dce250
4e83314
012b61e
f7dacdc
41075e6
2f4ce0f
04bb5b3
f237f6a
20a1d30
5279a74
6a87332
a5e0642
d88532f
6904c05
d6c03fa
f702b2b
bc8a8d4
53d136e
15b8e6c
4b2487d
ae63b66
8094d8a
3a29609
8a7073a
b8bb449
5d4af60
c4ace76
d73f8f5
237230d
2511b08
14008ad
c3a7089
a10bb1b
e300764
47a9a97
ecbf411
d984227
c05a6fc
923bc96
81389df
d1592ac
bb3b3e8
3929d73
f91d08b
0bbe7eb
b404109
9fda417
847a1c9
3ef755a
79413fc
e467333
edf432f
ca5306c
66aa974
185c659
152368f
ab7cf58
be1d389
a63f4c4
3563bc0
c19f8cc
7a9d1ec
3bca5af
b338f12
46734a0
fcc6c1c
bd0e4e1
fd267ba
374b4d0
dcdfc1a
8ffb614
5a43240
406b95a
0da25b5
a289bbc
674ff50
c81cefe
d05c9f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @title LUT Test | ||
* @category Material | ||
*/ | ||
import { Camera, Material, MeshRenderer, PrimitiveMesh, Shader, Vector3, WebGLEngine } from "@galacean/engine"; | ||
import { initScreenshot, updateForE2E } from "./.mockForE2E"; | ||
|
||
// Create engine | ||
WebGLEngine.create({ canvas: "canvas" }) | ||
.then((engine) => { | ||
engine.canvas.resizeByClientSize(2); | ||
|
||
const scene = engine.sceneManager.activeScene; | ||
const rootEntity = scene.createRootEntity(); | ||
// engine.run(); | ||
|
||
// Create camera | ||
const cameraEntity = rootEntity.createChild("Camera"); | ||
cameraEntity.transform.position = new Vector3(0, 0, 3); | ||
const camera = cameraEntity.addComponent(Camera); | ||
|
||
const entity = rootEntity.createChild("Entity"); | ||
entity.transform.setRotation(90, 0, 0); | ||
const renderer = entity.addComponent(MeshRenderer); | ||
renderer.mesh = PrimitiveMesh.createPlane(engine, 1, 1); | ||
|
||
const shader = Shader.create( | ||
"LUT-test", | ||
` | ||
attribute vec3 POSITION; | ||
attribute vec2 TEXCOORD_0; | ||
uniform mat4 renderer_MVPMat; | ||
varying vec2 v_uv; | ||
|
||
void main(){ | ||
gl_Position = renderer_MVPMat * vec4(POSITION, 1.0); | ||
v_uv = TEXCOORD_0; | ||
}`, | ||
` | ||
varying vec2 v_uv; | ||
uniform sampler2D scene_PrefilteredDFG; | ||
|
||
void main(){ | ||
gl_FragColor = texture2D(scene_PrefilteredDFG, v_uv); | ||
} | ||
` | ||
); | ||
const material = new Material(engine, shader); | ||
renderer.setMaterial(material); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add shader precision and resource cleanup.
`
+ precision highp float;
varying vec2 v_uv;
uniform sampler2D scene_PrefilteredDFG;
const shader = Shader.create(
"LUT-test",
// ... shader code ...
);
+ if (!shader.valid) {
+ throw new Error("Failed to compile shader: " + shader.errorMessage);
+ }
+
+ engine.on("beforeDestroy", () => {
+ shader.destroy();
+ material.destroy();
+ });
|
||
updateForE2E(engine); | ||
initScreenshot(engine, camera); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance error handling and add test cleanup.
.catch((e) => {
- console.log(e);
+ console.error("LUT Test failed:", e);
+ throw e; // Re-throw to ensure test failure
});
updateForE2E(engine);
initScreenshot(engine, camera);
+ return () => {
+ // Cleanup resources
+ engine.destroy();
+ };
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
Engine, | ||
Material, | ||
PostProcess, | ||
PostProcessEffectFloatParameter, | ||
PostProcessPass, | ||
PostProcessPassEvent, | ||
RenderTarget, | ||
|
@@ -43,9 +44,7 @@ | |
class CustomPass extends PostProcessPass { | ||
private _blitMaterial: Material; | ||
|
||
set intensity(value) { | ||
this._blitMaterial.shaderData.setFloat("intensity", value); | ||
} | ||
intensity = new PostProcessEffectFloatParameter(0.7, 0, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification The intensity parameter is not being utilized in the shader or render pass The review comment is correct. While the
The suggested implementation in the review comment would correctly integrate the intensity parameter into the effect. 🔗 Analysis chainVerify the implementation of the intensity parameter. While the addition of the Consider updating the shader and void main(){
- gl_FragColor = texture2D(renderer_BlitTexture, v_uv).rrra;
+ vec4 color = texture2D(renderer_BlitTexture, v_uv);
+ gl_FragColor = mix(color, vec4(color.rrr, color.a), intensity);
} onRender(_, srcTexture: Texture2D, dst: RenderTarget): void {
const engine = this.engine;
+ this._blitMaterial.shaderData.setFloat("intensity", this.intensity.value);
Blitter.blitTexture(engine, srcTexture, dst, undefined, undefined, this._blitMaterial, 0);
} 🏁 Scripts executedThe following scripts were executed for the analysis: Error: No shell scripts found Script: #!/bin/bash
# Check the complete implementation in the file
cat e2e/case/postProcess-customPass.ts
# Search for any other files that might contain related shader code
fd -e glsl -e frag
# Look for other implementations that might use intensity
rg "intensity" -A 5 -B 5
Length of output: 79887 |
||
|
||
constructor(engine: Engine) { | ||
super(engine); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,27 @@ | |
* @category Advance | ||
*/ | ||
import { Logger, WebGLEngine, AssetType, Camera } from "@galacean/engine"; | ||
import { ShaderLab } from "@galacean/engine-shader-lab"; | ||
import { ShaderLab } from "@galacean/engine-shaderlab"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Import change is correct, but documentation needs updating The new package name 🔗 Analysis chainVerify the new package name is correct. The import path has changed from 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for any remaining references to the old package name
# and verify the new package exists in package.json
echo "Checking for old package references..."
rg -l "engine-shader-lab"
echo "Verifying package.json dependencies..."
if [ -f "package.json" ]; then
jq '.dependencies["@galacean/engine-shaderlab"] // .devDependencies["@galacean/engine-shaderlab"]' package.json
fi
Length of output: 398 Script: #!/bin/bash
# Check documentation references
echo "=== Checking documentation references ==="
rg -A 5 -B 5 "engine-shader-lab" docs/
# Look for workspace configuration files
echo -e "\n=== Looking for workspace files ==="
fd -e yaml -e json
# Search for the new package name in configuration files
echo -e "\n=== Searching for new package name ==="
rg -l "engine-shaderlab" --type-add 'config:*.{json,yaml,yml}' -t config
Length of output: 4523 |
||
import { registerIncludes } from "@galacean/engine-toolkit"; | ||
import { initScreenshot, updateForE2E } from './.mockForE2E'; | ||
import { initScreenshot, updateForE2E } from "./.mockForE2E"; | ||
|
||
// Create ShaderLab | ||
const shaderLab = new ShaderLab(); | ||
registerIncludes(); | ||
|
||
Logger.enable(); | ||
WebGLEngine.create({ canvas: "canvas", shaderLab }).then( (engine) => { | ||
WebGLEngine.create({ canvas: "canvas", shaderLab }).then((engine) => { | ||
engine.canvas.resizeByClientSize(2); | ||
engine.resourceManager | ||
.load({ | ||
type: AssetType.Project, | ||
url: "https://mdn.alipayobjects.com/oasis_be/afts/file/A*o15SSopTBh0AAAAAAAAAAAAADkp5AQ/project.json" | ||
}).then(() => { | ||
}) | ||
.then(() => { | ||
updateForE2E(engine); | ||
|
||
const cameraEntity = | ||
engine.sceneManager.activeScene.findEntityByName('Camera'); | ||
const camera = cameraEntity.getComponent(Camera) | ||
initScreenshot(engine, camera) | ||
}) | ||
const cameraEntity = engine.sceneManager.activeScene.findEntityByName("Camera"); | ||
const camera = cameraEntity.getComponent(Camera); | ||
initScreenshot(engine, camera); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Consider using a stable tag instead of the dev branch
The repository has a stable
4.2.0
tag available, which would be more reliable than the development branch. Note that there are also newer releases (v0.0.3) that might be more appropriate depending on your compatibility requirements.git clone https://github.com/galacean/engine-spine.git -b dev/4.2
withgit clone https://github.com/galacean/engine-spine.git -b 4.2.0
🔗 Analysis chain
Verify the engine-spine branch dependency.
The workflow now specifically checks out the
dev/4.2
branch of engine-spine. Please confirm if this is intended to be a permanent change or if it should track a stable branch/tag instead.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 780