1. Let's Make a Game Using Molehill
- 章节名:1. Let's Make a Game Using Molehill
整书跳着看了一遍,总觉得落下了什么,还是仔细看一下,简单记下笔记。 第一章,Let's Make a Game Using Molehill 介绍什么是molehil。。略 此书面对了解AS3,但不太了解3d的读者 3d术语: Mesh : 3d游戏中的模型就叫一个mesh。模型一般用3d studiomax 等软件做的,一个场景可以有几百个mesh组成 Polygon: mesh可以由成百上千的多边形组成,多边形可以是三角形,也可以是四边形,一个3d立方体由6个面片组成,每个面片叫做一个poly Vertex:每个poly有3个或以上角,每个角的顶点就是一个vertex。 Texture:想象成墙纸,可以是一个jpg或png的图片。 Shaders: shader是视觉风格的定义,它定义怎样渲染某物,在stage3d中,shaders存在Program3D类中。创建一个shader,需要创建一个vertex program,和一个fragment program Fragment program:在molehill中是处理mesh视觉渲染的一系列命令。也叫像素着色器。fragment programs描述一个给定的表面材质和对光照的反应,不同的材质对光照有不同的反应方式取决于反射和透明度等,需要不同的代码来模拟。每个模型都需要一个fragment program,否则就不会渲染出来,它可以是一个简单的texture,也可以是复杂的2个texture混合外加灯光反射。 Vertex program: molehill常用 vertex program计算mesh的形状,影响每个vertex在3d世界中的位置。这样可以把mesh缩放,扭曲,做变形动画。也可以分配任意数量的数据到mesh中的每个vertex,不只是xyz坐标,可以是rgb颜色uv等。每个模型的渲染都需要个vertex program,可以是简单的在原始位置渲染或复杂到让mesh做变形动画。 Vectors: Vector3D描述空间中的位置,在geom包里,import flash.geom.Vector3D; var putTheTreeHere:Vector3D = new Vector3D(0,0,0); var locationOfTreasure:Vector3D = new Vector3D(1000,0,-15000); Normals: 仅用来指明方向,length等于1的单位向量,可以简单的用Vector3D类的normalize()方法获得。 var aNormalPointingUp:Vector3D = new Vector3D(0,1,0); Matrices:是向量的集合,Matrix3D是4×4的矩阵,用来方便的移动,旋转,缩放对象。 第一章结束,总结 Vector3D: containing an x, y, and z component Normal: a Vector3D that has a length of one Matrix: a 4x4 group of vectors with position, rotation, and scale Vertex: a point in space that is the corner of a polygon Polygon: a shape defined by multiple vertex coordinates Mesh: a group of polygons (polies) that make up a model Texture: a bitmap image that is like a wallpaper for a mesh Vertex program: commands affecting the shape of a mesh Fragment program: commands affecting the look of a mesh
N神对本书的所有笔记 · · · · · ·
-
1. Let's Make a Game Using Molehill
-
2.Blueprint of a Molehill
原来为什么慢,因为之前DisplayList全部CPU,molehill为什么快,因为molehill是完全GPU加速的...
-
3. Fire up the Engines
这章直接看代码就行了,书里好像也么讲什么,代码倒是注释的很详细 除了shader代码要后边章节...
说明 · · · · · ·
表示其中内容是对原文的摘抄