FlarToolKit source errors

42 views
Skip to first unread message

juri bryan

unread,
Feb 28, 2013, 6:53:53 AM2/28/13
to flartool...@googlegroups.com
Hi everyone,
I really really need some help!
I have no idea what I am doing wrong and why my code is not working...
It shows no errors in the code, but FlashBuilder 4.7 tells me that there are 76 errors in different files of my source(the FlarToolKit).
What did I do wrong, how can I fix this problem?
It seams to me that I am doing one of the very basic steps wrong, since my code opens and runs the webcam but no 3d object appears.
Then I copy pasted that code into a new project and now nothing happens, all I am getting is a white screen.
And I am still getting those 76 error messages, but not a single error in a line of code that I wrote...
Any help is more then welcome!

package

{

import flash.display.BitmapData;

import flash.display.Sprite;

import flash.events.Event;

import flash.media.Camera;

import flash.media.Video;

import flash.utils.ByteArray;

import org.libspark.flartoolkit.core.FLARCode;

import org.libspark.flartoolkit.core.param.FLARParam;

import org.libspark.flartoolkit.core.raster.rgb.FLARRgbRaster_BitmapData;

import org.libspark.flartoolkit.core.transmat.FLARTransMatResult;

import org.libspark.flartoolkit.detector.FLARSingleMarkerDetector;

import org.libspark.flartoolkit.support.pv3d.FLARBaseNode;

import org.libspark.flartoolkit.support.pv3d.FLARCamera3D;

import org.papervision3d.lights.PointLight3D;

import org.papervision3d.materials.shadematerials.FlatShadeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.objects.primitives.Cube;

import org.papervision3d.render.BasicRenderEngine;

import org.papervision3d.scenes.Scene3D;

import org.papervision3d.view.Viewport3D;

public class AR_01 extends Sprite

{

[Embed(source="pat1.pat", mimeType="application/octet-stream")]

private var pattern:Class;

[Embed(source="FLARCameraParams.dat", mimeType="application/octet-stream")]

private var params:Class;

private var fparams:FLARParam;

private var mpattern:FLARCode;

private var vid:Video;

private var cam:Camera;

private var bmd:BitmapData;

private var raster:FLARRgbRaster_BitmapData;

private var detector:FLARSingleMarkerDetector;

private var scene:Scene3D;

private var camera:FLARCamera3D;

private var container:FLARBaseNode;

private var vp:Viewport3D;

private var bre:BasicRenderEngine;

private var trans:FLARTransMatResult;

public function AR_01()

{

setupFlear();

setupCam();

setupBitmap();

setupPV3D();

addEventListener(Event.ENTER_FRAME, loop);

}

private function setupFlear():void

{

fparams = new FLARParam();

fparams.loadARParam(params() as ByteArray);

mpattern = new FLARCode(16,16);

mpattern.loadARPatt(new pattern());

}

private function setupCam():void

{

vid = new Video(640,480);

cam = Camera.getCamera();

cam.setMode(640,480,30);

vid.attachCamera(cam);

addChild(vid);

}

private function setupBitmap():void

{

bmd = new BitmapData(640,480);

bmd.draw(vid);

raster = new FLARRgbRaster_BitmapData(bmd);

detector = new FLARSingleMarkerDetector(fparams, mpattern, 80);

}

private function setupPV3D():void

{

scene= new Scene3D();

camera= new FLARCamera3D(fparams);

container= new FLARBaseNode();

scene.addChild(container);

var pl:PointLight3D = new PointLight3D();

pl.x = 1000;

pl.y = 1000;

pl.z= -10000;

var ml:MaterialsList = new MaterialsList({all: new FlatShadeMaterial(pl)});

var cube1:Cube = new Cube(ml,30,30,30);

container.addChild(cube1);

bre= new BasicRenderEngine();

trans = new FLARTransMatResult();

vp= new Viewport3D();

addChild(vid);

}

private function loop(e:Event):void

{

bmd.draw(vid);

try

{

if(detector.detectMarkerLite(raster, 80) && detector.getConfidence() > 0.5)

{

detector.getTransformMatrix(trans);

container.setTransformMatrix(trans);

bre.renderScene(scene, camera, vp);

}

}

catch(e:Error){}

}

}

}

Reply all
Reply to author
Forward
0 new messages