原來Sandy還可以導(dǎo)入模型文件(ASE) 我調(diào)試這個(gè)例子時(shí)總有錯(cuò)誤提示(提示路徑錯(cuò)誤),但不影響使用,初步估計(jì)是這個(gè)版本的Bug。 例子中創(chuàng)建組的方式有了點(diǎn)變化
var g:Group = Group( p_eEvent.group);
代碼:
package { import flash.display.Sprite; import flash.events.*; import flash.ui.*; import sandy.core.Scene3D; import sandy.core.data.*; import sandy.core.scenegraph.*; import sandy.materials.*; import sandy.materials.attributes.*; import sandy.primitive.*; import sandy.parser.*; /** * ... * @author ever5u */ public class fuxi extends Sprite { private var scene:Scene3D; private var camera:Camera3D; private var pot:Shape3D; public function fuxi() { var parser:IParser = Parser.create("teieraASE.ASE",Parser.ASE ); parser.addEventListener( ParserEvent.FAIL, onError ); parser.addEventListener( ParserEvent.INIT, createScene ); parser.parse(); } private function onError( pEvt:ParserEvent ):void { trace("there is an error in loading your stuff"); } private function createScene(p_eEvent:ParserEvent ):void { //創(chuàng)建攝像機(jī) camera = new Camera3D( 300, 300 ); camera.y = 30; camera.z = -200; camera.lookAt(0,0,0); //創(chuàng)建 Group var g:Group = Group( p_eEvent.group); //處理模型 pot = g.children[0] as Shape3D; //著色設(shè)置 var materialAttr:MaterialAttributes = new MaterialAttributes( new LineAttributes( 0.1, 0x2111BB, 0.1 ), new LightAttributes( true, 0.1) ); var material01:Material = new ColorMaterial( 0xFFCC33, 1, materialAttr ); material01.lightingEnable = false; var app01:Appearance = new Appearance( material01 ); //應(yīng)用著色 pot.appearance = app01; scene = new Scene3D( "scene", this, camera, g ); addEventListener( Event.ENTER_FRAME, enterFrameHandler ); } private function enterFrameHandler( event : Event ) : void { pot.pan += 2; scene.render(); } } }
效果:
文件teieraASE.ASE: teieraASE.rar
出處:藍(lán)色理想
責(zé)任編輯:bluehearts
上一頁 Flash3D學(xué)習(xí)——Sandy學(xué)習(xí)筆記 [12] 下一頁 Flash3D學(xué)習(xí)——Sandy學(xué)習(xí)筆記 [14]
◎進(jìn)入論壇RIA設(shè)計(jì)與應(yīng)用版塊參加討論
|