mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Textures?
This commit is contained in:
parent
c27d8d5bc7
commit
115fe0a5a1
@ -2,7 +2,7 @@
|
|||||||
uniform vec3 lDirection;
|
uniform vec3 lDirection;
|
||||||
uniform bool isSky;
|
uniform bool isSky;
|
||||||
uniform bool isPhong;
|
uniform bool isPhong;
|
||||||
uniform sampler2D skybox;
|
uniform sampler2D tex;
|
||||||
|
|
||||||
in vec3 fNormal;
|
in vec3 fNormal;
|
||||||
in vec3 fPosition;
|
in vec3 fPosition;
|
||||||
@ -14,8 +14,9 @@ out vec4 fColor;
|
|||||||
void
|
void
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
vec4 texColor = texture(tex, texCoords);
|
||||||
if(isSky) {
|
if(isSky) {
|
||||||
fColor = texture(skybox, texCoords);
|
fColor = texColor;
|
||||||
} else if(isPhong) {
|
} else if(isPhong) {
|
||||||
// Get lighting vectors
|
// Get lighting vectors
|
||||||
vec3 LightDirection = normalize(vec3(1,3,1));
|
vec3 LightDirection = normalize(vec3(1,3,1));
|
||||||
@ -27,15 +28,16 @@ main()
|
|||||||
|
|
||||||
// Compute specular component
|
// Compute specular component
|
||||||
vec3 Rl = normalize(-LightDirection+2.0*nfNormal*dot(nfNormal,LightDirection));
|
vec3 Rl = normalize(-LightDirection+2.0*nfNormal*dot(nfNormal,LightDirection));
|
||||||
float specular = 0.0;//0.1*pow(max(0.0, dot(Rl, nviewDirection)), 16);
|
float specular = pow(max(0.0, dot(Rl, nviewDirection)), 16);
|
||||||
|
|
||||||
// Fragment color (currently static, to be replaced with texture)
|
// Fragment color
|
||||||
vec3 color = ifColor.xyz;
|
vec4 color = texColor * diffuse * 0.6 + vec4(1) * specular * 0.6;
|
||||||
|
|
||||||
// Compute final color
|
// Compute final color
|
||||||
|
fColor = vec4(color.xyz, 1);
|
||||||
//fColor = vec4(color * (0.1 + diffuse + specular), 1);
|
//fColor = vec4(color * (0.1 + diffuse + specular), 1);
|
||||||
fColor = vec4(fNormal, 1);
|
//fColor = vec4(fNormal, 1);
|
||||||
} else {
|
} else {
|
||||||
fColor = ifColor;
|
fColor = texColor * ifColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,8 +47,8 @@ main()
|
|||||||
vec3 color = ifColor.xyz;
|
vec3 color = ifColor.xyz;
|
||||||
|
|
||||||
// Compute final color
|
// Compute final color
|
||||||
//fColor = vec4(color * (0.1 + diffuse + specular), 1);
|
ifColor = vec4(color * (0.1 + diffuse + specular), 1);
|
||||||
ifColor = vec4(fNormal, 1);
|
//ifColor = vec4(fNormal, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ void Viewer::drawSkybox()
|
|||||||
|
|
||||||
// Increase size of skybox
|
// Increase size of skybox
|
||||||
|
|
||||||
modelViewMatrix.scale(100);
|
modelViewMatrix.scale(101);
|
||||||
|
|
||||||
|
|
||||||
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user