Archive for February, 2009

FLARCodeImage:Utility for FLARToolKit

Tuesday, February 3rd, 2009

example that using FLARCodeImage

I made a utility class for FLARToolKit.
FLARCodeImage is a child of Sprite.

This class makes FLARCode an image. And, you can use it as a substitute of the marker.

How to use

  1. Create a instannce of FLARCode and load .pat file.
    1
    2
    3
    4
    5
    6
    
    [Embed(source = "assets/patt.hiro", mimeType = "application/octet-stream")]private var CodeData:Class;
    //...
     
    var code:FLARCode = new FLARCode(16, 16);
    var codeFile:ByteArray = new CodeData() as ByteArray;
    code.loadARPatt(codeFile.readMultiByte(codeFile.length, "shift-jis"));
  2. Create a instance of FLARCodeImage.
    1
    
    var codeImg:FLARCodeImage = new FLARCodeImage(code, 300, 300);
  3. Create a instance of MovieMaterial(Papervision3D’s material classs), and create a instance of Plane using it as material.
    1
    2
    3
    4
    
    var mat:TriangleMaterial = new MovieMaterial(codeImg);
    mat.doubleSided = true;
    var plane:Plane = new Plane(mat, 300, 300, 4, 4);
    this._modelView = new PV3DPanel(this.stage.stageWidth, this.stage.stageHeight, plane);
  4. Use its image as a input for FLARToolKit instead of WebCamera.