解答:setupGui 改寫為:

1
2
3
4
5
6
function setupGui() { 
    effectController = { fov: 40 };
    var gui = new dat.GUI();
    var element = gui.add( effectController, "fov", 1.0, 179.0 );
    element.name("field of view");
}

然後在 render() 呼叫 renderer.render 之前加入:

1
2
camera.fov = effectController.fov;
camera.updateProjectionMatrix();