|
@@ -21,21 +21,25 @@ RenderWidget::RenderWidget(QWidget *parent) :
|
21
|
21
|
|
22
|
22
|
_engine->addEntity(new UGEEntityAxes(_engine));
|
23
|
23
|
|
24
|
|
- UGEEntityCube* cube = new UGEEntityCube(_engine);
|
25
|
|
- cube->setTextureId("test");
|
26
|
|
- cube->rotate(Vector3D(0.0, 45.0, 45.0));
|
27
|
|
- cube->move(Vector3D(0, 1, 0));
|
28
|
|
- cube->setScale(Vector3D(1.0, 2.0, 1.0));
|
29
|
|
- cube->hide();
|
30
|
|
- _engine->addEntity(cube);
|
|
24
|
+ for (int i = 0; i < 100; ++i) {
|
|
25
|
+ UGEEntityCube* cube = new UGEEntityCube(_engine);
|
|
26
|
+ cube->setTextureId("test");
|
|
27
|
+ cube->rotate(Vector3D(0.0, 45.0, 45.0));
|
|
28
|
+ cube->move(Vector3D(0, i, i));
|
|
29
|
+ cube->setScale(Vector3D(1.0, 2.0, 1.0));
|
|
30
|
+ // cube->hide();
|
|
31
|
+ _engine->addEntity(cube);
|
|
32
|
+ _entities.append(cube);
|
|
33
|
+ }
|
31
|
34
|
|
32
|
35
|
WaveFrontObj* wavefrontObj = new WaveFrontObj(this);
|
33
|
36
|
wavefrontObj->openFile("/home/robin/Downloads/enterprise/obj/USSEnterprise.obj");
|
34
|
37
|
UGEEntityWaveFrontObj* obj = new UGEEntityWaveFrontObj(wavefrontObj, this);
|
35
|
38
|
_engine->addEntity(obj);
|
|
39
|
+ _entities.append(obj);
|
36
|
40
|
// obj->hide();
|
37
|
|
- _entity = cube;
|
38
|
|
-// animate();
|
|
41
|
+// _entity = cube;
|
|
42
|
+ animate();
|
39
|
43
|
}
|
40
|
44
|
|
41
|
45
|
void RenderWidget::initializeGL()
|
|
@@ -141,7 +145,9 @@ void RenderWidget::rotate(float phi, float theta)
|
141
|
145
|
void RenderWidget::animate()
|
142
|
146
|
{
|
143
|
147
|
// _angle += 0.1;
|
144
|
|
- _entity->rotate(Vector3D(0.0, 2.0, 2.0));
|
|
148
|
+ for (int i = 0; i < _entities.size(); ++i) {
|
|
149
|
+ _entities[i]->rotate(Vector3D(0.0, 2.0, 2.0));
|
|
150
|
+ }
|
145
|
151
|
QTimer::singleShot(20, this, SLOT(animate()));
|
146
|
152
|
update();
|
147
|
153
|
}
|