All pastes #2064600 Raw Edit

Something

public text v1 · immutable
#2064600 ·published 2011-05-19 13:11 UTC
rendered paste body
static void R_DrawSkyMesh(batch_t *batch, mesh_t *m, shader_t *shader)
{
	static entity_t skyent;
	batch_t b;
	//float time = cl.gametime+realtime-cl.gametimemark; //warning: unused variable ‘time’

	float skydist = gl_skyboxdist.value;
	if (skydist<1)
		skydist=gl_maxdist.value * 0.577;
	if (skydist<1)
		skydist = 10000000;

	VectorCopy(r_refdef.vieworg, skyent.origin);
	skyent.axis[0][0] = skydist;
	skyent.axis[0][1] = 0;
	skyent.axis[0][3] = 0;
	skyent.axis[1][0] = 0;
	skyent.axis[1][1] = skydist;
	skyent.axis[1][2] = 0;
	skyent.axis[2][0] = 0;
	skyent.axis[2][1] = 0;
	skyent.axis[2][2] = skydist;
	skyent.scale = 1;

//FIXME: We should use the skybox clipping code and split the sphere into 6 sides.
	b = *batch;
	b.meshes = 1;
	b.firstmesh = 0;
	b.mesh = &m;
	b.ent = &skyent;
	b.shader = shader;
	b.skin = &shader->defaulttextures;
	b.texture = NULL;
	BE_SubmitBatch(&b);
}