init commit

This commit is contained in:
2025-06-11 22:45:11 +08:00
commit 71307f3e53
115 changed files with 13922 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#include "dvr_triangle.h"
#include "pipe/dvc_rasterizer.h"
void Triangle::build(const davinci::fVector3& _pixelColor, int32_t canvasWidth, int32_t canvasHeight, bool debug)
{
pixelColor = _pixelColor;
pixels.clear();
//make sure it's cw
bool ccw = false;
if ((p2 - p1).crossProduct(p0 - p2).z > 0) {
ccw = true;
}
//build pixel data
davinci::Rasterizer::drawTriangleLarrabee(canvasWidth, canvasHeight,
p0.xy(), p1.xy(), p2.xy(),
[this](std::pair<int32_t, int32_t> pos, const davinci::fVector3& t)
{
pixels.push_back(pos);
},
ccw
);
}