aboutsummaryrefslogtreecommitdiffstats
path: root/dev/a2-carsoccer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dev/a2-carsoccer/.gitignore4
-rw-r--r--dev/a2-carsoccer/CMakeLists.txt352
-rw-r--r--dev/a2-carsoccer/README.md2
-rw-r--r--dev/a2-carsoccer/ball.cc116
-rw-r--r--dev/a2-carsoccer/ball.h78
-rw-r--r--dev/a2-carsoccer/car.cc132
-rw-r--r--dev/a2-carsoccer/car.h104
-rw-r--r--dev/a2-carsoccer/car_soccer.cc268
-rw-r--r--dev/a2-carsoccer/car_soccer.h168
-rw-r--r--dev/a2-carsoccer/cmake/DownloadHelper.txt.in52
-rw-r--r--dev/a2-carsoccer/cmake/ExternalProjectDownloadBuildInstall.cmake196
-rw-r--r--dev/a2-carsoccer/cmake/MessageMacros.cmake34
-rw-r--r--dev/a2-carsoccer/cmake/UseOpenGL.cmake104
-rw-r--r--dev/a2-carsoccer/config.h.in26
-rw-r--r--dev/a2-carsoccer/main.cc22
15 files changed, 829 insertions, 829 deletions
diff --git a/dev/a2-carsoccer/.gitignore b/dev/a2-carsoccer/.gitignore
index dd1a9a8..2fcd5ce 100644
--- a/dev/a2-carsoccer/.gitignore
+++ b/dev/a2-carsoccer/.gitignore
@@ -1,2 +1,2 @@
-config.h
-build
+config.h
+build
diff --git a/dev/a2-carsoccer/CMakeLists.txt b/dev/a2-carsoccer/CMakeLists.txt
index 0d67553..7f281ac 100644
--- a/dev/a2-carsoccer/CMakeLists.txt
+++ b/dev/a2-carsoccer/CMakeLists.txt
@@ -1,176 +1,176 @@
-# 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(a2-carsoccer)
-
-# 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}")
-
-# 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
- ball.cc
- car.cc
- car_soccer.cc
- main.cc
-)
-
-set(HEADERFILES
- ball.h
- car_soccer.h
- car.h
- config.h
-)
-
-set(EXTRAFILES
- config.h.in
- README.md
-)
-
-set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
-
-
-
-#### 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})
-
-
-
-#### 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
-)
+# 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(a2-carsoccer)
+
+# 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}")
+
+# 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
+ ball.cc
+ car.cc
+ car_soccer.cc
+ main.cc
+)
+
+set(HEADERFILES
+ ball.h
+ car_soccer.h
+ car.h
+ config.h
+)
+
+set(EXTRAFILES
+ config.h.in
+ README.md
+)
+
+set_source_files_properties(${EXTRAFILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+
+
+#### 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})
+
+
+
+#### 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
+)
diff --git a/dev/a2-carsoccer/README.md b/dev/a2-carsoccer/README.md
index 9c30158..7c8f9ca 100644
--- a/dev/a2-carsoccer/README.md
+++ b/dev/a2-carsoccer/README.md
@@ -1 +1 @@
-# My solution to Assignment 2
+# My solution to Assignment 2
diff --git a/dev/a2-carsoccer/ball.cc b/dev/a2-carsoccer/ball.cc
index 8289905..10c70df 100644
--- a/dev/a2-carsoccer/ball.cc
+++ b/dev/a2-carsoccer/ball.cc
@@ -1,58 +1,58 @@
-#include "ball.h"
-
-/// The constructor sets the radius and calls Reset() to start the ball at
-/// the center of the field
-Ball::Ball() : radius_(2.6f) {
- Reset();
-}
-
-Ball::~Ball() {
-
-}
-
-
-float Ball::radius() {
- return radius_;
-}
-
-Point3 Ball::position() {
- return position_;
-}
-
-void Ball::set_position(const Point3 &p) {
- position_ = p;
-}
-
-Vector3 Ball::velocity() {
- return velocity_;
-}
-
-void Ball::set_velocity(const Vector3 &v) {
- velocity_ = v;
-}
-
-void Ball::Reset() {
- position_ = Point3(0, radius_, 0);
-
- float a = GfxMath::PI * rand()/RAND_MAX;
- velocity_ = Vector3(25*cos(a), 10, 25*sin(a));
-}
-
-void Ball::Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix) {
- Color ballcol(1,1,1);
- Matrix4 Mball =
- Matrix4::Translation(position_- Point3(0,0,0)) *
- Matrix4::Scale(Vector3(radius_, radius_, radius_));
- quickShapes.DrawSphere(modelMatrix * Mball, viewMatrix, projMatrix, ballcol);
-
- // Draw the ball's shadow -- this is a bit of a hack, scaling Y by zero
- // flattens the sphere into a pancake, which we then draw just a bit
- // above the ground plane.
- Color shadowcol(0.2f, 0.4f, 0.15f);
- Matrix4 Mshadow =
- Matrix4::Translation(Vector3(position_[0], -0.1f, position_[2])) *
- Matrix4::Scale(Vector3(radius_, 0, radius_)) *
- Matrix4::RotationX(90);
- quickShapes.DrawSphere(modelMatrix * Mshadow, viewMatrix, projMatrix, shadowcol);
-}
-
+#include "ball.h"
+
+/// The constructor sets the radius and calls Reset() to start the ball at
+/// the center of the field
+Ball::Ball() : radius_(2.6f) {
+ Reset();
+}
+
+Ball::~Ball() {
+
+}
+
+
+float Ball::radius() {
+ return radius_;
+}
+
+Point3 Ball::position() {
+ return position_;
+}
+
+void Ball::set_position(const Point3 &p) {
+ position_ = p;
+}
+
+Vector3 Ball::velocity() {
+ return velocity_;
+}
+
+void Ball::set_velocity(const Vector3 &v) {
+ velocity_ = v;
+}
+
+void Ball::Reset() {
+ position_ = Point3(0, radius_, 0);
+
+ float a = GfxMath::PI * rand()/RAND_MAX;
+ velocity_ = Vector3(25*cos(a), 10, 25*sin(a));
+}
+
+void Ball::Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix) {
+ Color ballcol(1,1,1);
+ Matrix4 Mball =
+ Matrix4::Translation(position_- Point3(0,0,0)) *
+ Matrix4::Scale(Vector3(radius_, radius_, radius_));
+ quickShapes.DrawSphere(modelMatrix * Mball, viewMatrix, projMatrix, ballcol);
+
+ // Draw the ball's shadow -- this is a bit of a hack, scaling Y by zero
+ // flattens the sphere into a pancake, which we then draw just a bit
+ // above the ground plane.
+ Color shadowcol(0.2f, 0.4f, 0.15f);
+ Matrix4 Mshadow =
+ Matrix4::Translation(Vector3(position_[0], -0.1f, position_[2])) *
+ Matrix4::Scale(Vector3(radius_, 0, radius_)) *
+ Matrix4::RotationX(90);
+ quickShapes.DrawSphere(modelMatrix * Mshadow, viewMatrix, projMatrix, shadowcol);
+}
+
diff --git a/dev/a2-carsoccer/ball.h b/dev/a2-carsoccer/ball.h
index 0fa107e..a43eb31 100644
--- a/dev/a2-carsoccer/ball.h
+++ b/dev/a2-carsoccer/ball.h
@@ -1,39 +1,39 @@
-/** CSci-4611 Assignment 2: Car Soccer
- */
-
-#ifndef BALL_H_
-#define BALL_H_
-
-#include <mingfx.h>
-using namespace mingfx;
-
-/// Small class representing the ball. Feel free to add additional member variables and functions if you wish.
-class Ball {
-public:
-
- Ball();
- virtual ~Ball();
-
- // The same radius is used to draw the ball and to calculate physics for the ball
- float radius();
-
- // Current 3D position
- Point3 position();
- void set_position(const Point3 &p);
-
- // Current 3D velocity
- Vector3 velocity();
- void set_velocity(const Vector3 &v);
-
- // Resets the ball's position and velocity to initial values.
- void Reset();
-
- void Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix);
-
-private:
- Point3 position_;
- Vector3 velocity_;
- float radius_;
-};
-
-#endif
+/** CSci-4611 Assignment 2: Car Soccer
+ */
+
+#ifndef BALL_H_
+#define BALL_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+/// Small class representing the ball. Feel free to add additional member variables and functions if you wish.
+class Ball {
+public:
+
+ Ball();
+ virtual ~Ball();
+
+ // The same radius is used to draw the ball and to calculate physics for the ball
+ float radius();
+
+ // Current 3D position
+ Point3 position();
+ void set_position(const Point3 &p);
+
+ // Current 3D velocity
+ Vector3 velocity();
+ void set_velocity(const Vector3 &v);
+
+ // Resets the ball's position and velocity to initial values.
+ void Reset();
+
+ void Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix);
+
+private:
+ Point3 position_;
+ Vector3 velocity_;
+ float radius_;
+};
+
+#endif
diff --git a/dev/a2-carsoccer/car.cc b/dev/a2-carsoccer/car.cc
index 3b9bb5c..4b27cfe 100644
--- a/dev/a2-carsoccer/car.cc
+++ b/dev/a2-carsoccer/car.cc
@@ -1,66 +1,66 @@
-#include "car.h"
-
-/// The constructor sets the static properties of the car, like its size,
-/// and then calls Reset() to reset the position, velocity, and any other
-/// dynamic variables that change during game play.
-Car::Car() : size_(3,2,4), collision_radius_(2.5) {
- Reset();
-}
-
-Car::~Car() {
-}
-
-
-float Car::collision_radius() {
- return collision_radius_;
-
-}
-
-Vector3 Car::size() {
- return size_;
-}
-
-Point3 Car::position() {
- return position_;
-}
-
-void Car::set_position(const Point3 &p) {
- position_ = p;
-}
-
-Vector3 Car::forward() {
- return forward_;
-}
-
-void Car::set_forward(const Vector3 &v) {
- forward_ = v;
-}
-
-float Car::speed() {
- return speed_;
-}
-
-void Car::set_speed(float s) {
- speed_ = s;
-}
-
-Vector3 Car::velocity() {
- return speed_ * forward_;
-}
-
-
-void Car::Reset() {
- position_ = Point3(0, size_[1]/2, 45);
- forward_ = Vector3(0, 0, -1);
- speed_ = 0.0f;
-}
-
-void Car::Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix) {
- Color carcol(0.8f, 0.2f, 0.2f);
- Matrix4 Mcar =
- Matrix4::Translation(position_ - Point3(0,0,0)) *
- Matrix4::LookAt(Point3(0,0,0), Point3(0,0,0) + forward_, Vector3(0,1,0)).Inverse() *
- Matrix4::Scale(size_) *
- Matrix4::Scale(Vector3(0.5f, 0.5f, 0.5f));
- quickShapes.DrawCube(modelMatrix * Mcar, viewMatrix, projMatrix, carcol);
-}
+#include "car.h"
+
+/// The constructor sets the static properties of the car, like its size,
+/// and then calls Reset() to reset the position, velocity, and any other
+/// dynamic variables that change during game play.
+Car::Car() : size_(3,2,4), collision_radius_(2.5) {
+ Reset();
+}
+
+Car::~Car() {
+}
+
+
+float Car::collision_radius() {
+ return collision_radius_;
+
+}
+
+Vector3 Car::size() {
+ return size_;
+}
+
+Point3 Car::position() {
+ return position_;
+}
+
+void Car::set_position(const Point3 &p) {
+ position_ = p;
+}
+
+Vector3 Car::forward() {
+ return forward_;
+}
+
+void Car::set_forward(const Vector3 &v) {
+ forward_ = v;
+}
+
+float Car::speed() {
+ return speed_;
+}
+
+void Car::set_speed(float s) {
+ speed_ = s;
+}
+
+Vector3 Car::velocity() {
+ return speed_ * forward_;
+}
+
+
+void Car::Reset() {
+ position_ = Point3(0, size_[1]/2, 45);
+ forward_ = Vector3(0, 0, -1);
+ speed_ = 0.0f;
+}
+
+void Car::Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix) {
+ Color carcol(0.8f, 0.2f, 0.2f);
+ Matrix4 Mcar =
+ Matrix4::Translation(position_ - Point3(0,0,0)) *
+ Matrix4::LookAt(Point3(0,0,0), Point3(0,0,0) + forward_, Vector3(0,1,0)).Inverse() *
+ Matrix4::Scale(size_) *
+ Matrix4::Scale(Vector3(0.5f, 0.5f, 0.5f));
+ quickShapes.DrawCube(modelMatrix * Mcar, viewMatrix, projMatrix, carcol);
+}
diff --git a/dev/a2-carsoccer/car.h b/dev/a2-carsoccer/car.h
index 6746a56..c5ae5df 100644
--- a/dev/a2-carsoccer/car.h
+++ b/dev/a2-carsoccer/car.h
@@ -1,52 +1,52 @@
-/** CSci-4611 Assignment 2: Car Soccer
- */
-
-#ifndef CAR_H_
-#define CAR_H_
-
-#include <mingfx.h>
-using namespace mingfx;
-
-/// Small class representing the car. Feel free to add additional member variables and functions if you wish.
-class Car {
-public:
- Car();
- virtual ~Car();
-
- // Size is the size of the box drawn to represent the car in the X, Y, and Z dimensions
- Vector3 size();
-
- // Radius of the bounding sphere used to calculate approximate physics
- float collision_radius();
-
- // 3D position of the car
- Point3 position();
- void set_position(const Point3 &p);
-
- // The unit vector direction the car is pointing. Since the car drives around on the
- // Y=0 plane, this vector will always have a y coordinate = 0
- Vector3 forward();
- void set_forward(const Vector3 &v);
-
- // The speed of the car can be positive (moving forward) or negative (moving in reverse)
- float speed();
- void set_speed(float s);
-
- // Current 3D velocity, computed as speed_ * forward_
- Vector3 velocity();
-
- // Resets the position, speed, and forward direction to the car's starting point
- void Reset();
-
- // Draws a simple box shape for the car at the proper position and rotated to face forward
- void Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix);
-
-private:
- Vector3 size_;
- float collision_radius_;
- Point3 position_;
- Vector3 forward_;
- float speed_;
-};
-
-#endif
+/** CSci-4611 Assignment 2: Car Soccer
+ */
+
+#ifndef CAR_H_
+#define CAR_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+/// Small class representing the car. Feel free to add additional member variables and functions if you wish.
+class Car {
+public:
+ Car();
+ virtual ~Car();
+
+ // Size is the size of the box drawn to represent the car in the X, Y, and Z dimensions
+ Vector3 size();
+
+ // Radius of the bounding sphere used to calculate approximate physics
+ float collision_radius();
+
+ // 3D position of the car
+ Point3 position();
+ void set_position(const Point3 &p);
+
+ // The unit vector direction the car is pointing. Since the car drives around on the
+ // Y=0 plane, this vector will always have a y coordinate = 0
+ Vector3 forward();
+ void set_forward(const Vector3 &v);
+
+ // The speed of the car can be positive (moving forward) or negative (moving in reverse)
+ float speed();
+ void set_speed(float s);
+
+ // Current 3D velocity, computed as speed_ * forward_
+ Vector3 velocity();
+
+ // Resets the position, speed, and forward direction to the car's starting point
+ void Reset();
+
+ // Draws a simple box shape for the car at the proper position and rotated to face forward
+ void Draw(QuickShapes quickShapes, Matrix4 modelMatrix, Matrix4 viewMatrix, Matrix4 projMatrix);
+
+private:
+ Vector3 size_;
+ float collision_radius_;
+ Point3 position_;
+ Vector3 forward_;
+ float speed_;
+};
+
+#endif
diff --git a/dev/a2-carsoccer/car_soccer.cc b/dev/a2-carsoccer/car_soccer.cc
index c5619a8..9fac102 100644
--- a/dev/a2-carsoccer/car_soccer.cc
+++ b/dev/a2-carsoccer/car_soccer.cc
@@ -1,134 +1,134 @@
-/** CSci-4611 Assignment 2: Car Soccer
- */
-
-#include "car_soccer.h"
-#include "config.h"
-
-
-// Remember in C++, the .h file list all the functions and member variables that are part of the class!
-// Look there first to understand what is part of the CarSoccer class, then look below to see how each
-// function is implemented.
-
-
-CarSoccer::CarSoccer() : GraphicsApp(1024,768, "Car Soccer") {
- // If you are having trouble driving the car with the keybaord, you can set this to true to use
- // the mouse instead. The mouse controls are based on the postion of the mouse cursor on the window.
- // There is a "dead zone" in the middle of the window, and if you move the mouse up/down or left/right
- // outside of that zone, it is like pushing the up/down and/or left/right keys on the keyboard
- use_mouse_ = false;
-
- // Define a search path for finding data files (images and shaders)
- searchPath_.push_back(".");
- searchPath_.push_back("./data");
- searchPath_.push_back(DATA_DIR_INSTALL);
- searchPath_.push_back(DATA_DIR_BUILD);
-}
-
-CarSoccer::~CarSoccer() {
-}
-
-
-void CarSoccer::OnMouseMove(const Point2& pos, const Vector2& delta)
-{
- mouse_pos_ = PixelsToNormalizedDeviceCoords(pos);
-}
-
-void CarSoccer::OnSpecialKeyDown(int key, int scancode, int modifiers) {
- if (key == GLFW_KEY_SPACE) {
- // Here's where you could call some form of launch_ball();
- ball_.Reset();
- }
-}
-
-/// This is a little utility function that is helpful. It treats the arrow keys like a joystick or D-pad on a game controller
-/// and returns the direction you are pressing as a 2D vector, taking into account the fact that you might be holding
-/// down more than one key at a time.
-Vector2 CarSoccer::joystick_direction() {
- Vector2 dir;
-
- if (use_mouse_) {
- // threshold defines the size of the "dead zone" in the middle of the screen
- // if the mouse's x,y position falls outside of this, then it is like pushing
- // the corresponding key on the keyboard
- const float threshold = 0.2f;
- dir[0] = 0;
- if (mouse_pos_[0] < -threshold) {
- dir[0] = -1;
- }
- else if (mouse_pos_[0] > threshold) {
- dir[0] = 1;
- }
- dir[1] = 0;
- if (mouse_pos_[1] < -threshold) {
- dir[1] = -1;
- }
- else if (mouse_pos_[1] > threshold) {
- dir[1] = 1;
- }
- }
- else {
- // the default user interface is to use the arrow keys on the keyboard.
- // like a D-pad on a game controller, you can hold more than one key down at a time if you want.
- if (IsKeyDown(GLFW_KEY_LEFT))
- dir[0]--;
- if (IsKeyDown(GLFW_KEY_RIGHT))
- dir[0]++;
- if (IsKeyDown(GLFW_KEY_UP))
- dir[1]++;
- if (IsKeyDown(GLFW_KEY_DOWN))
- dir[1]--;
- }
-
- return dir;
-}
-
-// dt is for "Delta Time", the elapsed time in seconds since the last frame
-void CarSoccer::UpdateSimulation(double dt) {
- Vector2 dpad_dir = joystick_direction();
- std::cout << "D-Pad Direction: " << dpad_dir << std::endl;
-
- // Here's where you shound do your "simulation", updating the positions of the
- // car and ball based on the elapsed time and checking for collisions. Filling
- // in this routine is the main part of the assignment.
-
- // Example: This is not the "correct way" to drive the car, but this code
- // will at least move the car around for testing
- float metersPerSec = 10.0f;
- car_.set_position(car_.position() + metersPerSec * Vector3(dpad_dir[0], 0, -dpad_dir[1]) * dt);
-
-}
-
-
-void CarSoccer::InitOpenGL() {
- // Set up the camera in a good position to see the entire field
- projMatrix_ = Matrix4::Perspective(60, aspect_ratio(), 1, 1000);
- modelMatrix_ = Matrix4::LookAt(Point3(0,60,70), Point3(0,0,10), Vector3(0,1,0));
-
- // Set a background color for the screen (don't worry if you get a depricated warning on this line in OSX)
- glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
-
- // Load some image files we'll use
- fieldTex_.InitFromFile(Platform::FindFile("pitch.png", searchPath_));
- crowdTex_.InitFromFile(Platform::FindFile("crowd.png", searchPath_));
-}
-
-
-void CarSoccer::DrawUsingOpenGL() {
- // Draw the crowd as a fullscreen background image
- quickShapes_.DrawFullscreenTexture(Color(1,1,1), crowdTex_);
-
- // Draw the car and the ball
- car_.Draw(quickShapes_, modelMatrix_, viewMatrix_, projMatrix_);
- ball_.Draw(quickShapes_, modelMatrix_, viewMatrix_, projMatrix_);
-
- // Draw the field with the field texture on it.
- Color col(16.0f/255.0f, 46.0f/255.0f, 9.0f/255.0f);
- Matrix4 M = Matrix4::Translation(Vector3(0.0f, -0.201f, 0.0f)) * Matrix4::Scale(Vector3(50.0f, 1.0f, 60.0f));
- quickShapes_.DrawSquare(modelMatrix_ * M, viewMatrix_, projMatrix_, col);
- M = Matrix4::Translation(Vector3(0.0f, -0.2f, 0.0f)) * Matrix4::Scale(Vector3(40.0f, 1.0f, 50.0f));
- quickShapes_.DrawSquare(modelMatrix_ * M, viewMatrix_, projMatrix_, Color(1,1,1), fieldTex_);
-
- // You should add drawing the goals and the boundary of the playing area
- // using quickShapes_.DrawLines()
-
-}
+/** CSci-4611 Assignment 2: Car Soccer
+ */
+
+#include "car_soccer.h"
+#include "config.h"
+
+
+// Remember in C++, the .h file list all the functions and member variables that are part of the class!
+// Look there first to understand what is part of the CarSoccer class, then look below to see how each
+// function is implemented.
+
+
+CarSoccer::CarSoccer() : GraphicsApp(1024,768, "Car Soccer") {
+ // If you are having trouble driving the car with the keybaord, you can set this to true to use
+ // the mouse instead. The mouse controls are based on the postion of the mouse cursor on the window.
+ // There is a "dead zone" in the middle of the window, and if you move the mouse up/down or left/right
+ // outside of that zone, it is like pushing the up/down and/or left/right keys on the keyboard
+ use_mouse_ = false;
+
+ // Define a search path for finding data files (images and shaders)
+ searchPath_.push_back(".");
+ searchPath_.push_back("./data");
+ searchPath_.push_back(DATA_DIR_INSTALL);
+ searchPath_.push_back(DATA_DIR_BUILD);
+}
+
+CarSoccer::~CarSoccer() {
+}
+
+
+void CarSoccer::OnMouseMove(const Point2& pos, const Vector2& delta)
+{
+ mouse_pos_ = PixelsToNormalizedDeviceCoords(pos);
+}
+
+void CarSoccer::OnSpecialKeyDown(int key, int scancode, int modifiers) {
+ if (key == GLFW_KEY_SPACE) {
+ // Here's where you could call some form of launch_ball();
+ ball_.Reset();
+ }
+}
+
+/// This is a little utility function that is helpful. It treats the arrow keys like a joystick or D-pad on a game controller
+/// and returns the direction you are pressing as a 2D vector, taking into account the fact that you might be holding
+/// down more than one key at a time.
+Vector2 CarSoccer::joystick_direction() {
+ Vector2 dir;
+
+ if (use_mouse_) {
+ // threshold defines the size of the "dead zone" in the middle of the screen
+ // if the mouse's x,y position falls outside of this, then it is like pushing
+ // the corresponding key on the keyboard
+ const float threshold = 0.2f;
+ dir[0] = 0;
+ if (mouse_pos_[0] < -threshold) {
+ dir[0] = -1;
+ }
+ else if (mouse_pos_[0] > threshold) {
+ dir[0] = 1;
+ }
+ dir[1] = 0;
+ if (mouse_pos_[1] < -threshold) {
+ dir[1] = -1;
+ }
+ else if (mouse_pos_[1] > threshold) {
+ dir[1] = 1;
+ }
+ }
+ else {
+ // the default user interface is to use the arrow keys on the keyboard.
+ // like a D-pad on a game controller, you can hold more than one key down at a time if you want.
+ if (IsKeyDown(GLFW_KEY_LEFT))
+ dir[0]--;
+ if (IsKeyDown(GLFW_KEY_RIGHT))
+ dir[0]++;
+ if (IsKeyDown(GLFW_KEY_UP))
+ dir[1]++;
+ if (IsKeyDown(GLFW_KEY_DOWN))
+ dir[1]--;
+ }
+
+ return dir;
+}
+
+// dt is for "Delta Time", the elapsed time in seconds since the last frame
+void CarSoccer::UpdateSimulation(double dt) {
+ Vector2 dpad_dir = joystick_direction();
+ std::cout << "D-Pad Direction: " << dpad_dir << std::endl;
+
+ // Here's where you shound do your "simulation", updating the positions of the
+ // car and ball based on the elapsed time and checking for collisions. Filling
+ // in this routine is the main part of the assignment.
+
+ // Example: This is not the "correct way" to drive the car, but this code
+ // will at least move the car around for testing
+ float metersPerSec = 10.0f;
+ car_.set_position(car_.position() + metersPerSec * Vector3(dpad_dir[0], 0, -dpad_dir[1]) * dt);
+
+}
+
+
+void CarSoccer::InitOpenGL() {
+ // Set up the camera in a good position to see the entire field
+ projMatrix_ = Matrix4::Perspective(60, aspect_ratio(), 1, 1000);
+ modelMatrix_ = Matrix4::LookAt(Point3(0,60,70), Point3(0,0,10), Vector3(0,1,0));
+
+ // Set a background color for the screen (don't worry if you get a depricated warning on this line in OSX)
+ glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
+
+ // Load some image files we'll use
+ fieldTex_.InitFromFile(Platform::FindFile("pitch.png", searchPath_));
+ crowdTex_.InitFromFile(Platform::FindFile("crowd.png", searchPath_));
+}
+
+
+void CarSoccer::DrawUsingOpenGL() {
+ // Draw the crowd as a fullscreen background image
+ quickShapes_.DrawFullscreenTexture(Color(1,1,1), crowdTex_);
+
+ // Draw the car and the ball
+ car_.Draw(quickShapes_, modelMatrix_, viewMatrix_, projMatrix_);
+ ball_.Draw(quickShapes_, modelMatrix_, viewMatrix_, projMatrix_);
+
+ // Draw the field with the field texture on it.
+ Color col(16.0f/255.0f, 46.0f/255.0f, 9.0f/255.0f);
+ Matrix4 M = Matrix4::Translation(Vector3(0.0f, -0.201f, 0.0f)) * Matrix4::Scale(Vector3(50.0f, 1.0f, 60.0f));
+ quickShapes_.DrawSquare(modelMatrix_ * M, viewMatrix_, projMatrix_, col);
+ M = Matrix4::Translation(Vector3(0.0f, -0.2f, 0.0f)) * Matrix4::Scale(Vector3(40.0f, 1.0f, 50.0f));
+ quickShapes_.DrawSquare(modelMatrix_ * M, viewMatrix_, projMatrix_, Color(1,1,1), fieldTex_);
+
+ // You should add drawing the goals and the boundary of the playing area
+ // using quickShapes_.DrawLines()
+
+}
diff --git a/dev/a2-carsoccer/car_soccer.h b/dev/a2-carsoccer/car_soccer.h
index 9982238..471c8d2 100644
--- a/dev/a2-carsoccer/car_soccer.h
+++ b/dev/a2-carsoccer/car_soccer.h
@@ -1,84 +1,84 @@
-/** CSci-4611 Assignment 2: Car Soccer
- */
-
-#ifndef CAR_SOCCER_H_
-#define CAR_SOCCER_H_
-
-#include <mingfx.h>
-using namespace mingfx;
-
-#include "ball.h"
-#include "car.h"
-
-
-// The main class for the Car Soccer application
-class CarSoccer : public GraphicsApp {
-public:
- CarSoccer();
- virtual ~CarSoccer();
-
- /// Called whenever the mouse moves
- void OnMouseMove(const Point2& pos, const Vector2& delta);
-
- /// This is called when special keys like SPACEBAR are pressed
- void OnSpecialKeyDown(int key, int scancode, int modifiers);
-
- /// This is called once each frame. dt is "delta time", the time elapsed
- /// since the last call.
- void UpdateSimulation(double dt);
-
- /// This is called when it is time to initialize graphics objects, like
- /// texture files.
- void InitOpenGL();
-
- /// This is called once each frame, and you should draw the scene inside
- /// this function.
- void DrawUsingOpenGL();
-
- /// This is a little utility function that is helpful. It treats the
- /// arrow keys like a joystick and returns the direction you are pressing
- /// as a 2D vector, taking into account the fact that you might be holding
- /// down more than one key at a time.
- Vector2 joystick_direction();
-
- // Feel free to add more functions here as needed.
-
-
-private:
-
- // Simulation objects/parameters:
-
- // We suggest you start with the Car and Ball objects provided, adding new
- // member variables to those classes if you need to. You'll probably want
- // to store some other data for the simulation here too, like some value
- // for gravity.
- Car car_;
- Ball ball_;
-
-
- // Support for drawing some simple shapes:
- QuickShapes quickShapes_;
-
- // Images to use as textures:
- Texture2D fieldTex_;
- Texture2D crowdTex_;
-
- // Control the computer graphics camera (we'll learn about this in a few weeks):
- Matrix4 modelMatrix_;
- Matrix4 viewMatrix_;
- Matrix4 projMatrix_;
-
- // A list of paths to search for data files (images):
- std::vector<std::string> searchPath_;
-
- // Set this to true if you want to use the mouse to control the car rather than the keyboard
- bool use_mouse_;
-
- // Mouse position in Normalized Device Coordinates,
- // meaning -1 to +1 in both X and Y. (0,0) is the
- // center of the screen
- Point2 mouse_pos_;
-};
-
-
-#endif
+/** CSci-4611 Assignment 2: Car Soccer
+ */
+
+#ifndef CAR_SOCCER_H_
+#define CAR_SOCCER_H_
+
+#include <mingfx.h>
+using namespace mingfx;
+
+#include "ball.h"
+#include "car.h"
+
+
+// The main class for the Car Soccer application
+class CarSoccer : public GraphicsApp {
+public:
+ CarSoccer();
+ virtual ~CarSoccer();
+
+ /// Called whenever the mouse moves
+ void OnMouseMove(const Point2& pos, const Vector2& delta);
+
+ /// This is called when special keys like SPACEBAR are pressed
+ void OnSpecialKeyDown(int key, int scancode, int modifiers);
+
+ /// This is called once each frame. dt is "delta time", the time elapsed
+ /// since the last call.
+ void UpdateSimulation(double dt);
+
+ /// This is called when it is time to initialize graphics objects, like
+ /// texture files.
+ void InitOpenGL();
+
+ /// This is called once each frame, and you should draw the scene inside
+ /// this function.
+ void DrawUsingOpenGL();
+
+ /// This is a little utility function that is helpful. It treats the
+ /// arrow keys like a joystick and returns the direction you are pressing
+ /// as a 2D vector, taking into account the fact that you might be holding
+ /// down more than one key at a time.
+ Vector2 joystick_direction();
+
+ // Feel free to add more functions here as needed.
+
+
+private:
+
+ // Simulation objects/parameters:
+
+ // We suggest you start with the Car and Ball objects provided, adding new
+ // member variables to those classes if you need to. You'll probably want
+ // to store some other data for the simulation here too, like some value
+ // for gravity.
+ Car car_;
+ Ball ball_;
+
+
+ // Support for drawing some simple shapes:
+ QuickShapes quickShapes_;
+
+ // Images to use as textures:
+ Texture2D fieldTex_;
+ Texture2D crowdTex_;
+
+ // Control the computer graphics camera (we'll learn about this in a few weeks):
+ Matrix4 modelMatrix_;
+ Matrix4 viewMatrix_;
+ Matrix4 projMatrix_;
+
+ // A list of paths to search for data files (images):
+ std::vector<std::string> searchPath_;
+
+ // Set this to true if you want to use the mouse to control the car rather than the keyboard
+ bool use_mouse_;
+
+ // Mouse position in Normalized Device Coordinates,
+ // meaning -1 to +1 in both X and Y. (0,0) is the
+ // center of the screen
+ Point2 mouse_pos_;
+};
+
+
+#endif
diff --git a/dev/a2-carsoccer/cmake/DownloadHelper.txt.in b/dev/a2-carsoccer/cmake/DownloadHelper.txt.in
index fb29bff..69f3039 100644
--- a/dev/a2-carsoccer/cmake/DownloadHelper.txt.in
+++ b/dev/a2-carsoccer/cmake/DownloadHelper.txt.in
@@ -1,26 +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
-)
-
-
+# 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/a2-carsoccer/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/a2-carsoccer/cmake/ExternalProjectDownloadBuildInstall.cmake
index ce12d1d..4585dd3 100644
--- a/dev/a2-carsoccer/cmake/ExternalProjectDownloadBuildInstall.cmake
+++ b/dev/a2-carsoccer/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -1,98 +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()
-
+# 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/a2-carsoccer/cmake/MessageMacros.cmake b/dev/a2-carsoccer/cmake/MessageMacros.cmake
index 4628e5c..b2d08ee 100644
--- a/dev/a2-carsoccer/cmake/MessageMacros.cmake
+++ b/dev/a2-carsoccer/cmake/MessageMacros.cmake
@@ -1,17 +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()
-
+# 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/a2-carsoccer/cmake/UseOpenGL.cmake b/dev/a2-carsoccer/cmake/UseOpenGL.cmake
index 2ec5ffb..ac5f55c 100644
--- a/dev/a2-carsoccer/cmake/UseOpenGL.cmake
+++ b/dev/a2-carsoccer/cmake/UseOpenGL.cmake
@@ -1,52 +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()
+# 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/a2-carsoccer/config.h.in b/dev/a2-carsoccer/config.h.in
index bf66666..97962a5 100644
--- a/dev/a2-carsoccer/config.h.in
+++ b/dev/a2-carsoccer/config.h.in
@@ -1,13 +1,13 @@
-/** CSci-4611 Assignment 2: Car Soccer
-*/
-
-
-// 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@"
-
+/** CSci-4611 Assignment 2: Car Soccer
+*/
+
+
+// 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/a2-carsoccer/main.cc b/dev/a2-carsoccer/main.cc
index cc6c086..b39f6f8 100644
--- a/dev/a2-carsoccer/main.cc
+++ b/dev/a2-carsoccer/main.cc
@@ -1,11 +1,11 @@
-/** CSci-4611 Assignment 2: Car Soccer
- */
-
-
-#include "car_soccer.h"
-
-int main(int argc, const char *argv[]) {
- CarSoccer app;
- app.Run();
- return 0;
-}
+/** CSci-4611 Assignment 2: Car Soccer
+ */
+
+
+#include "car_soccer.h"
+
+int main(int argc, const char *argv[]) {
+ CarSoccer app;
+ app.Run();
+ return 0;
+}