チェンジセット 1356
- コミット日時:
- 2008/09/22 15:34:05 (4 ヶ月前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/FLARAnotherWorldWindow.as
r1342 r1356 13 13 * See the License for the specific language governing permissions and 14 14 * limitations under the License. 15 */ 15 */ 16 16 package org.tarotaro.flash.ar 17 17 { … … 27 27 import org.libspark.flartoolkit.core.FLARParam; 28 28 import org.libspark.flartoolkit.core.raster.FLARBitmapData; 29 import org.libspark.pv3d.Metasequoia; 30 import org.papervision3d.core.culling.FrustumTestMethod; 31 import org.papervision3d.core.proto.MaterialObject3D; 32 import org.papervision3d.lights.PointLight3D; 33 import org.papervision3d.materials.BitmapFileMaterial; 34 import org.papervision3d.materials.BitmapMaterial; 35 import org.papervision3d.materials.ColorMaterial; 36 import org.papervision3d.materials.shadematerials.FlatShadeMaterial; 37 import org.papervision3d.materials.utils.MaterialsList; 38 import org.papervision3d.materials.WireframeMaterial; 39 import org.papervision3d.objects.DisplayObject3D; 40 import org.papervision3d.objects.primitives.Cube; 41 import org.papervision3d.objects.primitives.Sphere; 29 42 30 43 /** 31 44 * ... 32 * @author 太郎(tarotaro.org)45 * @author DefaultUser (Tools -> Custom Arguments...) 33 46 */ 34 47 public class FLARAnotherWorldWindow extends Sprite … … 39 52 [Embed(source = "../../../../Data/patt.hiro", mimeType = "application/octet-stream")] 40 53 private var CodeData:Class; 41 //panorama.jpgはFlickrなどから調達して、Data以下に格納してください。42 54 [Embed(source = '../../../../Data/panorama.jpg')]private var PanoBitmap:Class; 55 43 56 private var _capture:Bitmap; 44 57 private var _video:Video; 45 private var _windowLayer:FLARPanoramaSphereLayer; 46 private var _arSprite:Sprite; 58 private var _layer:FLARAnotherWorldWindowLayer; 47 59 48 60 public function FLARAnotherWorldWindow() … … 62 74 this._video = new Video(); 63 75 this._video.attachCamera(webcam); 76 77 var model:DisplayObject3D = new DisplayObject3D(); 78 model.frustumTestMethod = FrustumTestMethod.NO_TESTING; 79 var mqo:Metasequoia = new Metasequoia(); 80 mqo.load("Data/miku_mahou.mqo", 2); 81 model.addChild(mqo); 64 82 65 66 var panoBMP:Bitmap = new PanoBitmap() as Bitmap; 67 68 this._windowLayer = new FLARPanoramaSphereLayer(raster, param, code, 80,panoBMP.bitmapData); 69 this.addChild(this._windowLayer); 83 var mt:MaterialObject3D = new BitmapFileMaterial("Data/tex3.jpg", true); 84 // 85 mt.doubleSided = true; 86 var list:MaterialsList = new MaterialsList(); 87 list.addMaterial(mt, "all"); 88 var size:int = 2500; 89 var cube:Cube = new Cube(list, size, size * 1.5, size / 2, 1, 1, 4, Cube.ALL, Cube.BACK); 90 cube.frustumTestMethod = FrustumTestMethod.NO_TESTING; 91 model.addChild(cube); 92 this._layer = new FLARAnotherWorldWindowLayer(raster, param, code, 80, model); 93 this.addChild(this._layer); 70 94 71 95 this._capture.scaleX = this._capture.scaleY = 0.5; … … 73 97 74 98 this.addEventListener(Event.ENTER_FRAME, onEnterFrame); 75 } 99 100 } 76 101 77 102 private function onEnterFrame(e:Event):void 78 103 { 79 104 this._capture.bitmapData.draw(this._video); 80 this._ windowLayer.update();105 this._layer.update(); 81 106 } 82 107 } as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/FLARAnotherWorldWindowLayer.as
r1341 r1356 16 16 package org.tarotaro.flash.ar 17 17 { 18 import flash.events.Event; 19 import flash.geom.Point; 20 import org.libspark.flartoolkit.core.FLARCode; 21 import org.libspark.flartoolkit.core.FLARParam; 22 import org.libspark.flartoolkit.core.FLARSquare; 23 import org.libspark.flartoolkit.core.raster.FLARBitmapData; 24 import org.papervision3d.cameras.CameraType; 25 import org.papervision3d.core.culling.FrustumTestMethod; 18 26 import org.papervision3d.objects.DisplayObject3D; 19 27 import org.papervision3d.view.BasicView; … … 51 59 52 60 //Viewの作成 53 this._view = new BasicView(windowWidth, windowHeight, true, false); 61 this._view = new BasicView(windowWidth, windowHeight, true, false, CameraType.TARGET); 62 model.frustumTestMethod = FrustumTestMethod.NO_TESTING; 63 54 64 this.addChild(this._view); 55 65 … … 59 69 60 70 //カメラのセッティング 61 this._view.camera.focus = 300;71 this._view.camera.focus = 500; 62 72 this._view.camera.zoom = 1; 63 this._view.camera.z = - 100;73 this._view.camera.z = -500; 64 74 65 75 //4.レンダリング開始 66 76 this._view.startRendering(); 67 77 } 78 68 79 69 80 override public function update():void … … 82 93 var center:Point = new Point((Mx + mx)/2, (My+my)/2); 83 94 84 this._view.camera.x = (center.x - this._source.getWidth() / 2); 85 this._view.camera.y = (center.y - this._source.getHeight() / 2); 86 this._view.camera.z = -100 - (45000 - square.area); 95 this._view.camera.x = -(center.x - this._source.getWidth() / 2) * 1; 96 this._view.camera.y = -(center.y - this._source.getHeight() / 2) * 1; 97 //this._view.camera.z = -100 - (45000 - square.area); 98 //this._view.camera.zoom = 1 + square.area / 9000; 99 100 trace(this._view.camera); 87 101 } else { 88 102 89 103 } 90 104 } 105 106 91 107 92 108 } as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/URLSample.mxml
r1334 r1356 10 10 import flash.events.Event; 11 11 import flash.net.URLRequest; 12 import org. libspark.pv3d.Metasequoia;12 import org.tarotaro.flash.pv3d.Metasequoia; 13 13 import org.papervision3d.materials.WireframeMaterial; 14 14 import org.papervision3d.objects.DisplayObject3D;
