From 342403a02f8063903d0f38327430721d4d0ae331 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 20 Sep 2021 18:15:14 -0500 Subject: do ass1 --- dev/rays/example.cc | 160 ++++++++++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 80 deletions(-) (limited to 'dev/rays/example.cc') diff --git a/dev/rays/example.cc b/dev/rays/example.cc index bfccb05..f1eaa4c 100644 --- a/dev/rays/example.cc +++ b/dev/rays/example.cc @@ -1,80 +1,80 @@ -/** CSci-4611 In-Class Example */ - -#include "example.h" - -#include "config.h" - -#include -#include - - - -Example::Example() : GraphicsApp(1024,768, "MinGfx Example") { - // Define a search path for finding data files (images and shaders) - search_path_.push_back("."); - search_path_.push_back("./data"); - search_path_.push_back(DATA_DIR_INSTALL); - search_path_.push_back(DATA_DIR_BUILD); -} - - -Example::~Example() { -} - - -void Example::UpdateSimulation(double dt) { - cam_.UpdateSimulation(dt, window()); -} - -// You can look around, like in minecraft, by dragging with the right mouse button. -void Example::OnRightMouseDrag(const Point2& mouse_in_pixels, const Vector2& delta_in_pixels) { - Vector2 delta_in_ndc = PixelsToNormalizedDeviceCoords(delta_in_pixels); - cam_.OnMouseMove(delta_in_ndc); -} - - - - -void Example::OnLeftMouseDown(const Point2& mouse_in_pixels) { - -} - -void Example::OnLeftMouseDrag(const Point2& mouse_in_pixels, const Vector2& delta_in_pixels) { - -} - -void Example::OnLeftMouseUp(const Point2& mouse_in_pixels) { - -} - - - - - - -void Example::InitOpenGL() { - // Set up the camera in a good position to see the entire scene - proj_matrix_ = Matrix4::Perspective(60.0f, aspect_ratio(), 0.01f, 100.0f); - cam_.set_view_matrix(Matrix4::LookAt(Point3(0,0,3), Point3(0,0,0), Vector3(0,1,0))); - glClearColor(1,1,1,1); - - // load textures and shaders - dart_tex_.InitFromFile(Platform::FindFile("dartboard.jpg", search_path_)); -} - - -void Example::DrawUsingOpenGL() { - Matrix4 view_matrix = cam_.view_matrix(); - - // draws a set of axes at the world origin, since we are passing the identity - // matrix for the "model" matrix. - Matrix4 identity; - quick_shapes_.DrawAxes(identity, view_matrix, proj_matrix_); - - Matrix4 boardTransform = Matrix4::RotationX(GfxMath::ToRadians(90)); - quick_shapes_.DrawSquare(boardTransform, view_matrix, proj_matrix_, Color(1, 1, 1), dart_tex_); -} - - - - +/** CSci-4611 In-Class Example */ + +#include "example.h" + +#include "config.h" + +#include +#include + + + +Example::Example() : GraphicsApp(1024,768, "MinGfx Example") { + // Define a search path for finding data files (images and shaders) + search_path_.push_back("."); + search_path_.push_back("./data"); + search_path_.push_back(DATA_DIR_INSTALL); + search_path_.push_back(DATA_DIR_BUILD); +} + + +Example::~Example() { +} + + +void Example::UpdateSimulation(double dt) { + cam_.UpdateSimulation(dt, window()); +} + +// You can look around, like in minecraft, by dragging with the right mouse button. +void Example::OnRightMouseDrag(const Point2& mouse_in_pixels, const Vector2& delta_in_pixels) { + Vector2 delta_in_ndc = PixelsToNormalizedDeviceCoords(delta_in_pixels); + cam_.OnMouseMove(delta_in_ndc); +} + + + + +void Example::OnLeftMouseDown(const Point2& mouse_in_pixels) { + +} + +void Example::OnLeftMouseDrag(const Point2& mouse_in_pixels, const Vector2& delta_in_pixels) { + +} + +void Example::OnLeftMouseUp(const Point2& mouse_in_pixels) { + +} + + + + + + +void Example::InitOpenGL() { + // Set up the camera in a good position to see the entire scene + proj_matrix_ = Matrix4::Perspective(60.0f, aspect_ratio(), 0.01f, 100.0f); + cam_.set_view_matrix(Matrix4::LookAt(Point3(0,0,3), Point3(0,0,0), Vector3(0,1,0))); + glClearColor(1,1,1,1); + + // load textures and shaders + dart_tex_.InitFromFile(Platform::FindFile("dartboard.jpg", search_path_)); +} + + +void Example::DrawUsingOpenGL() { + Matrix4 view_matrix = cam_.view_matrix(); + + // draws a set of axes at the world origin, since we are passing the identity + // matrix for the "model" matrix. + Matrix4 identity; + quick_shapes_.DrawAxes(identity, view_matrix, proj_matrix_); + + Matrix4 boardTransform = Matrix4::RotationX(GfxMath::ToRadians(90)); + quick_shapes_.DrawSquare(boardTransform, view_matrix, proj_matrix_, Color(1, 1, 1), dart_tex_); +} + + + + -- cgit v1.2.3