Sketchup Class

2 messages Options
Embed this post
Permalink
B O X

Sketchup Class

Reply Threaded More More options
Print post
Permalink
Hi All,

I noticed a few posts regarding the Sketchup Class I wrote thats in the SVN. Currently it works as it should but its still needs testing. The Sketchup Class loads and unzips the kmz file accessing the .dae and the textures, and the SketchupCollada Class is just the Collada class that I altered to ignore lines and its corresponding geometry in the COLLADA structure.

Here is a list of things to keep in mind when creating the .kmz thats loaded through the Sketchup Class:


• Sketchup's packaged textures & colors don't work. Only bitmap images imported to the model directly from files work. Don't use textures from the Materials Window. If you need solid colors, just make swatches and drag em into sketchup. I will try and resolve this next.

• Grouped objects and components don't work. Explode em!

• Transparent textures need to be done with png's with transparency. Don't use Sketchup's alpha channels.

• Lines aren't shown and don't make the Collada Class fail anymore, but prob shouldn't be used anyways.

• Textures are set to tile in the SketchupCollada Class.

• Non uniform texture scaling of textures may cause textures failing to tile.

• When the kmz is online, navigating to its url in a browser downloads the kmz file and decompresses it.

• Its always good to break up large planes in Skechup so you don't have out of order triangles since there isn't any sort of Correct Z Ordering in PV.

Hope this helps. Once I get more time, I will put more time into it. In the mean-time, make clean, simple models.

Here is an example of usage:

___________________________________________

import org.papervision3d.scenes.Scene3D;
import org.papervision3d.cameras.FreeCamera3D;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.objects.parsers.Sketchup;

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.MEDIUM;

var viewport:Viewport3D = new Viewport3D(stage.stageWidth, stage.stageHeight, true, false);
        addChild(viewport);

var renderer:BasicRenderEngine = new BasicRenderEngine();

var scene:Scene3D = new Scene3D();

var camera:FreeCamera3D = new FreeCamera3D();
        camera.z = -1000;
        camera.zoom = 11;

var model:Sketchup = new Sketchup("BOX.kmz");
        model.scale = .01;
        scene.addChild(model);

stage.addEventListener( Event.ENTER_FRAME, render);
        function render(event:Event) {
                model.rotationY += (((mouseX-(stage.stageWidth/2))/10)-model.rotationY)/3;
                model.rotationX += ((-((mouseY-(stage.stageHeight/2))/10))-model.rotationX)/3;
                renderer.renderScene(scene, camera, viewport);
        };

___________________________________________________


Result: http://lab.box.biz/sketchup/SketchupClass.swf


Joel Isaac Hart

Re: Sketchup Class

Reply Threaded More More options
Print post
Permalink
This was VERY helpful. However I am getting this error when I use your code. Can you possibly tell me what I need to do differently?

Error:
Severity and Description Path Resource Location Creation Time Id
1046: Type was not found or was not a compile-time constant: Event. amohs amohs.as line 34 1207022935092 397

My Code:

package {

import flash.display.Sprite;

import org.papervision3d.scenes.Scene3D;

import org.papervision3d.cameras.FreeCamera3D;

import org.papervision3d.view.Viewport3D;

import org.papervision3d.render.BasicRenderEngine;

import org.papervision3d.objects.parsers.Sketchup;



public class amohs extends Sprite

{


stage.align = StageAlign.TOP_LEFT;

stage.scaleMode = StageScaleMode.NO_SCALE;

stage.quality = StageQuality.MEDIUM;


var viewport:Viewport3D = new Viewport3D(stage.stageWidth,

stage.stageHeight, true, false);

       addChild(viewport);


var renderer:BasicRenderEngine = new BasicRenderEngine();


var scene:Scene3D = new Scene3D();


var camera:FreeCamera3D = new FreeCamera3D();

       camera.z = -1000;

       camera.zoom = 11;


var model:Sketchup = new Sketchup("test.kmz");

       model.scale = .01;

       scene.addChild(model);


stage.addEventListener( Event.ENTER_FRAME, render);

       function render(event:Event) {

               model.rotationY += (((mouseX-(stage.stageWidth/2))/10)-model.rotationY)/3;

               model.rotationX +=

((-((mouseY-(stage.stageHeight/2))/10))-model.rotationX)/3;

               renderer.renderScene(scene, camera, viewport);

       };


public function amohs()

{

}

}

}


Thanks,
Joel Hart




On Thu, Mar 27, 2008 at 1:24 PM, B O X <[hidden email]> wrote:

Hi All,

I noticed a few posts regarding the Sketchup Class I wrote thats in the SVN.
Currently it works as it should but its still needs testing. The Sketchup
Class loads and unzips the kmz file accessing the .dae and the textures, and
the SketchupCollada Class is just the Collada class that I altered to ignore
lines and its corresponding geometry in the COLLADA structure.

Here is a list of things to keep in mind when creating the .kmz thats loaded
through the Sketchup Class:


• Sketchup's packaged textures & colors don't work. Only bitmap images
imported to the model directly from files work. Don't use textures from the
Materials Window. If you need solid colors, just make swatches and drag em
into sketchup. I will try and resolve this next.

• Grouped objects and components don't work. Explode em!

• Transparent textures need to be done with png's with transparency. Don't
use Sketchup's alpha channels.

• Lines aren't shown and don't make the Collada Class fail anymore, but prob
shouldn't be used anyways.

• Textures are set to tile in the SketchupCollada Class.

• Non uniform texture scaling of textures may cause textures failing to
tile.

• When the kmz is online, navigating to its url in a browser downloads the
kmz file and decompresses it.

• Its always good to break up large planes in Skechup so you don't have out
of order triangles since there isn't any sort of Correct Z Ordering in PV.

Hope this helps. Once I get more time, I will put more time into it. In the
mean-time, make clean, simple models.

Here is an example of usage:

___________________________________________

import org.papervision3d.scenes.Scene3D;
import org.papervision3d.cameras.FreeCamera3D;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.objects.parsers.Sketchup;

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.MEDIUM;

var viewport:Viewport3D = new Viewport3D(stage.stageWidth,
stage.stageHeight, true, false);
       addChild(viewport);

var renderer:BasicRenderEngine = new BasicRenderEngine();

var scene:Scene3D = new Scene3D();

var camera:FreeCamera3D = new FreeCamera3D();
       camera.z = -1000;
       camera.zoom = 11;

var model:Sketchup = new Sketchup("BOX.kmz");
       model.scale = .01;
       scene.addChild(model);

stage.addEventListener( Event.ENTER_FRAME, render);
       function render(event:Event) {
               model.rotationY += (((mouseX-(stage.stageWidth/2))/10)-model.rotationY)/3;
               model.rotationX +=
((-((mouseY-(stage.stageHeight/2))/10))-model.rotationX)/3;
               renderer.renderScene(scene, camera, viewport);
       };

___________________________________________________


Result:  http://lab.box.biz/sketchup/SketchupClass.swf
http://lab.box.biz/sketchup/SketchupClass.swf




-----
B O X
N Y C
--
View this message in context: http://www.nabble.com/Sketchup-Class-tp16332151p16332151.html
Sent from the Papervision3D mailing list archive at Nabble.com.


_______________________________________________
Papervision3D mailing list
[hidden email]
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
[hidden email]
http://osflash.org/mailman/listinfo/papervision3d_osflash.org