Embedded Materials for Embedded Meshes

Software: Away3D 4.x

jahiro, Newbie
Posted: 02 July 2011 12:07 PM   Total Posts: 3

Hi All,

I have a request for OBJs, but really it would apply to all 3D file formats.

When emdedding an OBJ file, I’m forced to load its MTL file and subsequent material maps at runtime.

Since most of the time you will want to embed a model in its entirety, not just the geometry, this limitation in embedding is a problem.

Would it be possible to add some additional logic so we can do this?

//Instantiate Embedded Assets
obj = new EmbeddedOBJ();
mtl = new EmbeddedMTL();
map1 = new EmbeddedMap1();
map2 = new EmbeddedMap2();

_loader.parseData(new EmbeddedFile(), “”, false, OBJParser);

//Pass Material information to the Loader3D
_loader.setMTL(mtl);
_loader.addMaterial(“map1.jpg”, map1);
_loader.addMaterial(“map2.jpg”, map2);

This would give the Loader3D enough information to map all the material maps to the geometry and would allow for a model in its entirety to be embedded.

iOS apps are very strict about what gets loaded at runtime. Once molehill is released for mobile, this feature request will become urgent, so might as well add support now, rather than waiting for the alarm bells! wink

Thanks for all your hard work Away3D team! <3 Away3D 4
-Jahiro

 

   

John Brookes, Moderator
Posted: 02 July 2011 01:04 PM   Total Posts: 732   [ # 1 ]

You can already do this.
eg for an awd1 file and its images

var context : AssetLoaderContext = new AssetLoaderContext();
context.mapUrlToData(‘images/lhf.jpg’, lhf_EmbedIMGASSET());
context.mapUrlToData(‘images/rhr.jpg’, rhf_EmbedIMGASSET);

AssetLibrary.parseData(EmbedAWDFile,null,context);

   

jahiro, Newbie
Posted: 02 July 2011 01:29 PM   Total Posts: 3   [ # 2 ]

Awesome, thanks for the reply John, I’ll give that a try.

To give the mapUrlToData functionality the awareness it deserves, can I suggest an example of it is added to the EmbedParseDataTest class in the examples folder?

   

John Brookes, Moderator
Posted: 02 July 2011 01:57 PM   Total Posts: 732   [ # 3 ]

https://raw.github.com/away3d/away3d-examples-broomstick/master/src/EmbedParseDataTest.as

   

jahiro, Newbie
Posted: 03 July 2011 02:24 AM   Total Posts: 3   [ # 4 ]

Ah, sorry, I’ll have to start using the Git repo - I was looking in SVN. Seems that the examples in the SVN repo are about a month old.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X