Giter Site home page Giter Site logo

nuno-silva / computer-graphics-wag Goto Github PK

View Code? Open in Web Editor NEW
1.0 5.0 0.0 2.58 MB

Micro Machines implementation in C++ for the Computer Graphics course - Instituto Superior Técnico, 2015

License: Other

Makefile 0.82% C++ 77.04% Vim Script 0.19% C 21.95%
opengl cpp game

computer-graphics-wag's Introduction

computer-graphics-wag

A Micro Machines implementation for the Computer Graphics course - Instituto Superior Técnico, 2015

Compiling and running on Linux

Compiling

Make sure you have gcc, g++, openGL, GLU and GLUT installed. For instance, on Lubuntu,

sudo apt-get install g++ freeglut3-dev

should install all required dependencies.

You also need libpng for the lab10 version of the project:

sudo apt-get install libpng++-dev

To compile, just run

cd src/
make

Running

To run Micro Machines:

make run

Compiling and running on Windows

Good luck using Visual Studio.

Coding style

  • 4 spaces indent
  • newline at end of file (why?)
  • ...

computer-graphics-wag's People

Contributors

iluxonchik avatar nuno-silva avatar rodamber avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

computer-graphics-wag's Issues

Task 2 - Implement the movement of the oranges

  • Oranges appearing randomly on table.
  • Oranges moving in uniform rectilinear fashion.
  • Oranges rotating as they move.
    • Add a leaf or a stalk to the oranges to add perception of rotation.
  • Oranges moving at different speeds.
  • Oranges speed increasing with time.
  • Oranges reappearing randomly on table after moving outside its borders, after a certain period (depends on task 3, I suppose).

Function names in DBG_PRINTF and DBG_PRINT

I want DBG_PRINTF and DBG_PRINT to automatically print the name of the function that called them.

@iluxonchik, does your compiler support either __FUNCTION__ or __func__?
gcc supports both. __func__ is part of C++11, but only supported in Visual Studio 2015+ according to this answer.

Model the table

Model the table using a cube. I didn't find a Table object in the UML, so I don't know what it should inherit from.

Handle arrow keys in GameManager::keyPressed

GameManager::keyPressed should tell the Car to turn left or right and to accelerate. This should be done when ⬅️, ➡️, ⬆️ and ⬇️ are pressed, calling the appropriate Car methods.

GameManager::keyPressed should not call invertWireframeState() direcly

GameManager::keyPressed should not call invertWireframeState() directly, as this changes the objects while they're being drawn, possibly leading to "currupt" drawings.
This should be done either in GameManager::onTimer or GameManager::update. GameManager::keyPressed would just set a flag in GameManager.

Implement friction

Implement friction when:

  • colliding with butters.
  • colliding with cheerios.

Should the road be filled?

Task 03.3 says we should define a material for the road. Do they mean:

  • define a material for the Cheerios?
  • create a road (inside roadside) and define a material for it?

Define a top view fixed camera

Implement OrthogonalCamera and define a fixed camera with a top view of the scene using an orthogonal projection. For lab02, the RoadSide should be all visible.

Model 5 butter packages

  • Model a butter package in paper using an appropriate origin point
  • Define ButterPackage.hpp
  • Implement ButterPackage.cpp

Task 1 - Two additional cameras

  • Define two new cameras
    • A fixed camera, that permits visualization of the whole field through a perspective projection.
    • A mobile camera, positioned before the car, also using a perspective projection.
  • Make possible to alternate between the 3 cameras using keys "1", "2" and "3".

Task 3 - Collisions

  • Give the car a starting position (starting line).
  • Detect the collision of the car with the oranges, butters, cheerios and the boundaries of the table.
    • Implement AABB framework.
    • The car stops when it collides with a cheerio or a butter.
    • The cheerios move a little and then stop when the car collides with them.
    • The car returns to the starting line when it collides with an orange.
  • Detect the collision of the car taking the path the car takes into account.

DynamicObjects should have an acceleration vector

I think DynamicObjects should have an acceleration vector and their update method would use it to calculate the new velocity and position. Sub classes would either not need an update method or just call DynamicObject::update and then do their own stuff.

For example, the Car would update its wheels on its update method, after calling DynamicObject::update.

Refactor wireframe state

drawSphere, drawCube, drawTorus and other draw* should be defined in GameObject. That way, setDrawAsWireframe and other \*WireFrame methods could be implemented by GameObject and would not be repeated by every child that needs it. The only drawback is that draw*would either need to be protected/public attributes of GameObject, or protected/public methods that would use a private function pointer of GameObject

Model the car

  • Define DynamicObject.hpp
  • Implement DynamicObject.cpp
  • Model the car in paper using an appropriate origin point
  • Define Car.hpp
  • Implement Car.cpp

The car must use at least 5 objects.

Global scene lighting (task 03.1)

  • create a directional light source (depends on #57), aka the sun
  • 'N' key toggles day/night mode
  • 'L' key toggles GL_LIGHTING
  • 'G' key toggles GL_FLAT/GL_SMOOTH using glShadeModel

Read part03.pdf and lab07 notes before doing anything.

Model 3 oranges

  • Define Obstacle.hpp
  • Model an orange in paper using an appropriate origin point
  • Define Orange.hpp
  • Implement Orange.cpp

GameManager::lastElapsedTime should be private

GameManager::lastElapsedTime and GameManager::onTimer() should be private. Then, either GameManager::init() would call glutTimerFunc() or GameManager would have a startTimer method which would be called by main().

Model six candles (task 03.2)

  • implement Candle class (point light) (depends on #57)
  • add six candles on top of the table
  • 'C' key toggles candles

Read part03.pdf and lab07 notes before doing anything.

Car Acceleration Broken

Car's acceleration seems to be broken. Acceleration requires multiple presses on the "up"/"down" key.

Model a simple road

Model the road using small torus as cheerios. Don't forget to model a cheerio in paper first.

Realistic dimensions

Our objects should have more realistic sizes. Based on some real measurements and a 2 x 2 meter table, I recommend, in centimetres ( W x L x H ):

  • Butter: 6 x 12 x 6+1 (about the size of a 250 g Portuguese butter package and my phone)
  • Orange: 6 x 6 x 6 (add a bit of randomness to them in the constructor... like 5-8 cm)
  • Car: 2 x 5.1 x 1.5 (based on this Audi A8 to a scale that is about 1/2 the size of the butter)
  • Cheerios: 1.9 x 1.9 x 0.6 (about the size of 3 stacked 10c coins)

Materials (part of task 03.3)

Define materials for:

  • Car (depends on #53)
  • Butter
  • Orange
  • Table (depends on #54)
  • Roadside (depends on #55)

Read part03.pdf and lab07 notes before doing anything.

Collisions not detected

Collisions Car and Butter and not being detected. Only tested with those two so far, others probably not working either.

Toggle wire frame

Pressing the A key should switch (at least?) the car, oranges and butter to wire frame mode.
Take this into account while designing #7, #8 and #9 . Any ideas on how we could implement this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.