-
Notifications
You must be signed in to change notification settings - Fork 0
/
objects.h
80 lines (70 loc) · 1.78 KB
/
objects.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
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef OBJECTS_H
#define OBJECTS_H
#include <string>
#include <QtGui>
#include <QtCore>
#include <fstream>
#include <cstdio>
#include <QPoint>
#include <QColor>
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QPainter>
#include <QDebug>
#include <QtMath>
#include <QList>
#include <typeinfo>
namespace Ui {
class MainWindow;
}
enum cols {Black, Red, Green, Blue};
using namespace std;
class Object : public QGraphicsItem {
protected:
Ui::MainWindow *m_ui;
int m_size;
QPoint m_center;
int m_refl, m_gamma , m_z;
QColor m_color;
QPen m_pen;
QString m_name;
public:
Object();
void setValues(int nsize, QPoint nm_center, Ui::MainWindow *ui, string name);
void changeColour(QColor new_color);
QColor getColor();
void setSize(int val);
void setName(QString name);
void setGamma(int val);
void setRefl(int val);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
};
class Cube : public Object {
private:
QPoint m_points[8];
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
};
class Sphere : public Object {
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
};
class Plain: public Object {
private:
QPoint m_points[4];
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
};
class Light : public Object {
private:
int m_lightPower;
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setPower(int val);
QRectF boundingRect() const;
};
#endif // OBJECTS_H