Skip to content
Snippets Groups Projects

Implements #216 triangle renderer

Merged Nicolas Pope requested to merge feature/216/triangles into master
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
@@ -136,16 +136,16 @@ float getZAtCoordinate(const float3 &barycentricCoord, const float (&tri)[3]) {
const int maxX = max(v[0].x, max(v[1].x, v[2].x));
const int maxY = max(v[0].y, max(v[1].y, v[2].y));
//if ((maxX - minX) * (maxY - minY) > 200) return;
int incx = ((maxX - minX) / 20) + 1;
int incy = ((maxY - minY) / 20) + 1;
if ((maxX - minX) * (maxY - minY) > 200) return;
//int incx = ((maxX - minX) / 20) + 1;
//int incy = ((maxY - minY) / 20) + 1;
float2 vs0 = make_float2(v[0].x, v[0].y);
float2 vs1 = make_float2(v[1].x, v[1].y);
float2 vs2 = make_float2(v[2].x, v[2].y);
for (int sy=minY; sy <= maxY; sy+=incy) {
for (int sx=minX; sx <= maxX; sx+=incx) {
for (int sy=minY; sy <= maxY; ++sy) {
for (int sx=minX; sx <= maxX; ++sx) {
if (sx >= params.camera.width || sx < 0 || sy >= params.camera.height || sy < 0) continue;
//float2 q = make_float2(sx, sy);
//float s = det(q - vs0, vs1) / det(vs0, vs1); //cross(q, vs2) / cross(vs1, vs2);
Loading