Creating a template class to load models
In order to show an imported 3D model using Papervision3D, we will create a basic application. Remember the example in Chapter 6, in which we made the camera orbit around a grid of planes by moving the mouse? We will use the same code to rotate around the models, which we are going to create and load later in this chapter.
Based on the orbit example we create the following class. Each time we load a new model we just have to alter the init() method. First, have a look at the following base code for this example:
package {
import flash.events.Event;
import org.papervision3d.materials.WireframeMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Cube;
import org.papervision3d.view.BasicView;
public class ExternalModelsExample extends BasicView
{
private var model:DisplayObject3D;
private var rotX:Number = 0.1;
private var rotY:Number = 0.1;
private...