-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic2D.h
47 lines (37 loc) · 1.17 KB
/
basic2D.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
45
46
47
#ifndef BASIC2D_H
#define BASIC2D_H
#include "display.h"
#define WINDOW_X 1200
#define WINDOW_Y 700
void drawLine(int,int,int,int,Color color=White);
void drawLine(x_yCoordinate,x_yCoordinate,Color color=White);
void drawPolygon(x_yCoordinate,x_yCoordinate,x_yCoordinate,Color color = White);
void drawPolygon(x_yCoordinate,x_yCoordinate,
x_yCoordinate,x_yCoordinate,Color color= White);
class Edge {
public:
Color Color1, Color2;
int X1, Y1, X2, Y2,Z1,Z2;
Edge(x_yCoordinate c1,const Color &, x_yCoordinate c2,const Color &);
};
class Span {
public:
Color Color1,Color2;
int X1, X2 , Z1 , Z2;
Span(int x1,const Color &color1, int x2,const Color &color2);
};
class Rasterizer {
public:
float A,B,C,D;
x_yCoordinate n;
float k;
float depth;
float z[1200][700];
Rasterizer(){}
//{for(int i=0;i<1200;i++){for(int j=0;j<700;j++){z[i][j]=0;}}}
void DrawSpan(const Span &span, int y);
void DrawSpansBetweenEdges(const Edge &e1, const Edge &e2);
void clearZbuffer();
void DrawTriangle(x_yCoordinate,const Color &color1,x_yCoordinate,const Color &color2,x_yCoordinate,const Color &color3);
};
#endif // BASIC2D_H