![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| int | engrid_scene (object **list) |
| object * | newgrid (int xsize, int ysize, int zsize, vector min, vector max) |
| int engrid_scene | ( | object ** | list | ) |
Definition at line 275 of file grid.cpp.
References cbrt, countobj(), engrid_cell(), engrid_objlist(), g, globalbound(), and newgrid().
Referenced by renderscene().
{
grid * g;
int numobj, numcbrt;
vector gmin, gmax;
gridindex index;
if (*list == NULL)
return 0;
numobj = countobj(*list);
fprintf(stderr, "Scene contains %d bounded objects.\n", numobj);
if (numobj > 16) {
numcbrt = (int) cbrt(4*numobj);
globalbound(list, &gmin, &gmax);
g = (grid *) newgrid(numcbrt, numcbrt, numcbrt, gmin, gmax);
engrid_objlist(g, list);
numobj = countobj(*list);
g->nextobj = *list;
*list = (object *) g;
/* now create subgrids.. */
for (index.z=0; index.z<g->zsize; index.z++) {
for (index.y=0; index.y<g->ysize; index.y++) {
for (index.x=0; index.x<g->xsize; index.x++) {
engrid_cell(g, &index);
}
}
}
}
return 1;
}
Definition at line 91 of file grid.cpp.
References g, grid_methods, new_objectid(), rt_getmem(), and VSub().
Referenced by engrid_cell(), and engrid_scene().
{
grid * g;
g = (grid *) rt_getmem(sizeof(grid));
memset(g, 0, sizeof(grid));
g->methods = &grid_methods;
g->id = new_objectid();
g->xsize = xsize;
g->ysize = ysize;
g->zsize = zsize;
g->min = min;
g->max = max;
VSub(&g->max, &g->min, &g->voxsize);
g->voxsize.x /= (flt) g->xsize;
g->voxsize.y /= (flt) g->ysize;
g->voxsize.z /= (flt) g->zsize;
g->cells = (objectlist **) rt_getmem(xsize*ysize*zsize*sizeof(objectlist *));
memset(g->cells, 0, xsize*ysize*zsize * sizeof(objectlist *));
/* fprintf(stderr, "New grid, size: %8d %8d %8d\n", g->xsize, g->ysize, g->zsize); */
return (object *) g;
}
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.