# HG changeset patch # User John Tsiombikas # Date 1435254214 -10800 # Node ID e48b40a3c82a4ed44ebdf6b78441816e0dce864c # Parent b41ceead170832f3d1d0091a90c254336de3524b foo diff -r b41ceead1708 -r e48b40a3c82a src/board.cc --- a/src/board.cc Thu Jun 25 05:58:35 2015 +0300 +++ b/src/board.cc Thu Jun 25 20:43:34 2015 +0300 @@ -141,6 +141,22 @@ return true; } +static float wood(float x, float y) +{ + float u = x; + float v = y; + x += 1.0; + x *= 10.0; + y *= 20.0; + + float len = sqrt(x * x + y * y) + turbulence2(u * 6.0, v * 12.0, 2) * 1.2 + + turbulence2(u * 0.5, v, 2) * 15.0; + float val = fmod(len, 1.0); + + //val = val * 0.5 + 0.5; + return val < 0.0 ? 0.0 : (val > 1.0 ? 1.0 : val); +} + static bool spike(float x, float y) { x = fmod(x * 5.0, 1.0); @@ -169,14 +185,15 @@ bool Board::generate_textures() { + static const Vector3 wcol1 = Vector3(0.6, 0.4, 0.2); + static const Vector3 wcol2 = Vector3(0.53, 0.32, 0.1);//Vector3(0.38, 0.25, 0.08); + const int xsz = 512; const int ysz = 1024; img_field.create(xsz, ysz); - clear_image(&img_field, 0, 0, 0); unsigned char *pptr = img_field.pixels; - for(int i=0; i 255 ? 255 : r; + pptr[1] = g > 255 ? 255 : g; + pptr[2] = b > 255 ? 255 : b; pptr += 3; } } diff -r b41ceead1708 -r e48b40a3c82a src/game.cc --- a/src/game.cc Thu Jun 25 05:58:35 2015 +0300 +++ b/src/game.cc Thu Jun 25 20:43:34 2015 +0300 @@ -9,7 +9,7 @@ static Board board; -static float cam_theta, cam_phi = 25, cam_dist = 6; +static float cam_theta, cam_phi = 25, cam_dist = 3; static bool bnstate[8]; static int prev_x, prev_y; @@ -22,6 +22,10 @@ glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); + if(GLEW_ARB_multisample) { + glEnable(GL_MULTISAMPLE); + } + if(!board.init()) { return false; } @@ -51,15 +55,6 @@ draw_backdrop(); board.draw(); - - /* - glBegin(GL_QUADS); - glNormal3f(0, 1, 0); - glVertex3f(-1, 0, 1); - glVertex3f(1, 0, 1); - glVertex3f(1, 0, -1); - glVertex3f(-1, 0, -1); - glEnd();*/ } static void draw_backdrop() @@ -96,7 +91,7 @@ { glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(50, (float)x / (float)y, 0.2, 200.0); + gluPerspective(45, (float)x / (float)y, 0.2, 200.0); glViewport(0, 0, x, y); } diff -r b41ceead1708 -r e48b40a3c82a src/main.cc --- a/src/main.cc Thu Jun 25 05:58:35 2015 +0300 +++ b/src/main.cc Thu Jun 25 20:43:34 2015 +0300 @@ -20,7 +20,7 @@ { glutInit(&argc, argv); glutInitWindowSize(1280, 800); - glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_MULTISAMPLE); glutCreateWindow("Tavli"); glutDisplayFunc(display);