| 113 | } |
| 114 | |
| 115 | float Buffer::depth(const Projection &projection, const Vec3 &normal, const int pixel_x, const int pixel_y) const |
| 116 | { |
| 117 | const float center_x = (static_cast<float>(pixel_x) + 0.5f) * dx; |
| 118 | const float center_y = (static_cast<float>(pixel_y) + 0.5f) * dy; |
| 119 | |
| 120 | if (std::fabs(normal.z) < 1e-7f) |
| 121 | { |
| 122 | return projection.p1.z; |
| 123 | } |
| 124 | |
| 125 | const float d_z = normal.x * (center_x - projection.p1.x) + normal.y * (center_y - projection.p1.y); |
| 126 | const float z = projection.p1.z - d_z / normal.z; |
| 127 | |
| 128 | return z; |
| 129 | } |
| 130 | |
| 131 | void Buffer::draw_projection(const Projection &projection, const char c, int material) |
| 132 | { |
nothing calls this directly
no outgoing calls
no test coverage detected