diff options
author | Matt Strapp <matt@mattstrapp.net> | 2021-09-27 21:44:53 -0500 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2021-09-27 21:44:53 -0500 |
commit | b38e870d6be22a377bf7b0fb5048801886ebaa77 (patch) | |
tree | 18e021a36e2f939892eb4895269f420274a341df /dev/a2-carsoccer/car.cc | |
parent | Pushed feedback file submission-p1 (diff) | |
download | csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.tar csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.tar.gz csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.tar.bz2 csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.tar.lz csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.tar.xz csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.tar.zst csci4611-0d26133a493712ab5b3fc9ba9f5ca5d8ea39f783.zip |
do ws2submission-w2.0
Diffstat (limited to 'dev/a2-carsoccer/car.cc')
-rw-r--r-- | dev/a2-carsoccer/car.cc | 132 |
1 files changed, 66 insertions, 66 deletions
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);
+}
|