diff --git a/e2e/package.json b/e2e/package.json index 1305898777..535c305551 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -1,7 +1,7 @@ { "name": "@galacean/engine-e2e", "private": true, - "version": "1.4.3", + "version": "1.4.4", "license": "MIT", "scripts": { "case": "vite serve .dev --config .dev/vite.config.js", diff --git a/package.json b/package.json index ad7c38a1aa..03cd8b39dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-root", - "version": "1.4.3", + "version": "1.4.4", "packageManager": "pnpm@9.3.0", "private": true, "scripts": { diff --git a/packages/core/package.json b/packages/core/package.json index 2523ba28e9..9f4ed46a6d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-core", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/design/package.json b/packages/design/package.json index b261be6f0e..b22fe1b43b 100644 --- a/packages/design/package.json +++ b/packages/design/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-design", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/galacean/package.json b/packages/galacean/package.json index 2c045954d7..c86e291b1e 100644 --- a/packages/galacean/package.json +++ b/packages/galacean/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/loader/package.json b/packages/loader/package.json index 8269543319..4664ff7a46 100644 --- a/packages/loader/package.json +++ b/packages/loader/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-loader", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/math/package.json b/packages/math/package.json index a8156bb538..786ea5e43e 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-math", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/physics-lite/package.json b/packages/physics-lite/package.json index 1b220a7665..31d4341e33 100644 --- a/packages/physics-lite/package.json +++ b/packages/physics-lite/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-physics-lite", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/physics-physx/package.json b/packages/physics-physx/package.json index 10b5b5cdba..c0c3ba119d 100644 --- a/packages/physics-physx/package.json +++ b/packages/physics-physx/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-physics-physx", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/rhi-webgl/package.json b/packages/rhi-webgl/package.json index ce244854d6..d3a77c738f 100644 --- a/packages/rhi-webgl/package.json +++ b/packages/rhi-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-rhi-webgl", - "version": "1.4.3", + "version": "1.4.4", "repository": { "url": "https://github.com/galacean/engine.git" }, diff --git a/packages/shader-lab/package.json b/packages/shader-lab/package.json index 6a0df07968..e916cacdfc 100644 --- a/packages/shader-lab/package.json +++ b/packages/shader-lab/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-shaderlab", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/shader-lab/src/parser/AST.ts b/packages/shader-lab/src/parser/AST.ts index 46a0ff5dc6..c649cc3fc9 100644 --- a/packages/shader-lab/src/parser/AST.ts +++ b/packages/shader-lab/src/parser/AST.ts @@ -892,12 +892,13 @@ export namespace ASTNode { super.init(); if (this.children.length === 1) { this.type = (this.children[0] as UnaryExpression).type; - } else { - const exp1 = this.children[0] as MultiplicativeExpression; - const exp2 = this.children[2] as UnaryExpression; - if (exp1.type === exp2.type) { - this.type = exp1.type; - } + // TODO: Temporarily remove type deduce due to generic function type issue. + // } else { + // const exp1 = this.children[0] as MultiplicativeExpression; + // const exp2 = this.children[2] as UnaryExpression; + // if (exp1.type === exp2.type) { + // this.type = exp1.type; + // } } } } @@ -908,12 +909,13 @@ export namespace ASTNode { super.init(); if (this.children.length === 1) { this.type = (this.children[0] as MultiplicativeExpression).type; - } else { - const exp1 = this.children[0] as AdditiveExpression; - const exp2 = this.children[2] as MultiplicativeExpression; - if (exp1.type === exp2.type) { - this.type = exp1.type; - } + // TODO: Temporarily remove type deduce due to generic function type issue. + // } else { + // const exp1 = this.children[0] as AdditiveExpression; + // const exp2 = this.children[2] as MultiplicativeExpression; + // if (exp1.type === exp2.type) { + // this.type = exp1.type; + // } } } } diff --git a/packages/shader-lab/src/parser/builtin/functions.ts b/packages/shader-lab/src/parser/builtin/functions.ts index 9e2df31585..eecf881c0f 100644 --- a/packages/shader-lab/src/parser/builtin/functions.ts +++ b/packages/shader-lab/src/parser/builtin/functions.ts @@ -65,6 +65,9 @@ export class BuiltinFunction { BuiltinFunctionTable.set(ident, list); } + // TODO: correct the type deduce, consider the following case: + // It incorrectly inferred the type of the following expression as float, which should be vec3. + // max(scatterAmt.xyz,0.0001) static getFn(ident: string, parameterTypes: NonGenericGalaceanType[]): BuiltinFunction | undefined { const list = BuiltinFunctionTable.get(ident); if (list) { diff --git a/packages/shader-shaderlab/package.json b/packages/shader-shaderlab/package.json index 9b1ae7c41b..96c682216e 100644 --- a/packages/shader-shaderlab/package.json +++ b/packages/shader-shaderlab/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-shader-shaderlab", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/ui/package.json b/packages/ui/package.json index 61711d80c6..ca87ffbb2f 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-ui", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/xr-webxr/package.json b/packages/xr-webxr/package.json index 1ab2cea088..cdc4b54317 100644 --- a/packages/xr-webxr/package.json +++ b/packages/xr-webxr/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-xr-webxr", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/packages/xr/package.json b/packages/xr/package.json index ebd065a618..b81bfb0052 100644 --- a/packages/xr/package.json +++ b/packages/xr/package.json @@ -1,6 +1,6 @@ { "name": "@galacean/engine-xr", - "version": "1.4.3", + "version": "1.4.4", "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" diff --git a/tests/package.json b/tests/package.json index 9973ac95b2..088e20b8c3 100644 --- a/tests/package.json +++ b/tests/package.json @@ -1,7 +1,7 @@ { "name": "@galacean/engine-tests", "private": true, - "version": "1.4.3", + "version": "1.4.4", "license": "MIT", "main": "dist/main.js", "module": "dist/module.js", diff --git a/tests/src/shader-lab/shaders/demo.shader b/tests/src/shader-lab/shaders/demo.shader index c5dcdf81b6..a154c43ac3 100644 --- a/tests/src/shader-lab/shaders/demo.shader +++ b/tests/src/shader-lab/shaders/demo.shader @@ -106,11 +106,34 @@ Shader "Water" { return o; } + struct FsphericalGaussian { + vec3 Axis; //u + vec3 Sharpness; //L + vec3 Amplitude; //a + }; + + // Normalized sg + FsphericalGaussian makeNormalizedSG(vec3 lightdir , vec3 sharpness) + { + FsphericalGaussian sg; + sg.Axis = lightdir; + sg.Sharpness = sharpness; + sg.Amplitude = sg.Sharpness /((2.0 * 1.) * (1.0 - exp(-2.0 * sg.Sharpness))); + return sg; + } + + vec3 sgdiffuseLighting(vec3 light ,vec3 normal ,vec3 scatterAmt) + { + FsphericalGaussian Kernel = makeNormalizedSG(light, 1.0 / max(scatterAmt.xyz,0.0001)); + return vec3(1.0); + } + /* This is a multi-line comment */ void frag(v2f i) { vec4 color = texture2D(material_BaseTexture, i.v_uv) * u_color; + float fogDistance = length(i.v_position); float fogAmount = 1.0 - exp2(-u_fogDensity * u_fogDensity * fogDistance * fogDistance * 1.442695); fogAmount = clamp(fogAmount, 0.0, 1.0); @@ -139,7 +162,7 @@ Shader "Water" { #undef SCENE_SHADOW_TYPE #ifndef SCENE_SHADOW_TYPE - gl_FragColor = linearToGamma(gl_FragColor); + gl_FragColor = vec4(sgdiffuseLighting(vec3(1.0), vec3(1.0), vec3(1.0)), 1.0); #else gl_FragColor = vec4(1.0, 1.0, 0.0, 0.0); #endif