DispCulling

From SWWorkshop

Jump to: navigation, search

In one level 10 thousand item can be exist. If you will render all of them. It cause performance problem. The solution is filtering items which are outside screen(Culling). Basic you check item boundary in scenario region and if outside cull it. Boundary check for every item in your code is'nt good. SWEngine abstracts this function. You only set scenario region and item boundary. All checks and rendering operation makes in background.

Below example shows how tu use culling function in SWEngine swDispManager. 2500 item exist but only 45 item rendered.


DispCullingSupport

int swDispManagerAdd(void(*dispFunc)(void*), void *obj,boolean *bEnabled,swRect *rect,int *layer); //4th parameter rect=Boundary referance..

Image:Culling.JPG


swDispManagerAdd(xenDisplay,xen,NULL,&xen->target,NULL);  

Set scenario region.

swDispManagerSetCullRegion(0,0,700,500);
Personal tools