「papervision3d」カテゴリーアーカイブ

InteractiveScene3DEvent

/*//////////////////////////////////////////////////////////////

BitmapData関連

BitmapAssetMaterial ・・・ 画像をライブラリからテクスチャマッピング

BitmapColorMaterial ・・・ 塗りつぶしビットマップをテクスチャマッピング

BitmapFileMaterial ・・・ 外部画像ファイル読み込み、テクスチャマッピング

BitmapMaterial ・・・ BitmapDataオブジェクトをテクスチャマッピング

BitmapViewportMaterial ・・・ Viewportをビットマップ化してテクスチャマッピング

BitmapWireframeMaterial ・・・ ワイヤーフレームビットマップをテクスチャマッピング

MovieClip関連

MovieAssetMaterial ・・・ ムービークリップをライブラリからテクスチャマッピング

MovieMaterial ・・・ ムービークリップをテクスチャマッピング

Graphic関連

ColorMaterial ・・・ べた塗りをテクスチャマッピング

WireframeMaterial ・・・ ワイヤーフレームをテクスチャマッピング

Video関連

VideoStreamMaterial ・・・ 動画をテクスチャマッピング

_色々

//読み込み////////////////////////////////////

外部読み込み

var material00:BitmapFileMaterial = new BitmapFileMaterial(‘test360.jpg’)

内部にてリンゲージ

var material:BitmapAssetMaterial = new BitmapAssetMaterial(‘jp_01’)

//Debug_camera///////////////////////////////

var world:BasicView = new BasicView(1000,1000,true,true,“Debug”);

addChild(world);

//Primitive///////////////////////////////

new Plane(material, 500, 500, 1, 1);

new Sphere(material, 100, 8, 8);

new Cube(new MaterialsList({all : material}), 500, 500, 500, 1, 1, 1);

new Cone(material, 100, 100, 8, 6);

new Cylinder(material, 100, 100, 8, 6, -1);

new PaperPlane(material, 0);

new Arrow(material);

//CameraType.FREE/////////////////////////

world.camera.target = null;

//debag.Camera///////////////////////////

camera = new DebugCamera3D( _viewport );

//MouseEvent///////////////////////

InteractiveScene3DEvent.OBJECT_CLICK

InteractiveScene3DEvent.OBJECT_OVER

InteractiveScene3DEvent.OBJECT_OUT

InteractiveScene3DEvent.OBJECT_MOVE

InteractiveScene3DEvent.OBJECT_PRESS

InteractiveScene3DEvent.OBJECT_RELEASE

InteractiveScene3DEvent.OBJECT_RELEASE_OUTSIDE

Flint

http://flintparticles.org/

ENTER_FRAME mouse位置

import caurina.transitions.Tweener;

import caurina.transitions.properties.CurveModifiers;

CurveModifiers.init();

// フレームアクションでPapervision3D

import org.papervision3d.cameras.Camera3D;

import org.papervision3d.events.*;

import org.papervision3d.events.InteractiveScene3DEvent;

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.objects.primitives.*;

import org.papervision3d.materials.WireframeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.view.BasicView;

import org.papervision3d.view.*

import org.papervision3d.materials.*

// 3D表示用のインスタンスを作ります

var world:BasicView = new BasicView();

addChild(world);

world.startRendering();

// テクスチャー(=マテリアル)を作ります

//var material:BitmapAssetMaterial = new BitmapAssetMaterial(‘EarthMap’)

var top_bfm:BitmapFileMaterial = new BitmapFileMaterial(“01.jpg”);

var left_bfm:BitmapFileMaterial = new BitmapFileMaterial(“02.jpg”);

var right_bfm:BitmapFileMaterial = new BitmapFileMaterial(“03.jpg”);

var bottom_bfm:BitmapFileMaterial = new BitmapFileMaterial(“04.jpg”);

var front_bfm:BitmapFileMaterial = new BitmapFileMaterial(“01.jpg”);

var back_bfm:BitmapFileMaterial = new BitmapFileMaterial(“01.jpg”);

var sphere:Cube = new Cube(new MaterialsList({top:top_bfm , left:left_bfm , right:right_bfm , bottom:bottom_bfm , front:front_bfm , back:back_bfm}) , 300 , 300 , 300);

world.scene.addChild(sphere);

var sphere2:Cube = new Cube(new MaterialsList({top:top_bfm , left:left_bfm , right:right_bfm , bottom:bottom_bfm , front:front_bfm , back:back_bfm}) , 300 , 300 , 300);

world.scene.addChild(sphere2);

sphere2.x = 200;

sphere2.y = 300;

addEventListener(Event.ENTER_FRAME, function(e){

var xx = ((mouseX / 500) * 180 – 90);

var yy = ((mouseY / 500) * 180 – 90);

Tweener.addTween(world.camera,{x:xx,y:yy,time:0.8});

});

font

import caurina.transitions.Tweener;

import caurina.transitions.properties.CurveModifiers;

CurveModifiers.init();

// フレームアクションでPapervision3D

import org.papervision3d.cameras.Camera3D;

import org.papervision3d.events.*;

import org.papervision3d.events.InteractiveScene3DEvent;

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.objects.primitives.*;

import org.papervision3d.materials.WireframeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.view.BasicView;

import org.papervision3d.view.*

import org.papervision3d.materials.*

import org.papervision3d.materials.special.*;

import org.papervision3d.typography.fonts.*;

import org.papervision3d.typography.*;

// 3D表示用のインスタンス制作

var world:BasicView = new BasicView(500,500,true,true);

addChild(world);

world.startRendering();

//textマテリアル制作

var textMaterial:Letter3DMaterial = new Letter3DMaterial(0xFF0000,1);

//フォント生成

var font:HelveticaBold = new HelveticaBold();

//テキスト3D制作

var text3D:Text3D = new Text3D(“Hello World.”, font, textMaterial);

world.scene.addChild(text3D);

//textマテリアル制作

var textMaterial2:Letter3DMaterial = new Letter3DMaterial(0xFF2222,1);

//フォント制作

var font2:HelveticaBold = new HelveticaBold();

//テキスト3D制作

var text3D2:Text3D = new Text3D(“Hello World.”, font2, textMaterial2);

world.scene.addChild(text3D2);

text3D.rotationX = 55;

stage.addEventListener(MouseEvent.CLICK,clickHandler);

function clickHandler(e:MouseEvent):void{

var ramX = Math.floor(Math.random()*500);

var ramY = Math.floor(Math.random()*500);

var ramZ = Math.floor(Math.random()*500);

var bezierram = Math.floor(Math.random()*500);

Tweener.addTween(text3D,{rotationX:ramZ,z:ramZ,x:ramX,y:ramY,_bezier:{x:bezierram,y:bezierram},

time:1});

Tweener.addTween(text3D2,{rotationX:ramX,z:ramZ,x:ramY,y:ramX,_bezier:{x:bezierram,y:bezierram},

time:1});

}

 OBJECT_CLICK

import caurina.transitions.Tweener;

import caurina.transitions.properties.CurveModifiers;

CurveModifiers.init();

// フレームアクションでPapervision3D

import org.papervision3d.cameras.Camera3D;

import org.papervision3d.events.*;

import org.papervision3d.events.InteractiveScene3DEvent;

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.objects.primitives.*;

import org.papervision3d.materials.WireframeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.view.BasicView;

import org.papervision3d.view.*

import org.papervision3d.materials.*

// 3D表示用のインスタンスを作ります

var world:BasicView = new BasicView(640,640,true,true);

addChild(world);

world.startRendering();

// テクスチャー(=マテリアル)を作ります

var material:BitmapAssetMaterial = new BitmapAssetMaterial(‘EarthMap’)

material.doubleSided = true;

material.interactive = true; //イベント有効化

var sphere:Sphere = new Sphere(material, 400, 16, 16);

world.scene.addChild(sphere);

world.camera.x = 500;

world.camera.z = 500;

sphere.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,clickHandler);

function clickHandler(e:Event):void{

var ramX = Math.floor(Math.random()*1000);

var ramY = Math.floor(Math.random()*1000);

var ramZ = Math.floor(Math.random()*500);

var bezierram = Math.floor(Math.random()*3000);

Tweener.addTween(world.camera,{z:ramZ,x:ramX,y:ramY,_bezier:{x:bezierram,y:bezierram},

time:1});

}

//Papervision3D

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.objects.primitives.*;

import org.papervision3d.materials.WireframeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.view.BasicView;

// 3D表示用のインスタンス作成

var world:BasicView = new BasicView();

addChild(world);

world.startRendering();

// テクスチャー(=マテリアル)を作成

var material = new WireframeMaterial(0x0000FF);

material.doubleSided = true;

var obj = new Plane(material, 500, 500, 1, 1);

world.scene.addChild(obj);

// エンターフレーム

addEventListener(Event.ENTER_FRAME, loop);

// エンターフレームでのアニメーション

function loop(e:Event) {

obj.rotationY += 1;

}

////////////////////////////////////////////////////////////画像多面貼り付け

var top_bfm:BitmapFileMaterial = new BitmapFileMaterial(“01.jpg”);

var left_bfm:BitmapFileMaterial = new BitmapFileMaterial(“02.jpg”);

var right_bfm:BitmapFileMaterial = new BitmapFileMaterial(“03.jpg”);

var bottom_bfm:BitmapFileMaterial = new BitmapFileMaterial(“04.jpg”);

var front_bfm:BitmapFileMaterial = new BitmapFileMaterial(“01.jpg”);

var back_bfm:BitmapFileMaterial = new BitmapFileMaterial(“01.jpg”);

var sphere:Cube = new Cube(new MaterialsList({top:top_bfm , left:left_bfm , right:right_bfm , bottom:bottom_bfm , front:front_bfm , back:back_bfm}) , 300 , 300 , 300);

world.scene.addChild(sphere);

world.camera.x = 700;

world.camera.z = 500;

デモ

import caurina.transitions.Tweener;

import caurina.transitions.properties.CurveModifiers;

CurveModifiers.init();

// フレームアクションでPapervision3D

import org.papervision3d.cameras.Camera3D;

import org.papervision3d.events.*;

import org.papervision3d.events.InteractiveScene3DEvent;

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.objects.primitives.*;

import org.papervision3d.materials.WireframeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.view.BasicView;

import org.papervision3d.view.*

import org.papervision3d.materials.*

// 3D表示用のインスタンスを作ります

var world:BasicView = new BasicView(1000,1000,true,true);

addChild(world);

world.startRendering();

// テクスチャー(=マテリアル)を作ります

var material00 = new WireframeMaterial(0x0000FF);

material00.doubleSided = true;

var obj:Plane = new Plane(material00, 2000, 2000, 1, 1);

world.scene.addChild(obj);

obj.rotationX = 90;

obj.y = -100;

var material:BitmapAssetMaterial = new BitmapAssetMaterial(‘oi’)

material.doubleSided = true;

material.interactive = true; //イベント有効化

var cube:Cube = new Cube(new MaterialsList({all : material}),100, 100, 100, 1, 1, 1);

world.scene.addChild(cube);

var material02 = new ColorMaterial(0x0000FF);

material02.doubleSided = true;

material02.interactive = true; //イベント有効化

var cube02:Cube = new Cube(new MaterialsList({front: material02}), 100, 100, 100, 1, 1, 1);

//front, back, right, left, top, bottom & all.

world.scene.addChild(cube02);

cube02.x = -175;

var material03 = new WireframeMaterial(0x0000FF);

material03.doubleSided = true;

material03.interactive = true; //イベント有効化

var cube03:Cube = new Cube(new MaterialsList({all : material03}),100,100,100,1,1,1);

world.scene.addChild(cube03);

cube03.x = -350;

var material04 = new WireframeMaterial(0x0000FF);

material04.doubleSided = true;

material04.interactive = true; //イベント有効化

var cube04:Cube = new Cube(new MaterialsList({all : material04}),100,100,100,1,1,1);

world.scene.addChild(cube04);

cube04.x = 175;

addEventListener(Event.ENTER_FRAME, loop);

// エンターフレームでのアニメーションを設定します

function loop(e:Event) {

cube.rotationY += 2;

cube.rotationX += 2;

cube02.rotationX -= 1;

cube02.rotationY += 2;

cube03.rotationX += 2;

cube03.rotationY -= 2;

cube04.rotationX -= 3;

cube04.rotationY -= 2;

}

//CameraType.FREE

world.camera.target = null;

//world.camera.focus = 20;

world.camera.y = 500;

world.camera.x = 0;

world.camera.z = 0;

world.camera.rotationY = 0;

world.camera.rotationX = 90;

cube.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler);

function OVERHandler(e:Event):void{

Tweener.addTween(world.camera,{y:200,x:0,time:1});

}

cube.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,OUTHandler);

function OUTHandler(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:500,x:0,time:1});

}

cube02.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler02);

function OVERHandler02(e:Event):void{

//world.camera.target = cube02;

Tweener.addTween(world.camera,{y:200,x:-150,time:1});

}

cube02.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,OUTHandler02);

function OUTHandler02(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:500,x:0,time:1});

}

cube03.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler03);

function OVERHandler03(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:200,x:-300,time:1});

}

cube03.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,OUTHandler03);

function OUTHandler03(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:500,x:0,time:1});

}

cube04.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler04);

function OVERHandler04(e:Event):void{

}