-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
47 lines (41 loc) · 1.59 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
#include <iostream>
#include "FlowEngine/src/Flow.h"
using namespace Flow;
struct DebugPoint : public Point, Normal{
glm::dvec3 test;
};
int main() {
Quad<DebugPoint> quad;
debugVertexPosition<DebugPoint>(&quad.vertices[0]);
debugVertexNormal<DebugPoint>(&quad.vertices[0]);
auto engine {makeEngine()};
auto window{std::make_shared<GLFWWindow>(640, 640, "FlowEngine")};
engine->setWindow(window);
auto renderer {Renderer::createRender()};
engine->setRenderer(renderer);
auto computer{createMultipleComputer()};
engine->setComputer(computer);
auto firstScene = makeScene();
{
auto viewPortSpec {makeViewPortSpec(0, 0, 500, 500, Camera{})};
auto firstViewPort {ViewPort::createViewPort(std::move(viewPortSpec))};
auto& firstCamera {firstViewPort->getCamera()};
firstCamera.setPos({0,0,10});
firstScene->addViewPort("FirstViewPort",firstViewPort);
}
auto firstObject {firstScene->createObject("firstObject")};
auto material {Material::creatMaterial({{"", VertexShader}, {"", FragmentShader}})};
std::function<void(RenderComponent*)> renderFunction {
[](RenderComponent* _component) {
_component->begin();
_component->bindMaterial(_component->getMaterial().get());
_component->drawIndex(4, 0);
_component->end();
}
};
firstObject.addComponent<RenderComponentMiddle>(renderFunction);
firstObject.getComponent<RenderComponentMiddle>()()->setMaterial(material);
engine->setScene(std::move(firstScene));
engine->update();
return 0;
}