Skip to content
Permalink
Browse files

- fix missing font glyphs

  • Loading branch information...
dpjudas committed Jun 23, 2019
1 parent 706bc0b commit e59c5cb9471efb9479708f01708ab5158163bf0e
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/rendering/polyrenderer/drawers/poly_triangle.cpp
@@ -658,6 +658,7 @@ void PolySWInputAssembly::Load(PolyTriangleThreadData *thread, const void *verti

bool PolyTriangleThreadData::IsDegenerate(const ShadedTriVertex *const* vert)
{
return false;
// A degenerate triangle has a zero cross product for two of its sides.
float ax = vert[1]->gl_Position.X - vert[0]->gl_Position.X;
float ay = vert[1]->gl_Position.Y - vert[0]->gl_Position.Y;
@@ -669,7 +670,7 @@ bool PolyTriangleThreadData::IsDegenerate(const ShadedTriVertex *const* vert)
float crossy = az * bx - ax * bz;
float crossz = ax * by - ay * bx;
float crosslengthsqr = crossx * crossx + crossy * crossy + crossz * crossz;
return crosslengthsqr <= 1.e-6f;
return crosslengthsqr <= 1.e-8f;
}

bool PolyTriangleThreadData::IsFrontfacing(TriDrawTriangleArgs *args)

2 comments on commit e59c5cb

@coelckers

This comment has been minimized.

Copy link
Owner

replied Jun 23, 2019

Is the 'return false' intentional?
Aside from that: For precision relevant floating point operations, use doubles, not floats. The same problem bit me in the ass in the real shader when trying to calculate the orientation of a vector with relation to a plane. floats are simply not precise enough for this kind of thing.

@dpjudas

This comment has been minimized.

Copy link
Collaborator Author

replied Jun 23, 2019

Oops, no that return false was an error.

About the precision for this particular calculation I'm not sure it needs the extra precision. I think the problem is more that the threshold was just set too big. I can't remember how exactly I ended up with 1.e-6f to begin with. If the problem persists I'll try your suggestion of using doubles instead.

Please sign in to comment.
You can’t perform that action at this time.