|
|
@@ -99,7 +99,7 @@ void init()
|
|
|
1.0));
|
|
|
|
|
|
// Sectors
|
|
|
- scene.sectors.push_back(Sector(Aabb(Vec3(-10.0), Vec3(10.0))));
|
|
|
+ scene.sectors.push_back(new Sector(Aabb(Vec3(-10.0), Vec3(10.0))));
|
|
|
}
|
|
|
|
|
|
//==============================================================================
|
|
|
@@ -121,6 +121,10 @@ void mainLoopExtra()
|
|
|
{
|
|
|
mover = &SceneSingleton::get().getActiveCamera();
|
|
|
}
|
|
|
+ if(in.getKey(SDL_SCANCODE_2))
|
|
|
+ {
|
|
|
+ mover = SceneSingleton::get().findSceneNode("horse")->getMovable();
|
|
|
+ }
|
|
|
if(in.getKey(SDL_SCANCODE_3))
|
|
|
{
|
|
|
mover = SceneSingleton::get().findSceneNode("spot0")->getMovable();
|
|
|
@@ -173,53 +177,6 @@ void mainLoop()
|
|
|
HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCurrentTime();
|
|
|
HighRezTimer::Scalar crntTime = prevUpdateTime;
|
|
|
|
|
|
- const char* vert = R"(
|
|
|
-in vec3 position;
|
|
|
-uniform mat4 mvp;
|
|
|
-
|
|
|
-void main() {
|
|
|
- gl_Position = mvp * vec4(position, 1.0);
|
|
|
-})";
|
|
|
-
|
|
|
- const char* frag = R"(
|
|
|
-out vec3 fColor;
|
|
|
-void main()
|
|
|
-{
|
|
|
- fColor = vec3(0.0, 1.0, 0.0);
|
|
|
-})";
|
|
|
-
|
|
|
- const char* trf[] = {nullptr};
|
|
|
-
|
|
|
- ShaderProgram sprog;
|
|
|
- sprog.create(vert, nullptr, nullptr, nullptr, frag, trf);
|
|
|
-
|
|
|
- Vec3 maxPos = Vec3(0.5 * 1.0);
|
|
|
- Vec3 minPos = Vec3(-0.5 * 1.0);
|
|
|
-
|
|
|
- std::array<Vec3, 8> points = {{
|
|
|
- Vec3(maxPos.x(), maxPos.y(), maxPos.z()), // right top front
|
|
|
- Vec3(minPos.x(), maxPos.y(), maxPos.z()), // left top front
|
|
|
- Vec3(minPos.x(), minPos.y(), maxPos.z()), // left bottom front
|
|
|
- Vec3(maxPos.x(), minPos.y(), maxPos.z()), // right bottom front
|
|
|
- Vec3(maxPos.x(), maxPos.y(), minPos.z()), // right top back
|
|
|
- Vec3(minPos.x(), maxPos.y(), minPos.z()), // left top back
|
|
|
- Vec3(minPos.x(), minPos.y(), minPos.z()), // left bottom back
|
|
|
- Vec3(maxPos.x(), minPos.y(), minPos.z()) // right bottom back
|
|
|
- }};
|
|
|
-
|
|
|
- std::array<uint16_t, 24> indeces = {{0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6,
|
|
|
- 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7}};
|
|
|
-
|
|
|
- Vbo posvbo, idsvbo;
|
|
|
-
|
|
|
- posvbo.create(GL_ARRAY_BUFFER, sizeof(points), &points[0], GL_STATIC_DRAW);
|
|
|
- idsvbo.create(GL_ELEMENT_ARRAY_BUFFER, sizeof(indeces), &indeces[0], GL_STATIC_DRAW);
|
|
|
-
|
|
|
- Vao vao;
|
|
|
- vao.create();
|
|
|
- vao.attachArrayBufferVbo(posvbo, 0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
|
|
|
- vao.attachElementArrayBufferVbo(idsvbo);
|
|
|
-
|
|
|
while(1)
|
|
|
{
|
|
|
SceneSingleton::get().updateFrameStart();
|
|
|
@@ -236,23 +193,6 @@ void main()
|
|
|
EventManagerSingleton::get().updateAllEvents(prevUpdateTime, crntTime);
|
|
|
MainRendererSingleton::get().render(SceneSingleton::get());
|
|
|
|
|
|
- Fbo::unbindAll();
|
|
|
-
|
|
|
- /*glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
- glDisable(GL_DEPTH_TEST);*/
|
|
|
-
|
|
|
- sprog.bind();
|
|
|
- sprog.findUniformVariable("mvp").set(
|
|
|
- cam->getProjectionMatrix() * cam->getViewMatrix());
|
|
|
- //horse->model->getModelPatches()[0].getVao(PassLevelKey(0, 0)).bind();
|
|
|
- vao.bind();
|
|
|
-
|
|
|
- //int indeces = horse->model->getModelPatches()[0].getIndecesNumber(0);
|
|
|
- int indeces = 24;
|
|
|
- glDrawElements(GL_LINES,
|
|
|
- indeces,
|
|
|
- GL_UNSIGNED_SHORT, 0);
|
|
|
-
|
|
|
if(InputSingleton::get().getKey(SDL_SCANCODE_ESCAPE))
|
|
|
{
|
|
|
break;
|