-
Notifications
You must be signed in to change notification settings - Fork 0
/
Canvas.h
68 lines (51 loc) · 1.42 KB
/
Canvas.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef Canvas_H
#define Canvas_H
#include <QtGui/QWidget>
#include <QtGui/QLabel>
#include <QPainter>
#include <QColor>
#include "Layer.h"
#include "Face.h"
#define Air 1
#define Persp 2
#define Front 3
#define Lat 4
class Canvas : public QWidget, public Observer
{
Q_OBJECT
public:
Canvas( QWidget * parent = 0 );
~Canvas();
void SetLabel( QLabel * );
void SetInitialCoords( int, int );
void SetFinalCoords( int, int );
void UpdateCoords( int, int );
void SetSubject( vector < Layer * > * S );
public slots:
void ToggleAxis( void );
void Update();
protected:
void paintEvent( QPaintEvent * );
void mouseMoveEvent( QMouseEvent * );
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
private:
void ZBuffer( QPainter * );
void fill( QPainter *, float **, float, float, float, float, float, float,
Face *, QColor, bool, punto3d *, int );
QColor lightColor ( float, float, float, Normal, QColor, punto3d *, int );
float Difuse ( Normal, float, float, float, punto3d *, int );
struct Coords
{
float x, y;
bool operator < ( const Coords & c ) const { return c.y < y; }
};
int x, y, j, k;
QLabel * L;
QString LabelText;
bool axis, pressed;
vector < Layer * > * Lay;
vector < vector < Edge * > * > Edges;
vector < QColor > C;
};
#endif