Skip to main content

Starter Code

info
  • I will add a higher-level walkthrough of what I showed in lecture to the documentation here, but writing it up will take at least another day or two.
  • The starter code is well-commented, so looking at the actual code is the best way to learn the details of what each line does!
  • I have implemented enough from the starter code to achieve what we would consider full completion, so in that sense we know it is not broken. We may however make improvements and clarifications in response to your feedback. I will also be pushing additional skeleton code and some extra helper functions. For these reasons, make sure you can pull updates to the repo!

Running the Code

Start by forking the code from the course github. Running the code should work as it did with assignments a0-c1;

First install the code

yarn install

Then you can run it with

yarn start

As before, I strongly recommend using the debugger in Webstorm, as I find it tremendously useful to step through code and examine local variables directly in the IDE---though I know many of you prefer VS code...

When you run the code, you should see something like this:

Let's take a look at what's in the scene. Below we set the terrain color set to a blue shade to make things easier to see:

We can see how this scene was constructed in the code by looking at MainSceneModel.ts.

Loading 3D Models

If you want to load 3D models, first be aware that loading arbitrary formats is tricky and we make no guarantees that you will be able to load the model of your choice. We do, however, provide some default functionality and examples in the Example1 Scene. To run the Example1 scene, change the relevant part of main/MainAppComponent.ts:

import {MainSceneModel} from "./Scene/MainSceneModel";
import {MainSceneController} from "./Scene/MainSceneController";
const SceneModel = new MainSceneModel();
SceneModel.confirmInitialized();
const SceneController = new MainSceneController(SceneModel);


/**
* Comment out the code above and uncomment the code below to run the Example1Scene
* Which has a loaded 3D model and the billboard particle system skeleton code
*/
// import {Example1SceneModel} from "./Scene/ExampleScenes/Example1";
// import {Example1SceneController} from "./Scene/ExampleScenes/Example1";
// const SceneModel = new Example1SceneModel();
// SceneModel.confirmInitialized();
// const SceneController = new Example1SceneController(SceneModel);

Do as the comment suggests and