Cube  Diff

Differences From Artifact [81f69c07bf]:

To Artifact [19962c058e]:


270
271
272
273
274
275
276
277
278
279
280
281
282




283
284

285
286
287
288
289
290



291

292
293
294
295
296

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311

312
313
314

315
316
317
318
319
320
321
}

int skyoglid;

struct strip {
	int tex, start, num;
};
vector<strip> strips;

void
renderstripssky()
{
	glBindTexture(GL_TEXTURE_2D, skyoglid);




	loopv(strips) if (strips[i].tex == skyoglid)
	    glDrawArrays(GL_TRIANGLE_STRIP, strips[i].start, strips[i].num);

}

void
renderstrips()
{
	int lasttex = -1;



	loopv(strips) if (strips[i].tex != skyoglid)

	{
		if (strips[i].tex != lasttex) {
			glBindTexture(GL_TEXTURE_2D, strips[i].tex);
			lasttex = strips[i].tex;
		}

		glDrawArrays(GL_TRIANGLE_STRIP, strips[i].start, strips[i].num);
	}
}

void
overbright(float amount)
{
	if (hasoverbright)
		glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, amount);
}

void
addstrip(int tex, int start, int n)
{
	strip &s = strips.add();

	s.tex = tex;
	s.start = start;
	s.num = n;

}

VARFP(gamma, 30, 100, 300, {
	float f = gamma / 100.0f;
	Uint16 ramp[256];

	SDL_CalculateGammaRamp(f, ramp);







|





>
>
>
>
|
|
>






>
>
>
|
>
|
|
|
|

>
|













|
>
|
|
<
>







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324

325
326
327
328
329
330
331
332
}

int skyoglid;

struct strip {
	int tex, start, num;
};
static OFMutableData *strips;

void
renderstripssky()
{
	glBindTexture(GL_TEXTURE_2D, skyoglid);

	const strip *items = (const strip *)strips.items;
	size_t count = strips.count;
	for (size_t i = 0; i < count; i++)
		if (items[i].tex == skyoglid)
			glDrawArrays(
			    GL_TRIANGLE_STRIP, items[i].start, items[i].num);
}

void
renderstrips()
{
	int lasttex = -1;
	const strip *items = (const strip *)strips.items;
	size_t count = strips.count;
	for (size_t i = 0; i < count; i++) {
		if (items[i].tex == skyoglid)
			continue;

		if (items[i].tex != lasttex) {
			glBindTexture(GL_TEXTURE_2D, items[i].tex);
			lasttex = items[i].tex;
		}

		glDrawArrays(GL_TRIANGLE_STRIP, items[i].start, items[i].num);
	}
}

void
overbright(float amount)
{
	if (hasoverbright)
		glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, amount);
}

void
addstrip(int tex, int start, int n)
{
	if (strips == nil)
		strips = [[OFMutableData alloc] initWithItemSize:sizeof(strip)];

	strip s = { .tex = tex, .start = start, .num = n };

	[strips addItem:&s];
}

VARFP(gamma, 30, 100, 300, {
	float f = gamma / 100.0f;
	Uint16 ramp[256];

	SDL_CalculateGammaRamp(f, ramp);
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444

	int xs, ys;
	skyoglid = lookuptexture(DEFAULT_SKY, &xs, &ys);

	resetcubes();

	curvert = 0;
	strips.setsize(0);

	render_world(player1.o.x, player1.o.y, player1.o.z, (int)player1.yaw,
	    (int)player1.pitch, (float)fov, w, h);
	finishstrips();

	setupworld();








|







441
442
443
444
445
446
447
448
449
450
451
452
453
454
455

	int xs, ys;
	skyoglid = lookuptexture(DEFAULT_SKY, &xs, &ys);

	resetcubes();

	curvert = 0;
	[strips removeAllItems];

	render_world(player1.o.x, player1.o.y, player1.o.z, (int)player1.yaw,
	    (int)player1.pitch, (float)fov, w, h);
	finishstrips();

	setupworld();