forked from Ubpa/USTC_CG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
39 lines (28 loc) · 1.05 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
#include "GenScene.h"
#include "Editor.h"
#include <UEngine/Engine.h>
#include <UScene/core.h>
#include <UEngine/SceneMngr.h>
#include <fstream>
using namespace Ubpa;
using namespace std;
int main(int argc, char** argv)
{
Engine::Instance().Init("Ubpa@2020 UEditor v0.0.7");
Editor::OnRegister();
const char* path = argc == 2 ? argv[1] : "../data/models/uscene.json";
// Scene* scene = SceneGenerator::Instance().GenScene(path);
Scene* scene = SceneGenerator::Instance().GenScene(0);
Editor::Instance().SetCamera(scene->root->GetSObjInTreeWith<Cmpt::Camera>());
SceneMngr::Instance().Insert(scene);
SceneMngr::Instance().Insert(Editor::Instance().scene);
SceneMngr::Instance().Active(scene, Editor::Instance().scene->root->GetSObjInTreeWith<Cmpt::Camera>());
Engine::Instance().Loop();
Engine::Instance().CleanUp();
SceneGenerator::Instance().PrintSerializedScene(scene);
string scene_str = SceneGenerator::Instance().getSerializedSceneStr(scene);
ofstream ofs("../data/models/my_scene_night.json");
ofs << scene_str;
delete scene;
return 0;
}