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

Fix/set emissive factor without map #230

Merged
2 commits merged into from
Dec 11, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ class gltfMaterial extends GltfObject
this.properties.set("u_OcclusionUVSet", this.occlusionTexture.texCoord);
}

this.properties.set("u_EmissiveFactor", this.emissiveFactor);
if (this.emissiveTexture !== undefined)
{
this.emissiveTexture.samplerName = "u_EmissiveSampler";
this.parseTextureInfoExtensions(this.emissiveTexture, "Emissive");
this.textures.push(this.emissiveTexture);
this.defines.push("HAS_EMISSIVE_MAP 1");
this.properties.set("u_EmissiveFactor", this.emissiveFactor);
this.properties.set("u_EmissiveUVSet", this.emissiveTexture.texCoord);
}

Expand Down
16 changes: 14 additions & 2 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,20 @@ class gltfRenderer
case(DebugOutput.OCCLUSION):
fragDefines.push("DEBUG_OCCLUSION 1");
break;
case(DebugOutput.EMISIVE):
fragDefines.push("DEBUG_EMISSIVE 1");
case(DebugOutput.EMISSIVE):
fragDefines.push("DEBUG_FEMISSIVE 1");
break;
case(DebugOutput.SPECULAR):
fragDefines.push("DEBUG_FSPECULAR 1");
break;
case(DebugOutput.DIFFUSE):
fragDefines.push("DEBUG_FDIFFUSE 1");
break;
case(DebugOutput.CLEARCOAT):
fragDefines.push("DEBUG_FCLEARCOAT 1");
break;
case(DebugOutput.SHEEN):
fragDefines.push("DEBUG_FSHEEN 1");
break;
case(DebugOutput.F0):
fragDefines.push("DEBUG_F0 1");
Expand Down
6 changes: 5 additions & 1 deletion src/rendering_parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ const DebugOutput =
NORMAL: "Normal",
BASECOLOR: "Base Color",
OCCLUSION: "Occlusion",
EMISIVE: "Emissive",
EMISSIVE: "Emissive",
DIFFUSE: "Diffuse",
SPECULAR: "Specular",
CLEARCOAT: "ClearCoat",
SHEEN: "Sheen",
ALPHA: "Alpha",
F0: "F0"
};
Expand Down
6 changes: 5 additions & 1 deletion src/shaders/metallic-roughness.frag
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ vec3 punctualColor = vec3(0.0);
g_finalColor.rgb = materialInfo.f0;
#endif

#ifdef DEBUG_EMISSIVE
#ifdef DEBUG_FEMISSIVE
g_finalColor.rgb = f_emissive;
#endif

Expand All @@ -577,6 +577,10 @@ vec3 punctualColor = vec3(0.0);
g_finalColor.rgb = f_clearcoat;
#endif

#ifdef DEBUG_FSHEEN
g_finalColor.rgb = f_sheen;
#endif

#ifdef DEBUG_ALPHA
g_finalColor.rgb = vec3(baseColor.a);
#endif
Expand Down