From 60024859bfe439f55a9cd3016b1a0a07f5f26578 Mon Sep 17 00:00:00 2001 From: Rusty Striker Date: Mon, 7 Aug 2023 19:33:32 +0300 Subject: [PATCH] GOT METALIC FINALLY --- README.md | 3 --- mmn_17.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 83fb74d..74d469a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/mmn_17.c b/mmn_17.c index 7a6bac0..6b29ace 100644 --- a/mmn_17.c +++ b/mmn_17.c @@ -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);