Skip to content

Commit

Permalink
Remove dead code from scenegraph-layer shader (#3167)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgios-uber committed May 31, 2019
1 parent 7bc0531 commit a9b6dd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ _attribute vec4 POSITION;
#ifdef HAS_NORMALS
_attribute vec4 NORMAL;
#endif
#ifdef HAS_TANGENTS
_attribute vec4 TANGENT;
#endif
#endif
// Varying
Expand All @@ -46,14 +42,6 @@ _attribute vec4 POSITION;
#endif
#endif
// Utils
#if defined(HAS_NORMALS) && defined(MODULE_PBR)
vec3 getProjectedNormal() {
return project_normal(instanceModelMatrix * (sceneModelMatrix * vec4(NORMAL.xyz, 0.0)).xyz);
}
#endif
// Main
void main(void) {
#if defined(HAS_UV) && !defined(MODULE_PBR)
Expand All @@ -71,16 +59,7 @@ void main(void) {
pbr_vPosition = position_commonspace.xyz;
#ifdef HAS_NORMALS
#ifdef HAS_TANGENTS___TODO_FIX_ME___
vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(NORMAL.xyz, 0.0)));
vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(TANGENT.xyz, 0.0)));
vec3 bitangentW = cross(normalW, tangentW) * TANGENT.w;
pbr_vTBN = mat3(tangentW, bitangentW, normalW);
#else // HAS_TANGENTS != 1
// pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(NORMAL.xyz, 0.0)));
// TODO: Check this
pbr_vNormal = getProjectedNormal();
#endif
pbr_vNormal = project_normal(instanceModelMatrix * (sceneModelMatrix * vec4(NORMAL.xyz, 0.0)).xyz);
#endif
#ifdef HAS_UV
Expand Down
4 changes: 3 additions & 1 deletion modules/mesh-layers/src/scenegraph-layer/scenegraph-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ export default class ScenegraphLayer extends Layer {
fs: this.addVersionToShader(fs),
modules,
isInstanced: true
}
},
// tangents are not supported
useTangents: false
};
}

Expand Down

0 comments on commit a9b6dd0

Please sign in to comment.