小编Tor*_*ker的帖子

如何纹理球体的不规则平面?

我想给THREE.js球体的每个面部赋予它自己的纹理.所以我让SphereGeometry计算顶点并使用面的顶点将每个面转换为PlaneGeometry.

THREE.SpherePlaneGeometry = function ( v1, v2, v3, v4 ) {

  THREE.Geometry.call( this );

  var normal = new THREE.Vector3( 0, 1, 0 );

  this.vertices.push( v1.clone() );
  this.vertices.push( v2.clone() );
  this.vertices.push( v3.clone() );
  this.vertices.push( v4.clone() );

  var face = new THREE.Face4( 0, 1, 2, 3 );

  face.normal.copy( normal );
  face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );

  this.faces.push( face );

  var uvs = [
    new THREE.UV( 1.0, 0.0 ),
    new THREE.UV( 0.0, 0.0 ),
    new THREE.UV( 0.0, 1.0 ),
    new THREE.UV( 1.0, 1.0 …
Run Code Online (Sandbox Code Playgroud)

javascript textures three.js

7
推荐指数
1
解决办法
1454
查看次数

标签 统计

javascript ×1

textures ×1

three.js ×1