~rabbits/moogle

a520a26a1a972bac834e01c421b0b92430d0f117 — Devine Lu Linvega 20 days ago d9e7644 main
Collect all edges together
1 files changed, 12 insertions(+), 14 deletions(-)

M src/moogle.c
M src/moogle.c => src/moogle.c +12 -14
@@ 18,7 18,6 @@ WITH REGARD TO THIS SOFTWARE.
#define TITLE "out40x28.icn"
#define SZ (HOR * VER * 8)

#define VLIMIT 256
#define ELIMIT 512
#define MLIMIT 128
#define PI 3.14159265358979323846


@@ 43,7 42,7 @@ typedef struct {
typedef struct {
	int verticeslen, edgeslen;
	Point3d position, *vertices;
	Edge edges[ELIMIT];
	Edge *edges;
} Mesh;

typedef struct {


@@ 66,7 65,8 @@ typedef struct {
	double x, y;
} Mouse;

static Point3d all_vertices[0x10000], *_all_vertices = &all_vertices[0];
static Point3d vertices[0x10000], *_vertices = &vertices[0];
static Edge edges[0x8000], *_edges = &edges[0];

static int WIDTH = 8 * HOR;
static int HEIGHT = 8 * VER;


@@ 263,20 263,17 @@ addvertex(Mesh *m, double x, double y, double z)
		if(equpt3d(m->vertices[i], v))
			return &m->vertices[i];
	m->verticeslen++;
	return set3d(_all_vertices++, v.x, v.y, v.z);
	return set3d(_vertices++, v.x, v.y, v.z);
}

static Edge *
addedge(Mesh *m, Point3d *a, Point3d *b, int color)
{
	if(m->edgeslen == ELIMIT) {
		fprintf(stderr, "Warning: Reached edge limit\n");
		return NULL;
	}
	m->edges[m->edgeslen].a = a;
	m->edges[m->edgeslen].b = b;
	m->edges[m->edgeslen].color = color;
	return &m->edges[m->edgeslen++];
	_edges->a = a;
	_edges->b = b;
	_edges->color = color;
	m->edgeslen++;
	return _edges++;
}

/* Primitives */


@@ 643,7 640,8 @@ addmesh(Scene *s)
		fprintf(stderr, "Warning: Reached mesh limit\n");
		return NULL;
	}
	s->meshes[s->len].vertices = _all_vertices;
	s->meshes[s->len].vertices = _vertices;
	s->meshes[s->len].edges = _edges;
	return &s->meshes[s->len++];
}



@@ 805,7 803,7 @@ main(void)
		return error("Init", "Failure");

	createumbrella(&scn);
	translate(createbox(&scn, 20,20,20,3),0,0,-10);
	translate(createbox(&scn, 20, 20, 20, 3), 0, 0, -10);

	/* Begin */