Esempio n. 1
0
// Try, very hard, to put everything in the multicol into two columns
// so that the total height is at most htavail.
void multicol::compose(int defonly)
{
	int i;
	stream cd;
	if (!nonempty()) {
		setheight(0);
		return;
	}
	scratch.freeall();		// fill scratch with everything destined
					// for either column
	for (cd = definite; cd.more(); cd.advance())
		scratch.append(cd.current());
	if (!defonly)
		for (cd = *(currpage->stage); cd.more(); cd.advance())
			if (cd.current()->numcol() == 2)
				scratch.append(cd.current());
	scratch.restoreall();		// in particular, floatables' goals
	int rawht = scratch.rawht();
	int halfheight = (int)(coltol*rawht);
					// choose a goal height
	int maxht = defonly ? halfheight : htavail;
secondtry:
	for (i = 0; i < 2; i++)
		column[i].freeall();
	leftblocked = 0;
	cd = scratch;
	while (cd.more()) {
		queue ministage;	// for the minimally acceptable chunks
		ministage.freeall();	// that are to be added to either column
		while (cd.more() && !cd.current()->issentinel()) {
			ministage.enqueue(cd.current());
			cd.advance();
		}
		choosecol(&ministage, maxht);
		if (cd.more() && cd.current()->issentinel())
			cd.advance();	// past sentinel
	}
	if (height() > htavail && maxht != htavail) {
					// We tried to balance the columns, but
					// the result was too tall.  Go back
					// and try again with the less ambitious
					// goal of fitting the space available.
		maxht = htavail;
		goto secondtry;
	}
	for (i = 0; i < 2; i++) {
		movefloats(&(column[i]), ((double) column[i].rawht())/currpage->pagesize);
		trimspace(&(column[i]));
	}
	if (dbg & 32) {
		printf("#multicol::compose: htavail %d maxht %d dv %d\n",
			htavail, maxht, height());
		dump();
	}
	if (defonly)
		stretch(height());
}
Esempio n. 2
0
void init(void)
{
	glEnable(GL_DEPTH_TEST);
	glClearColor(0.6, 0.6, 0.6, 1);
	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

	pngLoadRaw("terrain5.png", &info);
	setheight();
	move[1] = bilinear(move[0], move[2]);
	tri[0] = Vec3(0, bilinear(0, 0.5), 0.5);
	tri[1] = Vec3(2.5, bilinear(2.5, 0), 0);
	tri[2] = Vec3(0, bilinear(0, -0.5), -0.5);

	car = glmReadOBJ("porsche.obj");
	glmUnitize(car);
	glmScale(car, 15);
	glmFacetNormals(car);
	glmVertexNormals(car, 90);

	glEnable(GL_TEXTURE_2D);
}
Esempio n. 3
0
void ministub::setrealheight(float x,float z,float h)
   {
   if (SCALE*RELSCALE==0.0f) ERRORMSG();
   setheight(x,z,(h-CENTERY)/(SCALE*RELSCALE));
   }
Esempio n. 4
0
void ministub::setrealheight(int i,int j,float h)
   {
   if (SCALE*RELSCALE==0.0f) ERRORMSG();
   setheight(i,j,(h-CENTERY)/(SCALE*RELSCALE));
   }