- 最后登录
- 2018-12-19
- 注册时间
- 2012-8-20
- 阅读权限
- 90
- 积分
- 54706
- 纳金币
- 32328
- 精华
- 41
|
package
{
import flash.events.Event;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Cube;
import org.papervision3d.objects.primitives.PaperPlane;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.objects.primitives.Sphere
import org.papervision3d.view.BasicView;
import org.papervision3d.materials.BitmapColorMaterial;
import org.papervision3d.materials.utils.MaterialsList;
/**
* ...
* @author 张首尚
*/
public class vb extends BasicView
{
private var shpere:Sphere;
private var shpere2:Sphere;
private var planelane;
private var cube:Cube;
private var mList:MaterialsList;
private var paperPlaneaperPlane;
private var do3DisplayObject3D;
public function vb()
{
init();
this.startRendering();
}
override protected function onRenderTick(e:Event=null):void
{
//shpere.rotationX += 1;
//shpere.localRotationX += 1;
//shpere.localRotationY += 1;
//plane.rotationZ += 1;
//plane.localRotationZ += 1;
//cube.localRotationY += 1;
//cube.localRotationZ += 1;
//cube.localRotationX += 1;
//paperPlane.localRotationX += 1;
do3D.localRotationY += 1;
//shpere2.rotationY += 1;
super.onRenderTick();
}
private function init():void
{
do3D = new DisplayObject3D();
this.scene.addChild(do3D);
shpere = new Sphere(null,500,16,12);
//this.scene.addChild(shpere);
for (var i:int = 0; i < shpere.geometry.vertices.length; i++ ) {
var _shpere:Sphere = new Sphere(null, 10, 2, 2);
_shpere.x = shpere.geometry.vertices.x;
_shpere.y = shpere.geometry.vertices.y;
_shpere.z = shpere.geometry.vertices.z;
do3D.addChild(_shpere);
}
shpere2 = new Sphere(null, 100, 16, 12);
shpere2.x = 400;
//do3D.addChild(shpere2);
plane = new Plane(null,600,600,3,3);
plane.material.doubleSided = ***e;
//this.scene.addChild(plane);
mList = new MaterialsList();
var red:ColorMaterial = new ColorMaterial(0xFF0000);
var blue:ColorMaterial = new ColorMaterial(0x0000FF);
var green:ColorMaterial = new ColorMaterial(0x00FF00);
mList.addMaterial(red, "front");
mList.addMaterial(red, "back");
mList.addMaterial(blue, "left");
mList.addMaterial(blue, "right");
mList.addMaterial(green, "top");
mList.addMaterial(green, "bottom");
cube = new Cube(mList, 600, 600, 200, 3, 3,3,Cube.ALL);
//this.scene.addChild(cube);
paperPlane = new PaperPlane(null, 1);
paperPlane.material.doubleSided = ***e;
trace(paperPlane.boundingBox().size);
trace(paperPlane.boundingBox().size.x);
trace(paperPlane.boundingBox().size.y);
trace(paperPlane.boundingBox().size.z);
//this.scene.addChild(paperPlane);
}
}
}
【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/ |
|