|
|
|
@ -69,42 +69,43 @@ std::vector<float> verts({ |
|
|
|
|
}); |
|
|
|
|
// Vert struc: x y z r g b tx ty
|
|
|
|
|
|
|
|
|
|
std::vector<unsigned int> indices({
|
|
|
|
|
0, 1, 3,
|
|
|
|
|
std::vector<unsigned int> indices({ |
|
|
|
|
0, 1, 3, |
|
|
|
|
1, 2, 3, |
|
|
|
|
5, 6, 7,
|
|
|
|
|
7, 8, 9,
|
|
|
|
|
9, 10, 11,
|
|
|
|
|
5, 6, 7, |
|
|
|
|
7, 8, 9, |
|
|
|
|
9, 10, 11, |
|
|
|
|
11, 12, 13, |
|
|
|
|
0, 1, 3,
|
|
|
|
|
3, 4, 5,
|
|
|
|
|
5, 6, 7,
|
|
|
|
|
7, 8, 9,
|
|
|
|
|
9, 10, 11,
|
|
|
|
|
0, 1, 3, |
|
|
|
|
3, 4, 5, |
|
|
|
|
5, 6, 7, |
|
|
|
|
7, 8, 9, |
|
|
|
|
9, 10, 11, |
|
|
|
|
11, 12, 13, |
|
|
|
|
0, 1, 3,
|
|
|
|
|
3, 4, 5,
|
|
|
|
|
5, 6, 7,
|
|
|
|
|
7, 8, 9,
|
|
|
|
|
9, 10, 11,
|
|
|
|
|
0, 1, 3, |
|
|
|
|
3, 4, 5, |
|
|
|
|
5, 6, 7, |
|
|
|
|
7, 8, 9, |
|
|
|
|
9, 10, 11, |
|
|
|
|
11, 12, 13, |
|
|
|
|
0, 1, 3,
|
|
|
|
|
3, 4, 5,
|
|
|
|
|
5, 6, 7,
|
|
|
|
|
7, 8, 9,
|
|
|
|
|
9, 10, 11,
|
|
|
|
|
0, 1, 3, |
|
|
|
|
3, 4, 5, |
|
|
|
|
5, 6, 7, |
|
|
|
|
7, 8, 9, |
|
|
|
|
9, 10, 11, |
|
|
|
|
11, 12, 13, |
|
|
|
|
0, 1, 3,
|
|
|
|
|
3, 4, 5,
|
|
|
|
|
5, 6, 7,
|
|
|
|
|
7, 8, 9,
|
|
|
|
|
9, 10, 11,
|
|
|
|
|
0, 1, 3, |
|
|
|
|
3, 4, 5, |
|
|
|
|
5, 6, 7, |
|
|
|
|
7, 8, 9, |
|
|
|
|
9, 10, 11, |
|
|
|
|
11, 12, 13, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Window for the game
|
|
|
|
|
Window win("Euclid Engine: Demo"); |
|
|
|
|
Renderer::Scene scene(&win); |
|
|
|
|
|
|
|
|
|
void framebuffer_size_callback(GLFWwindow* glfwWindow, int w, int h) { |
|
|
|
|
win.updateSize(w, h); |
|
|
|
@ -129,7 +130,7 @@ int main() { |
|
|
|
|
glViewport(0, 0, win.width(), win.height()); |
|
|
|
|
glfwSetFramebufferSizeCallback(win.win, framebuffer_size_callback); // Framebuffer
|
|
|
|
|
|
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
glEnable(GL_DEPTH_TEST); |
|
|
|
|
|
|
|
|
|
// Input
|
|
|
|
|
glfwSetInputMode(win.win, GLFW_CURSOR, GLFW_CURSOR_DISABLED); // Disable cursor
|
|
|
|
@ -138,12 +139,11 @@ int main() { |
|
|
|
|
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); |
|
|
|
|
|
|
|
|
|
// Create scene
|
|
|
|
|
Renderer::Scene scene(&win); |
|
|
|
|
Renderer::TexturedObject ro(verts, indices); |
|
|
|
|
Renderer::TexturedObject ro2(verts, indices); |
|
|
|
|
|
|
|
|
|
ro.setTexture(RUSTY_METAL_TEXTURE); |
|
|
|
|
ro2.setTexture("assets/textures/meep.jpg"); // TODO: fix texture bug
|
|
|
|
|
ro.setTexture(RUSTY_METAL_TEXTURE); |
|
|
|
|
|
|
|
|
|
scene.spawnObject(&ro); |
|
|
|
|
scene.spawnObject(&ro2); |
|
|
|
@ -158,7 +158,9 @@ int main() { |
|
|
|
|
processInput(win.win); |
|
|
|
|
|
|
|
|
|
ro.translate(glm::vec3(0.0f, 0.0f, 0.001f)); |
|
|
|
|
// ro2.setPosition(glm::vec3(0.0f, 0.0f, -1000.0f));
|
|
|
|
|
// ro2.translate(glm::vec3(0.0f, -0.01f, 0.01f));
|
|
|
|
|
ro2.translate(glm::vec3(0.0f, 0.0f, -0.001f)); |
|
|
|
|
ro2.rotate(glm::vec3(1.01f, 1.0f, 1.0f)); |
|
|
|
|
|
|
|
|
|
// Render new frame
|
|
|
|
|
scene.render(); |
|
|
|
|