ホーム > Material, Papervision3d > Papervision3d はじめの11歩 Material BitmapColorMaterial

Papervision3d はじめの11歩 Material BitmapColorMaterial

2009 年 6 月 17 日 コメントをどうぞ コメント
激しくBitmapColorMaterialとColorMaterialの違いがわからなかった。
ぐぐったら以下のエントリーを発見したのでめも。
どうやらColorMaterialとの違いは
  1. 第3引数でinteractiveを設定できない。(プロパティーで設定可能)

  2. ColorMaterialが速い

  3. Graphics コマンドを BitmapData に drawしている

  4. smoothプロパティが設定可能

smoothプロパティはMaterialObject3Dにあるので継承していればその恩恵がうけられるけど、
このプロパティーはBitmapColorMaterial と BitmapWireframeMaterialのみらしい。ほー勉強になるわ。。
smoothプロパティ
1.colorMaterial:false,bmpColorMaterial:false デモ
2.colorMaterial:false,bmpColorMaterial:true デモ
3.colorMaterial:true,bmpColorMaterial:true デモ




package
{
	import org.papervision3d.materials.BitmapColorMaterial;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.view.BasicView;
	import flash.events.Event;
	import flash.display.Sprite;
	import flash.display.*;
 
	/**
	 * ...
	 * @author yaimo
	 */
	[SWF(width = "640", height = "480", backgroundColor = "0x000000", frameRate = "24")]
 
	public class Main extends Sprite
	{
		private var bmpColorPlane:Plane;
		private var colopPlane:Plane;
 
		public function Main():void
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
 
		private function init(e:Event = null):void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
 
			var bmpColorMaterial:BitmapColorMaterial = new BitmapColorMaterial(0xFF0080, 1);
			bmpColorMaterial.doubleSided = true;
			var colorMaterial:ColorMaterial = new ColorMaterial(0xFF8000, 1, true);
			colorMaterial.doubleSided = true;
 
			//DisplayObject3Dで定義されているため使用できるが適用されない
			colorMaterial.smooth = true;
			//追加
			bmpColorMaterial.smooth = true;
 
			bmpColorPlane = new Plane(bmpColorMaterial, 400, 400,1,1);
			colopPlane = new Plane(colorMaterial, 400, 400, 1, 1);
 
			colopPlane.x = -200;
			colopPlane.y = -200;
 
			bmpColorPlane.x = 200;
			bmpColorPlane.y = 200;
 
			var basicBiew:BasicView = new BasicView();
 
			basicBiew.scene.addChild(bmpColorPlane);
			basicBiew.scene.addChild(colopPlane);
 
			addChild(basicBiew);
 
			basicBiew.startRendering();
			addEventListener(Event.ENTER_FRAME, onFrameHandler);
		}
		private function onFrameHandler(e:Event):void
		{
			bmpColorPlane.rotationX += 1;
			bmpColorPlane.rotationY += 3;
			bmpColorPlane.rotationZ += 6;
 
			colopPlane.rotationX += 1;
			colopPlane.rotationY += 3;
			colopPlane.rotationZ += 6;
		}
 
	}
 
}



Bookmark and Share

関連する投稿

  1. コメントはまだありません。
  1. トラックバックはまだありません。