コード例 #1
0
ファイル: particle_emitter.c プロジェクト: AmIMeYet/ashton
// ----------------------------------------
// #update(delta)
VALUE Ashton_ParticleEmitter_update(VALUE self, VALUE delta)
{
    EMITTER();

    float _delta = NUM2DBL(delta);
    if(_delta < 0.0) rb_raise(rb_eArgError, "delta must be >= 0");

    if(emitter->count > 0)
    {
        Particle* particle = emitter->particles;
        Particle* last = &emitter->particles[emitter->max_particles - 1];
        for(; particle <= last; particle++)
        {
            // Ignore particles that are already dead.
            if(particle->time_to_live > 0)
            {
                update_particle(emitter, particle, _delta);
            }
        }
    }

    // Time to emit one (or more) new particles?
    emitter->time_until_emit -= _delta;
    while(emitter->time_until_emit <= 0)
    {
        rb_funcall(self, rb_intern("emit"), 0);
        emitter->time_until_emit += deviate(&emitter->interval);
    }

    // Copy all the current data onto the graphics card.
    if(emitter->count > 0) update_vbo(emitter);

    return Qnil;
}
コード例 #2
0
void vsx_widget_profiler_plot::event_mouse_double_click(vsx_widget_distance distance,vsx_widget_coords coords,int button)
{
  VSX_UNUSED(distance);
  VSX_UNUSED(coords);
  VSX_UNUSED(button);
  if (!selected_chunk)
    return;

  double tdiff = selected_chunk->time_end - selected_chunk->time_start;
  vsx_printf("tdiff. %f\n", tdiff);
  time_scale::get_instance()->time_scale_x = 0.5 / (tdiff) ;
  time_scale::get_instance()->time_offset = -time_scale::get_instance()->time_scale_x * (selected_chunk->time_start + 0.5 * tdiff);

  camera.set_pos( vsx_vector3<>(0.0, 0.0, 1.9) );
  update_vbo();
}
コード例 #3
0
void vsx_widget_profiler_plot::update()
{
  update_vbo();
}
コード例 #4
0
void vsx_widget_profiler_thread::update()
{
  update_vbo();
  update_tag_draw_chunks();
}
コード例 #5
0
ファイル: app.c プロジェクト: youka2/fx
void init(void)
{
	if(init_mblur() && init_vig() && init_quad())
	{
		int size=0; void *data=NULL;

		/*glClearColor(1.0f,1.0f,1.0f,1.0f);*/
		glClearColor(0.04f,0.0f,0.04f,1.0f);

		use_mblur();
		send_mblur_samples(16.0f); /* adjust motion blur samples here */

		use_vig();
		send_vig_size((float)sw(),(float)sh());
		vigmode(0);

		use_basic();
		persp(proj,75.0f,asp(),0.1f,24.0f);

		if(fload("data/area-model.bin",&size,&data))
		{
			add_to_vbo(&area_mod,data,size);
			free(data);

			update_vbo();

			gen_texs(1,&area_tex);
			//if(load_tex_compressed(area_tex,"data/area-ao-texture.bin",tf_mipmap))
			if(load_tex_compressed(area_tex,"data/area-texture.bin",tf_mipmap))
			{
				const int downsample=1; /* adjust fb down-sizing here */
				texmode(1);

				nsw=sw()/downsample;
				nsh=sh()/downsample;

				gen_texs(4,texs);
				gen_rbs(3,rbs);
				gen_fbs(4,fbos);

				use_fb(fbos[0]);
				add_fb_rb(0,rbs[0],nsw,nsh,GL_RGB8,4); /* adjust renderbuffer samples here */
				add_fb_rb(0,rbs[1],nsw,nsh,GL_DEPTH_COMPONENT24,4); /* adjust renderbuffer samples here */

				use_fb(fbos[1]);
				add_fb_tex(0,texs[0],nsw,nsh,GL_RGB8,tf_linear);
				add_fb_rb(0,rbs[2],nsw,nsh,GL_DEPTH_COMPONENT24,0);

				use_fb(fbos[2]);
				add_fb_tex(0,texs[1],nsw,nsh,GL_RGB8,tf_linear);
				add_fb_tex(1,texs[2],nsw,nsh,GL_RGBA32F,tf_linear);
				add_fb_rb(0,rbs[2],nsw,nsh,GL_DEPTH_COMPONENT24,0);

				use_fb(fbos[3]);
				add_fb_tex(0,texs[3],nsw,nsh,GL_RGB8,tf_linear);

				use_fb(0);
				use_rb(0);
				use_tex(0);
			}
			else quit();
		}
		else quit();
	}
	else quit();
}