AR重畳表示定義はJavaScriptライブラリのAR.Renderer.SuperimposedGraphicクラスで表現されます。AR.Renderer.SuperimposedGraphic オブジェクトを作成して必要なプロパティをセットしてください。
例
//AR重畳表示定義オブジェクトを作成します。 var superimposedGraphic = new AR.Renderer.SuperimposedGraphic(); //投影タイプを設定します。 superimposedGraphic.setProjectionType(AR.Renderer.SuperimposedGraphic.ProjectionType.ORTHO2D); //移動座標オブジェクトを作成します。 var translation = new AR.Renderer.Point(); translation.setX(1); translation.setY(1); translation.setZ(1); //AR重畳表示定義に移動座標を設定します。 superimposedGraphic.setTranslation(translation); //回転座標オブジェクトを作成します。 var rotation = new AR.Renderer.Point(); rotation.setX(0); //X座標方向 rotation.setY(0); //Y座標方向 rotation.setZ(0); //Z座標方向 //AR重畳表示定義に回転座標を設定します。 superimposedGraphic.setRotation(rotation); //タップアクション(URLアクション)オブジェクトを作成します。 var urlAction = new AR.Renderer.URLAction(); urlAction.setSrc(“http://…”); //タップアクションで動作させたいURLを指定します。 //AR重畳表示定義にタップアクションを設定します superimposedGraphic.setTapAction(urlAction); //グラフィックオブジェクトを作成します。 var squareModelGraphic = new AR.Renderer.SquareModelGraphic(); //スケールオブジェクトを作成します。 var scale = new AR.Renderer.Point(); scale.setX(1); //X座標方向 scale.setY(1); //Y座標方向 scale.setZ(1); //Z座標方向 //グラフィックにスケールを設定します。 squareModelGraphic.setScale(scale); //テクスチャオブジェクト(テキストテクスチャ)を作成します。 var textTexture = new AR.Renderer.TextTexture(); textTexture.setBackgroundColor(4294951104); textTexture.setColor(4289724416); textTexture.setFontSize(20); textTexture.setText(“テキスト”); textTexture.setWordWrap(true); //サイズオブジェクトを作成します。 var size = new AR.Renderer.Size(); size.setWidth(160); //テクスチャの幅 size.setHeight(80); //テクスチャの高さ //テクスチャにサイズを設定します。 textTexture.setSize(size); //グラフィックにテクスチャを設定します squareModelGraphic.setTexture(textTexture); //AR重畳表示定義にグラフィックを設定します。 superimposedGraphic.setGraphic(squareModelGraphic);
//テクスチャオブジェクト(イメージテクスチャ)を作成します。 var imageTexture = new AR.Renderer.ImageTexture(); imageTexture.setSrc("http://…"); //重畳表示したい画像のURLを指定してください。 //グラフィックにテクスチャを設定します squareModelGraphic.setTexture(imageTexture);