-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
56 lines (41 loc) · 1.19 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
49
50
51
52
53
54
55
56
//
// main.cpp
// c
//
// Created by Xiaorong Niu on 16/12/20.
// Copyright © 2016年 Xiaorong Niu. All rights reserved.
//
#include "GLMgr/GLMgr.h"
#include "refCount/AutoReleasePool.h"
#include <stdio.h>
#include <string.h>
#include "scene/Director.h"
#include "macro.h"
#include "math/Vec3.h"
#include "scene/Scene.h"
#include "scene/Mesh.h"
#include "scene/Material.h"
#include "scene/Camera.h"
int main(void)
{
Director::createInstance();
auto scene = Scene::create();
// scene->setCamera(Vec3(0, 0, 0), Vec3(0, 1, 0), Vec3(0, 0, 1));
Director::getInstance()->pushScene(scene);
auto node = Node::create();
node->setName("node");
scene->addChild(node);
auto mesh = Mesh::createCube(100);
node->setMesh(mesh);
auto material = Material::create();
material->useDefaultShader();
mesh->setMaterial(material);
auto camera = Camera::create();
scene->addChild(camera);
camera->lookAt(Math::Vec3(300, 300, 300), Math::Vec3(0, 0, 0), Math::Vec3(0, 0, 1));
camera->setPerspective(60, 640.0/480.0, 1, 10000);
// camera->setOrthographic(640, 480, 1, 10000);
Director::getInstance()->run();
Director::deleteInstance();
return 0;
}