@babylonjs/core 7.10.2 → 7.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +4 -2
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +3 -1
- package/Engines/nativeEngine.js +2 -1
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +2 -1
- package/Engines/thinEngine.js +2 -4
- package/Engines/thinEngine.js.map +1 -1
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/sceneLoader.d.ts +20 -11
- package/Loading/sceneLoader.js +10 -19
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +5 -3
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +3 -0
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js +2 -3
- package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js +6 -11
- package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +9 -1
- package/Materials/Node/nodeMaterialBuildState.js +25 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/material.d.ts +3 -1
- package/Materials/material.js +8 -6
- package/Materials/material.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +1 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +10 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +73 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -2
- package/Meshes/mesh.js +18 -20
- package/Meshes/mesh.js.map +1 -1
- package/Misc/filesInput.js +13 -0
- package/Misc/filesInput.js.map +1 -1
- package/Particles/particleSystemComponent.d.ts +3 -1
- package/Particles/particleSystemComponent.js +3 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +7 -2
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +1 -0
- package/Physics/v2/Plugins/havokPlugin.js +43 -0
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +1 -0
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsShape.d.ts +27 -0
- package/Physics/v2/physicsShape.js +39 -0
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Rendering/depthRenderer.js +1 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +2 -5
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/fogVertex.js +12 -0
- package/ShadersWGSL/ShadersInclude/fogVertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +35 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +70 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.js +12 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.js.map +1 -0
- package/ShadersWGSL/particles.vertex.d.ts +11 -0
- package/ShadersWGSL/particles.vertex.js +89 -0
- package/ShadersWGSL/particles.vertex.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../../Engines/shaderStore.js";
|
|
3
|
+
const name = "logDepthDeclaration";
|
|
4
|
+
const shader = `#ifdef LOGARITHMICDEPTH
|
|
5
|
+
uniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;
|
|
6
|
+
#endif
|
|
7
|
+
`;
|
|
8
|
+
// Sideeffect
|
|
9
|
+
ShaderStore.IncludesShadersStoreWGSL[name] = shader;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const logDepthDeclaration = { name, shader };
|
|
12
|
+
//# sourceMappingURL=logDepthDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logDepthDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/logDepthDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;CAGd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"logDepthDeclaration\";\nconst shader = `#ifdef LOGARITHMICDEPTH\nuniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const logDepthDeclaration = { name, shader };\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../../Engines/shaderStore.js";
|
|
3
|
+
const name = "logDepthVertex";
|
|
4
|
+
const shader = `#ifdef LOGARITHMICDEPTH
|
|
5
|
+
vFragmentDepth=1.0+vertexOutputs.position.w;vertexOutputs.position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;
|
|
6
|
+
#endif
|
|
7
|
+
`;
|
|
8
|
+
// Sideeffect
|
|
9
|
+
ShaderStore.IncludesShadersStoreWGSL[name] = shader;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const logDepthVertex = { name, shader };
|
|
12
|
+
//# sourceMappingURL=logDepthVertex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logDepthVertex.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/logDepthVertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,MAAM,GAAG;;;CAGd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"logDepthVertex\";\nconst shader = `#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+vertexOutputs.position.w;vertexOutputs.position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const logDepthVertex = { name, shader };\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./ShadersInclude/clipPlaneVertexDeclaration";
|
|
2
|
+
import "./ShadersInclude/fogVertexDeclaration";
|
|
3
|
+
import "./ShadersInclude/logDepthDeclaration";
|
|
4
|
+
import "./ShadersInclude/clipPlaneVertex";
|
|
5
|
+
import "./ShadersInclude/fogVertex";
|
|
6
|
+
import "./ShadersInclude/logDepthVertex";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const particlesVertexShader: {
|
|
9
|
+
name: string;
|
|
10
|
+
shader: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import "./ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
4
|
+
import "./ShadersInclude/fogVertexDeclaration.js";
|
|
5
|
+
import "./ShadersInclude/logDepthDeclaration.js";
|
|
6
|
+
import "./ShadersInclude/clipPlaneVertex.js";
|
|
7
|
+
import "./ShadersInclude/fogVertex.js";
|
|
8
|
+
import "./ShadersInclude/logDepthVertex.js";
|
|
9
|
+
const name = "particlesVertexShader";
|
|
10
|
+
const shader = `attribute position: vec3f;attribute color: vec4f;attribute angle: f32;attribute size: vec2f;
|
|
11
|
+
#ifdef ANIMATESHEET
|
|
12
|
+
attribute cellIndex: f32;
|
|
13
|
+
#endif
|
|
14
|
+
#ifndef BILLBOARD
|
|
15
|
+
attribute direction: vec3f;
|
|
16
|
+
#endif
|
|
17
|
+
#ifdef BILLBOARDSTRETCHED
|
|
18
|
+
attribute direction: vec3f;
|
|
19
|
+
#endif
|
|
20
|
+
#ifdef RAMPGRADIENT
|
|
21
|
+
attribute remapData: vec4f;
|
|
22
|
+
#endif
|
|
23
|
+
attribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;
|
|
24
|
+
#ifdef ANIMATESHEET
|
|
25
|
+
uniform particlesInfos: vec3f;
|
|
26
|
+
#endif
|
|
27
|
+
varying vUV: vec2f;varying vColor: vec4f;varying vPositionW: vec3f;
|
|
28
|
+
#ifdef RAMPGRADIENT
|
|
29
|
+
varying remapRanges: vec4f;
|
|
30
|
+
#endif
|
|
31
|
+
#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)
|
|
32
|
+
uniform invView: mat4x4f;
|
|
33
|
+
#endif
|
|
34
|
+
#include<clipPlaneVertexDeclaration>
|
|
35
|
+
#include<fogVertexDeclaration>
|
|
36
|
+
#include<logDepthDeclaration>
|
|
37
|
+
#ifdef BILLBOARD
|
|
38
|
+
uniform eyePosition: vec3f;
|
|
39
|
+
#endif
|
|
40
|
+
fn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {var xaxis: vec3f=normalize(cross( vec3f(0.,1.0,0.),yaxis));var zaxis: vec3f=normalize(cross(yaxis,xaxis));var row0: vec3f= vec3f(xaxis.x,xaxis.y,xaxis.z);var row1: vec3f= vec3f(yaxis.x,yaxis.y,yaxis.z);var row2: vec3f= vec3f(zaxis.x,zaxis.y,zaxis.z);var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}
|
|
41
|
+
#ifdef BILLBOARDSTRETCHED
|
|
42
|
+
fn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {var normalizedToCamera: vec3f=normalize(toCamera);var normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(direction),normalizedToCamera));var row0: vec3f= vec3f(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);var row2: vec3f= vec3f(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);
|
|
43
|
+
#ifdef BILLBOARDSTRETCHED_LOCAL
|
|
44
|
+
var row1: vec3f=direction;
|
|
45
|
+
#else
|
|
46
|
+
var crossProduct: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));var row1: vec3f= vec3f(crossProduct.x,crossProduct.y,crossProduct.z);
|
|
47
|
+
#endif
|
|
48
|
+
var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}
|
|
49
|
+
#endif
|
|
50
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
51
|
+
@vertex
|
|
52
|
+
fn main(input: VertexInputs)->FragmentInputs {
|
|
53
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
|
54
|
+
var cornerPos: vec2f;cornerPos=( vec2f(vertexInputs.offset.x-0.5,vertexInputs.offset.y -0.5)-uniforms.translationPivot)*vertexInputs.size;
|
|
55
|
+
#ifdef BILLBOARD
|
|
56
|
+
var rotatedCorner: vec3f;
|
|
57
|
+
#ifdef BILLBOARDY
|
|
58
|
+
rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.ngle);rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.y=0.;rotatedCorner.xz+=uniforms.translationPivot;var yaxis: vec3f=vertexInputs.position-eyePosition;yaxis.y=0.;vertexOutputs.vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;
|
|
59
|
+
#elif defined(BILLBOARDSTRETCHED)
|
|
60
|
+
rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;var toCamera: vec3f=vertexInputs.position-eyePosition;vertexOutputs.vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;
|
|
61
|
+
#else
|
|
62
|
+
rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;var viewPos: vec3f=(uniforms.view* vec4f(vertexInputs.position,1.0)).xyz+rotatedCorner;vertexOutputs.vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;
|
|
63
|
+
#endif
|
|
64
|
+
#ifdef RAMPGRADIENT
|
|
65
|
+
remapRanges=remapData;
|
|
66
|
+
#endif
|
|
67
|
+
vertexOutputs.position=uniforms.projection* vec4f(viewPos,1.0);
|
|
68
|
+
#else
|
|
69
|
+
var rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.y=0.;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;var yaxis: vec3f=normalize(direction);vertexOutputs.vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*view* vec4f(vertexOutputs.vPositionW,1.0);
|
|
70
|
+
#endif
|
|
71
|
+
vertexOutputs.vColor=vertexInputs.color;
|
|
72
|
+
#ifdef ANIMATESHEET
|
|
73
|
+
var rowOffset: f32=floor(cellIndex*particlesInfos.z);var columnOffset: f32=cellIndex-rowOffset/particlesInfos.z;var uvScale: vec2f=particlesInfos.xy;var uvOffset: vec2f= vec2f(vertexInputs.offset.x ,1.0-vertexInputs.offset.y);vertexOutputs.vUV=(uvOffset+ vec2f(columnOffset,rowOffset))*uvScale;
|
|
74
|
+
#else
|
|
75
|
+
vertexOutputs.vUV=vertexInputs.offset;
|
|
76
|
+
#endif
|
|
77
|
+
#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)
|
|
78
|
+
var worldPos: vec4f= vec4f(vertexOutputs.vPositionW,1.0);
|
|
79
|
+
#endif
|
|
80
|
+
#include<clipPlaneVertex>
|
|
81
|
+
#include<fogVertex>
|
|
82
|
+
#include<logDepthVertex>
|
|
83
|
+
#define CUSTOM_VERTEX_MAIN_END
|
|
84
|
+
}`;
|
|
85
|
+
// Sideeffect
|
|
86
|
+
ShaderStore.ShadersStoreWGSL[name] = shader;
|
|
87
|
+
/** @internal */
|
|
88
|
+
export const particlesVertexShader = { name, shader };
|
|
89
|
+
//# sourceMappingURL=particles.vertex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particles.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/particles.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0Eb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"particlesVertexShader\";\nconst shader = `attribute position: vec3f;attribute color: vec4f;attribute angle: f32;attribute size: vec2f;\n#ifdef ANIMATESHEET\nattribute cellIndex: f32;\n#endif\n#ifndef BILLBOARD\nattribute direction: vec3f;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute direction: vec3f;\n#endif\n#ifdef RAMPGRADIENT\nattribute remapData: vec4f;\n#endif\nattribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;\n#ifdef ANIMATESHEET\nuniform particlesInfos: vec3f; \n#endif\nvarying vUV: vec2f;varying vColor: vec4f;varying vPositionW: vec3f;\n#ifdef RAMPGRADIENT\nvarying remapRanges: vec4f;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform invView: mat4x4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef BILLBOARD\nuniform eyePosition: vec3f;\n#endif\nfn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {var xaxis: vec3f=normalize(cross( vec3f(0.,1.0,0.),yaxis));var zaxis: vec3f=normalize(cross(yaxis,xaxis));var row0: vec3f= vec3f(xaxis.x,xaxis.y,xaxis.z);var row1: vec3f= vec3f(yaxis.x,yaxis.y,yaxis.z);var row2: vec3f= vec3f(zaxis.x,zaxis.y,zaxis.z);var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nfn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {var normalizedToCamera: vec3f=normalize(toCamera);var normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(direction),normalizedToCamera));var row0: vec3f= vec3f(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);var row2: vec3f= vec3f(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvar row1: vec3f=direction;\n#else\nvar crossProduct: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));var row1: vec3f= vec3f(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nvar rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar cornerPos: vec2f;cornerPos=( vec2f(vertexInputs.offset.x-0.5,vertexInputs.offset.y -0.5)-uniforms.translationPivot)*vertexInputs.size;\n#ifdef BILLBOARD\nvar rotatedCorner: vec3f;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.ngle);rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.y=0.;rotatedCorner.xz+=uniforms.translationPivot;var yaxis: vec3f=vertexInputs.position-eyePosition;yaxis.y=0.;vertexOutputs.vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;var toCamera: vec3f=vertexInputs.position-eyePosition;vertexOutputs.vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;var viewPos: vec3f=(uniforms.view* vec4f(vertexInputs.position,1.0)).xyz+rotatedCorner;vertexOutputs.vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\nvertexOutputs.position=uniforms.projection* vec4f(viewPos,1.0);\n#else\nvar rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.y=0.;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;var yaxis: vec3f=normalize(direction);vertexOutputs.vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*view* vec4f(vertexOutputs.vPositionW,1.0);\n#endif\nvertexOutputs.vColor=vertexInputs.color;\n#ifdef ANIMATESHEET\nvar rowOffset: f32=floor(cellIndex*particlesInfos.z);var columnOffset: f32=cellIndex-rowOffset/particlesInfos.z;var uvScale: vec2f=particlesInfos.xy;var uvOffset: vec2f= vec2f(vertexInputs.offset.x ,1.0-vertexInputs.offset.y);vertexOutputs.vUV=(uvOffset+ vec2f(columnOffset,rowOffset))*uvScale;\n#else\nvertexOutputs.vUV=vertexInputs.offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvar worldPos: vec4f= vec4f(vertexOutputs.vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const particlesVertexShader = { name, shader };\n"]}
|