我已获得以下代码
function init(){
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(90, window.innerWidth / window.innerHeight, 0.1, 1000);
// here comes problems
var loader = new THREE.TextureLoader();
loader.load("three.js-master\wood.jpg", function ( texture ) {
var geometry = new THREE.PlaneGeometry(50,50, 10,10);
var material = new THREE.MeshBasicMaterial({map: texture, overdraw: 0.5});
var mesh = new THREE.Mesh(geometry, material);
mesh.rotation.x -= Math.PI / 2;
scene.add(mesh);
});
camera.position.set(0, player.height, -5);
camera.lookAt(new THREE.Vector3(0,player.height,0));
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth , window.innerHeight);
document.body.appendChild(renderer.domElement);
animate();
}
我用另一个物体渲染(我已计划用纹理制作一个房间)看起来像这样(黑色空白区域)
我的代码出了什么问题?感谢所有回复。