-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.h
45 lines (30 loc) · 1 KB
/
renderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "tgaimage.h"
#include "geometry.h"
#include <vector>
#include "model.h"
class ModelShader;
class Renderer
{
public:
Renderer(TGAImage &image_);
Renderer(TGAImage &image_, Model* model_);
void drawTriangle(Vec3f* pts, TGAColor color);
void drawTriangle(Vec3f* pts, Vec2f* uvs);
void drawTriangle(Vec3f* pts, TGAColor* vCols);
void drawTriangle(Vec3f* pts, ModelShader* shader);
void drawModel();
private:
ModelShader *shader;
std::vector<std::vector<float>> zBuf;
TGAImage ℑ
Model* model;
void init();
Matrix viewport;
//float *zbuffer;
};
void drawLine(int x0, int y0, int x1, int y1, TGAImage &image, TGAColor color);
void drawLine(Vec2i v0, Vec2i v1, TGAImage &image, TGAColor color);
void drawTriangle(Vec2i v0, Vec2i v1, Vec2i v2, TGAImage &image, TGAColor color);
void drawTriangle(Vec2i* pts, TGAImage &image, TGAColor color);
Vec3f barycentric(Vec2i *pts, Vec2i P);
Vec3f barycentric(Vec3f A, Vec3f B, Vec3f C, Vec3f P);