feat: barycentric interpolation for normals
This commit is contained in:
@@ -11,6 +11,7 @@ class Rendertarget {
|
||||
|
||||
Rendertarget(int width, int height) : width(width), height(height) {
|
||||
pixels = new decimal[width * height * 3];
|
||||
depth = new decimal[width * height];
|
||||
}
|
||||
|
||||
void set(int x, int y, vec3 val) {
|
||||
@@ -25,8 +26,17 @@ class Rendertarget {
|
||||
(*val)[i] = pixels[start + i];
|
||||
}
|
||||
}
|
||||
decimal getDepth(int x, int y) { return depth[width * y + x]; }
|
||||
void setDepth(int x, int y, decimal val) { depth[width * y + x] = val; }
|
||||
|
||||
void clearDepth() {
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
depth[i].i = std::numeric_limits<int32_t>::max();
|
||||
}
|
||||
}
|
||||
|
||||
decimal *pixels;
|
||||
decimal *depth;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user