Plane 생성자


Plane(material:MaterialObject3D=null, width:Number=0, height:Number=0, segmentsW:Number=0, segmentsH:Number=0)

 

파라미터

데이터 타입

기본

상세설명

material

MaterialObject3D

null

Plane 적용하고 싶은 Material 정의한다.

width

Number

0

넓이를 설정한다.

height

Number

0

높이를 설정한다.

segmentsW

Number

0

좌우 조각

segmentsH

Number

0

상하 조각

 

[그림 : segments(조각) 변화에 따른 Plane (1,1) / (2,1) / (2,2)]

참조 => (0,0)으로 설정하면 (1,1) 동일함.

 

[알고 가기 : 1]

Plane 이미지를 투영 시킬 흔히 이미지가 찌그러지는 현상을 목격할 있는데 이럴 경우에는 segments(조각) 숫자를 증가시키면 좀더 부드러운 화면을 있다. 하지만 조각의 수가 증가하면 할수록 렌더링 속도가 느려짐에 유의해야 한다. 참고로 개의 Scene에서 3000 이하의 Triangle 존재하도록 하는 것이 좋다.

 

[알고 가기 : 2]

Plane 회전(Rotate)시키는 경우, 기본적으로 면의 wireframe(철골구조물 - 외각 뼈대) Material 적용되어 있어 다른 면에는 null 적용된다. 이런 경우에는 양면모드 설정을 적용시켜줘야 한다.

ex) plane.material.doubleSided = true;

 

[알고 가기 : 기타]

Z축은 depth 조절하는 것이다 이는 카메라를 찍을 Zoom in, out 조절하는 것과 유사하다, 실제로 적용해서 보면 사물의 크기가 커졌다 작아졌다 하는 것을 있다.


예제 - Plane을 z좌표를 조절하면서 y축 기준으로 회전시키기



: 본 예제를 습득한 이후 각자 Sphere, Cylinder, Cone, Cube, Arrow, PaperPlane 의 생성자를 확인한 이후 본 예제를 응용하면 손쉽게 테스트가 가능할 것입니다 ^^.

//Main.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application

       creationComplete="init()"

       frameRate="40"

       xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

       <mx:Script>

             <![CDATA[

                    import sample.PlaneExample;

                    import mx.core.UIComponent;

                   

                    private function init():void{

                           var bs:PlaneExample = new PlaneExample();

                          

                           var ui:UIComponent = new UIComponent();

                           ui.addChild(bs);

                          

                           this.addChild(ui);

                    }

                   

             ]]>

       </mx:Script>

</mx:Application>


//PlaneExample.as

package sample

{

       import flash.events.Event;

      

       import org.papervision3d.objects.primitives.Plane;

       import org.papervision3d.view.BasicView;

 

       public class PlaneExample extends BasicView

       {

             private var _plane:Plane;

             private var _dir:int=1;

            

             public function PlaneExample()

             {

                    init();

                    startRendering();

             }

            

             private function init():void{

                   

                    var p:Plane = new Plane(null,300,300,1,1);    //고정용

                   

                    _plane = new Plane(null,300,300,1,1);   //움직이는

                    _plane.material.doubleSided = true;

                   

                    scene.addChild(_plane);

                    scene.addChild(p);

             }

            

             override protected function onRenderTick(event:Event=null):void{

                   

                    _plane.localRotationY+=1;

                   

                    if(_plane.z>100) _dir=-1;

                    else if(_plane.z<-100) _dir=1;

                   

                    _plane.z+=(_dir*10);

                   

                    super.onRenderTick();

             }

            

       }

}

'기타 > Old' 카테고리의 다른 글

[ PV3D ] 3-4 구 안쪽에 구 넣기  (0) 2009.10.12
[ PV3D ] 3-3 Nesting (둥지)  (0) 2009.10.10
[ PV3D ] 3-1 Primitives 기본모델?  (0) 2009.10.10
[ PV3D ] 2-3 기초예제 2 - 코드량 줄이기  (0) 2009.10.08
[ PV3D ] 2-2 기초 예제 1  (0) 2009.10.08

+ Recent posts