Away3D 基础5 - 3D基本元素(3)

47 篇文章 0 订阅
20 篇文章 1 订阅

这是关于3D基本元素的第三篇教程也是最后一篇。在这篇里要介绍的是我们不常用到的。GridPlaneLineSegment用于调试,然而Cone, Torus SeaTurtle更是“非必备品”了。

这篇教程里介绍过的3D基本元素也存在于别的3D引擎或模型包里。由于不常用,本教程里没有像前两节里那样丰富的实例。不过这里还是提供了能展现其用法的代码

先决条件

本教程建立在我们别的教程基础之上。假如你是flash3D菜鸟,你可能会先要去看看这些教程。举个例子,有些源文件,点击附带的as文件查看它们是如何工作的。所有这些例子都要用到一个Cover.as文件。这个文件是让教程里用到的flash影片不能同时工作,否则会拖垮你的电脑。如果你不确定如何使用这些例子,查看这个教程

教程里的一部分例子会用到“纹理”。关于纹理与材质我们会在后边教程详细介绍,如果要让代码在flash cs3里工作, 读这个教程.

 

The Cone

圆锥用处不大。做冰淇淋甜筒、锥形交通标和宴会帽等效果时可能会用到。圆锥有radiussegmentsHsegmentsWheight属性,另外一个属性用于指明是否开口,如果设为开口,我们就可以从圆锥底看到圆锥内部。

Swf:点击观看as: Basic08_cone.as

在本例展示了几种可能.下载源文件,看看各类属性如何设置。

The Cylinder

圆柱体与圆锥提供的属性大多相同,看下例:

Swf:点击观看as: Basic08_cylinder.as

圆柱体可能要比圆锥有用的多,不过用它要付出“昂贵”的代价。记得winxp经典屏保管道实时渲染吗?这个看上去很容易实现,但实际上用3D引擎很难实现这个效果。像前面的例子里看到的那样,要让一个3D元素显示的很“圆”就需要大量的三角形,圆柱体也不例外。回顾历史我们不难发现在游戏里大量使用“圆形表面”还只是近几年的事。

The GeodesicSphere

A Geodesic sphere is most commonly referred to as a Geodesic Dome. It's been used in building construction (see Spaceship Earth at Epcot) and has some unique properties when compared to a traditional Sphere primitive. In Away3D the Geodesic Sphere starts off with a basic shape that looks like 2 pyramids combined. This shape is then refined by triangulating each of the triangles in the basic shape to approximate a sphere.

The higher amount of triangulation, the more round the sphere will appear. In the image below, the fracture setting is noted next to each sphere so you can see how this affects the roundness of the sphere.

  

as: Basic08_geodesicsphere_refine.as

As you see from the image, this is a quite different way to build the sphere than with a normal sphere primitive. The triangles are almost the same size across the object and this makes a GeodesicSphere more round than a sphere, given the same number of triangles. Mouse over the example below to see how the two compare.

Swf:点击观看as: Basic08_geodesicsphere.as

It is also possible to create a Geodesic sphere based on other primitives as this code shows.

The RoundedCube

圆角立方体只在Away3D引擎里有。最简单的圆角立方体看上去就像个球。通过增加三角形面数可以得到更佳的效果

点此去浏览Fabrice Closier的博客。FabriceAway3D开发团队里核心成员。

这个基本元素还是最近在用户的要求下添加的。假如你需要一种Away3D里还没有的3D元素,你可以试图在away3D论坛里发帖。论坛会员就有可能去开发这个元素,当然如果你也有开发能力也欢迎您把代码投稿到away3D引擎。

 

 

The Wire primitives

 

 

Several of the primitives are also available in Wireframe version. They have no surface so you can see the mesh they consist of.

A final note

As said initially, these primitives have very limited use and some of them even contain bugs. While working on this tutorial, I've added these bugs to the issue list for Away3D. Most notably - the cone and geodesic sphere has texture issues, the cylinder becomes too long if you use more than one segment. The issues are reported to the team and will probably be fixed swiftly, but I'm adding it here as a "nice to know" thing.

The GridPlane

网格平面这个3D元素用于辅助建立场景。它只是带网格的平面,但它成为大多3D程序里必备部分是有原因的。看下面模型。

Swf:点击观看 as: Basic08_gridplane.as  image: seaturtle.jpg

如上添加了三叉戟与网格后,你对该场景个位置情况一目了然。

The Torus

圆环存在于大多3D工具里。它可用于油炸圈饼、救生圈。同时这个也用于测试阴影。应用模拟光反射、阴影于旋转的圆环上,圆环看上去效果很不错。

Swf:点击观看 movie: Basic08_torus.as, images: doughnut.jpg mandelbrot.jpg marble.jpg

注意圆环不用segmentsW segmentsH设置,取而代之的是segmentsR segmentsT

 torus.segmentsR = 20;torus.segmentsT = 10;

The LineSegment

像下面例子一样,有时候我们只需要在两点间画一根线。在away3D里提供了线段“元素。把鼠标移到下面影片上,我们可以看到一根线段始总连着”海龟“

Swf:点击观看as:Basic08_linesegment.as, image: seaturtle.jpg

 

The SeaTurtle

This was the first output of the as3 exporter, a class that can generate a compact AS3 class based on any loaded model. This class has since been updated a lot and it's very powerful. If you want a compact 3D project, you should consider testing how the AS3 exporter can improve both file size and load times. While not really a primitive, the Sea Turtle was a fun addition and a bit of a mascot in the early days of Away3D. Since it's kind of complex and has a lot of faces, it is also useful for testing lighting. The texture for the turtle is located in the "/techdemos/images/" folder that you can download from the Away3D subversion repository. You'll see it in use in the next primitive - the GridPlane.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 内容概要 《计算机试卷1》是一份综合性的计算机基础和应用测试卷,涵盖了计算机硬件、软件、操作系统、网络、多媒体技术等多个领域的知识点。试卷包括单选题和操作应用两大类,单选题部分测试学生对计算机基础知识的掌握,操作应用部分则评估学生对计算机应用软件的实际操作能力。 ### 适用人群 本试卷适用于: - 计算机专业或信息技术相关专业的学生,用于课程学习或考试复习。 - 准备计算机等级考试或职业资格认证的人士,作为实战演练材料。 - 对计算机操作有兴趣的自学者,用于提升个人计算机应用技能。 - 计算机基础教育工作者,作为教学资源或出题参考。 ### 使用场景及目标 1. **学习评估**:作为学校或教育机构对学生计算机基础知识和应用技能的评估工具。 2. **自学测试**:供个人自学者检验自己对计算机知识的掌握程度和操作熟练度。 3. **职业发展**:帮助职场人士通过实际操作练习,提升计算机应用能力,增强工作竞争力。 4. **教学资源**:教师可以用于课堂教学,作为教学内容的补充或学生的课后练习。 5. **竞赛准备**:适合准备计算机相关竞赛的学生,作为强化训练和技能检测的材料。 试卷的目标是通过系统性的题目设计,帮助学生全面复习和巩固计算机基础知识,同时通过实际操作题目,提高学生解决实际问题的能力。通过本试卷的学习与练习,学生将能够更加深入地理解计算机的工作原理,掌握常用软件的使用方法,为未来的学术或职业生涯打下坚实的基础

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值