[Papervision3D] why doesn't this work?
xero
xero.nu at gmail.com
Fri Jun 12 10:24:44 PDT 2009
hey,
if you are seeing the embeded model w/ the
randomly colored wireframe, that means the
model is loading successfully, but your material
isnt being applied correctly. this line:
matsList.addMaterial(new BitmapMaterial(data.bitmapData), "pt0");
where you are naming your material "pt0"
first off (i know this is n00bish) check your exported
asset, and verify that is infact the correct name.
you also might want to try and replace whatever
material is there by default, after the object has fully loaded,
but before you add it to the scene.
pt.replaceMaterialByName( /* new *material* */ , /* *material* name */);
good luck!
____ ___
\ \/ /___________ ____
.\ // __ \_ __ \/ _ \
./ \ ___/ | | \( <_> )
/___/\ \___ >__|---\____/
| \_/ \/ |
| xero harrison |
| xero.nu at gmail.com |
| http://xero.nu |
| http://fontvir.us |
| http://hexarray.nu |
| http://xero.owns.us |
`---------------------'
---------- Forwarded message ----------
> From: Steven Hargrove <steven.hargrove at gmail.com>
> To: papervision3d at osflash.org
> Date: Thu, 11 Jun 2009 17:45:50 -0400
> Subject: [Papervision3D] why doesn't this work?
> I'm having some trouble understanding why this is not working...
>
> package
> {
> import flash.display.*;
> import flash.events.*;
> import org.papervision3d.materials.*;
> import org.papervision3d.materials.shadematerials.EnvMapMaterial;
> import org.papervision3d.materials.utils.*;
> import org.papervision3d.objects.*;
> import org.papervision3d.objects.parsers.*;
> import org.papervision3d.view.*;
>
> /**
> * ...
> * @author http://www.miguelmoraleda.com
> */
> public class Main extends BasicView
> {
> private var _cameraTarget :DisplayObject3D;
>
> [Embed(source="MyAsset.DAE", mimeType="application/octet-stream")]
> private var ptModelAsset :Class;
>
> [Embed(source="MyAsset.jpg")]
> private var ptTextureAsset :Class;
>
> public function Main()
> {
> super(0, 0, true);
>
> configStage();
> configScene();
> createObjects();
> startRendering();
> }
>
> private function configStage():void
> {
> stage.scaleMode = StageScaleMode.NO_SCALE;
> stage.align = StageAlign.TOP_LEFT;
> stage.quality = StageQuality.LOW;
> }
>
> private function configScene():void
> {
> _cameraTarget = new DisplayObject3D();
>
> //camera.x = 400
> //camera.y = 400;
> //camera.z = -1100;
> camera.zoom = 1;
> camera.focus = 1100;
> camera.lookAt(_cameraTarget);
>
> }
> private function createObjects():void
> {
> var data:Bitmap = new ptTextureAsset() as Bitmap;
> var matsList:MaterialsList = new MaterialsList();
> matsList.addMaterial(new BitmapMaterial(data.bitmapData),
> "pt0");
>
> var pt:DAE = new DAE();
> //pt.scale = 5;
> pt.rotationX =
> pt.rotationY = 50;
> pt.rotationZ = -50;
> pt.load(XML(new ptModelAsset()), matsList);
> scene.addChild(pt);
>
> renderer.renderScene(scene, camera, viewport);
> this.startRendering();
> }
>
> override protected function onRenderTick(event:Event = null):void
> {
> //_physics.step();
> super.onRenderTick(event);
> }
>
> }
>
> }
>
> Essentially, I am just embeding both the DAE and texture (.jpg)
> compile-time via the Embed tag.
>
> Everything works great, except my texture will not adhere, what am I doing
> wrong?
>
> Steve
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090612/ca81c797/attachment.html>
More information about the Papervision3D
mailing list