Skip to content

Commit

Permalink
Merge branch 'hotfix/NonEncodedNormals'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Wozniak committed May 14, 2014
2 parents ce81582 + d3d9516 commit 64d2117
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/graphics/adapters/adapter.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public:
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );

glBindTexture( GL_TEXTURE_2D, _normalRenderTexture );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGB, GL_FLOAT, null );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA16F, width, height, 0, GL_RGBA, GL_FLOAT, null );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
Expand Down
2 changes: 1 addition & 1 deletion source/graphics/shaders/glsl/directionallight.d
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ immutable string directionallightFS = q{
{
vec3 textureColor = texture( diffuseTexture, fUV ).xyz;
float specularIntensity = texture( diffuseTexture, fUV ).w;
vec3 normal_v = decode(texture( normalTexture, fUV ).xy);
vec3 normal_v = texture( normalTexture, fUV ).xyz;
vec3 lightDir_v = -normalize( light.direction );

// Reconstruct position from Depth
Expand Down
4 changes: 2 additions & 2 deletions source/graphics/shaders/glsl/geometry.d
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ immutable string geometryFS = q{
flat in uint fObjectId;

layout( location = 0 ) out vec4 color;
layout( location = 1 ) out vec3 normal_v;
layout( location = 1 ) out vec4 normal_v;

uniform sampler2D diffuseTexture;
uniform sampler2D normalTexture;
Expand Down Expand Up @@ -78,7 +78,7 @@ immutable string geometryFS = q{
// specular intensity
vec3 specularSample = texture( specularTexture, fUV ).xyz;
color.w = ( specularSample.x + specularSample.y + specularSample.z ) / 3;
normal_v = vec3( encode( calculateMappedNormal()), float(fObjectId) );
normal_v = vec4( calculateMappedNormal(), float(fObjectId) );
}
};

2 changes: 1 addition & 1 deletion source/graphics/shaders/glsl/pointlight.d
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ immutable string pointlightFS = q{
vec2 UV = ( ( fPosition_s.xy / fPosition_s.w ) + 1 ) / 2;
vec3 textureColor = texture( diffuseTexture, UV ).xyz;
float specularIntensity = texture( diffuseTexture, UV ).w;
vec3 normal_v = decode(texture( normalTexture, UV ).xy);
vec3 normal_v = texture( normalTexture, UV ).xyz;

// Reconstruct position from depth
float depth = texture( depthTexture, UV ).x;
Expand Down
2 changes: 1 addition & 1 deletion source/utility/input.d
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public static:
{
glBindFramebuffer( GL_FRAMEBUFFER, Graphics.deferredFrameBuffer );
glReadBuffer( GL_COLOR_ATTACHMENT1 );
glReadPixels( x, y, 1, 1, GL_BLUE, GL_FLOAT, &fId);
glReadPixels( x, y, 1, 1, GL_ALPHA, GL_FLOAT, &fId);

uint id = cast(int)(fId);
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
Expand Down

0 comments on commit 64d2117

Please sign in to comment.