Home > Create | Flash > Papervision3Dの練習その1

Papervision3Dの練習その1

  • Posted by: hush
  • 2009年2月 2日 00:09
  • Create | Flash

swfはこちら
一般的なプログラミングで言うとhelloworld並の簡単なプログラムから初めていきます。オブジェクト指向の概念はJavaを少し触ったのいたので抵抗無く入り込めた。
マウスのイベント処理は頭使いそうなのでパスして、機能の勉強を重視していきます。

コーディングはFlashDevelopでやっています。タイピング遅いので単語補完ありがたい。

package
{
	//import flash.display.Sprite;
	import flash.events.Event;
	import org.papervision3d.materials.special.CompositeMaterial;
	
	import org.papervision3d.view.*;
	import org.papervision3d.objects.primitives.*;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.materials.*;
	import org.papervision3d.materials.utils.MaterialsList;

	
	public class Main extends BasicView 
	{
		private var container:DisplayObject3D;
		private var count:Number = 0;
		
		public function Main():void 
		{
			//super();
			init();
			startRendering();
		}
		
		private function init():void
		{
			container = new DisplayObject3D();
			
			var colorMaterial:ColorMaterial = new ColorMaterial(0x7799BB);
			var wireMaterial:WireframeMaterial = new WireframeMaterial(0x000000);
			var compoMaterial:CompositeMaterial = new CompositeMaterial();
			var compoMaterial2:CompositeMaterial = new CompositeMaterial();
			
			compoMaterial.addMaterial(colorMaterial);
			compoMaterial.addMaterial(wireMaterial);
			//compoMaterial.doubleSided = true;
			
			compoMaterial2.addMaterial(colorMaterial);
			compoMaterial2.addMaterial(wireMaterial);
			compoMaterial2.doubleSided = true;
			
			var my3dobj:Sphere = new Sphere(compoMaterial);
			var myPlane:Plane = new Plane(compoMaterial2);
			var myPlane2:Plane = new Plane(compoMaterial2);
			var myCube:Cube = new Cube(new MaterialsList({all :compoMaterial}));
			
			myPlane.x += 500;
			myPlane2.y += 500;
			myCube.x -= 500;
			
			scene.addChild(container);
			container.addChild(my3dobj);
			container.addChild(myPlane);
			container.addChild(myPlane2);
			container.addChild(myCube);
		}
		
		override protected function onRenderTick(event:Event = null):void
		{
			//container.yaw(1);
			//container.pitch(3);
			//container.roll(2);
			camera.x = 1000 * Math.sin(count/40);
			camera.y = 1000 * Math.sin(count/20);
			count++;
			super.onRenderTick(event);
		}
		
	}
	
}

参考
FrontPage - kozy.heteml.jp
Papervision3Dやってみるシリーズ | [FlaTech+]WebDesign Rainyday

Tag: actionscript, Papervision3D 2.0

Comments:0

Comment Form

Trackbacks:4

TrackBack URL for this entry
http://fdempa.com/mt/mt-tb.cgi/30
Listed below are links to weblogs that reference
Papervision3Dの練習その1 from NGTV
Meridia diet pill. from Meridia. 2009-07-24 (金) 18:50
Meridia weight loss pill meridia weight loss. Meridia. Meridia dosage. Meridi...
Buying xanax online. from Xanax side effects. 2009-08-03 (月) 08:19
Xanax for sale. Xanax. Ativan vs xanax. Lethal dosage xanax.
weight loss quick from weight loss quick 2014-03-07 (金) 21:30
NGTV - Papervision3Dの練習その1
testosterone boosting supplements from testosterone boosting supplements 2014-03-16 (日) 00:34
NGTV - Papervision3Dの練習その1

Home > Create | Flash > Papervision3Dの練習その1

Search
Feeds
Tag Cloud
Recent Comments
Movable Type 設定など 備忘録
衝撃的 Fakepilot.com

Return to page top