Forward rendering with simple shadow mapping works now.

simple_math_single_header
Martin Felis 2018-09-14 09:57:32 +02:00
parent 54d67cdeac
commit 03a3b856d7
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ void main() {
// diffuse lighting // diffuse lighting
vec3 normal_dir = normalize(ioFragNormal); vec3 normal_dir = normalize(ioFragNormal);
// vec3 light_dir = normalize(uLightDirection); // vec3 light_dir = normalize(uLightDirection);
vec3 light_dir = transpose(inverse(mat3(uViewMatrix * uModelMatrix))) * uLightDirection; vec3 light_dir = - transpose(inverse(mat3(uViewMatrix * uModelMatrix))) * uLightDirection;
float diff = max(dot(normal_dir, light_dir), 0.0); float diff = max(dot(normal_dir, light_dir), 0.0);
vec4 diffuse = diff * albedo_color; vec4 diffuse = diff * albedo_color;

View File

@ -1141,9 +1141,9 @@ void Renderer::DrawGui() {
switch (sRendererSettings.RenderMode) { switch (sRendererSettings.RenderMode) {
case SceneRenderModeDefault: case SceneRenderModeDefault:
mRenderTextureRef.mTextureIdPtr = mRenderTextureRef.mTextureIdPtr =
&mRenderTarget.mColorTexture; // &mRenderTarget.mColorTexture;
// &mDeferredLightingTarget.mColorTexture; // &mDeferredLightingTarget.mColorTexture;
// mUseDeferred ? &mDeferredLightingTarget.mColorTexture : &mRenderTarget.mColorTexture; mUseDeferred ? &mDeferredLightingTarget.mColorTexture : &mRenderTarget.mColorTexture;
break; break;
case SceneRenderModeColor: case SceneRenderModeColor:
mRenderTextureRef.mTextureIdPtr = &mRenderTarget.mColorTexture; mRenderTextureRef.mTextureIdPtr = &mRenderTarget.mColorTexture;