Ver código fonte

auto add/remove entities; add/remove cubes by click

develop
Robin Thoni 8 anos atrás
pai
commit
bede274623

+ 2
- 4
TheGame/TheGame.pro Ver arquivo

@@ -16,13 +16,11 @@ CONFIG += c++11
16 16
 SOURCES += main.cpp\
17 17
         mainwindow.cpp \
18 18
     renderwidget.cpp \
19
-    openglrenderdevice.cpp \
20
-    gamecube.cpp
19
+    openglrenderdevice.cpp
21 20
 
22 21
 HEADERS  += mainwindow.h \
23 22
     renderwidget.h \
24
-    openglrenderdevice.h \
25
-    gamecube.h
23
+    openglrenderdevice.h
26 24
 
27 25
 FORMS    += mainwindow.ui
28 26
 

+ 0
- 7
TheGame/gamecube.cpp Ver arquivo

@@ -1,7 +0,0 @@
1
-#include "gamecube.h"
2
-
3
-GameCube::GameCube(QObject *parent)
4
-    : UGEEntityCube(parent)
5
-{
6
-    _size = 1;
7
-}

+ 0
- 14
TheGame/gamecube.h Ver arquivo

@@ -1,14 +0,0 @@
1
-#ifndef GAMECUBE_H
2
-#define GAMECUBE_H
3
-
4
-#include "entities/ugeentitycube.h"
5
-
6
-class GameCube : public UGEEntityCube
7
-{
8
-public:
9
-    GameCube(QObject *parent = 0);
10
-
11
-public slots:
12
-};
13
-
14
-#endif // GAMECUBE_H

+ 36
- 34
TheGame/renderwidget.cpp Ver arquivo

@@ -8,7 +8,6 @@
8 8
 #include "entities/ugeentitywavefrontobj.h"
9 9
 #include "cameras/rotationcamera.h"
10 10
 #include "cameras/freeflycamera.h"
11
-#include "gamecube.h"
12 11
 
13 12
 RenderWidget::RenderWidget(QWidget *parent) :
14 13
     QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
@@ -34,27 +33,26 @@ RenderWidget::RenderWidget(QWidget *parent) :
34 33
 ////        cube->rotate(Vector3D(0.0, 45.0, 45.0));
35 34
 //        cube->move(Vector3D(0, i, i));
36 35
 ////        cube->setScale(Vector3D(1.0, 2.0, 1.0));
37
-//        _engine->addEntity(cube);
38 36
 //        _entities.append(cube);
39 37
 //    }
40 38
 
41
-    for(int i = 0,j = 0; i * j< 626;){
42
-        UGEEntityCube* cube = new GameCube(_engine);
43
-        cube->setTextureId("rubiks");
44
-        cube->move(Vector3D(i, 0, j++));
45
-        _engine->addEntity(cube);
46
-        _entities.append(cube);
47
-        if(j == 26){
48
-            j = 0;
49
-            i++;
39
+
40
+//    int xmax = 25;
41
+//    int zmax = 25;
42
+    int xmax = 1;
43
+    int zmax = 1;
44
+    for (int x = 0; x < xmax; ++x) {
45
+        for (int z = 0; z < zmax; ++z) {
46
+            UGEEntityCube* cube = new UGEEntityCube(_engine);
47
+            cube->setTextureId("rubiks");
48
+            cube->move(Vector3D(x - (xmax / 2), 0, z - (zmax / 2)));
50 49
         }
51 50
     }
52 51
 
53 52
     WaveFrontObj* wavefrontObj = new WaveFrontObj(this);
54 53
     wavefrontObj->openFile(_assetsPath + "objs/enterprise/USSEnterprise.obj");
55
-    UGEEntityWaveFrontObj* obj = new UGEEntityWaveFrontObj(wavefrontObj, this);
54
+    UGEEntityWaveFrontObj* obj = new UGEEntityWaveFrontObj(wavefrontObj, _engine);
56 55
     obj->hide();
57
-    _engine->addEntity(obj);
58 56
     _entities.append(obj);
59 57
     animate();
60 58
 }
@@ -82,22 +80,32 @@ void RenderWidget::resizeGL(int width, int height)
82 80
 void RenderWidget::mousePressEvent(QMouseEvent *event)
83 81
 {
84 82
     _camera->mousePressEvent(event);
85
-    if (event->buttons() & Qt::LeftButton) {
86
-//        Vector3D pos = _engine->get3DFrom2D(Vector2D(event->x(), height() - event->y()));
87
-        Vector3D pos = _camera->getPosition();
88
-       // qDebug() << pos.getX() << pos.getY() << pos.getZ();
83
+    bool left = event->buttons() & Qt::LeftButton;
84
+    bool right = event->buttons() & Qt::RightButton;
85
+    if (left || right) {
89 86
         Vector3D bestp;
90
-        bool ok = false;
91
-        for (int i = 0; i < _engine->getEntities().size(); i++) {
92
-            UGEEntity* entity = _engine->getEntities()[i];
93
-            bool provi;
94
-            Vector3D collision = entity->getVectorNearestIntesection(_camera->getDirection(), pos, &provi);
95
-            if (provi && (!ok || (pos - bestp).norm() > (pos - collision).norm())) {
96
-                bestp = collision;
97
-                UGEEntityAxes* axe = new UGEEntityAxes(_engine);
98
-                axe->move(bestp);
99
-                _engine->addEntity(axe);
100
-                ok = true;
87
+        UGEEntity* entity = _engine->getVectorNearestIntesection(_camera->getDirection(), _camera->getPosition(), &bestp);
88
+        if (entity) {
89
+//            UGEEntity* axe = new UGEEntityAxes(_engine);
90
+//            axe->move(bestp);
91
+            if (right) {
92
+                entity->deleteLater();
93
+            }
94
+            else if (left) {
95
+                Vector3D pos = entity->getPosition();
96
+                Vector3D diff = pos - bestp;
97
+                if (fmod(fabs(diff.getX()), 0.5) == 0) {
98
+                    pos.add(Vector3D(1 * (diff.getX() < 0 ? 1 : -1), 0, 0));
99
+                }
100
+                else if (fmod(fabs(diff.getY()), 0.5) == 0) {
101
+                    pos.add(Vector3D(0, 1 * (diff.getY() < 0 ? 1 : -1), 0));
102
+                }
103
+                else if (fmod(fabs(diff.getZ()), 0.5) == 0) {
104
+                    pos.add(Vector3D(0, 0, 1 * (diff.getZ() < 0 ? 1 : -1)));
105
+                }
106
+                UGEEntityCube* cube = new UGEEntityCube(_engine);
107
+                cube->move(pos);
108
+                cube->setTextureId("rubiks");
101 109
             }
102 110
         }
103 111
     }
@@ -111,12 +119,6 @@ void RenderWidget::mouseReleaseEvent(QMouseEvent *event)
111 119
 void RenderWidget::mouseMoveEvent(QMouseEvent *event)
112 120
 {
113 121
     _camera->mouseMoveEvent(event);
114
-
115
-//    Vector3D dd = _device->get2DFrom3D(Vector3D(0.5, 0.5, 0.5));
116
-//    dd.setY(height() - dd.getY());
117
-//    qDebug() << event->pos() << dd;
118
-//    pos = _device->get3DFrom2D(event->x(), height() - event->y());
119
-
120 122
 }
121 123
 
122 124
 void RenderWidget::mouseDoubleClickEvent(QMouseEvent *event)

+ 4
- 3
UGameEngine/cameras/freeflycamera.cpp Ver arquivo

@@ -15,9 +15,10 @@ FreeFlyCamera::FreeFlyCamera(UGameEngine *engine, QWidget* widget)
15 15
 
16 16
 void FreeFlyCamera::mouseMoveEvent(QMouseEvent *event)
17 17
 {
18
-    QPoint diff = (event->pos() - _lastPoint) / 2;
18
+    double ratio = 0.5;
19
+    QPoint diff = (event->pos() - _lastPoint);
19 20
 
20
-    rotate(-diff.x(), diff.y());
21
+    rotate(-diff.x() * ratio, diff.y() * ratio);
21 22
 
22 23
     QPoint glob = _widget->mapToGlobal(QPoint(_widget->width()/2,_widget->height()/2));
23 24
     QCursor::setPos(glob);
@@ -62,7 +63,7 @@ void FreeFlyCamera::updateLookAt()
62 63
     _engine->lookAt(_position, _direction + _position);
63 64
 }
64 65
 
65
-void FreeFlyCamera::rotate(float phi, float theta)
66
+void FreeFlyCamera::rotate(double phi, double theta)
66 67
 {
67 68
     _phi = Tools::normalizeAngle(_phi + phi);
68 69
     if (_theta + theta >= 180.0) {

+ 1
- 1
UGameEngine/cameras/freeflycamera.h Ver arquivo

@@ -16,7 +16,7 @@ public:
16 16
 
17 17
     virtual void updateLookAt();
18 18
 
19
-    void rotate(float phi, float theta);
19
+    void rotate(double phi, double theta);
20 20
 
21 21
 private:
22 22
 

+ 19
- 3
UGameEngine/engine/ugameengine.cpp Ver arquivo

@@ -84,10 +84,21 @@ Vector3D UGameEngine::get3DFrom2D(const Vector2D &pos)
84 84
     return _device->get3DFrom2D(pos);
85 85
 }
86 86
 
87
-UGEEntity *UGameEngine::getVectorNearestIntesection(const Vector3D &vector, const Vector3D &pos)
87
+UGEEntity *UGameEngine::getVectorNearestIntesection(const Vector3D &vector, const Vector3D &pos, Vector3D* bestp)
88 88
 {
89
-    Vector3D nearestPoint;
90
-    UGEEntity* entity = 0;
89
+    UGEEntity* beste = 0;
90
+    bool ok = false;
91
+    for (int i = 0; i < _entitites.size(); i++) {
92
+        UGEEntity* entity = _entitites[i];
93
+        bool provi;
94
+        Vector3D collision = entity->getVectorNearestIntesection(vector, pos, &provi);
95
+        if (provi && (!ok || (pos - *bestp).norm() > (pos - collision).norm())) {
96
+            *bestp = collision;
97
+            beste = entity;
98
+            ok = true;
99
+        }
100
+    }
101
+    return beste;
91 102
 }
92 103
 
93 104
 void UGameEngine::addEntity(UGEEntity *entity)
@@ -95,6 +106,11 @@ void UGameEngine::addEntity(UGEEntity *entity)
95 106
     _entitites.append(entity);
96 107
 }
97 108
 
109
+void UGameEngine::removeEntity(UGEEntity *entity)
110
+{
111
+    _entitites.removeOne(entity);
112
+}
113
+
98 114
 void UGameEngine::lookAt(const Vector3D &eye, const Vector3D &center, const Vector3D &up)
99 115
 {
100 116
     _device->lookAt(eye, center, up);

+ 4
- 1
UGameEngine/engine/ugameengine.h Ver arquivo

@@ -6,6 +6,7 @@
6 6
 #include "entitiesupdatethread.h"
7 7
 
8 8
 class EntitiesUpdateThread;
9
+class UGEEntity;
9 10
 
10 11
 class UGameEngine : public QObject
11 12
 {
@@ -24,11 +25,13 @@ public:
24 25
 
25 26
     Vector3D get3DFrom2D(const Vector2D &pos);
26 27
 
27
-    UGEEntity* getVectorNearestIntesection(const Vector3D& vector, const Vector3D &pos);
28
+    UGEEntity* getVectorNearestIntesection(const Vector3D& vector, const Vector3D &pos, Vector3D *bestp);
28 29
 
29 30
 public slots:
30 31
     void addEntity(UGEEntity* entity);
31 32
 
33
+    void removeEntity(UGEEntity* entity);
34
+
32 35
     void lookAt(const Vector3D& eye, const Vector3D& center, const Vector3D& up = Vector3D(0.0, 1.0, 0.0));
33 36
 
34 37
     void setClearColor(const QColor &clearColor);

+ 26
- 9
UGameEngine/entities/ugeentity.cpp Ver arquivo

@@ -1,21 +1,23 @@
1 1
 #include "ugeentity.h"
2 2
 #include "utils/tools.h"
3 3
 
4
-UGEEntity::UGEEntity(QObject *parent)
4
+UGEEntity::UGEEntity(UGameEngine *engine, QObject *parent)
5 5
     : QObject(parent)
6
-    , _scale(1.0, 1.0, 1.0)
7
-    , _visible(true)
8
-    , _needUpdate(true)
9
-    , _zero(0.001)
6
+    , _engine(engine)
10 7
 {
11
-    connect(this, SIGNAL(positionChanged()), this, SLOT(needUpdate()));
12
-    connect(this, SIGNAL(rotationChanged()), this, SLOT(needUpdate()));
13
-    connect(this, SIGNAL(scaleChanged()), this, SLOT(needUpdate()));
14
-    connect(this, SIGNAL(colorChanged()), this, SLOT(needUpdate()));
8
+    init();
9
+}
10
+
11
+UGEEntity::UGEEntity(UGameEngine *engine)
12
+    : QObject(engine)
13
+    , _engine(engine)
14
+{
15
+    init();
15 16
 }
16 17
 
17 18
 UGEEntity::~UGEEntity()
18 19
 {
20
+    _engine->removeEntity(this);
19 21
 }
20 22
 
21 23
 Vector3D UGEEntity::getPosition() const
@@ -234,6 +236,21 @@ void UGEEntity::needUpdate()
234 236
     _needUpdate = true;
235 237
 }
236 238
 
239
+void UGEEntity::init()
240
+{
241
+    connect(this, SIGNAL(positionChanged()), this, SLOT(needUpdate()));
242
+    connect(this, SIGNAL(rotationChanged()), this, SLOT(needUpdate()));
243
+    connect(this, SIGNAL(scaleChanged()), this, SLOT(needUpdate()));
244
+    connect(this, SIGNAL(colorChanged()), this, SLOT(needUpdate()));
245
+
246
+    _scale = Vector3D(1.0, 1.0, 1.0);
247
+    _visible = true;
248
+    _needUpdate =true;
249
+    _zero = 0.001;
250
+
251
+    _engine->addEntity(this);
252
+}
253
+
237 254
 
238 255
 Vector3D UGEEntity::getVectorNearestFaceIntersection(const Vector3D & p0, const Vector3D &p1, const Vector3D &p2, const Vector3D &vector, const Vector3D &pos, bool* ok){
239 256
     Vector3D v1 = p1 - p0;

+ 10
- 1
UGameEngine/entities/ugeentity.h Ver arquivo

@@ -7,12 +7,16 @@
7 7
 #include "utils/vector3d.h"
8 8
 #include "utils/matrix3x3.h"
9 9
 #include "engine/abstractrenderdevice.h"
10
+#include "engine/ugameengine.h"
11
+
12
+class UGameEngine;
10 13
 
11 14
 class UGEEntity : public QObject
12 15
 {
13 16
     Q_OBJECT
14 17
 public:
15
-    explicit UGEEntity(QObject *parent = 0);
18
+    explicit UGEEntity(UGameEngine* engine, QObject *parent);
19
+    explicit UGEEntity(UGameEngine* engine);
16 20
     virtual ~UGEEntity();
17 21
 
18 22
     Vector3D getPosition() const;
@@ -90,6 +94,8 @@ signals:
90 94
     void colorChanged(QColor color);
91 95
 
92 96
 protected:
97
+    UGameEngine* _engine;
98
+
93 99
     Vector3D _position;
94 100
 
95 101
 //    Vector3D _speed;
@@ -108,6 +114,9 @@ protected:
108 114
 
109 115
     double _zero;
110 116
 
117
+private:
118
+    void init();
119
+
111 120
 };
112 121
 
113 122
 #endif // UGEENTITY_H

+ 27
- 5
UGameEngine/entities/ugeentityaxes.cpp Ver arquivo

@@ -1,15 +1,22 @@
1 1
 #include "ugeentityaxes.h"
2 2
 
3
-UGEEntityAxes::UGEEntityAxes(QObject *parent) :
4
-    UGEEntity(parent)
3
+UGEEntityAxes::UGEEntityAxes(UGameEngine *engine, QObject *parent) :
4
+    UGEEntity(engine, parent)
5 5
 {
6
+    init();
7
+}
8
+
9
+UGEEntityAxes::UGEEntityAxes(UGameEngine *engine) :
10
+    UGEEntity(engine)
11
+{
12
+    init();
6 13
 }
7 14
 
8 15
 void UGEEntityAxes::onDraw(AbstractRenderDevice *device)
9 16
 {
10
-    drawLine(device, ColorVector3D(Qt::red, 0.0, 0.0, 0.0), ColorVector3D(Qt::red, 1.0, 0.0, 0.0), 2.5);
11
-    drawLine(device, ColorVector3D(Qt::green, 0.0, 0.0, 0.0), ColorVector3D(Qt::green, 0.0, 1.0, 0.0), 2.5);
12
-    drawLine(device, ColorVector3D(Qt::blue, 0.0, 0.0, 0.0), ColorVector3D(Qt::blue, 0.0, 0.0, 1.0), 2.5);
17
+    drawLine(device, ColorVector3D(Qt::red, 0.0, 0.0, 0.0), ColorVector3D(Qt::red, _size, 0.0, 0.0), 2.5);
18
+    drawLine(device, ColorVector3D(Qt::green, 0.0, 0.0, 0.0), ColorVector3D(Qt::green, 0.0, _size, 0.0), 2.5);
19
+    drawLine(device, ColorVector3D(Qt::blue, 0.0, 0.0, 0.0), ColorVector3D(Qt::blue, 0.0, 0.0, _size), 2.5);
13 20
 }
14 21
 
15 22
 Vector3D UGEEntityAxes::getVectorNearestIntesection(const Vector3D &vector, const Vector3D &pos, bool *ok)
@@ -17,3 +24,18 @@ Vector3D UGEEntityAxes::getVectorNearestIntesection(const Vector3D &vector, cons
17 24
     *ok = false;
18 25
     return Vector3D();
19 26
 }
27
+double UGEEntityAxes::size() const
28
+{
29
+    return _size;
30
+}
31
+
32
+void UGEEntityAxes::setSize(double size)
33
+{
34
+    _size = size;
35
+}
36
+
37
+void UGEEntityAxes::init()
38
+{
39
+    _size = 1.0;
40
+}
41
+

+ 11
- 1
UGameEngine/entities/ugeentityaxes.h Ver arquivo

@@ -7,16 +7,26 @@ class UGEEntityAxes : public UGEEntity
7 7
 {
8 8
     Q_OBJECT
9 9
 public:
10
-    explicit UGEEntityAxes(QObject *parent = 0);
10
+    explicit UGEEntityAxes(UGameEngine* engine, QObject *parent);
11
+    explicit UGEEntityAxes(UGameEngine* engine);
11 12
 
12 13
     virtual void onDraw(AbstractRenderDevice* device);
13 14
 
14 15
     virtual Vector3D getVectorNearestIntesection(const Vector3D &vector, const Vector3D &pos, bool* ok);
15 16
 
17
+    double size() const;
18
+    void setSize(double size);
19
+
16 20
 signals:
17 21
 
18 22
 public slots:
19 23
 
24
+protected:
25
+    double _size;
26
+
27
+private:
28
+    void init();
29
+
20 30
 };
21 31
 
22 32
 #endif // UGEENTITYAXES_H

+ 17
- 45
UGameEngine/entities/ugeentitycube.cpp Ver arquivo

@@ -1,11 +1,15 @@
1 1
 #include "ugeentitycube.h"
2 2
 
3
-UGEEntityCube::UGEEntityCube(QObject *parent)
4
-    : UGEEntity(parent)
5
-    , _size(1.0)
3
+UGEEntityCube::UGEEntityCube(UGameEngine *engine, QObject *parent)
4
+    : UGEEntity(engine, parent)
6 5
 {
7
-    connect(this, SIGNAL(sizeChanged()), this, SLOT(needUpdate()));
8
-    connect(this, SIGNAL(textureChanged()), this, SLOT(needUpdate()));
6
+    init();
7
+}
8
+
9
+UGEEntityCube::UGEEntityCube(UGameEngine *engine)
10
+    : UGEEntity(engine)
11
+{
12
+    init();
9 13
 }
10 14
 
11 15
 double UGEEntityCube::getSize() const
@@ -56,6 +60,14 @@ void UGEEntityCube::setTextureId(const QVariant &textureId)
56 60
     emit textureChanged(_textureId);
57 61
 }
58 62
 
63
+void UGEEntityCube::init()
64
+{
65
+    connect(this, SIGNAL(sizeChanged()), this, SLOT(needUpdate()));
66
+    connect(this, SIGNAL(textureChanged()), this, SLOT(needUpdate()));
67
+
68
+    _size = 1;
69
+}
70
+
59 71
 void UGEEntityCube::onUpdate()
60 72
 {
61 73
     double r = _size / 2;
@@ -114,9 +126,6 @@ void UGEEntityCube::onUpdate()
114 126
 Vector3D UGEEntityCube::getVectorNearestIntesection(const Vector3D &vector, const Vector3D &origin, bool *ok)
115 127
 {
116 128
     *ok = false;
117
-    //    Vector3D p1 = points[1] - p;
118
-    //    Vector3D p2 = points[1];
119
-    //    Vector3D n = p1.crossProduct(p2);
120 129
     Vector3D bestP;
121 130
     for (int i = 0; i < _facesTexture.size(); ++i){
122 131
         bool provi = false;
@@ -129,44 +138,7 @@ Vector3D UGEEntityCube::getVectorNearestIntesection(const Vector3D &vector, cons
129 138
                 bestP = pinter;
130 139
                 *ok = true;
131 140
             }
132
-            //qDebug() << bestP.getX() << bestP.getY() << bestP.getZ();
133 141
         }
134 142
     }
135 143
     return bestP;
136
-
137
-
138
-//    Vector3D inv(1.0 / vector.getX(), 1.0 / vector.getY(), 1.0 / vector.getZ());
139
-//    float tmin, tmax, tymin, tymax, tzmin, tzmax;
140
-
141
-//    tmin = (parameters[r.sign[0]].x() - origin.getX()) * inv.getX();
142
-//    tmax = (parameters[1-r.sign[0]].x() - origin.getX()) * inv.getX();
143
-//    tymin = (parameters[r.sign[1]].y() - origin.getY()) * inv.getY();
144
-//    tymax = (parameters[1-r.sign[1]].y() - origin.getY()) * inv.getY();
145
-//    if ( (tmin > tymax) || (tymin > tmax) ) {
146
-//        *ok = false;
147
-//        return Vector3D();
148
-//    }
149
-//    if (tymin > tmin)
150
-//    tmin = tymin;
151
-//    if (tymax < tmax)
152
-//    tmax = tymax;
153
-//    tzmin = (parameters[r.sign[2]].z() - r.origin.z()) * r.inv_direction.z();
154
-//    tzmax = (parameters[1-r.sign[2]].z() - r.origin.z()) * r.inv_direction.z();
155
-//    if ( (tmin > tzmax) || (tzmin > tmax) ) {
156
-//        *ok = false;
157
-//        return Vector3D();
158
-//    }
159
-//    *ok = true;
160
-//    return _position;
161
-
162
-//    if (tzmin > tmin)
163
-//    tmin = tzmin;
164
-//    if (tzmax < tmax)
165
-//    tmax = tzmax;
166
-//    if ((tmin < t1) && (tmax > t0)) {
167
-//        *ok = true;
168
-//        return _position;
169
-//    }
170
-//    *ok = false;
171
-//    return Vector3D();
172 144
 }

+ 5
- 1
UGameEngine/entities/ugeentitycube.h Ver arquivo

@@ -7,7 +7,8 @@ class UGEEntityCube : public UGEEntity
7 7
 {
8 8
     Q_OBJECT
9 9
 public:
10
-    explicit UGEEntityCube(QObject *parent = 0);
10
+    explicit UGEEntityCube(UGameEngine* engine, QObject *parent);
11
+    explicit UGEEntityCube(UGameEngine* engine);
11 12
 
12 13
     double getSize() const;
13 14
 
@@ -40,6 +41,9 @@ protected:
40 41
 
41 42
     QList<QList<ColorVector3D> > _facesColor;
42 43
 
44
+private:
45
+    void init();
46
+
43 47
 };
44 48
 
45 49
 #endif // UGEENTITYCUBE_H

+ 10
- 2
UGameEngine/entities/ugeentitywavefrontobj.cpp Ver arquivo

@@ -1,9 +1,17 @@
1 1
 #include "ugeentitywavefrontobj.h"
2 2
 
3
-UGEEntityWaveFrontObj::UGEEntityWaveFrontObj(WaveFrontObj *obj, QObject *parent)
4
-    : UGEEntity(parent)
3
+UGEEntityWaveFrontObj::UGEEntityWaveFrontObj(WaveFrontObj *obj, UGameEngine *engine, QObject *parent)
4
+    : UGEEntity(engine, parent)
5 5
     , _obj(obj)
6 6
 {
7
+
8
+}
9
+
10
+UGEEntityWaveFrontObj::UGEEntityWaveFrontObj(WaveFrontObj *obj, UGameEngine *engine)
11
+    : UGEEntity(engine)
12
+    , _obj(obj)
13
+{
14
+
7 15
 }
8 16
 
9 17
 void UGEEntityWaveFrontObj::onDraw(AbstractRenderDevice *device)

+ 2
- 1
UGameEngine/entities/ugeentitywavefrontobj.h Ver arquivo

@@ -8,7 +8,8 @@ class UGEEntityWaveFrontObj : public UGEEntity
8 8
 {
9 9
     Q_OBJECT
10 10
 public:
11
-    explicit UGEEntityWaveFrontObj(WaveFrontObj* obj, QObject *parent = 0);
11
+    explicit UGEEntityWaveFrontObj(WaveFrontObj* obj, UGameEngine* engine, QObject *parent);
12
+    explicit UGEEntityWaveFrontObj(WaveFrontObj* obj, UGameEngine* engine);
12 13
 
13 14
     virtual void onDraw(AbstractRenderDevice* device);
14 15
 

Carregando…
Cancelar
Salvar