MinusculeRender/src/rasterizer.cc

25 lines
711 B
C++
Raw Normal View History

2024-03-01 21:31:47 +08:00
// Copyright 2024 Bytedance Inc. All Rights Reserved.
// Author: tianlei.richard@qq.com (tianlei.richard)
#include "rasterizer.h"
#include <limits>
Rasterizer::Rasterizer(const int width, const int height)
: width_(width), height_(height),
pixels_(std::vector<std::vector<int>>(
height,
std::vector<int>(width, std::numeric_limits<int>::infinity()))) {}
void Rasterizer::rasterize(const Triangle &t) {
const auto &aabb = t.axis_align_bbox();
const int x_min = aabb.x;
const int x_max = aabb.x + aabb.width;
const int y_min = aabb.y;
const int y_max = aabb.y + aabb.height;
for (int i = x_min; i < x_max; ++i) {
for (int j = y_min; j < y_max; ++j) {
}
}
}