}
-/**
- * Recalculate prim's determinant. This is needed as we don't have
- * get this information through the vbuf_render interface & we must
- * calculate it here.
- */
-static float
-calc_det( const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4] )
-{
- /* edge vectors e = v0 - v2, f = v1 - v2 */
- const float ex = v0[0][0] - v2[0][0];
- const float ey = v0[0][1] - v2[0][1];
- const float fx = v1[0][0] - v2[0][0];
- const float fy = v1[0][1] - v2[0][1];
-
- /* det = cross(e,f).z */
- return ex * fy - ey * fx;
-}
static void
indices[i+j] * vertex_size);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2]);
v[1] = VERTEX(i + 1);
v[2] = VERTEX(i + 2);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i - 1);
v[2] = VERTEX(i);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i - 1);
v[2] = VERTEX(i);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i + 1);
v[2] = VERTEX(i + 2);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i + 2);
v[2] = VERTEX(i + 3);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i);
v[2] = VERTEX(i + 1);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i + 1);
v[2] = VERTEX(i - 1);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
v[1] = VERTEX(i - 1);
v[2] = VERTEX(i);
setup_tri( setup_ctx,
- calc_det(v[0], v[1], v[2]),
v[0],
v[1],
v[2] );
}
+/**
+ * Recalculate prim's determinant. This is needed as we don't have
+ * get this information through the vbuf_render interface & we must
+ * calculate it here.
+ */
+static float
+calc_det( const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4] )
+{
+ /* edge vectors e = v0 - v2, f = v1 - v2 */
+ const float ex = v0[0][0] - v2[0][0];
+ const float ey = v0[0][1] - v2[0][1];
+ const float fx = v1[0][0] - v2[0][0];
+ const float fy = v1[0][1] - v2[0][1];
+
+ /* det = cross(e,f).z */
+ return ex * fy - ey * fx;
+}
+
+
/**
* Do setup for triangle rasterization, then render the triangle.
*/
void setup_tri( struct setup_context *setup,
- float det,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4] )
{
+ float det = calc_det(v0, v1, v2);
+
/*
debug_printf("%s\n", __FUNCTION__ );
*/
setup->numFragsWritten = 0;
#endif
+
+
if (cull_tri( setup, det ))
return;
struct setup_context;
struct softpipe_context;
-void setup_tri( struct setup_context *setup,
- float det,
- const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4] );
+void
+setup_tri( struct setup_context *setup,
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4] );
void
setup_line(struct setup_context *setup,