Skip to content

Commit 026efca

Browse files
committed
Added support for morph targets, skinning and clipping planes.
Addresses #68.
1 parent 4a13895 commit 026efca

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

src/materials/DepthComparisonMaterial.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ export class DepthComparisonMaterial extends ShaderMaterial {
3434
vertexShader: vertex,
3535

3636
depthWrite: false,
37-
depthTest: false
37+
depthTest: false,
38+
39+
morphTargets: true,
40+
skinning: true
3841

3942
});
4043

src/materials/glsl/depth-comparison/shader.frag

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <packing>
2+
#include <clipping_planes_pars_fragment>
23

34
uniform sampler2D tDepth;
45
uniform float cameraNear;
@@ -9,6 +10,8 @@ varying vec4 vProjTexCoord;
910

1011
void main() {
1112

13+
#include <clipping_planes_fragment>
14+
1215
// Transform into Cartesian coordinate (not mirrored).
1316
vec2 projTexCoord = (vProjTexCoord.xy / vProjTexCoord.w) * 0.5 + 0.5;
1417
projTexCoord = clamp(projTexCoord, 0.002, 0.998);
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
#include <common>
2+
#include <morphtarget_pars_vertex>
3+
#include <skinning_pars_vertex>
4+
#include <clipping_planes_pars_vertex>
5+
16
varying float vViewZ;
27
varying vec4 vProjTexCoord;
38

49
void main() {
510

6-
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
7-
vProjTexCoord = projectionMatrix * mvPosition;
11+
#include <skinbase_vertex>
12+
13+
#include <begin_vertex>
14+
#include <morphtarget_vertex>
15+
#include <skinning_vertex>
16+
#include <project_vertex>
17+
818
vViewZ = mvPosition.z;
19+
vProjTexCoord = gl_Position;
920

10-
gl_Position = vProjTexCoord;
21+
#include <clipping_planes_vertex>
1122

1223
}

src/passes/OutlinePass.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ export class OutlinePass extends Pass {
134134
*/
135135

136136
this.renderPassDepth = new RenderPass(this.mainScene, this.mainCamera, {
137-
overrideMaterial: new MeshDepthMaterial({ depthPacking: RGBADepthPacking }),
137+
overrideMaterial: new MeshDepthMaterial({
138+
depthPacking: RGBADepthPacking,
139+
morphTargets: true,
140+
skinning: true
141+
}),
138142
clearColor: new Color(0xffffff),
139143
clearAlpha: 1.0
140144
});

0 commit comments

Comments
 (0)