+static int cxr_solid_checkerr(struct cxr_mesh *mesh, struct cxr_auto_buffer *abverts )
+{
+ int err_count = 0;
+
+ for( int i=0; i<mesh->polys.count; i++ )
+ {
+ int plane_err = 0;
+
+ struct cxr_polygon *poly = cxr_ab_ptr(&mesh->polys,i);
+ v4f plane;
+
+ normal_to_plane( poly->normal, poly->center, plane );
+
+ for( int j=0; j<poly->loop_total; j++ )
+ {
+ struct cxr_loop *loop = cxr_ab_ptr(&mesh->loops, poly->loop_start+j);
+ double *vert = cxr_ab_ptr(abverts,loop->index);
+
+ if( fabs(plane_polarity(plane,vert)) > 0.0025 )
+ {
+ err_count ++;
+ plane_err ++;
+
+ v3f ref;
+ plane_project_point( plane, vert, ref );
+
+ cxr_debug_line( ref, vert, colour_error );
+ cxr_debug_box( vert, 0.1, colour_error );
+ }
+ }
+
+ if( plane_err )
+ cxr_debug_poly( mesh, poly, cxr_ab_ptr(abverts,0), colour_error );
+ }
+
+ return err_count;
+}
+