这是代码的一部分。我在两个返回值上测试了geometry
和material
变量。删除这些变量,错误消失。
var actionZ = 0;
var rotationA = 1.1;
var movementSpeed = 1;
var totalObjects = 40000;
var rotated = false;
var container = document.createElement('div');
container.className = 'home-background';
document.body.appendChild( container );
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight,1, 2000)
camera.position.z = 2000;
var scene = new THREE.Scene();
scene.add(camera);
scene.fog = new THREE.FogExp2( 0x00b4f1, 0.0003 );
var geometry = new THREE.Geometry();
var i = 0;
for (i = 0; i < totalObjects; i ++) {
var vertex = new THREE.Vector3();
vertex.x = Math.random()*40000-20000;
vertex.y = Math.random()*7000-3500;
vertex.z = Math.random()*7000-3500;
geometry.vertices.push( vertex );
}
var material = new THREE.PointsMaterial( { size: 3, color: 0x00b4f1});
var particles = new THREE.Points( geometry, material );
答案 0 :(得分:1)
使用R106
创建THREE.Points
时,THREE.Geometry
中当前存在错误。您可以使用THREE.BufferGeometry
或最新的dev
版本来避免此问题。 R107
将于7月底发布。这是解决此问题的相关PR: