0

我想手动更改投影矩阵和投影对象,但是当我这样做时,什么都没有投影。我的代码写在下面:

    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 );

我究竟做错了什么?

提前致谢

4

1 回答 1

2

你的相机太远了,仅此而已。

camera.position.z = 100;

另外,声明

var objects = [];

您的代码正确地改变了相机投影矩阵。

于 2013-01-07T14:36:43.550 回答