Ejemplo n.º 1
0
void
SimCarCollideInit(tTrack *track)
{
	dtSetDefaultResponse(SimCarCollideResponse, DT_SMART_RESPONSE, NULL);
	// Hmm, why is caching disabled, are our objects too fast, so it does not work?
	// TODO: understand this and reconsider caching.
	dtDisableCaching();
	dtSetTolerance(0.001);
	
	fixedid = 0;

	if (track != NULL) {
		tTrackSeg *firstleft = getFirstWallStart(track->seg, TR_SIDE_LFT);
		tTrackSeg *firstright = getFirstWallStart(track->seg, TR_SIDE_RGT);

		buildWalls(firstleft, TR_SIDE_LFT);
		buildWalls(firstright, TR_SIDE_RGT);

		unsigned int i;
		for (i = 0; i < fixedid; i++) {
			dtCreateObject(&fixedobjects[i], fixedobjects[i]);
			dtSetObjectResponse(&fixedobjects[i], SimCarWallCollideResponse, DT_SMART_RESPONSE, &fixedobjects[i]);
		}
	}	
}
Ejemplo n.º 2
0
void init (void) {
	// If Depth Test is not enabled, I would see my object infront of 
	// my polygon even if my object falls behind polygon. 
	glClearDepth(1);
	glEnable(GL_DEPTH_TEST);
	glEnable (GL_BLEND);
	//glBlendFunc (GL_SRC_ALPHA, GL_ONE);
	glClearColor (0.0, 0.0, 0.0, 0.0);

	
	windvelocity.x = 0.5;
	windvelocity.y = 0.5;
	windvelocity.z = 0.5;

	buildWalls(habcount, num_tri_hab, habitat, habvert);
	createPredator(1);
	addObject(20);
	//buildWalls(tricount, num_triangles, triangle, vert);
	//cube=loadObject("birds.obj"); 
	cube=loadObject("Fiat509_2.6.obj");
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glShadeModel (GL_SMOOTH);
    glEnable (GL_LIGHTING);
    glEnable (GL_LIGHT0);
	float col[]={1.0,1.0,1.0,1.0};  //light color is white
    glLightfv(GL_LIGHT0,GL_DIFFUSE,col);
	texture[0] = LoadTextureRAW( "wood.bmp",500,334);
	
 }