Beispiel #1
0
int olTraceInit(OLTraceCtx **pctx, OLTraceParams *params)
{
	OLTraceCtx *ctx = malloc(sizeof(OLTraceCtx));

	ctx->p = *params;

	alloc_bufs(ctx);
	init_blur(ctx);

	*pctx = ctx;
	return 0;
}
Beispiel #2
0
int olTraceReInit(OLTraceCtx *ctx, OLTraceParams *params)
{
	unsigned int new_ksize = ((unsigned int)round(params->sigma * 6 + 1)) | 1;

	if (ctx->p.mode != params->mode ||
		ctx->p.width != params->width ||
		ctx->p.height != params->height ||
		ctx->ksize != new_ksize)
	{
		free_bufs(ctx);
		ctx->p = *params;
		alloc_bufs(ctx);
	} else {
		ctx->p = *params;
	}
	init_blur(ctx);
	return 0;
}
Beispiel #3
0
int main(){
	MSG message;
	HSTREAM stream = 0;
	object *room;
	object *sphere;
	object *sphere_copy;
	rtt_target *rendertarget;

	rtt_target *fucking_shit;

	int loading;
	int bjork_texture;
	int yo_plus;
	int carlb;
	int i;
	int veldig_kule;
	int greets;
	int mothafuckas;

	vector particles[PARTICLE_COUNT];
	make_random_particles(particles, PARTICLE_COUNT, 200);

	if(!mumps_open("CARL B!!!!1",WIDTH,HEIGHT,32,32,-1,FULLSCREEN)) error("kunne ikke lage bartevindu");
	if(!init_extensions()){
		mumps_close();
		error("kunne ikke bruke fet opengl-extension");
	}
	if (!BASS_Init(-1, 44100, 0, 0, 0)) {
		mumps_close();
		error("kunne ikke åpne fet lyd");
	}
	stream = BASS_StreamCreateFile(FALSE, "data/uglespy.ogg", 0, 0, BASS_MP3_SETPOS | BASS_STREAM_PRESCAN | 0);
	if (!stream) {
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fet lyd 2.0");
	}

	loading = load_texture("loading.jpg", FALSE);
	if(loading==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}

	glClearColor(0,0,0,0);
	glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
	fullscreen_image(loading);
	glFlush();
	mumps_update();


	room = load_object("cylinder01.kro");
	if(!room){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett objekt");
	}

	sphere = load_object("sphere01.kro");
	if(!sphere){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett objekt");
	}
	sphere_copy = copy_object(sphere);

	bjork_texture = load_texture("bjork.jpg", FALSE);
	if(bjork_texture==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}
	yo_plus = load_texture("yo_plus.jpg", FALSE);
	if(yo_plus==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}
	carlb = load_texture("carlb.jpg", FALSE);
	if(carlb==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}
	veldig_kule = load_texture("veldig_kule.jpg", FALSE);
	if(veldig_kule==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}
	greets = load_texture("greets.jpg", FALSE);
	if(greets==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}
	mothafuckas = load_texture("mothefuckas.jpg", FALSE);
	if(mothafuckas==-1){
		BASS_StreamFree(stream);
		BASS_Free();
		mumps_close();
		error("kunne ikke åpne fett bilde");
	}

	rendertarget = init_rtt(512,256,(float)WIDTH/(float)HEIGHT, FALSE, FALSE);
	fucking_shit = init_rtt(512,256,(float)WIDTH/(float)HEIGHT, FALSE, TRUE);
	init_blur(256,256);

	glEnable(GL_NORMALIZE);
	
	BASS_Start();
	BASS_ChannelPlay(stream, FALSE);

	do {
		QWORD pos = BASS_ChannelGetPosition(stream, BASS_POS_BYTE);
		double time = BASS_ChannelBytes2Seconds(stream, pos);

		glViewport(0,0,mumps_width,mumps_height);

		if(time<25.55f){
			glClearColor(1,1,1,0);
			glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
			glMatrixMode(GL_TEXTURE);
			glLoadIdentity();
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();

			gluPerspective(120, ASPECT, 1.f, 500);

			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity();

			glFogi(GL_FOG_MODE, GL_EXP2);
			glFogfv(GL_FOG_COLOR,black_color);
			glFogf(GL_FOG_DENSITY, 0.02f);
			glEnable(GL_FOG);

			set_camera(
				vector_make( // pos
					(float)sin(time*0.1f)*50,
					(float)sin(time*1.2f*0.1f+1)*50,
					(float)cos(sin(time*0.1f)-time*0.1f)*50
				),
				vector_make( // look_at
					0, 0, 0
				),
				0
			);

			draw_particles(particles,PARTICLE_COUNT,yo_plus, (float)15);

			if(time<2){
				float alpha = 1.f-time*0.5f;
				glPushAttrib(GL_ALL_ATTRIB_BITS);
				glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

				glColor4f(1,1,1, alpha );
				glEnable(GL_BLEND);
				fullscreen_image(loading);
				glPopAttrib();

			}

			if(time>17.5f){
				float alpha = (time-17.5);

				glPushAttrib(GL_ALL_ATTRIB_BITS);
				glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT);
				glBlendFunc( GL_SRC_ALPHA, GL_ONE );

				glColor4f(1,1,1, alpha );
				glEnable(GL_BLEND);
				fullscreen_image(carlb);
				glPopAttrib();
			}
		}else if(time<51.0f){
			float flash = 1.f-(time-25.55f);
			glClearColor(1,1,1,0);
			glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
			glMatrixMode(GL_TEXTURE);
			glLoadIdentity();
			glMatrixMode(GL_PROJECTION);
			glLoadIdentity();
			gluPerspective(90, ASPECT, 1.f, 500);
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity();

			glDisable(GL_FOG);


			gluLookAt(
				sin(time*0.1f)*90,-50,cos(time*0.1f)*90,
				0,-30,0,

				0,1,0
				);

			start_rtt(rendertarget);

			set_light(0, (float)sin(time)*50,0,(float)cos(time)*50,TRUE);
			set_light(1, (float)sin(time+1)*50,0,(float)cos(time+1)*50,TRUE);

			glEnable(GL_LIGHTING);
			glEnable(GL_DEPTH_TEST);

			glPushMatrix();
			glTranslatef(100,0,-100);
			draw_object(room);
			glPopMatrix();

			glPushMatrix();
			glTranslatef(0,-30,0);
			glScalef(0.7f,0.7f,0.7f);
			glRotatef(time*15,1,0,1);
			glRotatef(time*15,1,0,0);
			glRotatef(time*15.2f,0,1,0);

			glRotatef(time*15,0,0,1);
			glRotatef(time*25,1,0,0);
			glRotatef(time*15.2f,0,1,0);

			blob_distort(sphere, sphere_copy, vector_make((float)sin(time),time,-time), vector_make(
				(float)(1+sin(time))*0.1f,
				(float)(1+sin(time))*0.1f,
				(float)(1+sin(time))*0.1f
				),vector_make(0.3f,0.3f,0.3f) );
			draw_object(sphere_copy);
			glPopMatrix();

			end_rtt(rendertarget);

			i = blur((float)sin(time*0.3f)*0.3f, 0.1f+(1+(float)sin(time*0.1f))*0.2f, 0.2f, FALSE, rendertarget->texture);

			fullscreen_image(i);

			glEnable(GL_COLOR_MATERIAL);
			glColor4f(1,1,1, (1+(float)sin(time*0.5f))*0.3f );
			glBlendFunc( GL_SRC_ALPHA, GL_ONE );
			glEnable(GL_BLEND);
			fullscreen_image(bjork_texture);
			glDisable(GL_BLEND);


			if(time>38.35f){
				flash = 1.f-(time-38.4f);
				if(time>44.75f){
					flash = 1.f-(time-44.75f);
				}
			}

			if(flash<0) flash = 0;
			superflash(flash);

			if(time>38.35f){
				overlay(veldig_kule, 1);
			}
		}else if(time<(60+16.8f)){
			float flash = (1.f-(time-51.f));
			float flash2 = sin(-(3.1415f/2)+(time-51.f)*(117.5f/60.f)*8);
			if(flash<0) flash = 0;

			flash *= flash;


			flash2 *= (1+flash2)*0.5f;
			flash2 *= 20;

			start_rtt(fucking_shit);
			draw_dilldallscene(room, sphere, sphere_copy,time,flash,flash2);
			end_rtt(fucking_shit);

			glClearColor(0,0,0,0);
			glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

			draw_dilldallscene(room, sphere, sphere_copy,time,flash,flash2);

			glLoadIdentity();

			glEnable(GL_COLOR_MATERIAL);
			glColor4f(1,1,1, 0.5+(1+(float)sin(time*0.5f))*0.5f );
			glBlendFunc( GL_SRC_ALPHA, GL_ONE );
			glEnable(GL_BLEND);
			fullscreen_image_flip(fucking_shit->texture,1);
			fullscreen_image_flip(fucking_shit->texture,2);
			fullscreen_image_flip(fucking_shit->texture,3);
			glDisable(GL_BLEND);

			fuss(50,time, 1, 1, 0.1f);
			if(time>(60+3.9f)){
				flash=(1.f-(time-(60+3.9f)));
				overlay(greets, 1);
			}
			superflash(flash);
		}else{
			float flash = (1.f-(time-(60+16.8f)));
			fullscreen_image(mothafuckas);
			superflash(flash);
			if(time>(60+23.f)){
				float flash = (time-(60+23.f));
				superflash2(flash*0.5f);
			}
		}
		glFlush();
		mumps_update();

		if(time>60+30) PostQuitMessage(0);

		while(PeekMessage(&message,NULL,0,0,PM_REMOVE)){
			TranslateMessage(&message);
			DispatchMessage(&message);
		    if(message.message == WM_QUIT) break;
		}
	}while(message.message!=WM_QUIT && !GetAsyncKeyState(VK_ESCAPE));
	BASS_StreamFree(stream);
	BASS_Free();
	mumps_close();
	MessageBox(NULL,"Frigi minnet ditt sjøl, taper","In your face",MB_OK);
	return 0;
}