@babylonjs/core 8.49.6 → 8.49.7
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/Animations/animationGroup.d.ts +2 -3
- package/Animations/animationGroup.js +10 -15
- package/Animations/animationGroup.js.map +1 -1
- package/Bones/bone.d.ts +2 -0
- package/Bones/bone.js +2 -0
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +7 -0
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Limits/geospatialLimits.d.ts +1 -1
- package/Cameras/Limits/geospatialLimits.js +1 -1
- package/Cameras/Limits/geospatialLimits.js.map +1 -1
- package/Culling/ray.core.js +2 -2
- package/Culling/ray.core.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.d.ts +76 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.js +209 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +5 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +34 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +20 -6
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +108 -77
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +28 -0
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +36 -0
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +5 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +12 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +5 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +12 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +5 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +10 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +5 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +12 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +5 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +12 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +2 -1
- package/FrameGraph/frameGraphRenderContext.js +3 -1
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Layers/effectLayer.d.ts +4 -0
- package/Layers/effectLayer.js +2 -0
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/highlightLayer.js +1 -0
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/index.d.ts +2 -0
- package/Layers/index.js +2 -0
- package/Layers/index.js.map +1 -1
- package/Layers/selectionOutlineLayer.d.ts +180 -0
- package/Layers/selectionOutlineLayer.js +319 -0
- package/Layers/selectionOutlineLayer.js.map +1 -0
- package/Layers/thinEffectLayer.d.ts +5 -1
- package/Layers/thinEffectLayer.js +21 -16
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinGlowLayer.js +1 -0
- package/Layers/thinGlowLayer.js.map +1 -1
- package/Layers/thinHighlightLayer.js +1 -0
- package/Layers/thinHighlightLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +148 -0
- package/Layers/thinSelectionOutlineLayer.js +579 -0
- package/Layers/thinSelectionOutlineLayer.js.map +1 -0
- package/Loading/Plugins/babylonFileLoader.js +136 -48
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +6 -0
- package/Materials/Node/Blocks/Dual/textureBlock.js +10 -0
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +2 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +9 -0
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/pannerBlock.d.ts +39 -0
- package/Materials/Node/Blocks/pannerBlock.js +88 -0
- package/Materials/Node/Blocks/pannerBlock.js.map +1 -0
- package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +11 -3
- package/Maths/math.vector.functions.js +10 -0
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.d.ts +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js +14 -9
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.js +1 -1
- package/Meshes/Compression/dracoDecoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.d.ts +2 -2
- package/Meshes/Compression/dracoEncoder.js +11 -5
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.types.d.ts +8 -5
- package/Meshes/Compression/dracoEncoder.types.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +18 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +122 -28
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.d.ts +74 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js +107 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js.map +1 -0
- package/Meshes/abstractMesh.d.ts +4 -0
- package/Meshes/abstractMesh.js +4 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg2.js +9 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/instancedMesh.js +2 -2
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.js +6 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/environmentTextureTools.js +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Misc/textureTools.d.ts +2 -1
- package/Misc/textureTools.js +5 -3
- package/Misc/textureTools.js.map +1 -1
- package/Morph/morphTarget.js +2 -1
- package/Morph/morphTarget.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +27 -4
- package/Particles/Node/Blocks/systemBlock.js +36 -8
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +42 -6
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Shaders/selection.fragment.d.ts +7 -0
- package/Shaders/selection.fragment.js +47 -0
- package/Shaders/selection.fragment.js.map +1 -0
- package/Shaders/selection.vertex.d.ts +17 -0
- package/Shaders/selection.vertex.js +95 -0
- package/Shaders/selection.vertex.js.map +1 -0
- package/Shaders/selectionOutline.fragment.d.ts +5 -0
- package/Shaders/selectionOutline.fragment.js +23 -0
- package/Shaders/selectionOutline.fragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
- package/ShadersWGSL/selection.fragment.d.ts +7 -0
- package/ShadersWGSL/selection.fragment.js +47 -0
- package/ShadersWGSL/selection.fragment.js.map +1 -0
- package/ShadersWGSL/selection.vertex.d.ts +17 -0
- package/ShadersWGSL/selection.vertex.js +96 -0
- package/ShadersWGSL/selection.vertex.js.map +1 -0
- package/ShadersWGSL/selectionOutline.fragment.d.ts +5 -0
- package/ShadersWGSL/selectionOutline.fragment.js +24 -0
- package/ShadersWGSL/selectionOutline.fragment.js.map +1 -0
- package/package.json +1 -1
- package/scene.d.ts +2 -2
- package/scene.js +10 -2
- package/scene.js.map +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import "./ShadersInclude/bonesDeclaration.js";
|
|
4
|
+
import "./ShadersInclude/bakedVertexAnimationDeclaration.js";
|
|
5
|
+
import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
|
|
6
|
+
import "./ShadersInclude/morphTargetsVertexDeclaration.js";
|
|
7
|
+
import "./ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
8
|
+
import "./ShadersInclude/instancesDeclaration.js";
|
|
9
|
+
import "./ShadersInclude/morphTargetsVertexGlobal.js";
|
|
10
|
+
import "./ShadersInclude/morphTargetsVertex.js";
|
|
11
|
+
import "./ShadersInclude/instancesVertex.js";
|
|
12
|
+
import "./ShadersInclude/bonesVertex.js";
|
|
13
|
+
import "./ShadersInclude/bakedVertexAnimation.js";
|
|
14
|
+
import "./ShadersInclude/clipPlaneVertex.js";
|
|
15
|
+
const name = "selectionVertexShader";
|
|
16
|
+
const shader = `attribute vec3 position;
|
|
17
|
+
#ifdef INSTANCES
|
|
18
|
+
attribute float instanceSelectionId;
|
|
19
|
+
#endif
|
|
20
|
+
#include<bonesDeclaration>
|
|
21
|
+
#include<bakedVertexAnimationDeclaration>
|
|
22
|
+
#include<morphTargetsVertexGlobalDeclaration>
|
|
23
|
+
#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
|
|
24
|
+
#include<clipPlaneVertexDeclaration>
|
|
25
|
+
#include<instancesDeclaration>
|
|
26
|
+
uniform mat4 viewProjection;
|
|
27
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
28
|
+
uniform mat4 view;
|
|
29
|
+
#else
|
|
30
|
+
uniform vec2 depthValues;
|
|
31
|
+
#endif
|
|
32
|
+
#ifdef INSTANCES
|
|
33
|
+
flat varying float vSelectionId;
|
|
34
|
+
#endif
|
|
35
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
36
|
+
varying float vViewPosZ;
|
|
37
|
+
#else
|
|
38
|
+
varying float vDepthMetric;
|
|
39
|
+
#endif
|
|
40
|
+
#ifdef ALPHATEST
|
|
41
|
+
varying vec2 vUV;uniform mat4 diffuseMatrix;
|
|
42
|
+
#ifdef UV1
|
|
43
|
+
attribute vec2 uv;
|
|
44
|
+
#endif
|
|
45
|
+
#ifdef UV2
|
|
46
|
+
attribute vec2 uv2;
|
|
47
|
+
#endif
|
|
48
|
+
#endif
|
|
49
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
50
|
+
void main(void) {
|
|
51
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
|
52
|
+
vec3 positionUpdated=position;
|
|
53
|
+
#ifdef UV1
|
|
54
|
+
vec2 uvUpdated=uv;
|
|
55
|
+
#endif
|
|
56
|
+
#ifdef UV2
|
|
57
|
+
vec2 uv2Updated=uv2;
|
|
58
|
+
#endif
|
|
59
|
+
#include<morphTargetsVertexGlobal>
|
|
60
|
+
#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
|
|
61
|
+
#include<instancesVertex>
|
|
62
|
+
#include<bonesVertex>
|
|
63
|
+
#include<bakedVertexAnimation>
|
|
64
|
+
vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);gl_Position=viewProjection*worldPos;
|
|
65
|
+
#ifdef ALPHATEST
|
|
66
|
+
#ifdef UV1
|
|
67
|
+
vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
|
|
68
|
+
#endif
|
|
69
|
+
#ifdef UV2
|
|
70
|
+
vUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));
|
|
71
|
+
#endif
|
|
72
|
+
#endif
|
|
73
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
74
|
+
vViewPosZ=(view*worldPos).z;
|
|
75
|
+
#else
|
|
76
|
+
#ifdef USE_REVERSE_DEPTHBUFFER
|
|
77
|
+
vDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));
|
|
78
|
+
#else
|
|
79
|
+
vDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));
|
|
80
|
+
#endif
|
|
81
|
+
#endif
|
|
82
|
+
#ifdef INSTANCES
|
|
83
|
+
vSelectionId=instanceSelectionId;
|
|
84
|
+
#endif
|
|
85
|
+
#include<clipPlaneVertex>
|
|
86
|
+
#define CUSTOM_VERTEX_MAIN_END
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
// Sideeffect
|
|
90
|
+
if (!ShaderStore.ShadersStore[name]) {
|
|
91
|
+
ShaderStore.ShadersStore[name] = shader;
|
|
92
|
+
}
|
|
93
|
+
/** @internal */
|
|
94
|
+
export const selectionVertexShader = { name, shader };
|
|
95
|
+
//# sourceMappingURL=selection.vertex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/selection.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/bonesDeclaration\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/instancesDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal\";\nimport \"./ShadersInclude/morphTargetsVertex\";\nimport \"./ShadersInclude/instancesVertex\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\nimport \"./ShadersInclude/clipPlaneVertex\";\n\nconst name = \"selectionVertexShader\";\nconst shader = `attribute vec3 position;\n#ifdef INSTANCES\nattribute float instanceSelectionId;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<clipPlaneVertexDeclaration>\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef STORE_CAMERASPACE_Z\nuniform mat4 view;\n#else\nuniform vec2 depthValues;\n#endif\n#ifdef INSTANCES\nflat varying float vSelectionId;\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying float vViewPosZ;\n#else\nvarying float vDepthMetric;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUV;uniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);gl_Position=viewProjection*worldPos;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvViewPosZ=(view*worldPos).z;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));\n#else\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#endif\n#endif\n#ifdef INSTANCES\nvSelectionId=instanceSelectionId;\n#endif\n#include<clipPlaneVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const selectionVertexShader = { name, shader };\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
const name = "selectionOutlinePixelShader";
|
|
4
|
+
const shader = `uniform sampler2D maskSampler;uniform sampler2D depthSampler;varying vec2 vUV;uniform vec2 screenSize;uniform vec3 outlineColor;uniform float outlineThickness;uniform float occlusionStrength;uniform float occlusionThreshold;
|
|
5
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
6
|
+
void main(void) {
|
|
7
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
8
|
+
vec2 texelSize=1.0/screenSize;vec2 sampleOffset=texelSize*outlineThickness;vec2 centerMask=texture2D(maskSampler,vUV).rg;vec2 maskX=texture2D(maskSampler,vUV+vec2(sampleOffset.x,0.0)).rg;vec2 maskY=texture2D(maskSampler,vUV+vec2(0.0,sampleOffset.y)).rg;vec2 maskXY=texture2D(maskSampler,vUV+sampleOffset).rg;vec3 gradient=vec3(
|
|
9
|
+
centerMask.r-maskX.r,
|
|
10
|
+
centerMask.r-maskY.r,
|
|
11
|
+
centerMask.r-maskXY.r
|
|
12
|
+
);float edgeStrength=length(gradient);float outlineMask=step(0.1,edgeStrength);
|
|
13
|
+
float depthCenter=texture2D(depthSampler,vUV).r;float depthX=texture2D(depthSampler,vUV+vec2(sampleOffset.x,0.0)).r;float depthY=texture2D(depthSampler,vUV+vec2(0.0,sampleOffset.y)).r;float depthXY=texture2D(depthSampler,vUV+sampleOffset).r;float occlusionCenter=step(occlusionThreshold,abs(centerMask.g-depthCenter));float occlusionX=step(occlusionThreshold,abs(maskX.g-depthX));float occlusionY=step(occlusionThreshold,abs(maskY.g-depthY));float occlusionXY=step(occlusionThreshold,abs(maskXY.g-depthXY));float occlusionFactor=min(min(occlusionCenter,occlusionX),min(occlusionY,occlusionXY));float finalOutlineMask=outlineMask*(1.0-occlusionStrength*occlusionFactor);gl_FragColor=vec4(outlineColor,finalOutlineMask);
|
|
14
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
// Sideeffect
|
|
18
|
+
if (!ShaderStore.ShadersStore[name]) {
|
|
19
|
+
ShaderStore.ShadersStore[name] = shader;
|
|
20
|
+
}
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const selectionOutlinePixelShader = { name, shader };
|
|
23
|
+
//# sourceMappingURL=selectionOutline.fragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectionOutline.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/selectionOutline.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,MAAM,GAAG;;;;;;;;;;;;CAYd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\n\nconst name = \"selectionOutlinePixelShader\";\nconst shader = `uniform sampler2D maskSampler;uniform sampler2D depthSampler;varying vec2 vUV;uniform vec2 screenSize;uniform vec3 outlineColor;uniform float outlineThickness;uniform float occlusionStrength;uniform float occlusionThreshold;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 texelSize=1.0/screenSize;vec2 sampleOffset=texelSize*outlineThickness;vec2 centerMask=texture2D(maskSampler,vUV).rg;vec2 maskX=texture2D(maskSampler,vUV+vec2(sampleOffset.x,0.0)).rg;vec2 maskY=texture2D(maskSampler,vUV+vec2(0.0,sampleOffset.y)).rg;vec2 maskXY=texture2D(maskSampler,vUV+sampleOffset).rg;vec3 gradient=vec3(\ncenterMask.r-maskX.r,\ncenterMask.r-maskY.r,\ncenterMask.r-maskXY.r\n);float edgeStrength=length(gradient);float outlineMask=step(0.1,edgeStrength); \nfloat depthCenter=texture2D(depthSampler,vUV).r;float depthX=texture2D(depthSampler,vUV+vec2(sampleOffset.x,0.0)).r;float depthY=texture2D(depthSampler,vUV+vec2(0.0,sampleOffset.y)).r;float depthXY=texture2D(depthSampler,vUV+sampleOffset).r;float occlusionCenter=step(occlusionThreshold,abs(centerMask.g-depthCenter));float occlusionX=step(occlusionThreshold,abs(maskX.g-depthX));float occlusionY=step(occlusionThreshold,abs(maskY.g-depthY));float occlusionXY=step(occlusionThreshold,abs(maskXY.g-depthXY));float occlusionFactor=min(min(occlusionCenter,occlusionX),min(occlusionY,occlusionXY));float finalOutlineMask=outlineMask*(1.0-occlusionStrength*occlusionFactor);gl_FragColor=vec4(outlineColor,finalOutlineMask);\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const selectionOutlinePixelShader = { name, shader };\n"]}
|
|
@@ -8,7 +8,7 @@ finalDiffuse*=subSurfaceOut.refractionOpacity;
|
|
|
8
8
|
#if defined(SS_TRANSLUCENCY) && !defined(UNLIT)
|
|
9
9
|
finalDiffuse+=diffuseTransmissionBase;
|
|
10
10
|
#endif
|
|
11
|
-
finalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient
|
|
11
|
+
finalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient=finalAmbient*surfaceAlbedo.rgb;var finalEmissive: vec3f=uniforms.vEmissiveColor;
|
|
12
12
|
#ifdef EMISSIVE
|
|
13
13
|
var emissiveColorTex: vec3f=textureSample(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb;
|
|
14
14
|
#ifdef GAMMAEMISSIVE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrBlockFinalUnlitComponents.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAC5C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"pbrBlockFinalUnlitComponents\";\nconst shader = `var finalDiffuse: vec3f=diffuseBase;finalDiffuse*=surfaceAlbedo;\n#if defined(SS_REFRACTION) && !defined(UNLIT) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION)\nfinalDiffuse*=subSurfaceOut.refractionOpacity;\n#endif\n#if defined(SS_TRANSLUCENCY) && !defined(UNLIT)\nfinalDiffuse+=diffuseTransmissionBase;\n#endif\nfinalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient
|
|
1
|
+
{"version":3,"file":"pbrBlockFinalUnlitComponents.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAC5C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"pbrBlockFinalUnlitComponents\";\nconst shader = `var finalDiffuse: vec3f=diffuseBase;finalDiffuse*=surfaceAlbedo;\n#if defined(SS_REFRACTION) && !defined(UNLIT) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION)\nfinalDiffuse*=subSurfaceOut.refractionOpacity;\n#endif\n#if defined(SS_TRANSLUCENCY) && !defined(UNLIT)\nfinalDiffuse+=diffuseTransmissionBase;\n#endif\nfinalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient=finalAmbient*surfaceAlbedo.rgb;var finalEmissive: vec3f=uniforms.vEmissiveColor;\n#ifdef EMISSIVE\nvar emissiveColorTex: vec3f=textureSample(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb;\n#ifdef GAMMAEMISSIVE\nfinalEmissive*=toLinearSpaceVec3(emissiveColorTex.rgb);\n#else\nfinalEmissive*=emissiveColorTex.rgb;\n#endif\nfinalEmissive*= uniforms.vEmissiveInfos.y;\n#endif\nfinalEmissive*=uniforms.vLightingIntensity.y;\n#ifdef AMBIENT\nvar ambientOcclusionForDirectDiffuse: vec3f=mix( vec3f(1.),aoOut.ambientOcclusionColor,uniforms.vAmbientInfos.w);\n#else\nvar ambientOcclusionForDirectDiffuse: vec3f=aoOut.ambientOcclusionColor;\n#endif\nfinalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse;\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const pbrBlockFinalUnlitComponentsWGSL = { name, shader };\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import "./ShadersInclude/clipPlaneFragmentDeclaration.js";
|
|
4
|
+
import "./ShadersInclude/clipPlaneFragment.js";
|
|
5
|
+
const name = "selectionPixelShader";
|
|
6
|
+
const shader = `#ifdef INSTANCES
|
|
7
|
+
flat varying vSelectionId: f32;
|
|
8
|
+
#else
|
|
9
|
+
uniform selectionId: f32;
|
|
10
|
+
#endif
|
|
11
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
12
|
+
varying vViewPosZ: f32;
|
|
13
|
+
#else
|
|
14
|
+
varying vDepthMetric: f32;
|
|
15
|
+
#endif
|
|
16
|
+
#ifdef ALPHATEST
|
|
17
|
+
varying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;
|
|
18
|
+
#endif
|
|
19
|
+
#include<clipPlaneFragmentDeclaration>
|
|
20
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
21
|
+
@fragment
|
|
22
|
+
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
23
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
24
|
+
#include<clipPlaneFragment>
|
|
25
|
+
#ifdef ALPHATEST
|
|
26
|
+
if (textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vUV).a<0.4) {discard;}
|
|
27
|
+
#endif
|
|
28
|
+
#ifdef INSTANCES
|
|
29
|
+
var id: f32=fragmentInputs.vSelectionId;
|
|
30
|
+
#else
|
|
31
|
+
var id: f32=uniforms.selectionId;
|
|
32
|
+
#endif
|
|
33
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
34
|
+
fragmentOutputs.color=vec4(id,fragmentInputs.vViewPosZ,0.0,1.0);
|
|
35
|
+
#else
|
|
36
|
+
fragmentOutputs.color=vec4(id,fragmentInputs.vDepthMetric,0.0,1.0);
|
|
37
|
+
#endif
|
|
38
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
// Sideeffect
|
|
42
|
+
if (!ShaderStore.ShadersStoreWGSL[name]) {
|
|
43
|
+
ShaderStore.ShadersStoreWGSL[name] = shader;
|
|
44
|
+
}
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const selectionPixelShaderWGSL = { name, shader };
|
|
47
|
+
//# sourceMappingURL=selection.fragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/selection.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,+CAA+C,CAAC;AACvD,OAAO,oCAAoC,CAAC;AAE5C,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"./ShadersInclude/clipPlaneFragment\";\n\nconst name = \"selectionPixelShader\";\nconst shader = `#ifdef INSTANCES\nflat varying vSelectionId: f32;\n#else\nuniform selectionId: f32;\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying vViewPosZ: f32;\n#else\nvarying vDepthMetric: f32;\n#endif\n#ifdef ALPHATEST\nvarying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vUV).a<0.4) {discard;}\n#endif\n#ifdef INSTANCES\nvar id: f32=fragmentInputs.vSelectionId;\n#else\nvar id: f32=uniforms.selectionId;\n#endif\n#ifdef STORE_CAMERASPACE_Z\nfragmentOutputs.color=vec4(id,fragmentInputs.vViewPosZ,0.0,1.0);\n#else\nfragmentOutputs.color=vec4(id,fragmentInputs.vDepthMetric,0.0,1.0);\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const selectionPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./ShadersInclude/bonesDeclaration.js";
|
|
2
|
+
import "./ShadersInclude/bakedVertexAnimationDeclaration.js";
|
|
3
|
+
import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
|
|
4
|
+
import "./ShadersInclude/morphTargetsVertexDeclaration.js";
|
|
5
|
+
import "./ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
6
|
+
import "./ShadersInclude/instancesDeclaration.js";
|
|
7
|
+
import "./ShadersInclude/morphTargetsVertexGlobal.js";
|
|
8
|
+
import "./ShadersInclude/morphTargetsVertex.js";
|
|
9
|
+
import "./ShadersInclude/instancesVertex.js";
|
|
10
|
+
import "./ShadersInclude/bonesVertex.js";
|
|
11
|
+
import "./ShadersInclude/bakedVertexAnimation.js";
|
|
12
|
+
import "./ShadersInclude/clipPlaneVertex.js";
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const selectionVertexShaderWGSL: {
|
|
15
|
+
name: string;
|
|
16
|
+
shader: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
import "./ShadersInclude/bonesDeclaration.js";
|
|
4
|
+
import "./ShadersInclude/bakedVertexAnimationDeclaration.js";
|
|
5
|
+
import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
|
|
6
|
+
import "./ShadersInclude/morphTargetsVertexDeclaration.js";
|
|
7
|
+
import "./ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
8
|
+
import "./ShadersInclude/instancesDeclaration.js";
|
|
9
|
+
import "./ShadersInclude/morphTargetsVertexGlobal.js";
|
|
10
|
+
import "./ShadersInclude/morphTargetsVertex.js";
|
|
11
|
+
import "./ShadersInclude/instancesVertex.js";
|
|
12
|
+
import "./ShadersInclude/bonesVertex.js";
|
|
13
|
+
import "./ShadersInclude/bakedVertexAnimation.js";
|
|
14
|
+
import "./ShadersInclude/clipPlaneVertex.js";
|
|
15
|
+
const name = "selectionVertexShader";
|
|
16
|
+
const shader = `attribute position: vec3f;
|
|
17
|
+
#ifdef INSTANCES
|
|
18
|
+
attribute instanceSelectionId: f32;
|
|
19
|
+
#endif
|
|
20
|
+
#include<bonesDeclaration>
|
|
21
|
+
#include<bakedVertexAnimationDeclaration>
|
|
22
|
+
#include<morphTargetsVertexGlobalDeclaration>
|
|
23
|
+
#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
|
|
24
|
+
#include<clipPlaneVertexDeclaration>
|
|
25
|
+
#include<instancesDeclaration>
|
|
26
|
+
uniform viewProjection: mat4x4f;
|
|
27
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
28
|
+
uniform view: mat4x4f;
|
|
29
|
+
#else
|
|
30
|
+
uniform depthValues: vec2f;
|
|
31
|
+
#endif
|
|
32
|
+
#ifdef INSTANCES
|
|
33
|
+
flat varying vSelectionId: f32;
|
|
34
|
+
#endif
|
|
35
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
36
|
+
varying vViewPosZ: f32;
|
|
37
|
+
#else
|
|
38
|
+
varying vDepthMetric: f32;
|
|
39
|
+
#endif
|
|
40
|
+
#ifdef ALPHATEST
|
|
41
|
+
varying vUV: vec2f;uniform diffuseMatrix: mat4x4f;
|
|
42
|
+
#ifdef UV1
|
|
43
|
+
attribute uv: vec2f;
|
|
44
|
+
#endif
|
|
45
|
+
#ifdef UV2
|
|
46
|
+
attribute uv2: vec2f;
|
|
47
|
+
#endif
|
|
48
|
+
#endif
|
|
49
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
50
|
+
@vertex
|
|
51
|
+
fn main(input: VertexInputs)->FragmentInputs {
|
|
52
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
|
53
|
+
var positionUpdated: vec3f=vertexInputs.position;
|
|
54
|
+
#ifdef UV1
|
|
55
|
+
var uvUpdated: vec2f=vertexInputs.uv;
|
|
56
|
+
#endif
|
|
57
|
+
#ifdef UV2
|
|
58
|
+
var uv2Updated: vec2f=vertexInputs.uv2;
|
|
59
|
+
#endif
|
|
60
|
+
#include<morphTargetsVertexGlobal>
|
|
61
|
+
#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
|
|
62
|
+
#include<instancesVertex>
|
|
63
|
+
#include<bonesVertex>
|
|
64
|
+
#include<bakedVertexAnimation>
|
|
65
|
+
var worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;
|
|
66
|
+
#ifdef ALPHATEST
|
|
67
|
+
#ifdef UV1
|
|
68
|
+
vertexOutputs.vUV=(uniforms.diffuseMatrix*vec4f(uvUpdated,1.0,0.0)).xy;
|
|
69
|
+
#endif
|
|
70
|
+
#ifdef UV2
|
|
71
|
+
vertexOutputs.vUV=(uniforms.diffuseMatrix*vec4f(uv2Updated,1.0,0.0)).xy;
|
|
72
|
+
#endif
|
|
73
|
+
#endif
|
|
74
|
+
#ifdef STORE_CAMERASPACE_Z
|
|
75
|
+
vertexOutputs.vViewPosZ=(uniforms.view*worldPos).z;
|
|
76
|
+
#else
|
|
77
|
+
#ifdef USE_REVERSE_DEPTHBUFFER
|
|
78
|
+
vertexOutputs.vDepthMetric=((-vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y));
|
|
79
|
+
#else
|
|
80
|
+
vertexOutputs.vDepthMetric=((vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y));
|
|
81
|
+
#endif
|
|
82
|
+
#endif
|
|
83
|
+
#ifdef INSTANCES
|
|
84
|
+
vertexOutputs.vSelectionId=vertexInputs.instanceSelectionId;
|
|
85
|
+
#endif
|
|
86
|
+
#include<clipPlaneVertex>
|
|
87
|
+
#define CUSTOM_VERTEX_MAIN_END
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
// Sideeffect
|
|
91
|
+
if (!ShaderStore.ShadersStoreWGSL[name]) {
|
|
92
|
+
ShaderStore.ShadersStoreWGSL[name] = shader;
|
|
93
|
+
}
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const selectionVertexShaderWGSL = { name, shader };
|
|
96
|
+
//# sourceMappingURL=selection.vertex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/selection.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/bonesDeclaration\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/instancesDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal\";\nimport \"./ShadersInclude/morphTargetsVertex\";\nimport \"./ShadersInclude/instancesVertex\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\nimport \"./ShadersInclude/clipPlaneVertex\";\n\nconst name = \"selectionVertexShader\";\nconst shader = `attribute position: vec3f;\n#ifdef INSTANCES\nattribute instanceSelectionId: f32;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<clipPlaneVertexDeclaration>\n#include<instancesDeclaration>\nuniform viewProjection: mat4x4f;\n#ifdef STORE_CAMERASPACE_Z\nuniform view: mat4x4f;\n#else\nuniform depthValues: vec2f;\n#endif\n#ifdef INSTANCES\nflat varying vSelectionId: f32;\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying vViewPosZ: f32;\n#else\nvarying vDepthMetric: f32;\n#endif\n#ifdef ALPHATEST\nvarying vUV: vec2f;uniform diffuseMatrix: mat4x4f; \n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar positionUpdated: vec3f=vertexInputs.position;\n#ifdef UV1\nvar uvUpdated: vec2f=vertexInputs.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=vertexInputs.uv2;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;\n#ifdef ALPHATEST\n#ifdef UV1\nvertexOutputs.vUV=(uniforms.diffuseMatrix*vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef UV2\nvertexOutputs.vUV=(uniforms.diffuseMatrix*vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvertexOutputs.vViewPosZ=(uniforms.view*worldPos).z;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\nvertexOutputs.vDepthMetric=((-vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y));\n#else\nvertexOutputs.vDepthMetric=((vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y));\n#endif\n#endif\n#ifdef INSTANCES\nvertexOutputs.vSelectionId=vertexInputs.instanceSelectionId;\n#endif\n#include<clipPlaneVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const selectionVertexShaderWGSL = { name, shader };\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
|
+
const name = "selectionOutlinePixelShader";
|
|
4
|
+
const shader = `var maskSamplerSampler: sampler;var maskSampler: texture_2d<f32>;var depthSamplerSampler: sampler;var depthSampler: texture_2d<f32>;varying vUV: vec2f;uniform screenSize: vec2f;uniform outlineColor: vec3f;uniform outlineThickness: f32;uniform occlusionStrength: f32;uniform occlusionThreshold: f32;
|
|
5
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
6
|
+
@fragment
|
|
7
|
+
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
8
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
9
|
+
var texelSize: vec2f=1.0/uniforms.screenSize;var sampleOffset: vec2f=texelSize*uniforms.outlineThickness;var centerMask: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV,0.0).rg;var maskX: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV+vec2f(sampleOffset.x,0.0),0.0).rg;var maskY: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV+vec2f(0.0,sampleOffset.y),0.0).rg;var maskXY: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV+sampleOffset,0.0).rg;var gradient: vec3f=vec3f(
|
|
10
|
+
centerMask.r-maskX.r,
|
|
11
|
+
centerMask.r-maskY.r,
|
|
12
|
+
centerMask.r-maskXY.r
|
|
13
|
+
);var edgeStrength: f32=length(gradient);var outlineMask: f32=step(0.1,edgeStrength);
|
|
14
|
+
var depthCenter: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV,0.0).r;var depthX: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV+vec2f(sampleOffset.x,0.0),0.0).r;var depthY: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV+vec2f(0.0,sampleOffset.y),0.0).r;var depthXY: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV+sampleOffset,0.0).r;var occlusionCenter: f32=step(uniforms.occlusionThreshold,abs(centerMask.g-depthCenter));var occlusionX: f32=step(uniforms.occlusionThreshold,abs(maskX.g-depthX));var occlusionY: f32=step(uniforms.occlusionThreshold,abs(maskY.g-depthY));var occlusionXY: f32=step(uniforms.occlusionThreshold,abs(maskXY.g-depthXY));var occlusionFactor: f32=min(min(occlusionCenter,occlusionX),min(occlusionY,occlusionXY));var finalOutlineMask: f32=outlineMask*(1.0-uniforms.occlusionStrength*occlusionFactor);fragmentOutputs.color=vec4f(uniforms.outlineColor,finalOutlineMask);
|
|
15
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
// Sideeffect
|
|
19
|
+
if (!ShaderStore.ShadersStoreWGSL[name]) {
|
|
20
|
+
ShaderStore.ShadersStoreWGSL[name] = shader;
|
|
21
|
+
}
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const selectionOutlinePixelShaderWGSL = { name, shader };
|
|
24
|
+
//# sourceMappingURL=selectionOutline.fragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectionOutline.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/selectionOutline.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,MAAM,GAAG;;;;;;;;;;;;;CAad,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\n\nconst name = \"selectionOutlinePixelShader\";\nconst shader = `var maskSamplerSampler: sampler;var maskSampler: texture_2d<f32>;var depthSamplerSampler: sampler;var depthSampler: texture_2d<f32>;varying vUV: vec2f;uniform screenSize: vec2f;uniform outlineColor: vec3f;uniform outlineThickness: f32;uniform occlusionStrength: f32;uniform occlusionThreshold: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvar texelSize: vec2f=1.0/uniforms.screenSize;var sampleOffset: vec2f=texelSize*uniforms.outlineThickness;var centerMask: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV,0.0).rg;var maskX: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV+vec2f(sampleOffset.x,0.0),0.0).rg;var maskY: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV+vec2f(0.0,sampleOffset.y),0.0).rg;var maskXY: vec2f=textureSampleLevel(maskSampler,maskSamplerSampler,fragmentInputs.vUV+sampleOffset,0.0).rg;var gradient: vec3f=vec3f(\ncenterMask.r-maskX.r,\ncenterMask.r-maskY.r,\ncenterMask.r-maskXY.r\n);var edgeStrength: f32=length(gradient);var outlineMask: f32=step(0.1,edgeStrength); \nvar depthCenter: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV,0.0).r;var depthX: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV+vec2f(sampleOffset.x,0.0),0.0).r;var depthY: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV+vec2f(0.0,sampleOffset.y),0.0).r;var depthXY: f32=textureSampleLevel(depthSampler,depthSamplerSampler,fragmentInputs.vUV+sampleOffset,0.0).r;var occlusionCenter: f32=step(uniforms.occlusionThreshold,abs(centerMask.g-depthCenter));var occlusionX: f32=step(uniforms.occlusionThreshold,abs(maskX.g-depthX));var occlusionY: f32=step(uniforms.occlusionThreshold,abs(maskY.g-depthY));var occlusionXY: f32=step(uniforms.occlusionThreshold,abs(maskXY.g-depthXY));var occlusionFactor: f32=min(min(occlusionCenter,occlusionX),min(occlusionY,occlusionXY));var finalOutlineMask: f32=outlineMask*(1.0-uniforms.occlusionStrength*occlusionFactor);fragmentOutputs.color=vec4f(uniforms.outlineColor,finalOutlineMask);\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const selectionOutlinePixelShaderWGSL = { name, shader };\n"]}
|
package/package.json
CHANGED
package/scene.d.ts
CHANGED
|
@@ -2040,13 +2040,13 @@ export declare class Scene implements IAnimatable, IClipPlanesHolder, IAssetCont
|
|
|
2040
2040
|
*/
|
|
2041
2041
|
getLastTransformNodeById(id: string): Nullable<TransformNode>;
|
|
2042
2042
|
/**
|
|
2043
|
-
* Gets a the last added node (Mesh, Camera, Light) using a given Id
|
|
2043
|
+
* Gets a the last added node (Mesh, Camera, Light, Bone) using a given Id
|
|
2044
2044
|
* @param id defines the Id to search for
|
|
2045
2045
|
* @returns the found node or null if not found at all
|
|
2046
2046
|
*/
|
|
2047
2047
|
getLastEntryById(id: string): Nullable<Node>;
|
|
2048
2048
|
/**
|
|
2049
|
-
* Gets a node (Mesh, Camera, Light) using a given Id
|
|
2049
|
+
* Gets a node (Mesh, Camera, Light, Bone) using a given Id
|
|
2050
2050
|
* @param id defines the Id to search for
|
|
2051
2051
|
* @returns the found node or null if not found at all
|
|
2052
2052
|
*/
|
package/scene.js
CHANGED
|
@@ -3232,7 +3232,7 @@ export class Scene {
|
|
|
3232
3232
|
return null;
|
|
3233
3233
|
}
|
|
3234
3234
|
/**
|
|
3235
|
-
* Gets a the last added node (Mesh, Camera, Light) using a given Id
|
|
3235
|
+
* Gets a the last added node (Mesh, Camera, Light, Bone) using a given Id
|
|
3236
3236
|
* @param id defines the Id to search for
|
|
3237
3237
|
* @returns the found node or null if not found at all
|
|
3238
3238
|
*/
|
|
@@ -3258,10 +3258,18 @@ export class Scene {
|
|
|
3258
3258
|
return this.lights[index];
|
|
3259
3259
|
}
|
|
3260
3260
|
}
|
|
3261
|
+
for (index = this.skeletons.length - 1; index >= 0; index--) {
|
|
3262
|
+
const skeleton = this.skeletons[index];
|
|
3263
|
+
for (let boneIndex = skeleton.bones.length - 1; boneIndex >= 0; boneIndex--) {
|
|
3264
|
+
if (skeleton.bones[boneIndex].id === id) {
|
|
3265
|
+
return skeleton.bones[boneIndex];
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3261
3269
|
return null;
|
|
3262
3270
|
}
|
|
3263
3271
|
/**
|
|
3264
|
-
* Gets a node (Mesh, Camera, Light) using a given Id
|
|
3272
|
+
* Gets a node (Mesh, Camera, Light, Bone) using a given Id
|
|
3265
3273
|
* @param id defines the Id to search for
|
|
3266
3274
|
* @returns the found node or null if not found at all
|
|
3267
3275
|
*/
|