未验证 提交 bdb77d1e 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #16043 from WestLangley/dev-sphere_geometry

Prevent UV shearing near the poles in sphere geometries
......@@ -89,6 +89,10 @@ function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart,
var v = iy / heightSegments;
// special case for the poles
var uOffset = ( iy == 0 ) ? 0.5 / widthSegments : ( ( iy == heightSegments ) ? - 0.5 / widthSegments : 0 );
for ( ix = 0; ix <= widthSegments; ix ++ ) {
var u = ix / widthSegments;
......@@ -103,12 +107,12 @@ function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart,
// normal
normal.set( vertex.x, vertex.y, vertex.z ).normalize();
normal.copy( vertex ).normalize();
normals.push( normal.x, normal.y, normal.z );
// uv
uvs.push( u, 1 - v );
uvs.push( u + uOffset, 1 - v );
verticesRow.push( index ++ );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册