Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code from scenegraph-layer shader #3167

Merged
merged 1 commit into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed after cutting out all tangent code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some code inside the luma module.

};
}

Expand Down