Posted By: rojart
d3d_instancing = 1; - 01/24/13 08:57
I tested sprite instancing with infinite_level.c example, and indeed works.
But, if I try with particle sprites, like code below the fps went down.
Is d3d_instancing = 1 restricted for sprite particles?
But, if I try with particle sprites, like code below the fps went down.
Is d3d_instancing = 1 restricted for sprite particles?
Code:
/////////////////////////////// #include <default.c> #include <particles.c> /////////////////////////////// function p_fountain(PARTICLE* p) { VECTOR vTemp; vec_randomize(vTemp,2); vec_add(p.vel_x,vTemp); vec_set(p.blue,vector(random(255),random(255),255)); set(p, MOVE | BRIGHT | TRANSLUCENT); p.alpha = 100; p.size = 2; p.gravity = 0.2; p.skill_a = 3; // fade factor p.event = p_fade; } function p_fountain_sprite(ENTITY* p) { VECTOR vTemp; vec_randomize(vTemp,2); vec_add(p._VEL_X,vTemp); vec_set(p.blue,vector(random(255),random(255),255)); set(p, _MOVE | BRIGHT | TRANSLUCENT); p.alpha = 100; p._SIZE = 6; p._GRAVITY = 0.2; p._FADE = 3; p.event = p_fade_sprite; } function main() { d3d_instancing = 1; max_entities = max_particles; fps_max = 1000; level_load(NULL); video_window(NULL,NULL,0,"Sprite particle demo"); vec_set(camera.x,vector(-150,0,50)); while(1) { if(key_s) { effect_sprite(NULL,p_fountain_sprite,maxv(2,40*time_step),vector(0,0,0),vector(0,0,5)); draw_text(str_printf(NULL, "%d fps for %d sprites", (long)(16/time_frame),(long)num_entities), 5,5,COLOR_WHITE); } else { effect(p_fountain,maxv(2,2*time_step),vector(0,0,0),vector(0,0,5)); draw_text(str_printf(NULL, "%d fps for %d particles (press [S] for emulation with sprites)", (long)(16/time_frame),(long)num_particles), 5,5,COLOR_WHITE); } if(key_i) camera.flags |= ISOMETRIC; else camera.flags &= ~ISOMETRIC; wait(1); } }