NaDbSurface::NaDbSurface(const NaGeSurface* s) { pSurf = s->Copy(); glObjType = GLSURFACE; glObjID = (int)glObjType + NaDbObject::GetCount(); SMOOTH = 100; CSMOOTH = 100; itsShadeRed = 150; itsShadeGreen = 150; itsShadeBlue = 150; itsRed = 200; itsGreen = 225; itsBlue = 50; isoRed = 205; isoGreen = 205; isoBlue = 255; factor = 1; pattern = 0x5555; SetMaterial(BRONZE); pointList = new CListOfPoint3D; pointWFUList = new CListOfPoint3D; pointWFVList = new CListOfPoint3D; normalList = new CListOfPoint3D; bpointList = new CListOfPoint3D; myListWFUIter.SetList(pointWFUList); myListWFVIter.SetList(pointWFVList); ComputePoints(); ComputeWFPoints(); ComputeBoundLimits(); InitDisplayList(); }
void CBall::DrawShadow() { int nIndex = s_bOffscreenRender ? 1 : 0; if(!dispList_init_flag[nIndex]) { InitDisplayList(); } const dReal* pos = dGeomGetPosition(transBall); const dReal* gpos = dGeomGetPosition(gBall); const dReal* rot = dGeomGetRotation(transBall); position[ 0] = rot[0]; position[ 1] = rot[4]; position[ 2] = rot[8]; position[ 3] = rot[3]; position[ 4] = rot[1]; position[ 5] = rot[5]; position[ 6] = rot[9]; position[ 7] = rot[7]; position[ 8] = rot[2]; position[ 9] = rot[6]; position[10] = rot[10]; position[11] = rot[11]; position[12] = pos[0]; position[13] = pos[1]; position[14] = pos[2]; position[15] = 1; glPushMatrix(); glMultMatrixd(drop_shadow_mat); glMultMatrixd(position); glCallList(dispList_shadow[nIndex]); glPopMatrix(); }
SIZE InitShips (void) { SIZE num_ships; InitSpace (); SetContext (StatusContext); SetContext (SpaceContext); InitDisplayList (); InitGalaxy (); if (inHQSpace ()) { ReinitQueue (&race_q[0]); ReinitQueue (&race_q[1]); BuildSIS (); LoadHyperspace (); num_ships = 1; } else { COUNT i; RECT r; SetContextFGFrame (Screen); r.corner.x = SAFE_X; r.corner.y = SAFE_Y; r.extent.width = SPACE_WIDTH; r.extent.height = SPACE_HEIGHT; SetContextClipRect (&r); SetContextBackGroundColor (BLACK_COLOR); { CONTEXT OldContext; OldContext = SetContext (ScreenContext); SetContextBackGroundColor (BLACK_COLOR); ClearDrawable (); SetContext (OldContext); } if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) free_gravity_well (); else { #define NUM_ASTEROIDS 5 for (i = 0; i < NUM_ASTEROIDS; ++i) spawn_asteroid (NULL); #define NUM_PLANETS 1 for (i = 0; i < NUM_PLANETS; ++i) spawn_planet (); } num_ships = NUM_SIDES; } // FlushInput (); return (num_ships); }
void CBall::Draw(bool bWireFrame) { int nIndex = s_bOffscreenRender ? 1 : 0; if(!dispList_init_flag[nIndex]) { InitDisplayList(); } const dReal* pos = dGeomGetPosition(transBall); const dReal* gpos = dGeomGetPosition(gBall); const dReal* rot = dGeomGetRotation(transBall); position[ 0] = rot[0]; position[ 1] = rot[4]; position[ 2] = rot[8]; position[ 3] = rot[3]; position[ 4] = rot[1]; position[ 5] = rot[5]; position[ 6] = rot[9]; position[ 7] = rot[7]; position[ 8] = rot[2]; position[ 9] = rot[6]; position[10] = rot[10]; position[11] = rot[11]; position[12] = pos[0]; position[13] = pos[1]; position[14] = pos[2]; position[15] = 1; const int log_size = 300; static int max_log = 0; static int current_log = 0; static double pos_log[log_size][16]; if(bWireFrame) { glPushMatrix(); glMultMatrixd(position); glTranslatef(gpos[0], gpos[1], gpos[2]); material.setMaterial(); glCallList(dispList_wire[nIndex]); glPopMatrix(); max_log = current_log = 0; } else { if (!s_bOffscreenRender) { static float dif[4] = {0.75,0.4,0.2,0.0}; static float amb[4] = {0.5,0.2,0.1,0.0}; static float spec[4] = {1.0,1.0,1.0,0.0}; if (bDrawTail) { glDepthMask(0); glEnable(GL_BLEND); glDisable(GL_LIGHTING); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, dif); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 300); glBlendFunc(GL_SRC_ALPHA, GL_ONE); for (int i = 0;i < max_log; i++) { int j; if (max_log == log_size) j = (current_log + i) % log_size; else j = i; glColor4f(0.75,0.4,0.2, 0.5*(double)i / log_size); glPushMatrix(); glMultMatrixd(pos_log[j]); glCallList(dispList_polygon[nIndex]); glPopMatrix(); } glDisable(GL_BLEND); glEnable(GL_LIGHTING); glDepthMask(1); for (int i = 0;i < 16; i++) pos_log[current_log][i] = position[i]; current_log++; current_log = current_log % log_size; if (max_log < log_size)max_log++; } else { max_log = 0; current_log = 0; } } glPushMatrix(); glMultMatrixd(position); material.setMaterial(); glTranslatef(gpos[0], gpos[1], gpos[2]); glCallList(dispList_polygon[nIndex]); glPopMatrix(); } glPushMatrix(); glMultMatrixd(position); if(bWireFrame) { matr_blue.setMaterial(); DrawSphere(0.005); } else { } glPopMatrix(); }