Away3D(七):Primitives(Part 3)

本文介绍了如何使用不同的选项创建各种三维模型,包括圆锥、圆柱、地质球、圆角立方体、海龟模型、网格平面、圆环、线段等,并展示了如何设置材质和位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The Cone:(圆锥)

// create three cones with different options
cone1 = new Cone({material:"red#black",segmentsH:3,segmentsW:15,heigth:100,radius:50,x:-170});
view.scene.addChild(cone1);
// openEnded 为 true 时表示圆锥底部为空
cone2 = new Cone({material:"orange#black",segmentsH:1,segmentsW:15,heigth:100,radius:50,x:0,openEnded:true,bothsides:true});
view.scene.addChild(cone2);
var mat:PhongColorMaterial = new PhongColorMaterial(0x7777ff);
cone3 = new Cone({material:mat,segmentsH:1,segmentsW:15,heigth:100,radius:50,x:170});
view.scene.addChild(cone3);

 

The Cylinder:(圆柱)

// create a cube and put it on stage
cone1 = new Cylinder({material:"red#black",segmentsH:1,segmentsW:15,heigth:70,radius:30,x:-170});
view.scene.addChild(cone1);
cone2 = new Cylinder({material:"orange#black",segmentsH:1,segmentsW:15,heigth:70,radius:30,x:0,openEnded:true,bothsides:true});
view.scene.addChild(cone2);
var mat:PhongColorMaterial = new PhongColorMaterial(0x7777ff);
cone3 = new Cylinder({material:mat,segmentsH:1,segmentsW:15,heigth:70,radius:30,x:170});
view.scene.addChild(cone3);

 

The GeodesicSphere:(地质球)

// add a huge surrounding sphere so we really can see what we're doing
geoSphere = new GeodesicSphere({radius:200,material:"red#black",x:200});
// 同 Sphere 的 segmentsW 和 segmentsH
geoSphere.fractures = 5;
geoSphere.invertFaces();
View.scene.addChild(geoSphere);
 

The RoundedCube:(圆角cube)

var mat:BitmapMaterial = new BitmapMaterial(someCoolBmd);
var rc: RoundedCube = new RoundedCube(
		{material:mat,
		width:1000,
		depth: 1000,
		height: 1000,
		radius:500,
		subdivision:3 });
view.scene.addChild(rc);
 

The SeaTurtle:(示例海龟)

// Add turtle so we have something to look at
var turtle:SeaTurtle = new SeaTurtle({material:turtleTexture,rotationX:-90});
view.scene.addChild(turtle);
 

The GridPlane:

// Make a plane
planeX = new GridPlane({width:gridsize,height:gridsize,segmentsW:10,segmentsH:10,material:"#red"});
view.scene.addChild(planeX);
planeY = new GridPlane({width:gridsize,height:gridsize,segmentsW:10,segmentsH:10,rotationX:90,material:"#lightgreen"});
view.scene.addChild(planeY);
planeZ = new GridPlane({width:gridsize,height:gridsize,segmentsW:10,segmentsH:10,rotationX:90,rotationY:90,material:"#blue"});
view.scene.addChild(planeZ);
 

The Torus:(圆环)

// Create Torus and apply fancy material
var enviro:BitmapData = Cast.bitmap(enviroTexture);
var grass:BitmapData = Cast.bitmap(grassTexture);
var mat:EnviroBitmapMaterial = new EnviroBitmapMaterial(enviro,grass);
mat.reflectiveness = 0.3;
torus1 = new Torus({material:mat,x:-140,radius:80});
torus1.segmentsR = 20;
torus1.segmentsT = 10;
view.scene.addChild(torus1);
 

The LineSegment:(线段)

line = new LineSegment({material:"#red"});
view.scene.addChild(line);

// reposition line 重新定位 line
line.start = new Vertex(turtle1.x,turtle1.y,turtle1.z);
line.end = new Vertex(turtle2.x,turtle2.y,turtle2.z);
 

WireCircle, WireCone, WireCube, WireCylinder, WirePlane, WireSphere, WireTorus:

没有surface ,只有mesh

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值