-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
48 lines (40 loc) · 1.51 KB
/
main.cpp
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
//
// main.cpp
// Sagget
//
// Created by philipp on 13.10.2018.
// Copyright (c) 2018 Philipp Engelhard. All rights reserved.
//
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QSurface>
#include "src/common/values.h"
#include "src/common/qmlvalues.h"
#include "src/generation/generator.h"
#include "src/graphics/planetsurfacematerial.h"
#include "src/graphics/moonsurfacematerial.h"
#include "src/graphics/geospheremesh.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QSurfaceFormat defaultFormat;
defaultFormat.setProfile(QSurfaceFormat::CoreProfile);
defaultFormat.setVersion(3, 2);
defaultFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
QSurfaceFormat::setDefaultFormat(defaultFormat);
qmlRegisterType<Saggat::PlanetSurfaceMaterial>("Saggat", 1, 0, "PlanetSurfaceMaterial");
qmlRegisterType<Saggat::MoonSurfaceMaterial>("Saggat", 1, 0, "MoonSurfaceMaterial");
qmlRegisterType<Saggat::QmlValues>("Saggat", 1, 0, "QmlValues");
qmlRegisterType<GeosphereMesh>("LFD", 1, 0, "GeosphereMesh");
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty( QStringLiteral("Values"),
&Saggat::Values::getInstance() );
engine.rootContext()->setContextProperty( QStringLiteral("Generator"),
&Saggat::Generator::getInstance() );
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}