Beispiel #1
0
void Floor::onAllLoaded() {
	Object::onAllLoaded();

	_faces = listChildren<FloorFace>();

	buildEdgeList();
}
Beispiel #2
0
void scanFill (struct Object2D * object, struct Window *window, struct BufferDevice *device)
{
    int i;
    struct Point2D *pts = malloc(sizeof(object->points));
    struct Point2D *pn1, *pd1;

    int cor = object->fillColor;

    for (i = 0; i < object->curr_point; i++) {
        struct Point2D * p = &object->points[i];

        pn1 = sru2srn(p, window);
        pd1 = srn2srd(pn1, device);
        pts[i].x = pd1->x;
        pts[i].y = pd1->y;
        //pts[i].color = pd1->color;
    }

    int cnt = object->curr_point;
    int height = device->ymax;

    Edge * edges[height], * active;
    int scan;

    for (i=0; i<height; i++) {
        edges[i] = (Edge *) malloc (sizeof (Edge));
        edges[i]->next = NULL;
    }
    buildEdgeList (cnt, pts, edges);
    active = (Edge *) malloc (sizeof (Edge));
    active->next = NULL;

    for (scan=0; scan<height; scan++) {
        buildActiveList (scan, active, edges);
        if (active->next) {
            fillScan (scan, active, window, device, cor);
            updateActiveList (scan, active);
            resortActiveList (active);
        }
    }
    /* Free edge records that have been malloc'ed ... */
}