- static float ambient[] =
- {0.1, 0.1, 0.1, 1.0};
- static float diffuse[] =
- {1.0, 1.0, 1.0, 1.0};
- static float position[] =
- {0.0, 1.0, 0.0, 0.0};
- static float mat_shininess[] =
- {90.0};
- static float mat_specular[] =
- {0.8, 0.8, 0.8, 1.0};
- static float mat_diffuse[] =
- {0.46, 0.66, 0.795, 1.0};
- static float mat_ambient[] =
- {0.0, 0.1, 0.2, 1.0};
- static float lmodel_ambient[] =
- {0.4, 0.4, 0.4, 1.0};
- static float lmodel_localviewer[] =
- {0.0};
- float fblue = 0.0, fgreen;
-
- glFrontFace(GL_CW);
-
- glDepthFunc(GL_LEQUAL);
- glEnable(GL_DEPTH_TEST);
-
- glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT0, GL_POSITION, position);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
- glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_localviewer);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
+ atlantisstruct *ap = &atlantis[MI_SCREEN(mi)];
+
+ static const float ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static const float diffuse[] = {1.0, 1.0, 1.0, 1.0};
+ static const float position[] = {0.0, 1.0, 0.0, 0.0};
+ static const float mat_shininess[] = {90.0};
+ static const float mat_specular[] = {0.8, 0.8, 0.8, 1.0};
+ static const float mat_diffuse[] = {0.46, 0.66, 0.795, 1.0};
+ static const float mat_ambient[] = {0.0, 0.1, 0.2, 1.0};
+ static const float lmodel_ambient[] = {0.4, 0.4, 0.4, 1.0};
+ static const float lmodel_localviewer[] = {0.0};
+
+ float fblue = 0.0, fgreen;
+
+ glFrontFace(GL_CCW);
+
+ if (ap->wire)
+ {
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_NORMALIZE);
+ }
+ else
+ {
+ glDepthFunc(GL_LEQUAL);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_NORMALIZE);
+ glShadeModel(GL_SMOOTH);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_localviewer);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
+ }
+
+ if (ap->wire || !do_texture)
+ {
+ glDisable(GL_TEXTURE_2D);
+ }
+ else
+ {
+ GLfloat s_plane[] = { 1, 0, 0, 0 };
+ GLfloat t_plane[] = { 0, 0, 1, 0 };
+ GLfloat scale = 0.0005;
+
+ if (!ap->texture)
+ parse_image_data (mi);
+
+ clear_gl_error();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
+ ap->texture->width, ap->texture->height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE,
+ ap->texture->data);
+ check_gl_error("texture");
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
+ glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
+ glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
+ glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
+
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ glEnable(GL_TEXTURE_2D);
+
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+ glScalef(scale, scale, 1);
+ glMatrixMode(GL_MODELVIEW);
+ }