我想添加細分到這樣的領域:添加細分到幾何
http://stemkoski.github.com/Three.js/Subdivision-Cube.html
這裏是我的代碼:http://jsfiddle.net/mdrorum/HvFLw/
<script src="http://mrdoob.github.com/three.js/build/three.js"></script>
<script type="text/javascript">
var camera, scene, renderer;
var geometry, material, mesh;
var smooth, subdiv, modifier;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 1, 10000);
camera.position.z = 1000;
scene = new THREE.Scene();
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
geometry = new THREE.SphereGeometry(200);
material = new THREE.MeshBasicMaterial({ color: 0x00ff00, wireframe: true });
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
var smooth = mesh.clone();
var subdiv = 3;
var modifier = new THREE.SubdivisionModifier(subdiv);
//modifier.modify(smooth);
}
function animate() {
requestAnimationFrame(animate);
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render(scene, camera);
}
</script>
這工作得很好,但取消註釋://modifier.modify(smooth);
沒有任何反應。 :(
如何添加細分?
你有什麼錯誤嗎?(看看你的JavaScript錯誤控制檯。) – Styxxy