請按 [觀看] 範例 |
以下是編寫的步驟:
- 建立一個新類別並繼承AlternativaTemplate 類別
- 設定Camera 為CameraType.PANORAMA 模式
- 設定紋理材料(TextureMaterial) 為內嵌的全景圖像(assets/test1.jpg)
- 建立一個幾何球體(GeoSphere) 並貼上紋理材料
package { import alternativa.engine3d.materials.TextureMaterial; import alternativa.engine3d.primitives.GeoSphere; import alternativa.engine3d.resources.BitmapTextureResource; import org.libspark.alternativa3d.camera.CameraType; import org.libspark.alternativa3d.view.AlternativaTemplate; [SWF(backgroundColor="#000000", frameRate="60", quality="LOW", width="800", height="480")] public class Alternativa_Panorama extends AlternativaTemplate { [Embed(source = "assets/test1.jpg")] private static var ImageCls:Class; public function Alternativa_Panorama():void{ super({ cameraType:CameraType.PANORAMA, useDiagram : true }); } override protected function atInit():void{ var material:TextureMaterial = new TextureMaterial(new BitmapTextureResource(new ImageCls().bitmapData)); var shpere:GeoSphere = new GeoSphere(100, 32, true, material); scene.addChild(shpere); } } }在Android 和iOS 運作正常, 大家可以 [下載] 範例試試看.
參考資料: http://clockmaker.jp/blog-en/2011/11/alternativa3d-panorama/
沒有留言:
張貼留言