Away3D 3.6 and FLARToolkit

Discussion about FLARManager, the ightweight framework that makes it easier to build augmented reality applications for Flash

Moderator: ericsoco

Away3D 3.6 and FLARToolkit

Postby laurid » Wed Oct 05, 2011 3:03 am

I know this is the FLARManager Forum, but in the GoogleGroup (http://groups.google.com/group/flartoolkit-userz/browse_thread/thread/a372ca00e03b343e/23436b96e8677cd7?lnk=gst&q=away3d#23436b96e8677cd7) I couldn't find any help.

I know that FlarManager supports Away3d 3.6, but FlarToolkit does not. I can't use FlarManager, because it runs much slower than FlarToolkit itself (even with only one Marker/Pattern). But maybe someone can help me out with the 3D Transformations. I have to update the two Classes FLARBaseNode.as and FLARCamera3D.as in org.libspark.flartoolkit.support.away3d. I figured out that Flar Manager is doing the 3D Transformations in these two Classes:
http://transmote.com/codeshare/FLARMana ... omUtils.as
http://transmote.com/codeshare/FLARMana ... _Away3D.as

I did some reverse engineering and rewrote the class FLARBaseNode. But it's not working:
Code: Select all
package org.libspark.flartoolkit.support.away3dv36{
   import away3d.containers.ObjectContainer3D;
   import flash.geom.Matrix3D;
   import flash.geom.Vector3D;
   import org.libspark.flartoolkit.core.transmat.FLARTransMatResult;
   
   public class FLARBaseNode extends ObjectContainer3D {
      
      public function FLARBaseNode(...initarray) {
         super(initarray);
      }
      
      private var _tmp:Matrix3D = new Matrix3D;
      
      public function setTransformMatrix(r:FLARTransMatResult):void {
         var m:Matrix3D=new Matrix3D(Vector.<Number>([
            r.m00,   r.m01,   r.m02,   r.m03,
            r.m10,   r.m11,   r.m12,   r.m13,
            r.m20,   r.m21,   r.m22,   r.m23,
            0,      0,      0,      1
         ]));
         this.transform=convertMatrixToAwayMatrix(m);
      }
      public static function convertMatrixToAwayMatrix (mat:Matrix3D) :Matrix3D {
         var raw:Vector.<Number> = mat.rawData;
         raw[1] = -raw[1];
         raw[4] = -raw[4];
         raw[6] = -raw[6];
         raw[9] = -raw[9];
         raw[13] = -raw[13];
         return new Matrix3D(raw);
      }
   }
}


The Function setTransformMatrix is called when my Marker is detected:
Code: Select all
public function onMarkerAdded(e:Event=null):void
      {
         trace("marker added");
         this.detector.getTransformMatrix(this.resultMat);
         this.markerNode.setTransformMatrix(this.resultMat);
         this.container.visible = true;
}


It wolud be really Great if someone could help me out.
Thanks a lot!
laurid
 
Posts: 3
Joined: Thu Jan 27, 2011 1:30 pm

Return to FLARManager

Who is online

Users browsing this forum: No registered users and 0 guests