summaryrefslogtreecommitdiffstats
path: root/dev/rays/example.cc
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2021-09-20 18:15:14 -0500
committerMatt Strapp <matt@mattstrapp.net>2021-09-20 18:15:14 -0500
commit342403a02f8063903d0f38327430721d4d0ae331 (patch)
tree29d020a27bc16939c568dd4b29166566d1c0e658 /dev/rays/example.cc
parentFix parenthesis (diff)
downloadcsci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.tar
csci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.tar.gz
csci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.tar.bz2
csci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.tar.lz
csci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.tar.xz
csci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.tar.zst
csci4611-5a8b6d8538618b144e39618350ad06a4d9e232fa.zip
Diffstat (limited to '')
-rw-r--r--dev/rays/example.cc160
1 files changed, 80 insertions, 80 deletions
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 <iostream>
-#include <sstream>
-
-
-
-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 <iostream>
+#include <sstream>
+
+
+
+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_);
+}
+
+
+
+