int main() { Window window; Camera camera(window.GetAspectRatio(), glm::vec3(2.0, 2.0, 1.0)); Mesh* sphereMesh = CreateMesh("sphere.obj", "sphere"); Shader defaultShader("Shaders/defaultShader.vert", "Shaders/defaultShader.frag", "defaultShader"); SetupMesh(sphereMesh, defaultShader); do { window.Clear(); DrawMesh(*sphereMesh, camera, defaultShader); camera.front = sphereMesh->position; sphereMesh->rotY -= 0.016; { if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_W) == GLFW_PRESS) { sphereMesh->position.x -= 0.16; } else if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_S) == GLFW_PRESS) { sphereMesh->position.x += 0.16; } if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_A) == GLFW_PRESS) { sphereMesh->position.z += 0.16; } else if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_D) == GLFW_PRESS) { sphereMesh->position.z -= 0.16; } } window.Update(); } while (!window.Closed() && glfwGetKey(window.GetWindowInstance(), GLFW_KEY_ESCAPE) != GLFW_PRESS); delete sphereMesh; }
void Mesh::setupVBOs() { // delete all the old geometry control_map_tri_verts.clear(); board_tri_verts.clear(); piece_tri_verts.clear(); light_vert.clear(); floor_quad_verts.clear(); cleanupVBOs(); // setup the new geometry //Vec3f light_position = LightPosition(); //SetupLight(light_position); SetupFloor(); SetupMesh(table, board_tri_verts_VBO, board_tri_verts); SetupMesh(control_map, control_map_tri_verts_VBO, control_map_tri_verts); SetupMesh(piece, piece_tri_verts_VBO, piece_tri_verts); bbox.setupVBOs(); }
Mesh::Mesh(vector<Vertex> vec, vector<GLuint> ind, vector<Texture> tex) { vertices = vec; indices = ind; textures = tex; SetupMesh(); }
AHair::AHair() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = false; // Create default layer AddNewLayer(); SetupMesh(); }
void Mesh::setupVBOs() { // delete all the old geometry mesh_tri_verts.clear(); light_vert.clear(); cleanupVBOs(); // setup the new geometry Vec3f light_position = LightPosition(); SetupLight(light_position); SetupMesh(); SetupPlateVisualization(); bbox.setupVBOs(); }