Using Papervision Object Parsers

Sketchup Parser

What is a Sketchup file?

While I was unable to get this parser to properly read the kmz file, I was able to extract the content of the kmz and load the Sketchup DAE file without a probem. To do this, just follow the instructions from the DAE parser above.

Sketchup Parsing Example

package {
	import org.papervision3d.lights.PointLight3D;
	import org.papervision3d.materials.shadematerials.GouraudMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.objects.parsers.DAE;
	import org.papervision3d.view.BasicView;

	public class SketchupParser_v1 extends BasicView {
		// create a class-level var for the collada scene
		private var _dae:DAE;
		// create the light
		private var _light:PointLight3D;

		public function SketchupParser_v1() {

		private function lights():void {
			// create the light to the scene
			_light = new PointLight3D(true, true);
			// place it in the same position as the camera (0, 0, -1000);

		private function init3d():void {
			// create a materials list and add the wireframe material
			var knotMaterialsList:MaterialsList = new MaterialsList();
			// we are now going to use a gouraud material for shading
			var knotMaterial:GouraudMaterial = new GouraudMaterial(_light);
			knotMaterialsList.addMaterial(knotMaterial, "all");
			// instantiate the DAE obj and load the knot object
			// apply the material and scale to 0.05
			_dae = new DAE();
			_dae.load("assets/sketchup/knot.dae", knotMaterialsList);
			_dae.scale = 1;
			camera.z = -5;
			// add the DAE file to the scene
			// start rendering (activated onRenderTick)

		override protected function onRenderTick(event:Event = null):void {
			// rotate the object

This, you may notice, is identical to the DAE loader. That is because it is just loading the DAE extracted from the Sketchup kmz file.

Leave a Reply

Your email address will not be published. Required fields are marked *