我想手动更改投影矩阵和项目对象,但是当我这样做时,没有任何内容被投射。 我的代码如下:
container = document.createElement( 'div' );
document.body.appendChild( container );
scene = new THREE.Scene();
scene.matrixAutoUpdate = false;
camera = new THREE.PerspectiveCamera( 45, width/height, 1, 10000 );
camera.position.z = 1000;
sm = [0.00276099, 0.00450188, 0.0029867, 0, -0.0003996, 0.00351491, -0.00492164, 0, -0.0053816, 0.00203048, 0.00189776, 0 ,0, 0, 0, 1];
for (var i=0;i<16;i++){
camera.projectionMatrix.elements[i] = sm[i];
}
scene.add( camera );
siz = 20;
geometry = new THREE.CubeGeometry( siz, siz, siz );
material = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( "{{ STATIC_URL }}images/middle.jpg" ) });
mesh = new THREE.Mesh( geometry, material);
mesh.matrixAutoUpdate = false;
scene.add( mesh );
objects.push( mesh);
mesh.updateMatrix();
scene.updateMatrixWorld();
projector = new THREE.Projector();
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.sortObjects = false;
renderer.setSize( width, height );
renderer.shadowMapEnabled = true;
renderer.shadowMapSoft = true;
container.appendChild( renderer.domElement );
我做错了什么?
提前致谢
答案 0 :(得分:2)
你的相机太远了,就是这样。
camera.position.z = 100;
另外,声明
var objects = [];
您的代码正确地改变了相机投影矩阵。