Sorry to dig out this thread but I can't get no sleep and just found these pretty lensflares in this old thread.

Thanks a lot HeelX
as soon as I find a really good postcard I'll send it smile

If anyone still needs some lite-C code for the lensflares take my quick & dirty, nightly hacked-in lines below:

Code:

// define 21 lensflares
// abused the pan value for the pivot value

ENTITY* lensflare_01 = {
	type = "lens_01.DDS";
	layer = 2;
	view = camera;
	pan = -0.139;
}

// lensflares 02 - 20 
// (...)

ENTITY* lensflare_21 = {
	type = "lens_21.DDS";
	layer = 2;
	view = camera;
	pan = 1;
}


// place a lensflare on the sun position and correct the position according to the pivot value

function lensPlace(ENTITY* lens) {
	VECTOR* temp = vector(0,0,0);
	vec_set(temp,sun_pos);

	if (vec_to_screen(temp,camera) != NULL) { // sun is visible 
		lens.flags2 |= VISIBLE;

		temp.x = temp.x + 2 * lens.pan * ((screen_size.x / 2) - temp.x);
		temp.y = temp.y + 2 * lens.pan * ((screen_size.y / 2) - temp.y);
		temp.z = 2000; // 2000 quants to depth
		vec_set(lens.x,temp);
		rel_for_screen(lens.x,camera); // lens flare to sun position
	} else { // sun not visible 
		lens.flags2 &= ~(VISIBLE);
	}
}

// at least start the action somewhere

function lensflare_starter() {
	
	// values for my test level

	sun_angle.pan = 193;
	sun_angle.tilt = 10;
	
	while(1) {
		lensPlace(lensflare_01);
		// lensflare 02 - 20
		// (...)
		lensPlace(lensflare_21);
		wait(1);
	}




Last edited by AlexDeloy; 05/17/08 00:26.