1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Rectangle;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.primitives.Cube;
import org.papervision3d.objects.primitives.Cylinder;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.view.BasicView;
[SWF(width = "600", height = "400", backgroundColor = "#0", frameRate = "30")]
/**
* Test des différences entre Sandy3D et Papervision3D
*
* @author Lorenzo
*/
public class MainGroupeTable extends BasicView {
public function MainGroupeTable():void {
super(600,400,true);
init();
}
private var _plateau:Cube;
[Embed(source='../lib/bois006.jpg')]
private static var Bois1:Class;
[Embed(source='../lib/bois016.jpg')]
private static var Bois2:Class;
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
stage.scaleMode = "noBorder";
var bm:Bitmap = new Bois1();
var bm2:Bitmap = new Bois2();
var bm3:Bitmap = new Bitmap(new BitmapData(20, 20));
bm3.bitmapData.copyPixels(bm2.bitmapData, new Rectangle(0, 0, 20, 20), new Point(0, 0));
bm2.bitmapData.dispose();
var materialsList:MaterialsList = new MaterialsList();
materialsList.addMaterial(new BitmapMaterial(bm.bitmapData), 'all');
_plateau = new Cube(materialsList, 500, 500, 20);
//_plateau.material.doubleSided = true;
scene.addChild(_plateau);
var cylinder:Cylinder = new Cylinder(new BitmapMaterial(bm3.bitmapData), 10, 200, 8, 6, -1, false);
cylinder.x = 210;
cylinder.y = -111;
cylinder.z = 210;
_plateau.addChild(cylinder);
cylinder = new Cylinder(new BitmapMaterial(bm3.bitmapData), 10, 200, 8, 6, -1, false);
cylinder.x = -210;
cylinder.y = -111;
cylinder.z = 210;
_plateau.addChild(cylinder);
cylinder = new Cylinder(new BitmapMaterial(bm3.bitmapData), 10, 200, 8, 6, -1, false);
cylinder.x = -210;
cylinder.y = -111;
cylinder.z = -210;
_plateau.addChild(cylinder);
cylinder = new Cylinder(new BitmapMaterial(bm3.bitmapData), 10, 200, 8, 6, -1, false);
cylinder.x = 210;
cylinder.y = -111;
cylinder.z = -210;
_plateau.addChild(cylinder);
camera.z = -500;
startRendering();
}
override protected function onRenderTick(e:Event=null):void {
_plateau.localRotationY += 1;
_plateau.localRotationX += 1.5;
super.onRenderTick();
}
}
} |
Partager