Skip to content

Commit

Permalink
Commit final demos
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-field committed May 23, 2019
1 parent 379328b commit f687261
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
42 changes: 25 additions & 17 deletions demos/moving-camera-demo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,41 @@ void updateCamera(Scene& scene, GLFWwindow* window) {

int main() {
// Setup scene
Camera camera = Camera(Vector3(0, 0, 0), 100, 0.1, 100, 800, 600);
Camera camera = Camera(Vector3(0, 0, 0), 90, 0.1f, 100, 500, 500);
Scene scene = Scene(camera);

Vector3 cubeCenter = Vector3(1, 0, 2);
Vector3 pyramidCenter = Vector3(-1, 0, 2);

Mesh cube = Mesh::createCube(1, cubeCenter);
cube.material = Material(ColorRGB(0.0, 0.1, 0.9));
scene.addMesh(cube);
Vector3 cube1Center = Vector3(-1, 0, 2);
Mesh cube1 = Mesh::createCube(1, cube1Center);
cube1.material = Material(ColorRGB(0, 0, 1));
scene.addMesh(cube1);

Mesh pyramid = Mesh::createPyramid(1, 1, pyramidCenter);
pyramid.translate(Vector3(-1, 0, 0));
pyramid.scale(2);
pyramid.rotateX((180 * M_PI) / 180);
pyramid.material = Material(ColorRGB(0.1, 0.9, 0.2));
scene.addMesh(pyramid);
Vector3 cube2Center = Vector3(1, 0, 2);
Mesh cube2 = Mesh::createCube(1, cube2Center);
cube2.material = Material(ColorRGB(1, 0, 0));
//scene.addMesh(cube2);

Vector3 cube3Center = Vector3(0, 0, 2);
Mesh cube3 = Mesh::createCube(5, cube3Center);
cube3.flipNormals();
cube3.material = Material(ColorRGB(1, 1, 1));
scene.addMesh(cube3);

Vector3 planeCenter = Vector3(0, -0.5f, 2);
Mesh plane = Mesh::createPlane(10, planeCenter);
plane.material = Material(ColorRGB(1, 1, 1));
scene.addMesh(plane);

Mesh obj = Mesh::importObj("sample-obj/alfa147.obj");
obj.translate(Vector3(-2, -0.5f, 0));
obj.translate(Vector3(0.8f, -0.5f, 2));
obj.rotateX(-90 * M_PI / 180);
obj.scale(0.01);
obj.material = Material(ColorRGB(0.9, 0.1, 0.0));
scene.addMesh(obj);

Light light(Vector3(0, 0, -1));

Light light(Vector3(1, 1, 0));
light.color = ColorRGB(1, 1, 1);
light.intensity = 100;
scene.lights.push_back(light);
scene.addLight(light);

// Create window and OpenGL context
glfwInit();
Expand Down
2 changes: 1 addition & 1 deletion demos/wx-demo/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Scene* MainWindow::createScene() {

Vector3 cube2Center = Vector3(1, 0, 2);
Mesh cube2 = Mesh::createCube(1, cube2Center);
cube2.rotateY(45 * M_PI / 180);
cube2.material = Material(ColorRGB(1, 0, 0));
scene->addMesh(cube2);

Expand All @@ -70,6 +69,7 @@ Scene* MainWindow::createScene() {
obj.translate(Vector3(0.8f, -0.1f, 2));
obj.scale(0.01);
obj.material = Material(ColorRGB(0.9, 0.1, 0.0));
//scene->addMesh(obj);

Light light(Vector3(1, 1, 0));
light.color = ColorRGB(1, 1, 1);
Expand Down

0 comments on commit f687261

Please sign in to comment.