init commit
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user