Thanks Fabrice! I read in some of your other posts that asd was faster, thought I’d give it a try, and I was genuinely blown away with my brief tests. Massive respect to you.
I’m still searching for how to ‘export only the geometry’ any pointers on where to select this in Prefab3D? [Exports] -> [Prefab Files] -> [Prefab3D ASD] ?
I created a bare-bones class that tries to set the material every frame but it seems that the mesh (or reference to the mesh?) is somehow lost each frame:
package
{
import flash.events.*;
import flash.display.*;
import away3d.entities.Mesh;
import away3d.core.base.SubMesh;
import away3d.core.partition.MeshNode;
import away3d.containers.View3D;
import away3d.lights.*; //Pointlight
import away3d.materials.lightpickers.StaticLightPicker; //
import away3d.library.AssetLibrary;
import away3d.materials.*; // ColorMaterial, TextureMaterial
import MyClass;
final public class MainMenu extends MovieClip
{
private var view:View3D;
private var staticLightPicker:StaticLightPicker;
private var directionalLight:DirectionalLight;
var myClass:MyClass;
var myMesh:Mesh;
public function MainMenu()
/*CONSTRUCTOR*/
{
/*setup stage, camera, lights*/
directionalLight=new DirectionalLight();
directionalLight.ambient=0.1;
staticLightPicker=new StaticLightPicker([directionalLight]);
view=new View3D();
view.camera.z=-1000;
view.scene.addChild(directionalLight);
addChild(view);
/*Instantiate asd-class 'myClass'*/
myClass=new MyClass(); //create instance of asd class
var v:Vector.<Mesh>=myClass.meshes; // use get meshs
var myMesh:Mesh=v[0]; //
myMesh.material=new ColorMaterial(0x00FF00,.5);
ColorMaterial(myMesh.material).lightPicker=staticLightPicker;
ColorMaterial(myMesh.material).specular=.1;
view.scene.addChild(myMesh);
trace(myMesh);
addEventListener(Event.ENTER_FRAME,render,false,0,true);
stage.addEventListener(MouseEvent.CLICK,clickHandler,false,0,true);
}
private function render(e:Event):void
{
view.render();
trace('!!'+myMesh);//null
var v:Vector.<Mesh>=myClass.meshes;
var myMesh:Mesh=v[0];
myMesh.material=new ColorMaterial(0x00FF00,.5);
ColorMaterial(myMesh.material).lightPicker=staticLightPicker;
ColorMaterial(myMesh.material).specular=.1;
view.scene.addChild(myMesh);
trace('??'+myMesh);//[object Mesh]
}
private function clickHandler(e:MouseEvent):void
{
while(view.scene.numChildren)view.scene.removeChildAt(0); // removes mesh until render() is called and mesh is restored - no visible change
}
I’m using version 2.143 of Prefab and Away3D 4.1.4