From: John Tsiombikas Date: Sun, 3 Mar 2019 00:07:59 +0000 (+0200) Subject: block colors X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;ds=inline;h=3bdc1e0adfc4261ffd74e65b094ca3f1a05dc6b6;hp=49c9842d3766ebb1b3a67f41774c188e7bc1ae95;p=vrtris block colors --- diff --git a/src/gamescr.c b/src/gamescr.c index 4fd0b2b..f2a2ee4 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -82,6 +82,16 @@ static const long level_speed[NUM_LEVELS] = { 167, 151, 134, 117, 107, 98, 88, 79, 69, 60, 50 }; +static const float blkcolor[][4] = { + {1.0, 0.65, 0.0, 1}, + {0.16, 1.0, 0.0, 1}, + {0.65, 0.65, 1.0, 1}, + {1.0, 1.0, 0.0, 1}, + {0.0, 1.0, 1.0, 1}, + {1.0, 0.5, 1.0, 1}, + {1.0, 0.25, 0.0, 1} +}; + static int init(void) { @@ -207,10 +217,14 @@ static void update(float dtsec) static void draw(void) { + const float lpos[] = {-1, 1, 6, 1}; + glTranslatef(0, 0, -cam_dist); glRotatef(cam_phi, 1, 0, 0); glRotatef(cam_theta, 0, 1, 0); + glLightfv(GL_LIGHT0, GL_POSITION, lpos); + glPushAttrib(GL_ENABLE_BIT); glBindTexture(GL_TEXTURE_2D, tex_well); glEnable(GL_TEXTURE_2D); @@ -231,12 +245,16 @@ static void draw(void) glPopMatrix(); } +static const float blkspec[] = {1, 1, 1, 1}; + static void draw_block(int block, const int *pos, int rot) { - int i, pal; + int i; unsigned char *p = blocks[block][rot]; - /*pal = FIRST_BLOCK_PAL + block;*/ + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blkcolor[block]); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, blkspec); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 50.0f); for(i=0; i<4; i++) { int x = pos[1] + BLKX(*p); @@ -260,6 +278,11 @@ static void drawpf(void) for(i=0; i