bug fixes

This commit is contained in:
Anselme 2016-05-18 09:18:10 +02:00
parent b62c9263aa
commit 989742f458
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ vec3 phongLighting(in vec3 kd, in vec3 ks, in float ns, in vec3 color, in vec3 n
void main()
{
vec2 worldCoord = texCoord*worldSize + camera.xy*worldSize.y/screenSize;
vec2 worldCoord = texCoord*worldSize + camera.xy*worldSize.y;
ivec2 nbRevolutions = ivec2(floor(worldCoord / worldSize));
if(abs(mod(nbRevolutions.y, 2)) > 0.5)
{
@ -31,6 +31,6 @@ void main()
worldCoord = worldCoord - nbRevolutions*worldSize;
vec3 texColor = texelFetch(colorMap, ivec2(worldCoord)).xyz;
vec3 lighting = phongLighting(texColor, vec3(0.5), 10, vec3(1), normal, lightDir, normalize(lightDir+vec3(0, 0, -1)));
vec3 lighting = phongLighting(texColor, vec3(0.5), 50, vec3(1), normalize(normal), lightDir, normalize(lightDir+vec3(0, 0, -1)));
outColor = vec4(texColor*0.2 + 0.8*lighting, 1.0);
}

View File

@ -41,7 +41,7 @@ public:
virtual void renderGL(Scene *scene);
virtual void resizeGL(int w, int h);
void cameraMove(int x, int y) { m_camera.x -= x/m_camera.z; m_camera.y += y/m_camera.z; }
void cameraMove(int x, int y) { m_camera.x -= x/(m_camera.z*m_width); m_camera.y += y/(m_camera.z*m_width); }
void cameraZoom(int nbScrolls);
};