#3265 Score: 0
左趋趋
Participant
4 pts

你看这样行不

void rst::rasterizer::set_pixel(const Eigen::Vector3f &point, const Eigen::Vector3f &color)
{
    // old index: auto ind = point.y() + point.x() * width;
    int j = round(point.y());
    int i = round(point.x());
    if (j < 0 || j > height - 1)
        return;
    if (i < 0 || i > width - 1)
        return;
    // auto ind = (height - 1 - round(point.y())) * width + round(point.x());
    auto ind = (height - 1 - j) * width + i;
    frame_buf[ind] = color;
}