Exemple #1
0
//-------------------------------------------
// Initialisation des resources globales
//-------------------------------------------
void Renderer::initRessources()
{

    // Initialisation des paramètres OpenGL.
    {
        // 1 - Activer le test de profondeur
        glAssert(glEnable(GL_DEPTH_TEST));
        // 2 - Positionner le mode de dessin
        glAssert(glPolygonMode(GL_FRONT_AND_BACK, GL_FILL));
        // Fin du code à écrire

    }

    // Viewing parameters initialisation
    initView();

    // Loading or building geometric data.
    initGeometry();

    // Set up lighting
    initLighting();

    // Shaders initialisation
    initShaders();
}
Exemple #2
0
void myInit(char *progname)
{
    int width = 600, height = 600;
    float aspect = (float)width / (float)height;
    
    glutInitWindowPosition(0, 0);
    glutInitWindowSize(width, height);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutCreateWindow(progname);
    glClearColor(0.8, 1.0, 1.0, 1.0);
    
    glutKeyboardFunc(myKbd);
    glutSpecialFunc(mySkey);
    glutMouseFunc(myMouse);
    glutMotionFunc(myMotion);
    
    resetview();    //„Éì„É•„ɺ„ÅÆÂàùÊúüÂå?
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(30.0, aspect, 1.0, 30.0);
    glMatrixMode(GL_MODELVIEW);
    
    initLighting();
}
Exemple #3
0
/* main OpenGL initialization routine */
static void initializeGL(ModeInfo *mi, GLsizei width, GLsizei height) 
{
  gfluxstruct *gp = &gfluxes[MI_SCREEN(mi)];

  reshape_gflux(mi, width, height);
  glViewport( 0, 0, width, height ); 

  gp->tex_xscale = 1.0;  /* maybe changed later */
  gp->tex_yscale = 1.0;

  switch(_draw) {
    case solid :
      gp->drawFunc = (displaySolid);
      glEnable(GL_DEPTH_TEST);
    break;
    case light :
      gp->drawFunc = (displayLight);
      glEnable(GL_DEPTH_TEST);
      initLighting();
	break;
	case checker :
      gp->drawFunc = (displayTexture);
      glEnable(GL_DEPTH_TEST);
      createTexture(gp);
      initLighting();
    break;
	case grab :
      gp->drawFunc = (displayTexture);
      glEnable(GL_DEPTH_TEST);
      grabTexture(gp);
      initLighting();
    break;
    case wire :
	default :
      gp->drawFunc = (displayWire);
      glDisable(GL_DEPTH_TEST);
    break;
  }

  if(_flat) glShadeModel(GL_FLAT);
  else glShadeModel(GL_SMOOTH);

}
Exemple #4
0
/*
    Function: Main entry point ( Application main )

    Flow:
        - Init GLUT
        - Setup Window Buffers ( Double render buffer as well as support
            for Alpha, and Depth buffer)
        - Setup Window Width, Height, X, Y Position
        - Create Window with title
        - Setup Lighting
        - Set callback to display function for rendering
        - Set callback to reshape function for changing the size of the viewport
        - Set callback to keyPressed and keyUp to handle keyboard input
        - Tell GLUT to enter main loop
            E.g
                while( running ) {
                    doApplicationStuff();
                }
    End State:
        Creation and running of an application as well as closing and
        releasing all resources used by the application
*/
int main(int argc, char **argv)
{
    int windowWidth     = 500;
    int windowHeight    = 500;
    int windowXPos      = 100;
    int windowYPos      = 100;

    // Initialize GLUT with command line input
    glutInit(&argc, argv);

    // Set up a basic buffer (only single buffered for now)
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);

	glutGameModeString("1440x900:32@60");
	glutEnterGameMode();

    // Set width ,height, X Pos and Y pos of window
    //glutInitWindowSize(windowWidth, windowHeight);
    //glutInitWindowPosition(windowXPos, windowYPos);

    // Create window with title
    //glutCreateWindow("Basic Window with lighting!");

    // Clear keyboard state
    initKeyboardState();

    // Setup lighting
    initLighting();

	 // Initiate object lists
	 CreateCube();

    // Setup Idle and Display to both use the 'display' function,
    // set the reshape event to use the 'reshape' funciton
    glutDisplayFunc(display);
    glutIdleFunc(display);
    glutReshapeFunc(reshape);

    // Set keyboard callback function to handle key pressing and releasing
    glutKeyboardFunc(keyPressed);
    glutKeyboardUpFunc(keyUp);
    glutSpecialFunc(keySpecialPressed);
    glutSpecialUpFunc(keySpecialUp);
    
    // Run the main loop which will handle closing of the application
	 glutMainLoop();

    // Free the texture
    FreeTexture( texture );
}
Exemple #5
0
void init(void)
{
	srand(static_cast <unsigned> (time(NULL)));
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    
    loadObj();

//    findBoundingBox();
    
    initLighting();
    
	glEnable(GL_TEXTURE_2D);
    glDepthRange(0.0, 1.0);  /* The default z mapping */
}
Exemple #6
0
void init(void) {
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glShadeModel(GL_SMOOTH);
  glEnable(GL_DEPTH_TEST);
  initLighting();	
  initTextures();

  /* initialize projection matrix */
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(-.5,.5,-.5,.5,1.0,35.0);

  /* initialize viewing transform matrix (= camera position) and save */
  placeCamera();

}
void myInit (char *progname)
{
  int width = 500, height = 500;

  glutInitWindowPosition(0, 0);
  glutInitWindowSize( width, height );
  glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  glutCreateWindow(progname);
  glClearColor (0., 0., 0., 1.);

  glutKeyboardFunc(myKbd);

  resetview();

  initLighting();
}
Exemple #8
0
int main(int argc, char **argv)
{
    /*Initialize and create window.*/
    glutInit(&argc, argv);
    glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    global.windowID = glutCreateWindow("Assignment 2 - s3331571");

    /*Load images to be 'transformed' into textures.*/
    globalTexture.grass = loadImage("./Texture/grass.jpg");
    globalTexture.metal = loadImage("./Texture/metal.jpg");
    
    /*Load textures from the images.*/
    globalTexture.grassT = loadTexture(globalTexture.grass);
    globalTexture.metalT = loadTexture(globalTexture.metal);
    glEnable(GL_TEXTURE_2D);

    /*Initialize any variables.*/
    initVariables();
    initFiringVariables();
    initPlayerBases();
    initScores();
   
    glEnable(GL_DEPTH_TEST);
    
    /*Call helper method to initilize lighting.*/
    initLighting();   

    /*Setup Callbacks.*/
    glutDisplayFunc(display);
    glutMotionFunc(mouseMove);
    //glutMouseFunc(mouse);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(keyboardSpecial);
    glutIdleFunc(idle);
    
    /*Give random function a seed.*/
    srand(time(NULL));

    /*Calculate initial vertices.*/
    storeStarBackground();
    calcGeometryVertices();
    
    setupAllMusic();

    glutMainLoop();
}
Exemple #9
0
void myInit (char *progname)
{
	int width = 1280, height = 720;

    glutInitWindowPosition(0, 0);
    glutInitWindowSize( width, height);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
    glutCreateWindow(progname);
    glClearColor (0.0, 0.0, 0.0, 1.0);
   	glutMouseFunc( myMouse );
    glutMotionFunc( myMotion );
    glutKeyboardFunc( myKbd );

    	distance = 0;   elevation=0;    azimuth = -90;

	glShadeModel(GL_FLAT);
	initLighting();
}
Exemple #10
0
int main (int argc, char **argv) {
	srand(time(NULL));
	
	glutInit(&argc, argv);
	// Autodetect the screen resolution
	Settings::pixelWidth = glutGet(GLUT_SCREEN_WIDTH);
	Settings::pixelHeight = glutGet(GLUT_SCREEN_HEIGHT);
	
	// If window initialisation fails, exit and return error;
	if(initGLWindow() != GL_TRUE)
		exit(1);
	initLighting();
	
	
	monoCamera = new MonoCamera((Settings::viewingDistance), (Settings::displayWidth), 
								Settings::pixelHeight, Settings::pixelWidth);
	stereoCamera = new StereoCamera((Settings::viewingDistance), (Settings::displayWidth), 
									Settings::pixelHeight, Settings::pixelWidth);
	
	// Sets the initial pen colour to black
	Model::getInstance()->setColour(0.0f, 0.0f, 0.0f);
	
	if (Settings::stereoMode==ANAGLYPHMODE) {
		//printf("Change colour /n");
		Model::getInstance()->setColour(0.0f, 0.0f, 0.0f);
	}
	
	// Analysis code
	Point aPoint;
	if (Settings::dPoints)
		aPoint = Analysis::addPoints(Settings::dNoPoints);
	if (Settings::dPoints && Settings::dErasingTime)
		Analysis::deletePoint(aPoint);
	if (Settings::dTree && Settings::dataFlag==PRQUADTREE)
		Analysis::addPRPoint();
	if (Settings::dPRSize && Settings::dataFlag==PRQUADTREE) {
		Analysis::addPoints(10000000);
		Analysis::getPRSize();
	}
	
	glutMainLoop();
	return(0);
}
Exemple #11
0
/*
    Initialise des parametres OpenGL
*/
void initGL()
{
	/*
	** Initialisation
	*/

	initMaterials();
	initLighting();

	glFrontFace( GL_CCW );
	glEnable( GL_NORMALIZE );

    gCam.theta= 0.0;
    gCam.phi = 89.0;
    gCam.r = 500.0;
    gCam.fovy = 45.0;
	gCam.ratio = 1.0;
	gCam.znear = 1.0;
	gCam.zfar = 3000.0;
}
Exemple #12
0
//initalize 
void init(void)
{ 
	glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, WINDOW_WIDTH, 0, WINDOW_HEIGHT, -1, 1);

	initLighting();
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);

	bird.Home();
   glClearColor(0.0, 0.0, 0.0, 0.0);
   glShadeModel(GL_SMOOTH);
   theWorld.SetBird(&bird);
   glEnable(GL_DEPTH_TEST);
   glDepthFunc(GL_LEQUAL);

}
Exemple #13
0
inline
void initScene()
{
	glClearColor(0.2, 0.2, 0.2, 1.0);


	// Setting transformations
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glGetFloatv(GL_MODELVIEW_MATRIX, CurrentModelview);

	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);


	// Lighting
	initLighting();



	glEnable(GL_DEPTH_TEST);
}
Exemple #14
0
bool stageThreeInitialise(void)
{
	STRUCTURE *psStr;
	UDWORD i;
	DROID		*psDroid;

	debug(LOG_WZ, "== stageThreeInitalise ==");
	bTrackingTransporter = false;

	loopMissionState = LMS_NORMAL;

	if(!InitRadar()) 	// After resLoad cause it needs the game palette initialised.
	{
		return false;
	}

	// reset the clock to normal speed
	gameTimeResetMod();

	if (!init3DView())	// Initialise 3d view stuff. After resLoad cause it needs the game palette initialised.
	{
		return false;
	}

	effectResetUpdates();
	initLighting(0, 0, mapWidth, mapHeight);

	if(bMultiPlayer)
	{
		// FIXME Is this really needed?
		debug( LOG_WZ, "multiGameInit()\n" );
		multiGameInit();
		cmdDroidMultiExpBoost(true);
	}

	preProcessVisibility();

	// Load any stored templates; these need to be available ASAP
	initTemplates();

	if (!fpathInitialise())
	{
		return false;
	}

	mapInit();
	clustInitialise();
	gridReset();

	//if mission screen is up, close it.
	if(MissionResUp)
	{
		intRemoveMissionResultNoAnim();
	}

	// Re-inititialise some static variables.

	driveInitVars(false);
	resizeRadar();

	setAllPauseStates(false);

	/* decide if we have to create teams, ONLY in multiplayer mode!*/
	if (bMultiPlayer && game.alliance == ALLIANCES_TEAMS)
	{
		createTeamAlliances();

		/* Update ally vision for pre-placed structures and droids */
		for(i=0;i<MAX_PLAYERS;i++)
		{
			if(i != selectedPlayer)
			{
				/* Structures */
				for(psStr=apsStructLists[i]; psStr; psStr=psStr->psNext)
				{
					if(aiCheckAlliances(psStr->player,selectedPlayer))
					visTilesUpdate((BASE_OBJECT *)psStr);
				}

				/* Droids */
				for(psDroid=apsDroidLists[i]; psDroid; psDroid=psDroid->psNext)
				{
					if(aiCheckAlliances(psDroid->player,selectedPlayer))
					visTilesUpdate((BASE_OBJECT *)psDroid);
				}
			}
		}
	}

	// ffs JS   (and its a global!)
	if (getLevelLoadType() != GTYPE_SAVE_MIDMISSION)
	{
		eventFireCallbackTrigger((TRIGGER_TYPE)CALL_GAMEINIT);
		triggerEvent(TRIGGER_GAME_INIT);
	}

	return true;
}
/* openGL init */
void myInit() {

	t = clock();

	/* Enable a single OpenGL light. */
	initLighting();
	initMaterials();
	glEnable(GL_LIGHT0);
	glEnable(GL_LIGHTING);

	initGroundTexture();
	initSkyTexture();
	initRailTexture();
	initSpline();
	calculateNormalsAndBinormals();

	/* create the display list */
	theSpline = glGenLists(1);
	glNewList(theSpline, GL_COMPILE);

	/* create cross sections */
	glBegin(GL_LINES);

	for (int i = 0; i < normals.numControlPoints; i++) {
		glVertex3f(rollercoasterSpline.points[i].x, rollercoasterSpline.points[i].y, rollercoasterSpline.points[i].z);
		glVertex3f(rollercoasterSpline.points[i].x + normals.points[i].x / 2,
			rollercoasterSpline.points[i].y + normals.points[i].y / 2,
			rollercoasterSpline.points[i].z + normals.points[i].z / 2);
	}

	glEnd();

	/* create support beams */
	glBegin(GL_LINES);

	for (int i = 0; i < normals.numControlPoints; i++) {
		if (i % 20 == 0) {
			glVertex3f(rollercoasterSpline.points[i].x, rollercoasterSpline.points[i].y, rollercoasterSpline.points[i].z);
			glVertex3f(rollercoasterSpline.points[i].x, rollercoasterSpline.points[i].y, 0);

			glVertex3f(rollercoasterSpline.points[i].x + normals.points[i].x / 2,
				rollercoasterSpline.points[i].y + normals.points[i].y / 2,
				rollercoasterSpline.points[i].z + normals.points[i].z / 2);
			glVertex3f(rollercoasterSpline.points[i].x + normals.points[i].x / 2,
				rollercoasterSpline.points[i].y + normals.points[i].y / 2,
				0);
		}
	}

	glEnd();

	// modulate texture with lighting
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

	glBindTexture(GL_TEXTURE_2D, railTexture);
	// turn on texture mapping
	glEnable(GL_TEXTURE_2D);


	/* compute the spline */
	glBegin(GL_QUADS);

	double alpha = 0.05;
	for (int i = 0; i < rollercoasterSpline.numControlPoints; i++) {
		double pointX = rollercoasterSpline.points[i].x;
		double pointY = rollercoasterSpline.points[i].y;
		double pointZ = rollercoasterSpline.points[i].z;
		double normX = normals.points[i].x;
		double normY = normals.points[i].y;
		double normZ = normals.points[i].z;
		double binX = binormals.points[i].x;
		double binY = binormals.points[i].y;
		double binZ = binormals.points[i].z;

		double pointX2 = rollercoasterSpline.points[i + 1].x;
		double pointY2 = rollercoasterSpline.points[i + 1].y;
		double pointZ2 = rollercoasterSpline.points[i + 1].z;
		double normX2 = normals.points[i + 1].x;
		double normY2 = normals.points[i + 1].y;
		double normZ2 = normals.points[i + 1].z;
		double binX2 = binormals.points[i + 1].x;
		double binY2 = binormals.points[i + 1].y;
		double binZ2 = binormals.points[i + 1].z;

		double v0X = pointX - alpha*(normX - binX);
		double v0Y = pointY - alpha*(normY - binY);
		double v0Z = pointZ - alpha*(normZ - binZ);

		double v1X = pointX + alpha*(normX + binX);
		double v1Y = pointY + alpha*(normY + binY);
		double v1Z = pointZ + alpha*(normZ + binZ);

		double v2X = pointX + alpha*(normX - binX);
		double v2Y = pointY + alpha*(normY - binY);
		double v2Z = pointZ + alpha*(normZ - binZ);

		double v3X = pointX - alpha*(normX + binX);
		double v3Y = pointY - alpha*(normY + binY);
		double v3Z = pointZ - alpha*(normZ + binZ);

		double v4X = pointX2 - alpha*(normX2 - binX2);
		double v4Y = pointY2 - alpha*(normY2 - binY2);
		double v4Z = pointZ2 - alpha*(normZ2 - binZ2);

		double v5X = pointX2 + alpha*(normX2 + binX2);
		double v5Y = pointY2 + alpha*(normY2 + binY2);
		double v5Z = pointZ2 + alpha*(normZ2 + binZ2);

		double v6X = pointX2 + alpha*(normX2 - binX2);
		double v6Y = pointY2 + alpha*(normY2 - binY2);
		double v6Z = pointZ2 + alpha*(normZ2 - binZ2);

		double v7X = pointX2 - alpha*(normX2 + binX2);
		double v7Y = pointY2 - alpha*(normY2 + binY2);
		double v7Z = pointZ2 - alpha*(normZ2 + binZ2);

		// // // RAIL TWO // // //

		double v0X2 = pointX - alpha*(-8 * normX - binX);
		double v0Y2 = pointY - alpha*(-8 * normY - binY);
		double v0Z2 = pointZ - alpha*(-8 * normZ - binZ);

		double v1X2 = pointX + alpha*(10 * normX + binX);
		double v1Y2 = pointY + alpha*(10 * normY + binY);
		double v1Z2 = pointZ + alpha*(10 * normZ + binZ);

		double v2X2 = pointX + alpha*(10 * normX - binX);
		double v2Y2 = pointY + alpha*(10 * normY - binY);
		double v2Z2 = pointZ + alpha*(10 * normZ - binZ);

		double v3X2 = pointX - alpha*(-8 * normX + binX);
		double v3Y2 = pointY - alpha*(-8 * normY + binY);
		double v3Z2 = pointZ - alpha*(-8 * normZ + binZ);

		double v4X2 = pointX2 - alpha*(-8 * normX2 - binX2);
		double v4Y2 = pointY2 - alpha*(-8 * normY2 - binY2);
		double v4Z2 = pointZ2 - alpha*(-8 * normZ2 - binZ2);

		double v5X2 = pointX2 + alpha*(10 * normX2 + binX2);
		double v5Y2 = pointY2 + alpha*(10 * normY2 + binY2);
		double v5Z2 = pointZ2 + alpha*(10 * normZ2 + binZ2);

		double v6X2 = pointX2 + alpha*(10 * normX2 - binX2);
		double v6Y2 = pointY2 + alpha*(10 * normY2 - binY2);
		double v6Z2 = pointZ2 + alpha*(10 * normZ2 - binZ2);

		double v7X2 = pointX2 - alpha*(-8 * normX2 + binX2);
		double v7Y2 = pointY2 - alpha*(-8 * normY2 + binY2);
		double v7Z2 = pointZ2 - alpha*(-8 * normZ2 + binZ2);

		// // // // // // // // //


		glNormal3f(-normals.points[i].x, -normals.points[i].y, -normals.points[i].z);
		// right side face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v0X, v0Y, v0Z);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v1X, v1Y, v1Z);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v5X, v5Y, v5Z);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v4X, v4Y, v4Z);

		glNormal3f(-binormals.points[i].x, -binormals.points[i].y, -binormals.points[i].z);
		// top face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v1X, v1Y, v1Z);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v2X, v2Y, v2Z);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v6X, v6Y, v6Z);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v5X, v5Y, v5Z);

		glNormal3f(normals.points[i].x, normals.points[i].y, normals.points[i].z);
		// left side face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v2X, v2Y, v2Z);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v3X, v3Y, v3Z);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v7X, v7Y, v7Z);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v6X, v6Y, v6Z);

		glNormal3f(binormals.points[i].x, binormals.points[i].y, binormals.points[i].z);
		// bottom face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v0X, v0Y, v0Z);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v3X, v3Y, v3Z);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v7X, v7Y, v7Z);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v4X, v4Y, v4Z);



		// // // RAIL TWO // // //
		// // // // // // // // //

		glNormal3f(-normals.points[i].x, -normals.points[i].y, -normals.points[i].z);
		// right side face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v0X2, v0Y2, v0Z2);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v1X2, v1Y2, v1Z2);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v5X2, v5Y2, v5Z2);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v4X2, v4Y2, v4Z2);

		glNormal3f(-binormals.points[i].x, -binormals.points[i].y, -binormals.points[i].z);
		// top face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v1X2, v1Y2, v1Z2);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v2X2, v2Y2, v2Z2);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v6X2, v6Y2, v6Z2);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v5X2, v5Y2, v5Z2);

		glNormal3f(normals.points[i].x, normals.points[i].y, normals.points[i].z);
		// left side face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v2X2, v2Y2, v2Z2);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v3X2, v3Y2, v3Z2);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v7X2, v7Y2, v7Z2);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v6X2, v6Y2, v6Z2);

		glNormal3f(binormals.points[i].x, binormals.points[i].y, binormals.points[i].z);
		// bottom face
		glTexCoord2f(1.0, 0.0);
		glVertex3f(v0X2, v0Y2, v0Z2);
		glTexCoord2f(0.0, 0.0);
		glVertex3f(v3X2, v3Y2, v3Z2);
		glTexCoord2f(0.0, 1.0);
		glVertex3f(v7X2, v7Y2, v7Z2);
		glTexCoord2f(1.0, 1.0);
		glVertex3f(v4X2, v4Y2, v4Z2);

	}
	glDisable(GL_TEXTURE_2D);
	glEnd();
	glEndList();


	/* setup gl view here */
	glClearColor(0.0, 0.0, 0.0, 0.0);
}
Exemple #16
0
bool stageThreeInitialise()
{
	STRUCTURE *psStr;
	UDWORD i;
	DROID *psDroid;
	bool fromSave = (getSaveGameType() == GTYPE_SAVE_START || getSaveGameType() == GTYPE_SAVE_MIDMISSION);

	debug(LOG_WZ, "== stageThreeInitialise ==");

	loopMissionState = LMS_NORMAL;

	if (!InitRadar()) 	// After resLoad cause it needs the game palette initialised.
	{
		return false;
	}

	// reset the clock to normal speed
	gameTimeResetMod();

	if (!init3DView())	// Initialise 3d view stuff. After resLoad cause it needs the game palette initialised.
	{
		return false;
	}

	effectResetUpdates();
	initLighting(0, 0, mapWidth, mapHeight);
	pie_InitLighting();

	if (fromSave)
	{
		// these two lines are the biggest hack in the world.
		// the reticule seems to get detached from 'reticuleup'
		// this forces it back in sync...
		intRemoveReticule();
		intAddReticule();
	}

	if (bMultiPlayer)
	{
		if (!fromSave)
		{
			multiGameInit();
		}
		initTemplates();
	}

	preProcessVisibility();

	prepareScripts(getLevelLoadType() == GTYPE_SAVE_MIDMISSION || getLevelLoadType() == GTYPE_SAVE_START);

	if (!fpathInitialise())
	{
		return false;
	}

	mapInit();
	gridReset();

	//if mission screen is up, close it.
	if (MissionResUp)
	{
		intRemoveMissionResultNoAnim();
	}

	// Re-inititialise some static variables.

	resizeRadar();

	setAllPauseStates(false);

	/* decide if we have to create teams, ONLY in multiplayer mode!*/
	if (bMultiPlayer && alliancesSharedVision(game.alliance))
	{
		createTeamAlliances();

		/* Update ally vision for pre-placed structures and droids */
		for (i = 0; i < MAX_PLAYERS; i++)
		{
			if (i != selectedPlayer)
			{
				/* Structures */
				for (psStr = apsStructLists[i]; psStr; psStr = psStr->psNext)
				{
					if (aiCheckAlliances(psStr->player, selectedPlayer))
					{
						visTilesUpdate((BASE_OBJECT *)psStr);
					}
				}

				/* Droids */
				for (psDroid = apsDroidLists[i]; psDroid; psDroid = psDroid->psNext)
				{
					if (aiCheckAlliances(psDroid->player, selectedPlayer))
					{
						visTilesUpdate((BASE_OBJECT *)psDroid);
					}
				}
			}
		}
	}

	countUpdate();
	if (getLevelLoadType() != GTYPE_SAVE_MIDMISSION)
	{
		if (getDebugMappingStatus())
		{
			triggerEventCheatMode(true);
		}
		eventFireCallbackTrigger((TRIGGER_TYPE)CALL_GAMEINIT);
		triggerEvent(TRIGGER_GAME_INIT);
	}

	return true;
}