summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorunknown <paulx161@umn.edu>2021-02-04 18:37:17 -0600
committerunknown <paulx161@umn.edu>2021-02-04 18:37:17 -0600
commitfee4cbf40b07e17eca676b4687c51313f7cfdd2e (patch)
treec3e668b7e76a7f293806f897ae88b4a2dcb254b8
parentadded dev/MinGfx/ (diff)
downloadcsci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.tar
csci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.tar.gz
csci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.tar.bz2
csci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.tar.lz
csci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.tar.xz
csci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.tar.zst
csci4611-fee4cbf40b07e17eca676b4687c51313f7cfdd2e.zip
Added example projects from lecture
-rw-r--r--dev/angry-vectors/.gitignore2
-rw-r--r--dev/angry-vectors/CMakeLists.txt183
-rw-r--r--dev/angry-vectors/README.md1
-rw-r--r--dev/angry-vectors/angry_vectors.cc125
-rw-r--r--dev/angry-vectors/angry_vectors.h71
-rw-r--r--dev/angry-vectors/cmake/DownloadHelper.txt.in26
-rw-r--r--dev/angry-vectors/cmake/ExternalProjectDownloadBuildInstall.cmake98
-rw-r--r--dev/angry-vectors/cmake/MessageMacros.cmake17
-rw-r--r--dev/angry-vectors/cmake/UseOpenGL.cmake52
-rw-r--r--dev/angry-vectors/main.cc9
-rw-r--r--dev/mesh-demo/.gitignore2
-rw-r--r--dev/mesh-demo/CMakeLists.txt182
-rw-r--r--dev/mesh-demo/README.md1
-rw-r--r--dev/mesh-demo/cmake/DownloadHelper.txt.in26
-rw-r--r--dev/mesh-demo/cmake/ExternalProjectDownloadBuildInstall.cmake98
-rw-r--r--dev/mesh-demo/cmake/MessageMacros.cmake17
-rw-r--r--dev/mesh-demo/cmake/UseOpenGL.cmake52
-rw-r--r--dev/mesh-demo/example.cc107
-rw-r--r--dev/mesh-demo/example.h61
-rw-r--r--dev/mesh-demo/main.cc9
-rw-r--r--dev/rays/.gitignore2
-rw-r--r--dev/rays/CMakeLists.txt193
-rw-r--r--dev/rays/README.md1
-rw-r--r--dev/rays/cmake/DownloadHelper.txt.in26
-rw-r--r--dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake98
-rw-r--r--dev/rays/cmake/MessageMacros.cmake17
-rw-r--r--dev/rays/cmake/UseOpenGL.cmake52
-rw-r--r--dev/rays/config.h.in13
-rw-r--r--dev/rays/data/dartboard.jpgbin0 -> 23423 bytes
-rw-r--r--dev/rays/example.cc80
-rw-r--r--dev/rays/example.h62
-rw-r--r--dev/rays/main.cc9
-rw-r--r--dev/robot_transforms/robot_transforms.pde78
-rw-r--r--dev/snowman/.gitignore2
-rw-r--r--dev/snowman/CMakeLists.txt182
-rw-r--r--dev/snowman/README.md1
-rw-r--r--dev/snowman/cmake/DownloadHelper.txt.in26
-rw-r--r--dev/snowman/cmake/ExternalProjectDownloadBuildInstall.cmake98
-rw-r--r--dev/snowman/cmake/MessageMacros.cmake17
-rw-r--r--dev/snowman/cmake/UseOpenGL.cmake52
-rw-r--r--dev/snowman/main.cc9
-rw-r--r--dev/snowman/snowman.cc48
-rw-r--r--dev/snowman/snowman.h52
-rw-r--r--dev/texture-demo/.gitignore2
-rw-r--r--dev/texture-demo/CMakeLists.txt193
-rw-r--r--dev/texture-demo/README.md1
-rw-r--r--dev/texture-demo/cmake/DownloadHelper.txt.in26
-rw-r--r--dev/texture-demo/cmake/ExternalProjectDownloadBuildInstall.cmake98
-rw-r--r--dev/texture-demo/cmake/MessageMacros.cmake17
-rw-r--r--dev/texture-demo/cmake/UseOpenGL.cmake52
-rw-r--r--dev/texture-demo/config.h.in13
-rw-r--r--dev/texture-demo/data/campbells.pngbin0 -> 81808 bytes
-rw-r--r--dev/texture-demo/data/monalisa.pngbin0 -> 563243 bytes
-rw-r--r--dev/texture-demo/example.cc113
-rw-r--r--dev/texture-demo/example.h65
-rw-r--r--dev/texture-demo/main.cc9
56 files changed, 2846 insertions, 0 deletions
diff --git a/dev/angry-vectors/.gitignore b/dev/angry-vectors/.gitignore
new file mode 100644
index 0000000..dd1a9a8
--- /dev/null
+++ b/dev/angry-vectors/.gitignore
@@ -0,0 +1,2 @@
+config.h
+build
diff --git a/dev/angry-vectors/CMakeLists.txt b/dev/angry-vectors/CMakeLists.txt
new file mode 100644
index 0000000..a8bb5c0
--- /dev/null
+++ b/dev/angry-vectors/CMakeLists.txt
@@ -0,0 +1,183 @@
+# Original Author(s) of this File:
+# Daniel Keefe, 2017, University of Minnesota
+#
+# Author(s) of Significant Updates/Modifications to the File:
+# ...
+
+
+
+# You are encouraged to copy this example, move it outside of the MinGfx directory, and use
+# it as a starting point for your project. When you do this, you'll have to edit the
+# following line as needed to point to the MinGfx install prefix used on your system.
+
+# !!!!!!!!!!!!! EDIT THE FOLLOWING LINE AS NEEDED !!!!!!!!!!!!!
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build/install ../..)
+
+
+#### BASIC PROJECT SETUP ####
+
+project(angry-vectors)
+
+# Using 3.9 to get a modern version of FindOpenGL.cmake
+cmake_minimum_required (VERSION 3.9)
+
+# Dependencies that are auto-downloaded, built, and installed for you will go in the
+# directory pointed to by the CMAKE_INSTALL_PREFIX. It defaults to a location inside
+# the build directory.
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
+ set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
+endif()
+
+# Add to paths cmake uses to search for scripts, modules, and config packages
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_INSTALL_PREFIX})
+list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_INSTALL_PREFIX})
+
+include(MessageMacros)
+h1("Building ${PROJECT_NAME}")
+h2("Configuring paths")
+
+message(STATUS "Module path: ${CMAKE_MODULE_PATH}")
+message(STATUS "Prefix path: ${CMAKE_PREFIX_PATH}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+
+set(DATA_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/data)
+set(DATA_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
+
+message(STATUS "Data dir (in build tree): ${DATA_DIR_BUILD}")
+message(STATUS "Data dir (in install tree): ${DATA_DIR_INSTALL}")
+
+set(SHADERS_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/shaders)
+set(SHADERS_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/shaders)
+
+message(STATUS "Shaders dir (in build tree): ${SHADERS_DIR_BUILD}")
+message(STATUS "Shaders dir (in install tree): ${SHADERS_DIR_INSTALL}")
+
+
+#### SOURCE FOR THIS PROJECT ####
+h2("Configuring source files")
+
+set(SOURCEFILES
+ angry_vectors.cc
+ main.cc
+)
+
+set(HEADERFILES
+ angry_vectors.h
+)
+
+set(EXTRAFILES
+ README.md
+)
+
+set(SHADERFILES
+)
+
+set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+set_source_files_properties(${SHADERFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+source_group("Shaders" FILES ${SHADERFILES})
+
+
+#### COMPILE OPTIONS ####
+
+h2("Configuring Compiler Options")
+
+
+message(STATUS "Building for " ${CMAKE_SYSTEM_NAME} ".")
+
+# Linux specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions(-DLINUX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Apple specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_definitions(-DOSX)
+
+ # RPATH settings, see https://cmake.org/Wiki/CMake_RPATH_handling
+ set(CMAKE_MACOSX_RPATH ON)
+
+ # use, i.e. don't skip the full RPATH for the build tree
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+ # when building, don't use the install RPATH already
+ # (but later on when installing)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # add the automatically determined parts of the RPATH
+ # which point to directories outside the build tree to the install RPATH
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+ # the RPATH to be used when installing, but only if it's not a system directory
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ IF("${isSystemDir}" STREQUAL "-1")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ ENDIF("${isSystemDir}" STREQUAL "-1")
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Windows specific
+if (WIN32)
+ add_definitions(-DWIN32)
+
+ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
+ message(FATAL_ERROR
+ "You must use the 64 bit version of the compiler. Be sure to set the correct generator when configuring through CMake.")
+ endif()
+endif()
+
+
+
+
+#### DEFINE TARGET(S) ####
+
+h2("Defining Target(s)")
+
+add_executable(${PROJECT_NAME} ${SOURCEFILES} ${HEADERFILES} ${EXTRAFILES} ${SHADERFILES})
+
+
+
+#### FIND AND ADD DEPENDENCIES ####
+
+h2("Adding Dependencies")
+set(EXTERNAL_DIR external)
+
+
+# MinGfx (linked with an imported cmake target so no need to specify include dirs)
+# This will try to find MinGfxConfig.cmake, which should have been installed under
+# CMAKE_INSTALL_PREFIX/lib/cmake/MinGfx when you installed the MinGfx Toolkit.
+find_package(MinGfx REQUIRED)
+target_link_libraries(${PROJECT_NAME} PUBLIC MinGfx::MinGfx)
+
+
+# Add dependency on OpenGL
+include(UseOpenGL)
+UseOpenGL(${PROJECT_NAME} PUBLIC ${EXTERNAL_DIR})
+
+
+
+#### INSTALL TARGET(S) ####
+
+h2("Configuring Install Target")
+
+# The install locations are relative to the CMAKE_INSTALL_PREFIX variable
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
+
+install(
+ DIRECTORY data/
+ DESTINATION ${DATA_DIR_INSTALL}
+ OPTIONAL
+)
+
+install(
+ DIRECTORY shaders/
+ DESTINATION ${SHADERS_DIR_INSTALL}
+ OPTIONAL
+)
diff --git a/dev/angry-vectors/README.md b/dev/angry-vectors/README.md
new file mode 100644
index 0000000..ee42984
--- /dev/null
+++ b/dev/angry-vectors/README.md
@@ -0,0 +1 @@
+# Angry Vectors CSci-4611 In-Class Example of Visual Debugging
diff --git a/dev/angry-vectors/angry_vectors.cc b/dev/angry-vectors/angry_vectors.cc
new file mode 100644
index 0000000..9ca7445
--- /dev/null
+++ b/dev/angry-vectors/angry_vectors.cc
@@ -0,0 +1,125 @@
+/** CSci-4611 In-Class Example */
+
+#include "angry_vectors.h"
+
+#include <iostream>
+#include <sstream>
+
+
+
+AngryVectors::AngryVectors() : GraphicsApp(1024,768, "AngryVectors"), time_(0.0), playing_(true), pauseBtn_(NULL) {
+}
+
+
+
+AngryVectors::~AngryVectors() {
+}
+
+
+
+void AngryVectors::OnPauseBtnPressed() {
+ playing_ = !playing_;
+ if (playing_) {
+ pauseBtn_->setCaption("Pause");
+ }
+ else {
+ pauseBtn_->setCaption("Play");
+ }
+}
+
+
+Point3 AngryVectors::CalcBirdPos(double t) {
+ // projectile motion for the "bird"
+ double e = t / 4.0;
+ double x = e * 52.0 - 30.0;
+ double y = 30.0 * (-e * e + 1.2 * e) + 5.0;
+ double z = -35.0;
+ return Point3((float)x, (float)y, (float)z);
+}
+
+Vector3 AngryVectors::CalcBirdVel(double t) {
+ return CalcBirdPos(time_+0.1) - CalcBirdPos(time_);
+}
+
+
+void AngryVectors::UpdateSimulation(double dt) {
+ if (playing_) {
+ time_ += (float)dt;
+ if (time_ > 4) {
+ time_ = 0.0;
+ }
+ }
+}
+
+
+
+void AngryVectors::InitNanoGUI() {
+ // Setup the GUI window
+ nanogui::Window *window = new nanogui::Window(screen(), "Controls");
+ window->setPosition(Eigen::Vector2i(10, 10));
+ window->setSize(Eigen::Vector2i(400,200));
+ window->setLayout(new nanogui::GroupLayout());
+
+ pauseBtn_ = new nanogui::Button(window, "Pause");
+ pauseBtn_->setCallback(std::bind(&AngryVectors::OnPauseBtnPressed, this));
+ pauseBtn_->setTooltip("Toggle playback.");
+
+ screen()->performLayout();
+}
+
+
+
+void AngryVectors::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);
+ view_matrix_ = Matrix4::LookAt(Point3(0,2,15), Point3(0,0,0), Vector3(0,1,0));
+ glClearColor(0.2f, 0.6f, 1.0f, 1.0f);
+}
+
+
+void AngryVectors::DrawUsingOpenGL() {
+ // ground
+ Matrix4 ground_matrix = Matrix4::Translation(Vector3(0,-2,-50)) * Matrix4::Scale(Vector3(80, 2, 100));
+ quick_shapes_.DrawCube(ground_matrix, view_matrix_, proj_matrix_, Color(0.3f, 0.9f, 0.4f));
+
+ // 3 targets
+ Matrix4 target1_matrix = Matrix4::Translation(Vector3(21, 6, -35)) * Matrix4::Scale(Vector3(1.5, 6, 10));
+ quick_shapes_.DrawCube(target1_matrix, view_matrix_, proj_matrix_, Color(0.6f, 0.4f, 0.2f));
+
+ Matrix4 target2_matrix = Matrix4::Translation(Vector3(25, 6, -35)) * Matrix4::Scale(Vector3(1.5, 6, 10));
+ quick_shapes_.DrawCube(target2_matrix, view_matrix_, proj_matrix_, Color(0.6f, 0.4f, 0.2f));
+
+ Matrix4 target3_matrix = Matrix4::Translation(Vector3(23, 18, -35)) * Matrix4::Scale(Vector3(1.5, 6, 10));
+ quick_shapes_.DrawCube(target3_matrix, view_matrix_, proj_matrix_, Color(0.6f, 0.4f, 0.2f));
+
+ // launcher
+ Matrix4 launcher_matrix;
+ quick_shapes_.DrawLineSegment(launcher_matrix, view_matrix_, proj_matrix_, Color(0,0,0),
+ Point3(-30,-2,-35), Point3(-30, 5, -35), 0.75);
+
+ // bird
+ Point3 bird_pos = CalcBirdPos(time_);
+ Matrix4 bird_matrix = Matrix4::Translation(bird_pos - Point3::Origin());
+ quick_shapes_.DrawSphere(bird_matrix, view_matrix_, proj_matrix_, Color(1,0,0));
+
+
+
+ // DEBUGGING OUTPUT
+
+ // this is useful to be able to see where the origin is and the scale. The
+ // axes are drawn at (0,0,0), and each arrow is 1 unit long. The red axis is X,
+ // green is Y, and blue is Z.
+ Matrix4 identity;
+ quick_shapes_.DrawAxes(identity, view_matrix_, proj_matrix_);
+
+
+ // TODO: make sure bird velocity makes sense. (hint, hint)
+
+
+
+}
+
+
+
+
+
diff --git a/dev/angry-vectors/angry_vectors.h b/dev/angry-vectors/angry_vectors.h
new file mode 100644
index 0000000..37ad578
--- /dev/null
+++ b/dev/angry-vectors/angry_vectors.h
@@ -0,0 +1,71 @@
+/** CSci-4611 In-Class Example */
+
+#ifndef ANGRY_VECTORS_H_
+#define ANGRY_VECTORS_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include <string>
+#include <vector>
+
+class AngryVectors : public GraphicsApp {
+public:
+
+ // Creates the App
+ AngryVectors();
+
+ // Cleans up when the App shuts down
+ virtual ~AngryVectors();
+
+ // Note a Run() function is inherited from GraphicsApp, that's what
+ // actually starts up the App.
+
+ // This is a callback, a function that gets called when the user presses
+ // the Pause button in the GUI.
+ void OnPauseBtnPressed();
+
+ // This calculates the bird position given a time value.
+ Point3 CalcBirdPos(double time);
+
+ // This calculates the bird velocity given a time value, this is the routine
+ // we want to check to make sure it is working properly
+ Vector3 CalcBirdVel(double time);
+
+ // This gets called once each frame. Note that dt (a.k.a., "delta time") is
+ // the amount of time (in seconds) that has passed since the last frame.
+ void UpdateSimulation(double dt);
+
+ // This is where we initialize the on-screen GUI, which is implemented using
+ // an open source library called NanoGUI. It gets called once
+ // when the program starts up.
+ void InitNanoGUI();
+
+ // This is where we initialize any OpenGL data, like textures or meshes that
+ // need to be loaded from files and setup in OpenGL. It gets called once
+ // when the program starts up.
+ void InitOpenGL();
+
+ // This gets called once each frame, and this is where you draw the latest
+ // version of your 3D graphics scene.
+ void DrawUsingOpenGL();
+
+
+private:
+
+ // Time of flight for our "bird"
+ float time_;
+
+ // Sets up the computer graphics camera
+ Matrix4 view_matrix_;
+ Matrix4 proj_matrix_;
+
+ // A helper class for drawing some simple shapes (cubes, spheres, 3D arrows)
+ QuickShapes quick_shapes_;
+
+ // Gui elements
+ nanogui::Button *pauseBtn_;
+ bool playing_;
+};
+
+#endif \ No newline at end of file
diff --git a/dev/angry-vectors/cmake/DownloadHelper.txt.in b/dev/angry-vectors/cmake/DownloadHelper.txt.in
new file mode 100644
index 0000000..fb29bff
--- /dev/null
+++ b/dev/angry-vectors/cmake/DownloadHelper.txt.in
@@ -0,0 +1,26 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# This is a "helper" cmake project -- the only thing this project does is download
+# the external project. So, the configure, build, install, and test commands for
+# ExternalProject_Add() are intentionally set as NOPs.
+
+cmake_minimum_required (VERSION 3.9)
+
+project(@EXT_PROJECT_NAME@-download)
+
+include(ExternalProject)
+ExternalProject_Add(
+ @EXT_PROJECT_NAME@
+ SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
+ BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
+ @DOWNLOAD_OPTIONS@
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ LOG_DOWNLOAD ON
+ GIT_PROGRESS 1
+)
+
+
diff --git a/dev/angry-vectors/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/angry-vectors/cmake/ExternalProjectDownloadBuildInstall.cmake
new file mode 100644
index 0000000..ce12d1d
--- /dev/null
+++ b/dev/angry-vectors/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -0,0 +1,98 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+
+# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
+# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
+# should be stored right next to this one. So, defining this variable outside the scope of the
+# functions below.
+set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
+
+
+
+# Usage:
+# ExternalProject_Download(
+# # This first argument is the name of the project to download. It is required:
+# glm
+#
+# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
+# # These can be any of the arguments used for the downloading step of the cmake builtin
+# # ExternalProject_Add command.
+# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
+# GIT_TAG master
+# etc..
+# )
+function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
+
+ h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
+
+ set(DOWNLOAD_OPTIONS ${ARGN})
+ string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
+
+
+ file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
+ configure_file(
+ ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
+ ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
+ )
+
+ h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Completed download of external project ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
+
+# Usage:
+# ExternalProject_BuildAndInstallNow(
+# # This first argument is the name of the external project to download. It is required:
+# VRPN
+# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
+# # main CMakeLists.txt file:
+# src
+#
+# # Additional arguments are passed on as options to the cmake build file generator
+# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
+# -DVRPN_BUILD_HID_GUI=OFF
+# etc..
+# )
+function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
+
+ # any extra args to the function are interpreted as arguments for the cmake config process
+ set(CMAKE_CONFIG_OPTIONS ${ARGN})
+
+ # always set the install prefix to be the same as for the main project
+ list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
+
+ #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
+
+
+ set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
+
+ file(MAKE_DIRECTORY ${BUILD_DIR})
+
+ h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
+ message(STATUS "Using source dir: ${SRC_DIR}")
+ message(STATUS "Using build dir: ${BUILD_DIR}")
+ message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
+
+ h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
+
+ h2("Completed external build of ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
diff --git a/dev/angry-vectors/cmake/MessageMacros.cmake b/dev/angry-vectors/cmake/MessageMacros.cmake
new file mode 100644
index 0000000..4628e5c
--- /dev/null
+++ b/dev/angry-vectors/cmake/MessageMacros.cmake
@@ -0,0 +1,17 @@
+# This file is part of the MinVR cmake build system.
+# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
+
+
+macro(h1 TITLE)
+ string(TOUPPER ${TITLE} TITLE)
+ message(STATUS "\n\n==== ${TITLE} ====")
+endmacro()
+
+macro(h2 TITLE)
+ message(STATUS "\n* ${TITLE}")
+endmacro()
+
+macro(h3 TITLE)
+ message(STATUS "- ${TITLE}")
+endmacro()
+
diff --git a/dev/angry-vectors/cmake/UseOpenGL.cmake b/dev/angry-vectors/cmake/UseOpenGL.cmake
new file mode 100644
index 0000000..2ec5ffb
--- /dev/null
+++ b/dev/angry-vectors/cmake/UseOpenGL.cmake
@@ -0,0 +1,52 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# Either finds a pre-installed version or complains.
+
+# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
+# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
+# or add_library(${PROJECT_NAME} ...)), add the following two lines:
+
+# include(UseOpenGL)
+# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
+
+# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
+# usage described here:
+# https://cmake.org/cmake/help/latest/command/target_include_directories.html
+
+# The third argument is the directory to use for downloading the external project if
+# autobuild is used.
+
+
+
+macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
+
+ message(STATUS "Searching for OpenGL...")
+
+ # Check to see if the library is already installed on the system
+ # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
+ # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
+ # now the preferred way to link with OpenGL and all of its dependencies.
+ # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
+ find_package(OpenGL)
+
+ if (NOT ${OPENGL_FOUND})
+ message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
+ endif()
+
+ message(STATUS "Ok: OpenGL Found.")
+ message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
+ message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
+
+
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
+
+ if (${OPENGL_GLU_FOUND})
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
+ endif()
+
+ target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
+
+endmacro()
diff --git a/dev/angry-vectors/main.cc b/dev/angry-vectors/main.cc
new file mode 100644
index 0000000..0bacdcf
--- /dev/null
+++ b/dev/angry-vectors/main.cc
@@ -0,0 +1,9 @@
+/** CSci-4611 In-Class Example */
+
+#include "angry_vectors.h"
+
+int main(int argc, const char *argv[]) {
+ AngryVectors app;
+ app.Run();
+ return 0;
+}
diff --git a/dev/mesh-demo/.gitignore b/dev/mesh-demo/.gitignore
new file mode 100644
index 0000000..dd1a9a8
--- /dev/null
+++ b/dev/mesh-demo/.gitignore
@@ -0,0 +1,2 @@
+config.h
+build
diff --git a/dev/mesh-demo/CMakeLists.txt b/dev/mesh-demo/CMakeLists.txt
new file mode 100644
index 0000000..6e2bfc5
--- /dev/null
+++ b/dev/mesh-demo/CMakeLists.txt
@@ -0,0 +1,182 @@
+# Original Author(s) of this File:
+# Daniel Keefe, 2017, University of Minnesota
+#
+# Author(s) of Significant Updates/Modifications to the File:
+# ...
+
+
+
+# You are encouraged to copy this example, move it outside of the MinGfx directory, and use
+# it as a starting point for your project. When you do this, you'll have to edit the
+# following line as needed to point to the MinGfx install prefix used on your system.
+
+# !!!!!!!!!!!!! EDIT THE FOLLOWING LINE AS NEEDED !!!!!!!!!!!!!
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build/install ../..)
+
+
+
+
+
+#### BASIC PROJECT SETUP ####
+
+project(example)
+
+# Using 3.9 to get a modern version of FindOpenGL.cmake
+cmake_minimum_required (VERSION 3.9)
+
+# Dependencies that are auto-downloaded, built, and installed for you will go in the
+# directory pointed to by the CMAKE_INSTALL_PREFIX. It defaults to a location inside
+# the build directory.
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
+ set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
+endif()
+
+# Add to paths cmake uses to search for scripts, modules, and config packages
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_INSTALL_PREFIX})
+list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_INSTALL_PREFIX})
+
+include(MessageMacros)
+h1("Building ${PROJECT_NAME}")
+h2("Configuring paths")
+
+message(STATUS "Module path: ${CMAKE_MODULE_PATH}")
+message(STATUS "Prefix path: ${CMAKE_PREFIX_PATH}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+
+set(DATA_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/data)
+set(DATA_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
+
+message(STATUS "Data dir (in build tree): ${DATA_DIR_BUILD}")
+message(STATUS "Data dir (in install tree): ${DATA_DIR_INSTALL}")
+
+set(SHADERS_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/shaders)
+set(SHADERS_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/shaders)
+
+message(STATUS "Shaders dir (in build tree): ${SHADERS_DIR_BUILD}")
+message(STATUS "Shaders dir (in install tree): ${SHADERS_DIR_INSTALL}")
+
+
+#### SOURCE FOR THIS PROJECT ####
+h2("Configuring source files")
+
+set(SOURCEFILES
+ example.cc
+ main.cc
+)
+
+set(HEADERFILES
+ example.h
+)
+
+set(EXTRAFILES
+ README.md
+)
+
+set(SHADERFILES
+)
+
+set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+set_source_files_properties(${SHADERFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+source_group("Shaders" FILES ${SHADERFILES})
+
+
+#### COMPILE OPTIONS ####
+
+h2("Configuring Compiler Options")
+
+
+
+message(STATUS "Building for " ${CMAKE_SYSTEM_NAME} ".")
+
+# Linux specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions(-DLINUX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Apple specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_definitions(-DOSX)
+
+ # RPATH settings, see https://cmake.org/Wiki/CMake_RPATH_handling
+ set(CMAKE_MACOSX_RPATH ON)
+
+ # use, i.e. don't skip the full RPATH for the build tree
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+ # when building, don't use the install RPATH already
+ # (but later on when installing)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # add the automatically determined parts of the RPATH
+ # which point to directories outside the build tree to the install RPATH
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+ # the RPATH to be used when installing, but only if it's not a system directory
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ IF("${isSystemDir}" STREQUAL "-1")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ ENDIF("${isSystemDir}" STREQUAL "-1")
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Windows specific
+if (WIN32)
+ add_definitions(-DWIN32)
+endif()
+
+
+
+
+#### DEFINE TARGET(S) ####
+
+h2("Defining Target(s)")
+
+add_executable(${PROJECT_NAME} ${SOURCEFILES} ${HEADERFILES} ${EXTRAFILES} ${SHADERFILES})
+
+
+
+#### FIND AND ADD DEPENDENCIES ####
+
+h2("Adding Dependencies")
+set(EXTERNAL_DIR external)
+
+
+# MinGfx (linked with an imported cmake target so no need to specify include dirs)
+# This will try to find MinGfxConfig.cmake, which should have been installed under
+# CMAKE_INSTALL_PREFIX/lib/cmake/MinGfx when you installed the MinGfx Toolkit.
+find_package(MinGfx REQUIRED)
+target_link_libraries(${PROJECT_NAME} PUBLIC MinGfx::MinGfx)
+
+
+# Add dependency on OpenGL
+include(UseOpenGL)
+UseOpenGL(${PROJECT_NAME} PUBLIC ${EXTERNAL_DIR})
+
+
+
+#### INSTALL TARGET(S) ####
+
+h2("Configuring Install Target")
+
+# The install locations are relative to the CMAKE_INSTALL_PREFIX variable
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
+
+install(
+ DIRECTORY data/
+ DESTINATION ${DATA_DIR_INSTALL}
+ OPTIONAL
+)
+
+install(
+ DIRECTORY shaders/
+ DESTINATION ${SHADERS_DIR_INSTALL}
+ OPTIONAL
+)
diff --git a/dev/mesh-demo/README.md b/dev/mesh-demo/README.md
new file mode 100644
index 0000000..ee42984
--- /dev/null
+++ b/dev/mesh-demo/README.md
@@ -0,0 +1 @@
+# Angry Vectors CSci-4611 In-Class Example of Visual Debugging
diff --git a/dev/mesh-demo/cmake/DownloadHelper.txt.in b/dev/mesh-demo/cmake/DownloadHelper.txt.in
new file mode 100644
index 0000000..fb29bff
--- /dev/null
+++ b/dev/mesh-demo/cmake/DownloadHelper.txt.in
@@ -0,0 +1,26 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# This is a "helper" cmake project -- the only thing this project does is download
+# the external project. So, the configure, build, install, and test commands for
+# ExternalProject_Add() are intentionally set as NOPs.
+
+cmake_minimum_required (VERSION 3.9)
+
+project(@EXT_PROJECT_NAME@-download)
+
+include(ExternalProject)
+ExternalProject_Add(
+ @EXT_PROJECT_NAME@
+ SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
+ BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
+ @DOWNLOAD_OPTIONS@
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ LOG_DOWNLOAD ON
+ GIT_PROGRESS 1
+)
+
+
diff --git a/dev/mesh-demo/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/mesh-demo/cmake/ExternalProjectDownloadBuildInstall.cmake
new file mode 100644
index 0000000..ce12d1d
--- /dev/null
+++ b/dev/mesh-demo/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -0,0 +1,98 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+
+# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
+# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
+# should be stored right next to this one. So, defining this variable outside the scope of the
+# functions below.
+set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
+
+
+
+# Usage:
+# ExternalProject_Download(
+# # This first argument is the name of the project to download. It is required:
+# glm
+#
+# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
+# # These can be any of the arguments used for the downloading step of the cmake builtin
+# # ExternalProject_Add command.
+# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
+# GIT_TAG master
+# etc..
+# )
+function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
+
+ h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
+
+ set(DOWNLOAD_OPTIONS ${ARGN})
+ string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
+
+
+ file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
+ configure_file(
+ ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
+ ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
+ )
+
+ h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Completed download of external project ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
+
+# Usage:
+# ExternalProject_BuildAndInstallNow(
+# # This first argument is the name of the external project to download. It is required:
+# VRPN
+# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
+# # main CMakeLists.txt file:
+# src
+#
+# # Additional arguments are passed on as options to the cmake build file generator
+# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
+# -DVRPN_BUILD_HID_GUI=OFF
+# etc..
+# )
+function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
+
+ # any extra args to the function are interpreted as arguments for the cmake config process
+ set(CMAKE_CONFIG_OPTIONS ${ARGN})
+
+ # always set the install prefix to be the same as for the main project
+ list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
+
+ #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
+
+
+ set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
+
+ file(MAKE_DIRECTORY ${BUILD_DIR})
+
+ h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
+ message(STATUS "Using source dir: ${SRC_DIR}")
+ message(STATUS "Using build dir: ${BUILD_DIR}")
+ message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
+
+ h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
+
+ h2("Completed external build of ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
diff --git a/dev/mesh-demo/cmake/MessageMacros.cmake b/dev/mesh-demo/cmake/MessageMacros.cmake
new file mode 100644
index 0000000..4628e5c
--- /dev/null
+++ b/dev/mesh-demo/cmake/MessageMacros.cmake
@@ -0,0 +1,17 @@
+# This file is part of the MinVR cmake build system.
+# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
+
+
+macro(h1 TITLE)
+ string(TOUPPER ${TITLE} TITLE)
+ message(STATUS "\n\n==== ${TITLE} ====")
+endmacro()
+
+macro(h2 TITLE)
+ message(STATUS "\n* ${TITLE}")
+endmacro()
+
+macro(h3 TITLE)
+ message(STATUS "- ${TITLE}")
+endmacro()
+
diff --git a/dev/mesh-demo/cmake/UseOpenGL.cmake b/dev/mesh-demo/cmake/UseOpenGL.cmake
new file mode 100644
index 0000000..2ec5ffb
--- /dev/null
+++ b/dev/mesh-demo/cmake/UseOpenGL.cmake
@@ -0,0 +1,52 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# Either finds a pre-installed version or complains.
+
+# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
+# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
+# or add_library(${PROJECT_NAME} ...)), add the following two lines:
+
+# include(UseOpenGL)
+# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
+
+# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
+# usage described here:
+# https://cmake.org/cmake/help/latest/command/target_include_directories.html
+
+# The third argument is the directory to use for downloading the external project if
+# autobuild is used.
+
+
+
+macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
+
+ message(STATUS "Searching for OpenGL...")
+
+ # Check to see if the library is already installed on the system
+ # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
+ # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
+ # now the preferred way to link with OpenGL and all of its dependencies.
+ # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
+ find_package(OpenGL)
+
+ if (NOT ${OPENGL_FOUND})
+ message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
+ endif()
+
+ message(STATUS "Ok: OpenGL Found.")
+ message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
+ message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
+
+
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
+
+ if (${OPENGL_GLU_FOUND})
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
+ endif()
+
+ target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
+
+endmacro()
diff --git a/dev/mesh-demo/example.cc b/dev/mesh-demo/example.cc
new file mode 100644
index 0000000..759b09b
--- /dev/null
+++ b/dev/mesh-demo/example.cc
@@ -0,0 +1,107 @@
+/** CSci-4611 In-Class Example */
+
+#include "Example.h"
+
+#include <iostream>
+#include <sstream>
+
+
+
+Example::Example() : GraphicsApp(1024,768, "MinGfx Example") {
+}
+
+
+Example::~Example() {
+}
+
+
+void Example::UpdateSimulation(double dt) {
+}
+
+
+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);
+ view_matrix_ = Matrix4::LookAt(Point3(0,0,3), Point3(0,0,0), Vector3(0,1,0));
+ glClearColor(1,1,1,1);
+
+
+ // EXAMPLE 1: Load the mesh from a file
+ teapot_mesh_.LoadFromOBJ(Platform::FindMinGfxDataFile("teapot.obj"));
+
+
+
+
+ // EXAMPLE 2: Create the mesh by adding triangles one at a time
+ int tri_id;
+ // add a first triangle
+ tri_id = triangles_mesh_.AddTriangle(Point3(0,0,0), Point3(1,0,0), Point3(1,1,0));
+ // set attributes for the vertices
+ triangles_mesh_.SetNormals(tri_id, Vector3(0,0,1), Vector3(0,0,1), Vector3(0,0,1));
+ // add a second triangle and attributes
+ tri_id = triangles_mesh_.AddTriangle(Point3(0,0,0), Point3(1,1,0), Point3(0,1,0));
+ triangles_mesh_.SetNormals(tri_id, Vector3(0,0,1), Vector3(0,0,1), Vector3(0,0,1));
+ // call this when done to save to the GPU
+ triangles_mesh_.UpdateGPUMemory();
+
+
+
+
+
+ // EXAMPLE 3: Create the mesh by setting the vertex and index arrays directly
+ std::vector<unsigned int> indices;
+ std::vector<Point3> vertices;
+ std::vector<Vector3> normals;
+
+ // four vertices, each requires 3 floats: (x,y,z)
+ vertices.push_back(Point3(0,0,0));
+ vertices.push_back(Point3(1,0,0));
+ vertices.push_back(Point3(1,1,0));
+ vertices.push_back(Point3(0,1,0));
+
+ // four normals, each requires 3 floats: (x,y,z)
+ normals.push_back(Vector3(0,0,1));
+ normals.push_back(Vector3(0,0,1));
+ normals.push_back(Vector3(0,0,1));
+ normals.push_back(Vector3(0,0,1));
+
+ // indices into the arrays above for the first triangle
+ indices.push_back(0);
+ indices.push_back(1);
+ indices.push_back(2);
+
+ // indices for the second triangle, note some are reused
+ indices.push_back(0);
+ indices.push_back(2);
+ indices.push_back(3);
+
+ indexed_tris_mesh_.SetVertices(vertices);
+ indexed_tris_mesh_.SetNormals(normals);
+ indexed_tris_mesh_.SetIndices(indices);
+ indexed_tris_mesh_.UpdateGPUMemory();
+
+}
+
+
+void Example::DrawUsingOpenGL() {
+ // 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 teapot_transform = Matrix4::Translation(Vector3(-1.5,0,0));
+ shader_.Draw(teapot_transform, view_matrix_, proj_matrix_, &teapot_mesh_, DefaultShader::MaterialProperties());
+
+ Matrix4 mesh2_transform = Matrix4::Translation(Vector3(-0.5,-0.5,0));
+ shader_.Draw(mesh2_transform, view_matrix_, proj_matrix_, &triangles_mesh_, DefaultShader::MaterialProperties());
+
+ Matrix4 mesh3_transform = Matrix4::Translation(Vector3(1,-0.5,0));
+ shader_.Draw(mesh3_transform, view_matrix_, proj_matrix_, &indexed_tris_mesh_, DefaultShader::MaterialProperties());
+}
+
+
+
+
+
diff --git a/dev/mesh-demo/example.h b/dev/mesh-demo/example.h
new file mode 100644
index 0000000..7ce1a89
--- /dev/null
+++ b/dev/mesh-demo/example.h
@@ -0,0 +1,61 @@
+/** CSci-4611 In-Class Example */
+
+#ifndef SNOWMAN_H_
+#define SNOWMAN_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include <string>
+#include <vector>
+
+class Example : public GraphicsApp {
+public:
+
+ // Creates the App
+ Example();
+
+ // Cleans up when the App shuts down
+ virtual ~Example();
+
+ // Note a Run() function is inherited from GraphicsApp, that's what
+ // actually starts up the App.
+
+ // This is a callback, a function that gets called when the user presses
+ // the Pause button in the GUI.
+ void OnPauseBtnPressed();
+
+ // This gets called once each frame. Note that dt (a.k.a., "delta time") is
+ // the amount of time (in seconds) that has passed since the last frame.
+ void UpdateSimulation(double dt);
+
+ // This is where we initialize any OpenGL data, like textures or meshes that
+ // need to be loaded from files and setup in OpenGL. It gets called once
+ // when the program starts up.
+ void InitOpenGL();
+
+ // This gets called once each frame, and this is where you draw the latest
+ // version of your 3D graphics scene.
+ void DrawUsingOpenGL();
+
+
+private:
+
+ // Triangle mesh data structures
+ Mesh teapot_mesh_;
+ Mesh triangles_mesh_;
+ Mesh indexed_tris_mesh_;
+
+ // A shader is required to draw meshes, MinGfx provides a default shader
+ // that does some simple lighting.
+ DefaultShader shader_;
+
+ // Sets up the computer graphics camera
+ Matrix4 view_matrix_;
+ Matrix4 proj_matrix_;
+
+ // A helper class for drawing some simple shapes (cubes, spheres, 3D arrows)
+ QuickShapes quick_shapes_;
+};
+
+#endif \ No newline at end of file
diff --git a/dev/mesh-demo/main.cc b/dev/mesh-demo/main.cc
new file mode 100644
index 0000000..3bbc8b8
--- /dev/null
+++ b/dev/mesh-demo/main.cc
@@ -0,0 +1,9 @@
+/** CSci-4611 In-Class Example */
+
+#include "example.h"
+
+int main(int argc, const char *argv[]) {
+ Example app;
+ app.Run();
+ return 0;
+}
diff --git a/dev/rays/.gitignore b/dev/rays/.gitignore
new file mode 100644
index 0000000..dd1a9a8
--- /dev/null
+++ b/dev/rays/.gitignore
@@ -0,0 +1,2 @@
+config.h
+build
diff --git a/dev/rays/CMakeLists.txt b/dev/rays/CMakeLists.txt
new file mode 100644
index 0000000..eb62b1e
--- /dev/null
+++ b/dev/rays/CMakeLists.txt
@@ -0,0 +1,193 @@
+# Original Author(s) of this File:
+# Daniel Keefe, 2017, University of Minnesota
+#
+# Author(s) of Significant Updates/Modifications to the File:
+# ...
+
+
+
+# You are encouraged to copy this example, move it outside of the MinGfx directory, and use
+# it as a starting point for your project. When you do this, you'll have to edit the
+# following line as needed to point to the MinGfx install prefix used on your system.
+
+# !!!!!!!!!!!!! EDIT THE FOLLOWING LINE AS NEEDED !!!!!!!!!!!!!
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build/install ../..)
+
+
+#### BASIC PROJECT SETUP ####
+
+project(example)
+
+# Using 3.9 to get a modern version of FindOpenGL.cmake
+cmake_minimum_required (VERSION 3.9)
+
+# Dependencies that are auto-downloaded, built, and installed for you will go in the
+# directory pointed to by the CMAKE_INSTALL_PREFIX. It defaults to a location inside
+# the build directory.
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
+ set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
+endif()
+
+# Add to paths cmake uses to search for scripts, modules, and config packages
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_INSTALL_PREFIX})
+list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_INSTALL_PREFIX})
+
+include(MessageMacros)
+h1("Building ${PROJECT_NAME}")
+h2("Configuring paths")
+
+message(STATUS "Module path: ${CMAKE_MODULE_PATH}")
+message(STATUS "Prefix path: ${CMAKE_PREFIX_PATH}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+
+set(DATA_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/data)
+set(DATA_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
+
+message(STATUS "Data dir (in build tree): ${DATA_DIR_BUILD}")
+message(STATUS "Data dir (in install tree): ${DATA_DIR_INSTALL}")
+
+set(SHADERS_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/shaders)
+set(SHADERS_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/shaders)
+
+message(STATUS "Shaders dir (in build tree): ${SHADERS_DIR_BUILD}")
+message(STATUS "Shaders dir (in install tree): ${SHADERS_DIR_INSTALL}")
+
+
+# Configure a header file to pass some of the CMake settings to the source code
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/config.h
+)
+
+
+#### SOURCE FOR THIS PROJECT ####
+h2("Configuring source files")
+
+set(SOURCEFILES
+ example.cc
+ main.cc
+)
+
+set(HEADERFILES
+ config.h
+ example.h
+)
+
+set(EXTRAFILES
+ README.md
+)
+
+set(SHADERFILES
+)
+
+set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+set_source_files_properties(${SHADERFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+source_group("Shaders" FILES ${SHADERFILES})
+
+
+#### COMPILE OPTIONS ####
+
+h2("Configuring Compiler Options")
+
+
+
+message(STATUS "Building for " ${CMAKE_SYSTEM_NAME} ".")
+
+# Linux specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions(-DLINUX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Apple specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_definitions(-DOSX)
+
+ # RPATH settings, see https://cmake.org/Wiki/CMake_RPATH_handling
+ set(CMAKE_MACOSX_RPATH ON)
+
+ # use, i.e. don't skip the full RPATH for the build tree
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+ # when building, don't use the install RPATH already
+ # (but later on when installing)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # add the automatically determined parts of the RPATH
+ # which point to directories outside the build tree to the install RPATH
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+ # the RPATH to be used when installing, but only if it's not a system directory
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ IF("${isSystemDir}" STREQUAL "-1")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ ENDIF("${isSystemDir}" STREQUAL "-1")
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Windows specific
+if (WIN32)
+ add_definitions(-DWIN32)
+
+ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
+ message(FATAL_ERROR
+ "You must use the 64 bit version of the compiler. Be sure to set the correct generator when configuring through CMake.")
+ endif()
+endif()
+
+
+
+
+
+#### DEFINE TARGET(S) ####
+
+h2("Defining Target(s)")
+
+add_executable(${PROJECT_NAME} ${SOURCEFILES} ${HEADERFILES} ${EXTRAFILES} ${SHADERFILES})
+
+
+
+#### FIND AND ADD DEPENDENCIES ####
+
+h2("Adding Dependencies")
+set(EXTERNAL_DIR external)
+
+
+# MinGfx (linked with an imported cmake target so no need to specify include dirs)
+# This will try to find MinGfxConfig.cmake, which should have been installed under
+# CMAKE_INSTALL_PREFIX/lib/cmake/MinGfx when you installed the MinGfx Toolkit.
+find_package(MinGfx REQUIRED)
+target_link_libraries(${PROJECT_NAME} PUBLIC MinGfx::MinGfx)
+
+
+# Add dependency on OpenGL
+include(UseOpenGL)
+UseOpenGL(${PROJECT_NAME} PUBLIC ${EXTERNAL_DIR})
+
+
+
+#### INSTALL TARGET(S) ####
+
+h2("Configuring Install Target")
+
+# The install locations are relative to the CMAKE_INSTALL_PREFIX variable
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
+
+install(
+ DIRECTORY data/
+ DESTINATION ${DATA_DIR_INSTALL}
+ OPTIONAL
+)
+
+install(
+ DIRECTORY shaders/
+ DESTINATION ${SHADERS_DIR_INSTALL}
+ OPTIONAL
+)
diff --git a/dev/rays/README.md b/dev/rays/README.md
new file mode 100644
index 0000000..ee42984
--- /dev/null
+++ b/dev/rays/README.md
@@ -0,0 +1 @@
+# Angry Vectors CSci-4611 In-Class Example of Visual Debugging
diff --git a/dev/rays/cmake/DownloadHelper.txt.in b/dev/rays/cmake/DownloadHelper.txt.in
new file mode 100644
index 0000000..fb29bff
--- /dev/null
+++ b/dev/rays/cmake/DownloadHelper.txt.in
@@ -0,0 +1,26 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# This is a "helper" cmake project -- the only thing this project does is download
+# the external project. So, the configure, build, install, and test commands for
+# ExternalProject_Add() are intentionally set as NOPs.
+
+cmake_minimum_required (VERSION 3.9)
+
+project(@EXT_PROJECT_NAME@-download)
+
+include(ExternalProject)
+ExternalProject_Add(
+ @EXT_PROJECT_NAME@
+ SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
+ BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
+ @DOWNLOAD_OPTIONS@
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ LOG_DOWNLOAD ON
+ GIT_PROGRESS 1
+)
+
+
diff --git a/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake
new file mode 100644
index 0000000..ce12d1d
--- /dev/null
+++ b/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -0,0 +1,98 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+
+# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
+# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
+# should be stored right next to this one. So, defining this variable outside the scope of the
+# functions below.
+set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
+
+
+
+# Usage:
+# ExternalProject_Download(
+# # This first argument is the name of the project to download. It is required:
+# glm
+#
+# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
+# # These can be any of the arguments used for the downloading step of the cmake builtin
+# # ExternalProject_Add command.
+# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
+# GIT_TAG master
+# etc..
+# )
+function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
+
+ h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
+
+ set(DOWNLOAD_OPTIONS ${ARGN})
+ string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
+
+
+ file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
+ configure_file(
+ ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
+ ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
+ )
+
+ h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Completed download of external project ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
+
+# Usage:
+# ExternalProject_BuildAndInstallNow(
+# # This first argument is the name of the external project to download. It is required:
+# VRPN
+# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
+# # main CMakeLists.txt file:
+# src
+#
+# # Additional arguments are passed on as options to the cmake build file generator
+# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
+# -DVRPN_BUILD_HID_GUI=OFF
+# etc..
+# )
+function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
+
+ # any extra args to the function are interpreted as arguments for the cmake config process
+ set(CMAKE_CONFIG_OPTIONS ${ARGN})
+
+ # always set the install prefix to be the same as for the main project
+ list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
+
+ #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
+
+
+ set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
+
+ file(MAKE_DIRECTORY ${BUILD_DIR})
+
+ h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
+ message(STATUS "Using source dir: ${SRC_DIR}")
+ message(STATUS "Using build dir: ${BUILD_DIR}")
+ message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
+
+ h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
+
+ h2("Completed external build of ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
diff --git a/dev/rays/cmake/MessageMacros.cmake b/dev/rays/cmake/MessageMacros.cmake
new file mode 100644
index 0000000..4628e5c
--- /dev/null
+++ b/dev/rays/cmake/MessageMacros.cmake
@@ -0,0 +1,17 @@
+# This file is part of the MinVR cmake build system.
+# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
+
+
+macro(h1 TITLE)
+ string(TOUPPER ${TITLE} TITLE)
+ message(STATUS "\n\n==== ${TITLE} ====")
+endmacro()
+
+macro(h2 TITLE)
+ message(STATUS "\n* ${TITLE}")
+endmacro()
+
+macro(h3 TITLE)
+ message(STATUS "- ${TITLE}")
+endmacro()
+
diff --git a/dev/rays/cmake/UseOpenGL.cmake b/dev/rays/cmake/UseOpenGL.cmake
new file mode 100644
index 0000000..2ec5ffb
--- /dev/null
+++ b/dev/rays/cmake/UseOpenGL.cmake
@@ -0,0 +1,52 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# Either finds a pre-installed version or complains.
+
+# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
+# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
+# or add_library(${PROJECT_NAME} ...)), add the following two lines:
+
+# include(UseOpenGL)
+# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
+
+# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
+# usage described here:
+# https://cmake.org/cmake/help/latest/command/target_include_directories.html
+
+# The third argument is the directory to use for downloading the external project if
+# autobuild is used.
+
+
+
+macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
+
+ message(STATUS "Searching for OpenGL...")
+
+ # Check to see if the library is already installed on the system
+ # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
+ # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
+ # now the preferred way to link with OpenGL and all of its dependencies.
+ # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
+ find_package(OpenGL)
+
+ if (NOT ${OPENGL_FOUND})
+ message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
+ endif()
+
+ message(STATUS "Ok: OpenGL Found.")
+ message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
+ message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
+
+
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
+
+ if (${OPENGL_GLU_FOUND})
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
+ endif()
+
+ target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
+
+endmacro()
diff --git a/dev/rays/config.h.in b/dev/rays/config.h.in
new file mode 100644
index 0000000..16d824b
--- /dev/null
+++ b/dev/rays/config.h.in
@@ -0,0 +1,13 @@
+/** CSci-4611 In-Class Example
+*/
+
+
+// The file config.h.in is processed by cmake to produce config.h. This
+// replaces strings of the form "at"CMAKE_VARIABLE_NAME"at" with the value
+// of the corresponding cmake variable, allowing us to pass directory paths
+// and other information configured with cmake into our C++ code.
+
+
+#define DATA_DIR_BUILD "@DATA_DIR_BUILD@"
+#define DATA_DIR_INSTALL "@DATA_DIR_INSTALL@"
+
diff --git a/dev/rays/data/dartboard.jpg b/dev/rays/data/dartboard.jpg
new file mode 100644
index 0000000..fd1b36b
--- /dev/null
+++ b/dev/rays/data/dartboard.jpg
Binary files differ
diff --git a/dev/rays/example.cc b/dev/rays/example.cc
new file mode 100644
index 0000000..bfccb05
--- /dev/null
+++ b/dev/rays/example.cc
@@ -0,0 +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_);
+}
+
+
+
+
diff --git a/dev/rays/example.h b/dev/rays/example.h
new file mode 100644
index 0000000..f653166
--- /dev/null
+++ b/dev/rays/example.h
@@ -0,0 +1,62 @@
+/** CSci-4611 In-Class Example */
+
+#ifndef EXAMPLE_H_
+#define EXAMPLE_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include <string>
+#include <vector>
+
+class Example : public GraphicsApp {
+public:
+
+ // Creates the App
+ Example();
+
+ // Cleans up when the App shuts down
+ virtual ~Example();
+
+ // Note a Run() function is inherited from GraphicsApp, that's what
+ // actually starts up the App.
+
+ void OnLeftMouseDown(const Point2& pos);
+ void OnLeftMouseDrag(const Point2& pos, const Vector2& delta);
+ void OnLeftMouseUp(const Point2& pos);
+
+ void OnRightMouseDrag(const Point2& pos, const Vector2& delta);
+
+ // This gets called once each frame. Note that dt (a.k.a., "delta time") is
+ // the amount of time (in seconds) that has passed since the last frame.
+ void UpdateSimulation(double dt);
+
+ // This is where we initialize any OpenGL data, like textures or meshes that
+ // need to be loaded from files and setup in OpenGL. It gets called once
+ // when the program starts up.
+ void InitOpenGL();
+
+ // This gets called once each frame, and this is where you draw the latest
+ // version of your 3D graphics scene.
+ void DrawUsingOpenGL();
+
+
+private:
+
+ // This implements something like the camera controls in minecraft. You can
+ // walk around using the arrow keys or ASWZ keys. You can also move your
+ // head to look around by dragging with the right mouse button. Internally,
+ // the camera creates a view matrix.
+ CraftCam cam_;
+ Matrix4 proj_matrix_;
+
+ // A helper class for drawing some simple shapes (cubes, spheres, 3D arrows)
+ QuickShapes quick_shapes_;
+
+ // A list of paths to search for data files (images and shaders)
+ std::vector<std::string> search_path_;
+
+ Texture2D dart_tex_;
+ };
+
+#endif \ No newline at end of file
diff --git a/dev/rays/main.cc b/dev/rays/main.cc
new file mode 100644
index 0000000..3bbc8b8
--- /dev/null
+++ b/dev/rays/main.cc
@@ -0,0 +1,9 @@
+/** CSci-4611 In-Class Example */
+
+#include "example.h"
+
+int main(int argc, const char *argv[]) {
+ Example app;
+ app.Run();
+ return 0;
+}
diff --git a/dev/robot_transforms/robot_transforms.pde b/dev/robot_transforms/robot_transforms.pde
new file mode 100644
index 0000000..380c34f
--- /dev/null
+++ b/dev/robot_transforms/robot_transforms.pde
@@ -0,0 +1,78 @@
+
+
+float t = 0.0;
+
+void setup()
+{
+ size(600, 310);
+ smooth();
+}
+
+void draw() {
+ background(255);
+ drawFloor();
+ drawRobot();
+ t += 0.05;
+}
+
+
+void drawRobot() {
+
+}
+
+
+// HELPER ROUTINES FOR DRAWING THE ROBOT'S BODY PARTS
+
+// 50x65 rectangle with origin at bottom center (pelvis area)
+void drawTorso() {
+ noStroke();
+ fill(38, 38, 200);
+ rect(-25, -65, 50, 65); // body
+}
+
+// 38x30 rectangle with origin at bottom center
+void drawHead() {
+ noStroke();
+ fill(38, 38, 200);
+ rect(-19, -30, 38, 30);
+ fill(222, 222, 249);
+ ellipse(-8, -18, 12, 12); // left eye
+ ellipse( 8, -18, 12, 12); // right eye
+}
+
+// 12x26 rectangle with origin at top center
+void drawArmPart() {
+ noStroke();
+ fill(38, 38, 200);
+ rect(-6, 0, 12, 26);
+}
+
+// 12x20 ellipse with origin at the top center
+void drawHand() {
+ noStroke();
+ fill(122, 122, 249);
+ ellipse(0, 10, 12, 20);
+}
+
+// 16x40 rectangle with origin at top center
+void drawLegPart() {
+ noStroke();
+ fill(38, 38, 200);
+ rect(-8, 0, 16, 40);
+}
+
+// 26x12 ellipse with origin at top center
+void drawFoot() {
+ noStroke();
+ fill(122, 122, 249);
+ ellipse(0, 6, 26, 12);
+}
+
+
+
+void drawFloor()
+{
+ noStroke();
+ fill(100, 255, 100);
+ rect(0, 300, 600, 10);
+}
diff --git a/dev/snowman/.gitignore b/dev/snowman/.gitignore
new file mode 100644
index 0000000..dd1a9a8
--- /dev/null
+++ b/dev/snowman/.gitignore
@@ -0,0 +1,2 @@
+config.h
+build
diff --git a/dev/snowman/CMakeLists.txt b/dev/snowman/CMakeLists.txt
new file mode 100644
index 0000000..8d4319a
--- /dev/null
+++ b/dev/snowman/CMakeLists.txt
@@ -0,0 +1,182 @@
+# Original Author(s) of this File:
+# Daniel Keefe, 2017, University of Minnesota
+#
+# Author(s) of Significant Updates/Modifications to the File:
+# ...
+
+
+
+# You are encouraged to copy this example, move it outside of the MinGfx directory, and use
+# it as a starting point for your project. When you do this, you'll have to edit the
+# following line as needed to point to the MinGfx install prefix used on your system.
+
+# !!!!!!!!!!!!! EDIT THE FOLLOWING LINE AS NEEDED !!!!!!!!!!!!!
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build/install ../..)
+
+
+
+
+
+#### BASIC PROJECT SETUP ####
+
+project(snowman)
+
+# Using 3.9 to get a modern version of FindOpenGL.cmake
+cmake_minimum_required (VERSION 3.9)
+
+# Dependencies that are auto-downloaded, built, and installed for you will go in the
+# directory pointed to by the CMAKE_INSTALL_PREFIX. It defaults to a location inside
+# the build directory.
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
+ set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
+endif()
+
+# Add to paths cmake uses to search for scripts, modules, and config packages
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_INSTALL_PREFIX})
+list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_INSTALL_PREFIX})
+
+include(MessageMacros)
+h1("Building ${PROJECT_NAME}")
+h2("Configuring paths")
+
+message(STATUS "Module path: ${CMAKE_MODULE_PATH}")
+message(STATUS "Prefix path: ${CMAKE_PREFIX_PATH}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+
+set(DATA_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/data)
+set(DATA_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
+
+message(STATUS "Data dir (in build tree): ${DATA_DIR_BUILD}")
+message(STATUS "Data dir (in install tree): ${DATA_DIR_INSTALL}")
+
+set(SHADERS_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/shaders)
+set(SHADERS_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/shaders)
+
+message(STATUS "Shaders dir (in build tree): ${SHADERS_DIR_BUILD}")
+message(STATUS "Shaders dir (in install tree): ${SHADERS_DIR_INSTALL}")
+
+
+#### SOURCE FOR THIS PROJECT ####
+h2("Configuring source files")
+
+set(SOURCEFILES
+ snowman.cc
+ main.cc
+)
+
+set(HEADERFILES
+ snowman.h
+)
+
+set(EXTRAFILES
+ README.md
+)
+
+set(SHADERFILES
+)
+
+set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+set_source_files_properties(${SHADERFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+source_group("Shaders" FILES ${SHADERFILES})
+
+
+#### COMPILE OPTIONS ####
+
+h2("Configuring Compiler Options")
+
+
+
+message(STATUS "Building for " ${CMAKE_SYSTEM_NAME} ".")
+
+# Linux specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions(-DLINUX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Apple specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_definitions(-DOSX)
+
+ # RPATH settings, see https://cmake.org/Wiki/CMake_RPATH_handling
+ set(CMAKE_MACOSX_RPATH ON)
+
+ # use, i.e. don't skip the full RPATH for the build tree
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+ # when building, don't use the install RPATH already
+ # (but later on when installing)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # add the automatically determined parts of the RPATH
+ # which point to directories outside the build tree to the install RPATH
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+ # the RPATH to be used when installing, but only if it's not a system directory
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ IF("${isSystemDir}" STREQUAL "-1")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ ENDIF("${isSystemDir}" STREQUAL "-1")
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Windows specific
+if (WIN32)
+ add_definitions(-DWIN32)
+endif()
+
+
+
+
+#### DEFINE TARGET(S) ####
+
+h2("Defining Target(s)")
+
+add_executable(${PROJECT_NAME} ${SOURCEFILES} ${HEADERFILES} ${EXTRAFILES} ${SHADERFILES})
+
+
+
+#### FIND AND ADD DEPENDENCIES ####
+
+h2("Adding Dependencies")
+set(EXTERNAL_DIR external)
+
+
+# MinGfx (linked with an imported cmake target so no need to specify include dirs)
+# This will try to find MinGfxConfig.cmake, which should have been installed under
+# CMAKE_INSTALL_PREFIX/lib/cmake/MinGfx when you installed the MinGfx Toolkit.
+find_package(MinGfx REQUIRED)
+target_link_libraries(${PROJECT_NAME} PUBLIC MinGfx::MinGfx)
+
+
+# Add dependency on OpenGL
+include(UseOpenGL)
+UseOpenGL(${PROJECT_NAME} PUBLIC ${EXTERNAL_DIR})
+
+
+
+#### INSTALL TARGET(S) ####
+
+h2("Configuring Install Target")
+
+# The install locations are relative to the CMAKE_INSTALL_PREFIX variable
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
+
+install(
+ DIRECTORY data/
+ DESTINATION ${DATA_DIR_INSTALL}
+ OPTIONAL
+)
+
+install(
+ DIRECTORY shaders/
+ DESTINATION ${SHADERS_DIR_INSTALL}
+ OPTIONAL
+)
diff --git a/dev/snowman/README.md b/dev/snowman/README.md
new file mode 100644
index 0000000..ee42984
--- /dev/null
+++ b/dev/snowman/README.md
@@ -0,0 +1 @@
+# Angry Vectors CSci-4611 In-Class Example of Visual Debugging
diff --git a/dev/snowman/cmake/DownloadHelper.txt.in b/dev/snowman/cmake/DownloadHelper.txt.in
new file mode 100644
index 0000000..fb29bff
--- /dev/null
+++ b/dev/snowman/cmake/DownloadHelper.txt.in
@@ -0,0 +1,26 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# This is a "helper" cmake project -- the only thing this project does is download
+# the external project. So, the configure, build, install, and test commands for
+# ExternalProject_Add() are intentionally set as NOPs.
+
+cmake_minimum_required (VERSION 3.9)
+
+project(@EXT_PROJECT_NAME@-download)
+
+include(ExternalProject)
+ExternalProject_Add(
+ @EXT_PROJECT_NAME@
+ SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
+ BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
+ @DOWNLOAD_OPTIONS@
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ LOG_DOWNLOAD ON
+ GIT_PROGRESS 1
+)
+
+
diff --git a/dev/snowman/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/snowman/cmake/ExternalProjectDownloadBuildInstall.cmake
new file mode 100644
index 0000000..ce12d1d
--- /dev/null
+++ b/dev/snowman/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -0,0 +1,98 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+
+# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
+# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
+# should be stored right next to this one. So, defining this variable outside the scope of the
+# functions below.
+set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
+
+
+
+# Usage:
+# ExternalProject_Download(
+# # This first argument is the name of the project to download. It is required:
+# glm
+#
+# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
+# # These can be any of the arguments used for the downloading step of the cmake builtin
+# # ExternalProject_Add command.
+# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
+# GIT_TAG master
+# etc..
+# )
+function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
+
+ h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
+
+ set(DOWNLOAD_OPTIONS ${ARGN})
+ string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
+
+
+ file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
+ configure_file(
+ ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
+ ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
+ )
+
+ h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Completed download of external project ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
+
+# Usage:
+# ExternalProject_BuildAndInstallNow(
+# # This first argument is the name of the external project to download. It is required:
+# VRPN
+# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
+# # main CMakeLists.txt file:
+# src
+#
+# # Additional arguments are passed on as options to the cmake build file generator
+# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
+# -DVRPN_BUILD_HID_GUI=OFF
+# etc..
+# )
+function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
+
+ # any extra args to the function are interpreted as arguments for the cmake config process
+ set(CMAKE_CONFIG_OPTIONS ${ARGN})
+
+ # always set the install prefix to be the same as for the main project
+ list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
+
+ #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
+
+
+ set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
+
+ file(MAKE_DIRECTORY ${BUILD_DIR})
+
+ h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
+ message(STATUS "Using source dir: ${SRC_DIR}")
+ message(STATUS "Using build dir: ${BUILD_DIR}")
+ message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
+
+ h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
+
+ h2("Completed external build of ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
diff --git a/dev/snowman/cmake/MessageMacros.cmake b/dev/snowman/cmake/MessageMacros.cmake
new file mode 100644
index 0000000..4628e5c
--- /dev/null
+++ b/dev/snowman/cmake/MessageMacros.cmake
@@ -0,0 +1,17 @@
+# This file is part of the MinVR cmake build system.
+# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
+
+
+macro(h1 TITLE)
+ string(TOUPPER ${TITLE} TITLE)
+ message(STATUS "\n\n==== ${TITLE} ====")
+endmacro()
+
+macro(h2 TITLE)
+ message(STATUS "\n* ${TITLE}")
+endmacro()
+
+macro(h3 TITLE)
+ message(STATUS "- ${TITLE}")
+endmacro()
+
diff --git a/dev/snowman/cmake/UseOpenGL.cmake b/dev/snowman/cmake/UseOpenGL.cmake
new file mode 100644
index 0000000..2ec5ffb
--- /dev/null
+++ b/dev/snowman/cmake/UseOpenGL.cmake
@@ -0,0 +1,52 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# Either finds a pre-installed version or complains.
+
+# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
+# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
+# or add_library(${PROJECT_NAME} ...)), add the following two lines:
+
+# include(UseOpenGL)
+# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
+
+# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
+# usage described here:
+# https://cmake.org/cmake/help/latest/command/target_include_directories.html
+
+# The third argument is the directory to use for downloading the external project if
+# autobuild is used.
+
+
+
+macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
+
+ message(STATUS "Searching for OpenGL...")
+
+ # Check to see if the library is already installed on the system
+ # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
+ # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
+ # now the preferred way to link with OpenGL and all of its dependencies.
+ # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
+ find_package(OpenGL)
+
+ if (NOT ${OPENGL_FOUND})
+ message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
+ endif()
+
+ message(STATUS "Ok: OpenGL Found.")
+ message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
+ message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
+
+
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
+
+ if (${OPENGL_GLU_FOUND})
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
+ endif()
+
+ target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
+
+endmacro()
diff --git a/dev/snowman/main.cc b/dev/snowman/main.cc
new file mode 100644
index 0000000..20e2ea3
--- /dev/null
+++ b/dev/snowman/main.cc
@@ -0,0 +1,9 @@
+/** CSci-4611 In-Class Example */
+
+#include "snowman.h"
+
+int main(int argc, const char *argv[]) {
+ Snowman app;
+ app.Run();
+ return 0;
+}
diff --git a/dev/snowman/snowman.cc b/dev/snowman/snowman.cc
new file mode 100644
index 0000000..77ffa4d
--- /dev/null
+++ b/dev/snowman/snowman.cc
@@ -0,0 +1,48 @@
+/** CSci-4611 In-Class Example */
+
+#include "snowman.h"
+
+#include <iostream>
+#include <sstream>
+
+
+
+Snowman::Snowman() : GraphicsApp(1024,768, "Do You Want to Build a Snowman?") {
+}
+
+
+Snowman::~Snowman() {
+}
+
+
+void Snowman::UpdateSimulation(double dt) {
+}
+
+
+void Snowman::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);
+ view_matrix_ = Matrix4::LookAt(Point3(0,2,10), Point3(0,0,0), Vector3(0,1,0));
+ glClearColor(0.2f, 0.6f, 1.0f, 1.0f);
+}
+
+
+void Snowman::DrawUsingOpenGL() {
+ Matrix4 identity;
+
+ // draws a set of axes at the world origin, since we are passing the identity
+ // matrix for the "model" matrix.
+ quick_shapes_.DrawAxes(identity, view_matrix_, proj_matrix_);
+
+
+ Matrix4 S_ground = Matrix4::Scale(Vector3(40.0f, 0.2f, 40.0f));
+ Matrix4 T_ground = Matrix4::Translation(Vector3(0.0f, -0.2f, 0.0f));
+ Matrix4 ground_combo = T_ground * S_ground;
+ quick_shapes_.DrawCube(ground_combo, view_matrix_, proj_matrix_, Color(0.8f, 0.8f, 0.8f));
+
+}
+
+
+
+
+
diff --git a/dev/snowman/snowman.h b/dev/snowman/snowman.h
new file mode 100644
index 0000000..fea3dc8
--- /dev/null
+++ b/dev/snowman/snowman.h
@@ -0,0 +1,52 @@
+/** CSci-4611 In-Class Example */
+
+#ifndef SNOWMAN_H_
+#define SNOWMAN_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include <string>
+#include <vector>
+
+class Snowman : public GraphicsApp {
+public:
+
+ // Creates the App
+ Snowman();
+
+ // Cleans up when the App shuts down
+ virtual ~Snowman();
+
+ // Note a Run() function is inherited from GraphicsApp, that's what
+ // actually starts up the App.
+
+ // This is a callback, a function that gets called when the user presses
+ // the Pause button in the GUI.
+ void OnPauseBtnPressed();
+
+ // This gets called once each frame. Note that dt (a.k.a., "delta time") is
+ // the amount of time (in seconds) that has passed since the last frame.
+ void UpdateSimulation(double dt);
+
+ // This is where we initialize any OpenGL data, like textures or meshes that
+ // need to be loaded from files and setup in OpenGL. It gets called once
+ // when the program starts up.
+ void InitOpenGL();
+
+ // This gets called once each frame, and this is where you draw the latest
+ // version of your 3D graphics scene.
+ void DrawUsingOpenGL();
+
+
+private:
+
+ // Sets up the computer graphics camera
+ Matrix4 view_matrix_;
+ Matrix4 proj_matrix_;
+
+ // A helper class for drawing some simple shapes (cubes, spheres, 3D arrows)
+ QuickShapes quick_shapes_;
+};
+
+#endif \ No newline at end of file
diff --git a/dev/texture-demo/.gitignore b/dev/texture-demo/.gitignore
new file mode 100644
index 0000000..dd1a9a8
--- /dev/null
+++ b/dev/texture-demo/.gitignore
@@ -0,0 +1,2 @@
+config.h
+build
diff --git a/dev/texture-demo/CMakeLists.txt b/dev/texture-demo/CMakeLists.txt
new file mode 100644
index 0000000..0c7fce9
--- /dev/null
+++ b/dev/texture-demo/CMakeLists.txt
@@ -0,0 +1,193 @@
+# Original Author(s) of this File:
+# Daniel Keefe, 2017, University of Minnesota
+#
+# Author(s) of Significant Updates/Modifications to the File:
+# ...
+
+
+
+# You are encouraged to copy this example, move it outside of the MinGfx directory, and use
+# it as a starting point for your project. When you do this, you'll have to edit the
+# following line as needed to point to the MinGfx install prefix used on your system.
+
+# !!!!!!!!!!!!! EDIT THE FOLLOWING LINE AS NEEDED !!!!!!!!!!!!!
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build/install ../..)
+
+
+#### BASIC PROJECT SETUP ####
+
+project(example)
+
+# Using 3.9 to get a modern version of FindOpenGL.cmake
+cmake_minimum_required (VERSION 3.9)
+
+# Dependencies that are auto-downloaded, built, and installed for you will go in the
+# directory pointed to by the CMAKE_INSTALL_PREFIX. It defaults to a location inside
+# the build directory.
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
+ set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
+endif()
+
+# Add to paths cmake uses to search for scripts, modules, and config packages
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_INSTALL_PREFIX})
+list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_INSTALL_PREFIX})
+
+include(MessageMacros)
+h1("Building ${PROJECT_NAME}")
+h2("Configuring paths")
+
+message(STATUS "Module path: ${CMAKE_MODULE_PATH}")
+message(STATUS "Prefix path: ${CMAKE_PREFIX_PATH}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+
+set(DATA_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/data)
+set(DATA_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
+
+message(STATUS "Data dir (in build tree): ${DATA_DIR_BUILD}")
+message(STATUS "Data dir (in install tree): ${DATA_DIR_INSTALL}")
+
+set(SHADERS_DIR_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/shaders)
+set(SHADERS_DIR_INSTALL ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/shaders)
+
+message(STATUS "Shaders dir (in build tree): ${SHADERS_DIR_BUILD}")
+message(STATUS "Shaders dir (in install tree): ${SHADERS_DIR_INSTALL}")
+
+
+# Configure a header file to pass some of the CMake settings to the source code
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/config.h
+)
+
+
+#### SOURCE FOR THIS PROJECT ####
+h2("Configuring source files")
+
+set(SOURCEFILES
+ example.cc
+ main.cc
+)
+
+set(HEADERFILES
+ config.h
+ example.h
+)
+
+set(EXTRAFILES
+ README.md
+)
+
+set(SHADERFILES
+)
+
+set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+set_source_files_properties(${SHADERFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+source_group("Shaders" FILES ${SHADERFILES})
+
+
+#### COMPILE OPTIONS ####
+
+h2("Configuring Compiler Options")
+
+
+
+message(STATUS "Building for " ${CMAKE_SYSTEM_NAME} ".")
+
+# Linux specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions(-DLINUX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Apple specific
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_definitions(-DOSX)
+
+ # RPATH settings, see https://cmake.org/Wiki/CMake_RPATH_handling
+ set(CMAKE_MACOSX_RPATH ON)
+
+ # use, i.e. don't skip the full RPATH for the build tree
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+ # when building, don't use the install RPATH already
+ # (but later on when installing)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # add the automatically determined parts of the RPATH
+ # which point to directories outside the build tree to the install RPATH
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+ # the RPATH to be used when installing, but only if it's not a system directory
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ IF("${isSystemDir}" STREQUAL "-1")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ ENDIF("${isSystemDir}" STREQUAL "-1")
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+endif()
+
+
+# Windows specific
+if (WIN32)
+ add_definitions(-DWIN32)
+
+ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
+ message(FATAL_ERROR
+ "You must use the 64 bit version of the compiler. Be sure to set the correct generator when configuring through CMake.")
+ endif()
+endif()
+
+
+
+
+
+#### DEFINE TARGET(S) ####
+
+h2("Defining Target(s)")
+
+add_executable(${PROJECT_NAME} ${SOURCEFILES} ${HEADERFILES} ${EXTRAFILES} ${SHADERFILES})
+
+
+
+#### FIND AND ADD DEPENDENCIES ####
+
+h2("Adding Dependencies")
+set(EXTERNAL_DIR external)
+
+
+# MinGfx (linked with an imported cmake target so no need to specify include dirs)
+# This will try to find MinGfxConfig.cmake, which should have been installed under
+# CMAKE_INSTALL_PREFIX/lib/cmake/MinGfx when you installed the MinGfx Toolkit.
+find_package(MinGfx REQUIRED)
+target_link_libraries(${PROJECT_NAME} PUBLIC MinGfx::MinGfx)
+
+
+# Add dependency on OpenGL
+include(UseOpenGL)
+UseOpenGL(${PROJECT_NAME} PUBLIC ${EXTERNAL_DIR})
+
+
+
+#### INSTALL TARGET(S) ####
+
+h2("Configuring Install Target")
+
+# The install locations are relative to the CMAKE_INSTALL_PREFIX variable
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
+
+install(
+ DIRECTORY data/
+ DESTINATION ${DATA_DIR_INSTALL}
+ OPTIONAL
+)
+
+install(
+ DIRECTORY shaders/
+ DESTINATION ${SHADERS_DIR_INSTALL}
+ OPTIONAL
+)
diff --git a/dev/texture-demo/README.md b/dev/texture-demo/README.md
new file mode 100644
index 0000000..ee42984
--- /dev/null
+++ b/dev/texture-demo/README.md
@@ -0,0 +1 @@
+# Angry Vectors CSci-4611 In-Class Example of Visual Debugging
diff --git a/dev/texture-demo/cmake/DownloadHelper.txt.in b/dev/texture-demo/cmake/DownloadHelper.txt.in
new file mode 100644
index 0000000..fb29bff
--- /dev/null
+++ b/dev/texture-demo/cmake/DownloadHelper.txt.in
@@ -0,0 +1,26 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# This is a "helper" cmake project -- the only thing this project does is download
+# the external project. So, the configure, build, install, and test commands for
+# ExternalProject_Add() are intentionally set as NOPs.
+
+cmake_minimum_required (VERSION 3.9)
+
+project(@EXT_PROJECT_NAME@-download)
+
+include(ExternalProject)
+ExternalProject_Add(
+ @EXT_PROJECT_NAME@
+ SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
+ BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
+ @DOWNLOAD_OPTIONS@
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ LOG_DOWNLOAD ON
+ GIT_PROGRESS 1
+)
+
+
diff --git a/dev/texture-demo/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/texture-demo/cmake/ExternalProjectDownloadBuildInstall.cmake
new file mode 100644
index 0000000..ce12d1d
--- /dev/null
+++ b/dev/texture-demo/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -0,0 +1,98 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+
+# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
+# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
+# should be stored right next to this one. So, defining this variable outside the scope of the
+# functions below.
+set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
+
+
+
+# Usage:
+# ExternalProject_Download(
+# # This first argument is the name of the project to download. It is required:
+# glm
+#
+# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
+# # These can be any of the arguments used for the downloading step of the cmake builtin
+# # ExternalProject_Add command.
+# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
+# GIT_TAG master
+# etc..
+# )
+function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
+
+ h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
+
+ set(DOWNLOAD_OPTIONS ${ARGN})
+ string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
+
+
+ file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
+ configure_file(
+ ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
+ ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
+ )
+
+ h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Completed download of external project ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
+
+# Usage:
+# ExternalProject_BuildAndInstallNow(
+# # This first argument is the name of the external project to download. It is required:
+# VRPN
+# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
+# # main CMakeLists.txt file:
+# src
+#
+# # Additional arguments are passed on as options to the cmake build file generator
+# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
+# -DVRPN_BUILD_HID_GUI=OFF
+# etc..
+# )
+function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
+
+ # any extra args to the function are interpreted as arguments for the cmake config process
+ set(CMAKE_CONFIG_OPTIONS ${ARGN})
+
+ # always set the install prefix to be the same as for the main project
+ list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
+
+ #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
+
+
+ set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
+
+ file(MAKE_DIRECTORY ${BUILD_DIR})
+
+ h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
+ message(STATUS "Using source dir: ${SRC_DIR}")
+ message(STATUS "Using build dir: ${BUILD_DIR}")
+ message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
+
+ h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
+
+ h2("Completed external build of ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
diff --git a/dev/texture-demo/cmake/MessageMacros.cmake b/dev/texture-demo/cmake/MessageMacros.cmake
new file mode 100644
index 0000000..4628e5c
--- /dev/null
+++ b/dev/texture-demo/cmake/MessageMacros.cmake
@@ -0,0 +1,17 @@
+# This file is part of the MinVR cmake build system.
+# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
+
+
+macro(h1 TITLE)
+ string(TOUPPER ${TITLE} TITLE)
+ message(STATUS "\n\n==== ${TITLE} ====")
+endmacro()
+
+macro(h2 TITLE)
+ message(STATUS "\n* ${TITLE}")
+endmacro()
+
+macro(h3 TITLE)
+ message(STATUS "- ${TITLE}")
+endmacro()
+
diff --git a/dev/texture-demo/cmake/UseOpenGL.cmake b/dev/texture-demo/cmake/UseOpenGL.cmake
new file mode 100644
index 0000000..2ec5ffb
--- /dev/null
+++ b/dev/texture-demo/cmake/UseOpenGL.cmake
@@ -0,0 +1,52 @@
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# Either finds a pre-installed version or complains.
+
+# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
+# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
+# or add_library(${PROJECT_NAME} ...)), add the following two lines:
+
+# include(UseOpenGL)
+# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
+
+# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
+# usage described here:
+# https://cmake.org/cmake/help/latest/command/target_include_directories.html
+
+# The third argument is the directory to use for downloading the external project if
+# autobuild is used.
+
+
+
+macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
+
+ message(STATUS "Searching for OpenGL...")
+
+ # Check to see if the library is already installed on the system
+ # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
+ # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
+ # now the preferred way to link with OpenGL and all of its dependencies.
+ # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
+ find_package(OpenGL)
+
+ if (NOT ${OPENGL_FOUND})
+ message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
+ endif()
+
+ message(STATUS "Ok: OpenGL Found.")
+ message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
+ message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
+
+
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
+
+ if (${OPENGL_GLU_FOUND})
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
+ endif()
+
+ target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
+
+endmacro()
diff --git a/dev/texture-demo/config.h.in b/dev/texture-demo/config.h.in
new file mode 100644
index 0000000..16d824b
--- /dev/null
+++ b/dev/texture-demo/config.h.in
@@ -0,0 +1,13 @@
+/** CSci-4611 In-Class Example
+*/
+
+
+// The file config.h.in is processed by cmake to produce config.h. This
+// replaces strings of the form "at"CMAKE_VARIABLE_NAME"at" with the value
+// of the corresponding cmake variable, allowing us to pass directory paths
+// and other information configured with cmake into our C++ code.
+
+
+#define DATA_DIR_BUILD "@DATA_DIR_BUILD@"
+#define DATA_DIR_INSTALL "@DATA_DIR_INSTALL@"
+
diff --git a/dev/texture-demo/data/campbells.png b/dev/texture-demo/data/campbells.png
new file mode 100644
index 0000000..ed4b245
--- /dev/null
+++ b/dev/texture-demo/data/campbells.png
Binary files differ
diff --git a/dev/texture-demo/data/monalisa.png b/dev/texture-demo/data/monalisa.png
new file mode 100644
index 0000000..91e5498
--- /dev/null
+++ b/dev/texture-demo/data/monalisa.png
Binary files differ
diff --git a/dev/texture-demo/example.cc b/dev/texture-demo/example.cc
new file mode 100644
index 0000000..b114da5
--- /dev/null
+++ b/dev/texture-demo/example.cc
@@ -0,0 +1,113 @@
+/** 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) {
+}
+
+
+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);
+ view_matrix_ = Matrix4::LookAt(Point3(2,1,4), Point3(2,1,0), Vector3(0,1,0));
+ glClearColor(1,1,1,1);
+
+
+ // Load the texture we will use
+ texture_.InitFromFile(Platform::FindFile("monalisa.png", search_path_));
+
+
+ // Create the mesh by setting the vertex and index arrays directly
+ std::vector<unsigned int> indices;
+ std::vector<Point3> vertices;
+ std::vector<Vector3> normals;
+ std::vector<Point2> tex_coords;
+
+ // four vertices, each requires 3 floats: (x,y,z)
+ vertices.push_back(Point3(0,0,0));
+ vertices.push_back(Point3(1,0,0));
+ vertices.push_back(Point3(1,1,-1));
+ vertices.push_back(Point3(0,1,-1));
+
+ // four normals, each requires 3 floats: (x,y,z)
+ normals.push_back(Vector3(0,1,1).ToUnit());
+ normals.push_back(Vector3(0,1,1).ToUnit());
+ normals.push_back(Vector3(0,1,1).ToUnit());
+ normals.push_back(Vector3(0,1,1).ToUnit());
+
+ // TODO: YOU ADD TEXTURE COORDINATES TO THE MESH
+
+
+
+ // indices into the arrays above for the first triangle
+ indices.push_back(0);
+ indices.push_back(1);
+ indices.push_back(2);
+
+ // indices for the second triangle, note some are reused
+ indices.push_back(0);
+ indices.push_back(2);
+ indices.push_back(3);
+
+ mesh_.SetVertices(vertices);
+ mesh_.SetNormals(normals);
+ mesh_.SetIndices(indices);
+
+ // TODO: ALSO REMEMBER TO CALL mesh_.SetTexCoords(..) HERE ONCE YOU HAVE THEM DEFINED.
+ // USE TEXTURE UNIT = 0 SINCE WE HAVE ONLY ONE TEXTURE APPLIED TO THE MESH.
+
+ mesh_.UpdateGPUMemory();
+
+}
+
+
+void Example::DrawUsingOpenGL() {
+ // 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_);
+
+
+ // We're already learned about how to use transformation matrices to move
+ // an individual model around within the scene.
+ Matrix4 model_matrix = Matrix4::Scale(Vector3(4,4,4));
+
+
+ // Since we want to texture the mesh we will define a custom material for the
+ // mesh. The material property we are interested in is called "surface_texture".
+ // We'll set that to point to the Texture2D that we loaded earlier. You can
+ // also set other properties of the material to define how it reflects light.
+ DefaultShader::MaterialProperties mesh_material;
+ mesh_material.surface_texture = texture_;
+ mesh_material.ambient_reflectance = Color(0.8f, 0.8f, 0.8f);
+ mesh_material.diffuse_reflectance = Color(0.8f, 0.8f, 0.8f);
+
+
+ // Use a shader program to draw the mesh with the given model, view, and projection
+ // matrices and with the material properties defined in mesh_material.
+ shader_.Draw(model_matrix, view_matrix_, proj_matrix_, &mesh_, mesh_material);
+}
+
+
+
+
diff --git a/dev/texture-demo/example.h b/dev/texture-demo/example.h
new file mode 100644
index 0000000..afecff6
--- /dev/null
+++ b/dev/texture-demo/example.h
@@ -0,0 +1,65 @@
+/** CSci-4611 In-Class Example */
+
+#ifndef SNOWMAN_H_
+#define SNOWMAN_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include <string>
+#include <vector>
+
+class Example : public GraphicsApp {
+public:
+
+ // Creates the App
+ Example();
+
+ // Cleans up when the App shuts down
+ virtual ~Example();
+
+ // Note a Run() function is inherited from GraphicsApp, that's what
+ // actually starts up the App.
+
+ // This is a callback, a function that gets called when the user presses
+ // the Pause button in the GUI.
+ void OnPauseBtnPressed();
+
+ // This gets called once each frame. Note that dt (a.k.a., "delta time") is
+ // the amount of time (in seconds) that has passed since the last frame.
+ void UpdateSimulation(double dt);
+
+ // This is where we initialize any OpenGL data, like textures or meshes that
+ // need to be loaded from files and setup in OpenGL. It gets called once
+ // when the program starts up.
+ void InitOpenGL();
+
+ // This gets called once each frame, and this is where you draw the latest
+ // version of your 3D graphics scene.
+ void DrawUsingOpenGL();
+
+
+private:
+
+ // Texture loaded from a file
+ Texture2D texture_;
+
+ // Triangle mesh data structure
+ Mesh mesh_;
+
+ // A shader is required to draw meshes, MinGfx provides a default shader
+ // that does some simple lighting.
+ DefaultShader shader_;
+
+ // Sets up the computer graphics camera
+ Matrix4 view_matrix_;
+ Matrix4 proj_matrix_;
+
+ // A helper class for drawing some simple shapes (cubes, spheres, 3D arrows)
+ QuickShapes quick_shapes_;
+
+ // Paths to search for data files, like images
+ std::vector<std::string> search_path_;
+};
+
+#endif \ No newline at end of file
diff --git a/dev/texture-demo/main.cc b/dev/texture-demo/main.cc
new file mode 100644
index 0000000..3bbc8b8
--- /dev/null
+++ b/dev/texture-demo/main.cc
@@ -0,0 +1,9 @@
+/** CSci-4611 In-Class Example */
+
+#include "example.h"
+
+int main(int argc, const char *argv[]) {
+ Example app;
+ app.Run();
+ return 0;
+}