cf sparrowEditor commit
This commit is contained in:
parent
f2f1965a2d
commit
7976b6e484
@ -16,11 +16,23 @@ public:
|
|||||||
Texture* diffuse_texture;
|
Texture* diffuse_texture;
|
||||||
Texture* normal_map;
|
Texture* normal_map;
|
||||||
|
|
||||||
PhongMaterial() : emission(0), diffuse(0.5f), specular(0.5f), shininess(10), diffuse_texture(NULL)
|
PhongMaterial() :
|
||||||
|
emission(0),
|
||||||
|
diffuse(0.5f),
|
||||||
|
specular(0.5f),
|
||||||
|
shininess(10),
|
||||||
|
diffuse_texture(NULL),
|
||||||
|
normal_map(NULL)
|
||||||
{
|
{
|
||||||
updateShader();
|
updateShader();
|
||||||
}
|
}
|
||||||
PhongMaterial(glm::vec3 myKd, glm::vec3 myKs, float myNs) : emission(0), diffuse(myKd), specular(myKs), shininess(myNs), diffuse_texture(NULL)
|
PhongMaterial(glm::vec3 myKd, glm::vec3 myKs, float myNs) :
|
||||||
|
emission(0),
|
||||||
|
diffuse(myKd),
|
||||||
|
specular(myKs),
|
||||||
|
shininess(myNs),
|
||||||
|
diffuse_texture(NULL),
|
||||||
|
normal_map(NULL)
|
||||||
{
|
{
|
||||||
updateShader();
|
updateShader();
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ vec3 computeLight(in vec3 kd, in vec3 ks, in float ns, in vec3 color, in vec3 no
|
|||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
int i;
|
int i;
|
||||||
vec3 kd = vec3(texture2D(baseTexture, varTexCoord));
|
vec3 kd = vec3(texture2D(baseTexture, varTexCoord))*materialKd;
|
||||||
vec3 light = 0.1*kd + computeLight(kd, materialKs, materialNs, dirLight[1], varNormal, lightDirInView[0], halfVecInView[0]);
|
vec3 light = 0.1*kd + computeLight(kd, materialKs, materialNs, dirLight[1], varNormal, lightDirInView[0], halfVecInView[0]);
|
||||||
for(i=1; i<nbPointLights+1; ++i)
|
for(i=1; i<nbPointLights+1; ++i)
|
||||||
light += computeLight(kd, materialKs, materialNs, pointLights[i*2 -1], varNormal, lightDirInView[i], halfVecInView[i]);
|
light += computeLight(kd, materialKs, materialNs, pointLights[i*2 -1], varNormal, lightDirInView[i], halfVecInView[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user