|
|
@@ -62,9 +62,9 @@ namespace FrameworkTests
|
|
|
});
|
|
|
window.setMouseAction(Framework::_ret1ME);
|
|
|
window.setKeyboardAction(Framework::_ret1TE);
|
|
|
+ Framework::DirectX12* api = new Framework::DirectX12();
|
|
|
Framework::Screen3D screen(
|
|
|
- dynamic_cast<Framework::NativeWindow*>(window.getThis()),
|
|
|
- new Framework::DirectX12());
|
|
|
+ dynamic_cast<Framework::NativeWindow*>(window.getThis()), api);
|
|
|
screen.setHandleUserInputsOnTick(0);
|
|
|
window.setScreen(
|
|
|
dynamic_cast<Framework::Screen*>(screen.getThis()));
|
|
|
@@ -77,7 +77,6 @@ namespace FrameworkTests
|
|
|
cam.setViewDirection(target);
|
|
|
Framework::World3D world;
|
|
|
|
|
|
- Framework::Model3D cube;
|
|
|
Framework::Model3DData* data
|
|
|
= screen.zGraphicsApi()->createModel("cube");
|
|
|
data->setAmbientFactor(0.f);
|
|
|
@@ -236,30 +235,59 @@ namespace FrameworkTests
|
|
|
p->indexList[5] = 2 + 20;
|
|
|
data->addPolygon(p);
|
|
|
data->calculateNormals();
|
|
|
- cube.setModelData(data);
|
|
|
- cube.setPosition(0, 100, 0);
|
|
|
- cube.setSize(50);
|
|
|
- cube.setRotation(0.5, 0.5, 0.5);
|
|
|
- cube.tick(0.1);
|
|
|
- world.addDrawable(
|
|
|
- dynamic_cast<Framework::Model3D*>(cube.getThis()));
|
|
|
+ Framework::Array<Framework::Model3D*> cubes;
|
|
|
+ std::function<void(int, int, int)> addCube
|
|
|
+ = [&cubes, &world, &data](int x, int y, int z) {
|
|
|
+ Framework::Model3D* cube = new Framework::Model3D();
|
|
|
+ cube->setModelData(dynamic_cast<Framework::Model3DData*>(
|
|
|
+ data->getThis()));
|
|
|
+ cube->setPosition(x, y, z);
|
|
|
+ cube->setSize(5 + rand() % 5);
|
|
|
+ cube->setRotation(
|
|
|
+ rand() % 10 / 5, rand() % 10 / 5, rand() % 10 / 5);
|
|
|
+ world.addDrawable(cube);
|
|
|
+ cubes.add(cube);
|
|
|
+ };
|
|
|
+ for (int i = 0; i < 10000; i++)
|
|
|
+ {
|
|
|
+ addCube(rand() % 1000 - 500,
|
|
|
+ rand() % 1000 - 500,
|
|
|
+ rand() % 1000 - 500);
|
|
|
+ }
|
|
|
|
|
|
cam.setWorld(dynamic_cast<Framework::World3D*>(world.getThis()));
|
|
|
cam.addStyle(Framework::Cam3D::Style::Movable
|
|
|
| Framework::Cam3D::Style::Rotatable
|
|
|
| Framework::Cam3D::Style::Zoomable
|
|
|
| Framework::Cam3D::Style::Tick);
|
|
|
+ cam.setMovementSpeed(0.1f);
|
|
|
screen.addKamera(dynamic_cast<Framework::Cam3D*>(cam.getThis()));
|
|
|
|
|
|
Framework::RenderTh rTh;
|
|
|
rTh.setMaxFps(-1);
|
|
|
rTh.setQuiet(0);
|
|
|
+ rTh.setMaxFps(-1);
|
|
|
rTh.setScreen(dynamic_cast<Framework::Screen*>(screen.getThis()));
|
|
|
- rTh.setTickFunktion([&cube](void* p, void* f, double tick) {
|
|
|
- cube.setRotationX(cube.getXRotation() + tick);
|
|
|
- cube.setRotationY(cube.getXRotation() + tick / 10);
|
|
|
- cube.setRotationZ(cube.getXRotation() + tick / 50);
|
|
|
- });
|
|
|
+ double sum = 0;
|
|
|
+ rTh.setTickFunktion(
|
|
|
+ [&cubes, &sum, &addCube](void* p, void* f, double tick) {
|
|
|
+ for (Framework::Model3D* cube : cubes)
|
|
|
+ {
|
|
|
+ cube->setRotationX(cube->getXRotation() + tick * 2);
|
|
|
+ cube->setRotationY(cube->getXRotation() + tick / 5);
|
|
|
+ cube->setRotationZ(cube->getXRotation() + tick / 25);
|
|
|
+ cube->setSize(
|
|
|
+ cube->getSize() + tick * 5 * (sum > 2.5 ? 1 : -1));
|
|
|
+ }
|
|
|
+ sum += tick;
|
|
|
+ if (sum > 5)
|
|
|
+ {
|
|
|
+ sum -= 5;
|
|
|
+ /* addCube(rand() % 1000 - 500,
|
|
|
+ rand() % 1000 - 500,
|
|
|
+ rand() % 1000 - 500);*/
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
rTh.beginn();
|
|
|
Framework::StartMessageLoop();
|