Esempio n. 1
0
void
M_LineWrite3(AG_DataSource *ds, M_Line3 *L)
{
	M_WriteVector3(ds, &L->p);
	M_WriteVector3(ds, &L->d);
	M_WriteReal(ds, L->t);
}
Esempio n. 2
0
void
M_PolyhedronWrite(AG_DataSource *ds, const M_Polyhedron *P)
{
	Uint i, j;
	
	AG_WriteUint32(ds, (Uint32)P->nv);
	AG_WriteUint32(ds, (Uint32)P->ne);
	AG_WriteUint32(ds, (Uint32)P->nf);

	/* Write vertices */
	for (i = 0; i < P->nv; i++)
		M_WriteVector3(ds, &P->v[i]);
	
	/* Write edges */
	for (i = 0; i < P->ne; i+=2) {
		M_Halfedge *eHead = &P->e[i];
		M_Halfedge *eTail = &P->e[i+1];

		AG_WriteUint32(ds, (Uint32)eHead->v);
		AG_WriteUint32(ds, (Uint32)eTail->v);
		AG_WriteUint32(ds, (Uint32)eHead->f);
		AG_WriteUint32(ds, (Uint32)eTail->f);
	}
	
	/* Write facets */
	for (i = 0; i < P->nf; i++) {
		M_Facet *f = &P->f[i];

		AG_WriteUint8(ds, (Uint8)f->n);
		for (j = 0; j < f->n; j++)
			AG_WriteUint32(ds, (Uint32)f->e[j]);
	}
}
Esempio n. 3
0
void
M_CircleWrite3(AG_DataSource *ds, M_Circle3 *C)
{
	M_WriteVector3(ds, &C->p);
	M_WriteReal(ds, C->r);
}