public bool RenderCache()
{
int sign;
if (this.cacheCount < 3)
{
/* Degenerate contour -- no output */
return true;
}
double normal_x = 0;
double normal_y = 0;
double normal_z = 1;
sign = this.ComputeNormal(ref normal_x, ref normal_y, ref normal_z);
if (sign == SIGN_INCONSISTENT)
{
// Fan triangles did not have a consistent orientation
return false;
}
if (sign == 0)
{
// All triangles were degenerate
return true;
}
/* Make sure we do the right thing for each winding rule */
switch (this.windingRule)
{
case Tesselator.WindingRuleType.Odd:
case Tesselator.WindingRuleType.NonZero:
break;
case Tesselator.WindingRuleType.Positive:
if (sign < 0) return true;
break;
case Tesselator.WindingRuleType.Negative:
if (sign > 0) return true;
break;
case Tesselator.WindingRuleType.ABS_GEQ_Two:
return true;
}
this.CallBegin(this.BoundaryOnly ? Tesselator.TriangleListType.LineLoop
: (this.cacheCount > 3) ? Tesselator.TriangleListType.TriangleFan
: Tesselator.TriangleListType.Triangles);
this.CallVertex(this.indexCached[0]);
if (sign > 0)
{
int c_count = this.cacheCount;
for (int vcIndex = 1; vcIndex < c_count; ++vcIndex)
{
this.CallVertex(indexCached[vcIndex]);
}
}
else
{
for (int vcIndex = this.cacheCount - 1; vcIndex > 0; --vcIndex)
{
this.CallVertex(indexCached[vcIndex]);
}
}
this.CallEnd();
return true;
}
#endregion