Assignment 7
COMP 86



For this assignment, we will use Three.js and Javascript to build an interactive 3D world.

Make a three-dimensional version of your vehicle simulation. You can modify and simplify your original design in any way you want to make this feasible. This program does not have to include all of the features of your Java program. The task is to create something three-dimensional and interactive based on your simuation. You can add features that make sense in three dimensions, and remove other features.

Your program should:

Using Three.js

See the Three.js links on the course home page for documentation and downloading instructions. as well as the examples on the course lecture examples pages.

To use the Three.js library, you can download the code from http://threejs.org/ and put it in your local directory and access it from there in your <script> statements, as I did for class.

Or (perhaps easier) you can just access it directly from its server, by putting the following in your file instead of the <script> lines in my examples:


<script src="http://threejs.org/build/three.min.js"></script>
<script src="http://threejs.org/examples/js/Detector.js"></script>
<script src="http://threejs.org/examples/js/controls/OrbitControls.js"></script>
<script src="http://threejs.org/examples/js/loaders/OBJLoader.js"></script>


Program Design and Practices

(The rest of this still applies from previous assignments -- to the extent that it makes sense in your chosen language or system)

Your program design should exploit the features of object-oriented programming (encapsulation of code and data, support for abstract data types, polymorphism/overloading, inheritance). In particular, object-oriented programming provides us a good way to handle the various data needed in callback routines. You should use objects to encapsulate each interactive widget with the routines and data you need to use it.

You should provide an object for each interactive widget or small group of widgets you create. That object should hold anything you need to remember about the widget from one callback to another, all the data pertinent only to the command for that widget or that you need to operate this control, (including, in most cases, a pointer to the map or other outside object to perform the actual action the user requested), and the widget's own listener callback routines.

If you have several widgets that share some behavior or properties, you should organize your objects into an appropriate inheritance hierarchy.

You will have other data that must be accessed by several widgets, particularly shared information about the state of the program or global information about the state of the user interface. Provide additional classes and objects for holding this kind of information.

Remember to trigger your drawing to repaint itself explicitly whenever one of your commands causes a change that should be reflected on the screen. And remember that the way to change the screen is first to change the data stored your classes and then to trigger the repaint.

You should follow these general Java programming practices:

And, finally, on your Java programs, for uniformity, please name your Java class that has your main program in it Main, in file Main.java