我正在创建自定义几何图形并遇到此错误:THREE.Vertex 已被弃用。请改用 THREE.Vector3。THREE.UV 已被弃用。请改用 THREE.Vector2。
我不确定如何继续下面的代码。我将如何进行此更新?谢谢你。
Saturn_RingFunct = function ( innerRadius, outerRadius, nSegments ) {
//var ringsmap = "./images/SatRing.png";
//var texture = THREE.ImageUtils.loadTexture(ringsmap);
var material = new THREE.MeshLambertMaterial(
{ color:"yellow",wireframe:true/*map: texture, transparent:true, ambient:0xffffff*/ } );
//var ringsMesh = new THREE.Mesh( geometry, material );
var Saturn_Rings = new THREE.Geometry();
//THREE.Geometry.call( this );
var outerRadius = outerRadius || 1,
innerRadius = innerRadius || .5,
gridY = nSegments || 10;
var i, twopi = 2 * Math.PI;
var iVer = Math.max( 2, gridY );
var origin = new THREE.Vector3(0, 0, 0);
//this.vertices.push(new THREE.Vertex(origin));
for ( i = 0; i < ( iVer + 1 ) ; i++ ) {
var fRad1 = i / iVer;
var fRad2 = (i + 1) / iVer;
var fX1 = innerRadius * Math.cos( fRad1 * twopi );
var fY1 = innerRadius * Math.sin( fRad1 * twopi );
var fX2 = outerRadius * Math.cos( fRad1 * twopi );
var fY2 = outerRadius * Math.sin( fRad1 * twopi );
var fX4 = innerRadius * Math.cos( fRad2 * twopi );
var fY4 = innerRadius * Math.sin( fRad2 * twopi );
var fX3 = outerRadius * Math.cos( fRad2 * twopi );
var fY3 = outerRadius * Math.sin( fRad2 * twopi );
var v1 = new THREE.Vector3( fX1, fY1, 0 );
var v2 = new THREE.Vector3( fX2, fY2, 0 );
var v3 = new THREE.Vector3( fX3, fY3, 0 );
var v4 = new THREE.Vector3( fX4, fY4, 0 );
Saturn_Rings.vertices.push( new THREE.Vertex( v1 ) );
Saturn_Rings.vertices.push( new THREE.Vertex( v2 ) );
Saturn_Rings.vertices.push( new THREE.Vertex( v3 ) );
Saturn_Rings.vertices.push( new THREE.Vertex( v4 ) );
}
for ( i = 0; i < iVer ; i++ ) {
Saturn_Rings.faces.push(new THREE.Face3( i * 4, i * 4 + 1, i * 4 + 2));
Saturn_Rings.faces.push(new THREE.Face3( i * 4, i * 4 + 2, i * 4 + 3));
Saturn_Rings.faceVertexUvs[ 0 ].push( [
new THREE.UV(0, 1),
new THREE.UV(1, 1),
new THREE.UV(1, 0) ] );
Saturn_Rings.faceVertexUvs[ 0 ].push( [
new THREE.UV(0, 1),
new THREE.UV(1, 0),
new THREE.UV(0, 0) ] );
}
Saturn_Rings.computeCentroids();
Saturn_Rings.computeFaceNormals();
Saturn_Rings.computeVertexNormals();
//Saturn_Rings.boundingSphere = { radius: outerRadius };
var object = new THREE.Mesh(Saturn_Rings, material);
object.doubleSided = true;
object.doubleSided = true;
object.rotation.x = Math.PI / 2;
scene.add(object);
}