سؤال

I am writing some code based on the following tutorial:

http://active.tutsplus.com/tutorials/3d/quick-tip-displaying-a-3d-model-with-papervision3d/

I copied the code from the example and added paths to my own assets.

[Embed(source="/Models/daeModel/cow.dae", mimeType="application/octet-stream")]    
private var CowModelClass:Class;         
[Embed(source="/Models/daeModel/Cow.png")]    
private var CowTextureClass:Class;  
[Embed(source="/Models/SkyDome/images.jpg")]    
private var SkyTextureClass:Class;
[Embed(source="/Textures/grass-texture.jpg")]    
private var GrassTextureClass:Class;

The assets shown above are used to display a Collada cow model standing on grass (plane) under a skydome (sphere), so my code differs slightly from the tutorial and I am loading Collada not DAE.

import org.papervision3d.objects.parsers.Collada;

I publish it in Flash CS3 and the .swf works perfectly. Cow model displays, grass plane and skydome all show up.

Unfortunately the assets are loaded at runtime because Flash CS3 does not embed.

To embed the assets I then compile the .as using mxmlc.exe using:

-static-link-runtime-shared-libraries=true

and I get no compilation errors.

However, when I run the .swf, the grass plane and the skydome appear normally with their embedded textures, but the collada model does not show.

My own debug text displays the width of the model as 0, so it looks like the model hasn't loaded. The Collada class still works fine because I am able to move the 3D co-ordinates of the model and thereby move some 3D text which is centred on the co-ordinates of the model. The text displays but the model is not visible.

By making a simple change I am able to check the model's texture 'Cow.png' by applying it to the grass plane, and it shows up fine. Because the texture is in the same folder as the model, I know that navigating the path to the model's location isn't the problem.

Does anyone know of any reason Collada models might not show after compile with mxmlc?

Am I missing any command line parameters or something obvious like that?

Failing that is there any other way of embedding this model?

هل كانت مفيدة؟

المحلول

Problem Solved!

Compiler mxmlc required me to define cowByteArray as XML:

//load cow model MXMLC
var cowByteArray:ByteArray = new CowModelClass ( ); 
cow = new Collada ( ) ;
cow.load ( new XML(cowByteArray), cowMaterialsList ) ;

Using the second code, after compiling with mxmlc, the model shows up fine!

Hope this helps somebody!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top