Game Development Reference
In-Depth Information
Loading the Game Scene
In the previous chapter, we learned how to load objects exported from Blender and
learned about directional lights. We learned many WebGL API calls and now in this
chapter, we will put our knowledge to good use. In this chapter, we will not discuss
any new WebGL call but we will use our knowledge to create a small game scene.
But, before we do that, we will need to perform some code updates.
The code we developed in Chapter 2 , Colors and Shading Languages , is not capable of
handling multiple objects, and so, we will structure that code first.
The following are the topics that we will cover in this chapter:
Code changes to support multiple objects
WebGL, a state machine
Request animation frames
Load the scene
Positional lights
Multiple lights and shaders
Supporting multiple objects
Our starting point will be a new class Geometry . The objective of the class is to hold
the geometry of our 3D models. We will first understand what type of information
associated with each 3D model.
Search WWH ::




Custom Search