This Homework is due 2015.11.15 by noon so that we can look at your work in the AlloSphere on 2015.11.16.
In this assignment, you will adapt one of your pieces to work in the AlloSphere by following the pattern shown in the example code. Find and study this example code:
handouts/hw4/common.hpp
handouts/hw4/renderer.cpp
handouts/hw4/renderer_allosphere.cpp
handouts/hw4/simulator.cpp
Choose a work you did for Homework 1, 2 or 3. Make a folder in your personal repo named hw4
and copy this work into the hw4
folder, renaming it simulator.cpp
. For example, Frank Zappa might do this:
cd path/to/mat201b2015
mkdir student/frank.zappa/hw4
cp student/frank.zappa/hw1/p1.cpp student/frank.zappa/hw4/simulator.cpp
Next, investigate your onDraw()
code. What data does your app need to draw your scene? Design a struct called State
(i.e., struct State {...}
) that encapsulates this data. Define this struct in a file called common.hpp
in your hw4
folder. Use handouts/hw4/common.hpp
as an example. See how this is done in handouts/hw4
.
Modify your simulator.cpp
to broadcast the the state defined in common.hpp
using a cuttlebone::Maker<State>
as handouts/hw4/simulator.cpp
does (important lines are marked in this file).
Write a second program called renderer_allosphere.cpp
modeled after handouts/hw4/renderer_allosphere.cpp
that receives states and draws your scene.
Your work will be displayed in full surround with stereographic 3D. The camera position corresponds to the center of the bridge, with the standard OpenGL X, Y, and Z in terms of an arbitrary "front" that is the direction you get when you turn to the right after walking onto the bridge. As always your code has a near clip distance; now instead of thinking of a clipping "plane" you can think of a clipping "box" (or sphere) inside of which everything is invisible. Please build your world so that it looks right when the camera is at the origin (position 0,0,0 --- the default and where you stay if you don't navigate).
When you push this homework, we expect to see these files:
hw4/common.hpp
hw4/renderer_allosphere.cpp
hw4/simulator.cpp