Doi*_*del 4 javascript indices three.js buffer-geometry
我现在只是想知道究竟什么是"抵消"和"指数/指数".例如,在https://github.com/mrdoob/three.js/blob/dev/src/core/BufferGeometry.js中提到偏移量,并且IndexedGeometry中提到了索引,但是我现在无法在开发树中找到它.虽然指数似乎相当明显,虽然我可以深入研究代码,为自己找出一些可能正确的答案,但我很想听到"官方"声明:)
谢谢!
有两种定义几何的方法:
非索引
"vertices": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ],
"normals": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ]
Run Code Online (Sandbox Code Playgroud)
在此模式下,每个三角形位置都是定义的,您无法重复使用数据.
triangle 0: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]
Run Code Online (Sandbox Code Playgroud)
索引
"indices": [ 0, 1, 2, ... ],
"vertices": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ],
"normals": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ]
Run Code Online (Sandbox Code Playgroud)
在此模式下,索引定义数据的顺序.第一个三角形是使用指数0,1和2.这些索引将用于获取vertices和normals数据:
triangle 0: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]
Run Code Online (Sandbox Code Playgroud)
索引的主要好处是可以重用数据并将更少的数据上传到GPU:
"indices": [ 0, 0, 0, ... ],
"vertices": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ]
triangle 0: [ 0, 1, 2, 0, 1, 2, 0, 1, 2 ]
Run Code Online (Sandbox Code Playgroud)
按照补偿 ......
使用偏移,您可以渲染几何体的特定范围.相反,从图纸的triangle 0到triangle.length,你可以从中汲取triangle 200到triangle 400.
| 归档时间: |
|
| 查看次数: |
1992 次 |
| 最近记录: |