File tree Expand file tree Collapse file tree 4 files changed +48
-8
lines changed Expand file tree Collapse file tree 4 files changed +48
-8
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,14 @@ varying vec3 vViewPosition;
55
66 varying vec3 vNormal;
77
8- #endif
8+ #ifdef USE_TANGENT
9+
10+ varying vec3 vTangent;
11+ varying vec3 vBitangent;
912
13+ #endif
14+
15+ #endif
1016
1117struct BlinnPhongMaterial {
1218
Original file line number Diff line number Diff line change @@ -5,8 +5,14 @@ varying vec3 vViewPosition;
55
66 varying vec3 vNormal;
77
8- #endif
8+ #ifdef USE_TANGENT
9+
10+ varying vec3 vTangent;
11+ varying vec3 vBitangent;
912
13+ #endif
14+
15+ #endif
1016
1117struct ToonMaterial {
1218
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ varying vec3 vViewPosition;
77
88 varying vec3 vNormal;
99
10+ #ifdef USE_TANGENT
11+
12+ varying vec3 vTangent;
13+ varying vec3 vBitangent;
14+
15+ #endif
16+
1017#endif
1118
1219#include <common>
@@ -34,11 +41,18 @@ void main() {
3441 #include <skinnormal_vertex>
3542 #include <defaultnormal_vertex>
3643
37- #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
44+ #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
3845
39- vNormal = normalize( transformedNormal );
46+ vNormal = normalize( transformedNormal );
4047
41- #endif
48+ #ifdef USE_TANGENT
49+
50+ vTangent = normalize( transformedTangent );
51+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
52+
53+ #endif
54+
55+ #endif
4256
4357 #include <begin_vertex>
4458 #include <morphtarget_vertex>
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ varying vec3 vViewPosition;
77
88 varying vec3 vNormal;
99
10+ #ifdef USE_TANGENT
11+
12+ varying vec3 vTangent;
13+ varying vec3 vBitangent;
14+
15+ #endif
16+
1017#endif
1118
1219#include <common>
@@ -33,11 +40,18 @@ void main() {
3340 #include <skinnormal_vertex>
3441 #include <defaultnormal_vertex>
3542
36- #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
43+ #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
3744
38- vNormal = normalize( transformedNormal );
45+ vNormal = normalize( transformedNormal );
3946
40- #endif
47+ #ifdef USE_TANGENT
48+
49+ vTangent = normalize( transformedTangent );
50+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
51+
52+ #endif
53+
54+ #endif
4155
4256 #include <begin_vertex>
4357 #include <morphtarget_vertex>
You can’t perform that action at this time.
0 commit comments