MESH
本文由博主(YinaPan)原创,转载请注明出处:http://www.cnblogs.com/YinaPan/p/Unity_meshtest.html
A class that allows creating or modifying meshes from scripts.
一个允许通过脚本来创建和修改meshes的类.
Meshes contain vertices and multiple triangle arrays. See the Procedural example project for examples of using the mesh interface.
网格(meshes)包括顶点和多个三角形数组。参考Procedural example project中的例子来使用网格的界面。
The triangle arrays are simply indices into the vertex arrays; three indices for each triangle.
三角形数组仅仅是顶点的索引数组,每个三角形包含三个索引。
For every vertex there can be a normal, two texture coordinates, color and tangent. These are optional though and can be removed at will. All vertex information is stored in separate arrays of the same size, so if your mesh has 10 vertices, you would also have 10-size arrays for normals and other attributes.
每个顶点可以有一条法线,两个纹理坐标,及颜色和切线。虽然这些是可选的,但是也可以去掉。所有的顶点信息是被储存在单独的同等规格的数组中,所以如果你的网格(mesh)有10个顶点,你同样应该有大小为10的数组来存储法线和其它属性。
There are probably 3 things you might want to use the modifyable mesh interface for:
大概有3件事情是你想要使用可修改的表格.
1. Building a mesh from scratch: should always be done in the following order: 1) assign vertices 2) assign triangles
新建立一个网格 :应该总是按照这个顺序来做:
1)为顶点数组赋值
2)为三角形数组赋值
示例:

2. Modifying vertex attributes every frame: 1) get vertices, 2) modify them, 3) assign them back to the mesh.
每帧修改定点属性
1)获取顶点数组
2)修改它们
3)把它们放回网格
示例:

3. Continously changing the mesh triangles and vertices: 1) call Clear to start fresh, 2) assign vertices and other attributes, 3) assign triangle indices.
连续的改变网格的三角形数组值和顶点值
1)使用Clean刷新
2)赋予顶点值和其他属性
3)赋予索引值
It is important to call Clear before assigning new vertices or triangles. Unity always checks the supplied triangle indices whether they don't reference out of bounds vertices. Calling Clear then assigning vertices then triangles makes sure you never have out of bounds data.
调用Clean函数在赋予新的顶点值和三角形索引值之前是非常重要的,Unity总是检查三角形的索引值,判断它们是否超出边界。调用Clear函数后,给顶点赋值,再给三角形数组赋值,以确保没有超出数组的边界。
示例:

MESH的更多相关文章
- EasyMesh - A Two-Dimensional Quality Mesh Generator
EasyMesh - A Two-Dimensional Quality Mesh Generator eryar@163.com Abstract. EasyMesh is developed by ...
- 在Unity中使用UGUI修改Mesh绘制几何图形
在商店看到这样一个例子,表示很有兴趣,他们说是用UGUI做的.我想,像这种可以随便变形的图形,我第一个就想到了网格变形. 做法1: 细心的朋友应该会发现,每个UGUI可见元素,都有一个‘Canvas ...
- Unity3D 导航网格自动寻路(Navigation Mesh)
NavMesh(导航网格)是3D游戏世界中用于实现动态物体自动寻路的一种技术,将游戏中复杂的结构组织关系简化为带有一定信息的网格,在这些网格的基础上通过一系列的计算来实现自动寻路..导航时,只需要给导 ...
- Mesh Data Structure in OpenCascade
Mesh Data Structure in OpenCascade eryar@163.com 摘要Abstract:本文对网格数据结构作简要介绍,并结合使用OpenCascade中的数据结构,将网 ...
- Mesh Algorithm in OpenCascade
Mesh Algorithm in OpenCascade eryar@163.com Abstract. Rendering a generic surface is a two steps pro ...
- Unity里的Mesh属性
----------------------------------------------------------------------------------------------- Mesh ...
- 【Unity3D】利用Shader以及更改Mesh实现2D游戏的动态阴影效果
最近看到一个非常有趣的益智小游戏,是一个盗贼进入房子偷东西的, 其实这种游戏市面上已经很多了,吸引我的是那个类似手电筒的效果, 主角走到哪里,光就到哪里,被挡住的地方还有阴影.有点类似策略游戏里的战争 ...
- Netgen mesh library : nglib
Netgen mesh library : nglib eryar@163.com 摘要Abstract:本文主是对Netgen的库nglib的用法进行介绍.主要参考资料是Netgen用户指南.最后给 ...
- 为什么带网格(mesh)的模型添加了刚体Rigidbody和MeshCollider,还是会从地板穿过去?
两个Gameobject 放置在空中, 一个是Cube,一个是茄子模型 Cube的Collider 是Box Collider , 茄汁的Collider 是mesh collider, 他们都添加了 ...
- Unity3d 制作动态Mesh且可以随地面凹凸起伏
适用情景:主角带着光环,光环用一张贴图,要贴在地面上,并且随地面凹凸起伏 //代码 using UnityEngine; using System.Collections; [RequireCompo ...
随机推荐
- 分页SQL模板
select * from ( select rownum as rn ,a.* from ( select * from page a where object_id >1000 and ow ...
- code_analyzer(代码分析助手)
软件名: code_analyzer 使用c语言 pcre正则库分析源码文件,包括文件中的头文件.宏定义.函数. 用途: 无聊时,可以用来打发下时间. 演示: 对于本源程序的分析结果如下: ##### ...
- [Poetize I]黑魔法师之门
描述 Description applepi被囚禁的地点只有一扇门,当地 人称它为“黑魔法师之门”.这扇门上画着一张无向无权图,而打开这扇门的密码就是图中[每个点的度数大于零且都是偶数]的子图的个数对 ...
- 【Mongous】
amark/mongous Mongous - 一个轻量级的nodejs mongodb驱动 mongous,是我不够懂你吗?关于mongous不支持objectId查询 mongous 不需要 _i ...
- 字符串(后缀自动机):NOI 2016 优秀的拆分
[问题描述] 如果一个字符串可以被拆分为 AABB 的形式,其中 A 和 B 是任意非空字符串, 则我们称该字符串的这种拆分是优秀的. 例如,对于字符串 aabaabaa,如果令 A = aab, B ...
- C#程序注销、重启、关机和锁定电脑
一:截图 二:源代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...
- 调试中除了在URL上加时间戳外,如何避免js、css被返回304状态?
在本地开发环境(nginx)中,经常遇到这样的情况:调试js时浏览器总是不载入已修改的js内容,而直接吐出了上次缓存的代码. 我曾经做过以下尝试: ctrl+F5 ctrl+F5+F5+F5+F5 ...
- iOS 用CocoaPods做iOS程序的依赖管理
文档更新说明 2012-12-02 v1.0 初稿 2014-01-08 v1.1 增加设置 ruby 淘宝源相关内容 2014-05-25 v2.0 增加国内 spec 镜像.使用私有 pod.po ...
- VK Cup 2015 - Round 1 -E. Rooks and Rectangles 线段树最值+扫描线
题意: n * m的棋盘, k个位置有"rook"(车),q次询问,问是否询问的方块内是否每一行都有一个车或者每一列都有一个车? 满足一个即可 先考虑第一种情况, 第二种类似,sw ...
- 自动化Cobbler安装
#install cobbler-server soft #date 2013.08.07 #disabled iptables and selinux /etc/init.d/iptables st ...