ASE Parser

What is an ASE file?

This file type represents the Autodesk ASCII Scene Export file. It is a text file with scene information from 3ds Max.

Papervision allows you to import geometry and mapping of one mesh with this parser. They recommend not doing anything too complex.

ASE Parser Example

  1. package {
  2.  // flash class
  3.  import flash.events.Event;
  4.  // pv3d class
  5.  import org.papervision3d.events.FileLoadEvent;
  6.  import org.papervision3d.objects.parsers.Ase;
  7.  import org.papervision3d.objects.DisplayObject3D;
  8.  import org.papervision3d.lights.PointLight3D;
  9.  import org.papervision3d.materials.shadematerials.GouraudMaterial;
  10.  import org.papervision3d.materials.utils.MaterialsList;
  11.  import org.papervision3d.view.BasicView;
  12.  
  13.  public class AseParser_v1 extends BasicView {
  14.   // create a class-level var for the collada scene
  15.   private var _ase:Ase;
  16.   // create the light
  17.   private var _light:PointLight3D;
  18.  
  19.   public function AseParser_v1() {
  20.    lights();
  21.    init3d();
  22.   }
  23.  
  24.   private function lights():void {
  25.    // create the light to the scene
  26.    _light = new PointLight3D(true, true);
  27.    // place it in the same position as the camera (0, 0, -1000);
  28.    _light.copyPosition(camera);
  29.   }
  30.  
  31.   private function init3d():void {
  32.    // we are now going to use a gouraud material for shading
  33.    var knotMaterial:GouraudMaterial = new GouraudMaterial(_light);
  34.    // instantiate the ASE obj and load the knot object
  35.    // apply the material and scale to 0.1
  36.    _ase = new Ase(knotMaterial, "assets/knot.ASE", .1)
  37.    // add the ASE file to the scene
  38.    scene.addChild(_ase);
  39.    // start rendering (activated onRenderTick)
  40.    startRendering();
  41.   }
  42.  
  43.   override protected function onRenderTick(event:Event = null):void {
  44.    // rotate the object
  45.    _ase.yaw(1);
  46.    super.onRenderTick();
  47.   }
  48.  }
  49. }

This is a simple class that extends the BasicView class in the Papervision library. The general setup involves a PointLight3D light source that is location in the same position as the camera. Everything else deals with the loading of an ASE file.

To load the file, an instance of the ASE parser is created at the class-level. In the init I created a GouraudMaterial and applied the light to it with default settings (white light, black shading).

  1. var knotMaterial:GouraudMaterial = new GouraudMaterial(_light);

I then instantiated the ASE object and assigned the material, the path to the ASE file and the scaling value to the object in the constructor and added it to the stage

  1. _ase = new Ase(knotMaterial, "assets/knot.ASE", .1);

This class also includes an EnterFrame function to spin the object on the Y axis.

  1. _ase.yaw(1);

Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9