본문 바로가기

AS3/PV3D

패이퍼비전 3D 기초 - 04

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.view.BasicView;
	
	public class chapter04 extends Sprite
	{

		private var view:BasicView;

		private var container:DisplayObject3D;
		public function chapter04()
		{
			// 3D 환경 설정
			view = new BasicView( 550, 400 );
			this.addChild( view );
			// 객체 생성 및 Material 생성
			var material1: ColorMaterial = new ColorMaterial( 0xFF0000 );
			var material2: ColorMaterial = new ColorMaterial( 0x009900 );
			var plane1: Plane = new Plane( material1 );
			var plane2: Plane = new Plane( material2 );
			plane2.rotationY = 180;
			plane1.x = 100;
			plane2.x = 100;
			//평면을 포함한 컨테이너 생성
			container = new DisplayObject3D();
			view.scene.addChild( container );
			container.addChild( plane1 );
			container.addChild( plane2 );
			//랜더링
			this.addEventListener(Event.ENTER_FRAME, onEnter );
		}
		
		private function onEnter(event:Event):void
		{
			container.rotationY += 3;
			view.singleRender();
		}
		
	}
}

'AS3 > PV3D' 카테고리의 다른 글

패이퍼비전 3D 기초 - 06  (0) 2010.11.19
패이퍼비전 3D 기초 - 05  (0) 2010.11.19
패이퍼비전 3D 기초 - 03  (0) 2010.11.19
패이퍼비전 3D 기초 - 02  (0) 2010.11.19
패이퍼비전 3D 기초 - 01  (0) 2010.11.19