GOT METALIC FINALLY

This commit is contained in:
Rusty Striker 2023-08-07 19:33:32 +03:00
parent 07bbd626e7
commit 60024859bf
2 changed files with 10 additions and 5 deletions

View file

@ -6,9 +6,6 @@ Code here is published under the [AGPL-v3](https://www.gnu.org/licenses/agpl-3.0
# TODO
- Add multiple objects(that is not the cow)(is grass an object?)
- at least 3
- one needs to be metalic
- User controlled light source
- Add light source
- move the light

View file

@ -255,10 +255,18 @@ void drawWorld(void) {
glPushMatrix();
glTranslatef(0.0, 10.0, 50.0);
glEnable(GL_COLOR_MATERIAL);
glColor3f(0.05, 0.5, 1.0);
glMaterialf(GL_FRONT, GL_SHININESS, 58.0);
glColor3f(0.05, 0.05, 0.1);
GLfloat mat[] = { 0.25, 0.25, 0.25, 0.4, 0.4, 0.4, 0.774597, 0.774597, 0.774597, 0.6 };
glMaterialf(GL_FRONT, GL_SHININESS, mat[9] * 128.0);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat + 3);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat + 6);
glutSolidCube(20.0);
GLfloat matReset[] = {0.0, 0.0, 0.0};
glMaterialf(GL_FRONT, GL_SHININESS, 0.0);
glMaterialfv(GL_FRONT, GL_AMBIENT, matReset);
glMaterialfv(GL_FRONT, GL_DIFFUSE, matReset);
glMaterialfv(GL_FRONT, GL_SPECULAR, matReset);
glPopMatrix();
glColor3f(0.1, 0.3, 0.0);
glCallList(lists.grass);