所以我正在尝试使用JSONLoader加载3D模型(file.json)。它大概是40mb,但模型没有显示在网页上,我的笔记本电脑开始升温。控制台没有告诉任何错误或警告,我想知道如何加载我的模型。
// ----------- render --------------
var renderer = new THREE.WebGLRenderer({canvas:document.getElementById('myCanvas'), antialias:true});
renderer.setClearColor(0x000000);
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
// ----------- camera --------------
var camera = new THREE.PerspectiveCamera(35, window.innerWidth/ window.innerHeight, 0.1, 3000);
// ----------- scene --------------
var scene = new THREE.Scene();
// create light
var light = new THREE.AmbientLight(0xC2ffe3, 0.5);
scene.add(light);
var light1 = new THREE.PointLight(0xffffff,0.5);
scene.add(light1);
var loader = new THREE.JSONLoader();
// load a resource
loader.load(
// resource URL
'untitled.json',
// onLoad callback
function ( geometry, materials ) {
var mesh = new THREE.Mesh( geometry, materials);
scene.add( mesh );
mesh.position.z = -10;
},
);
render();
function render(){
renderer.render(scene, camera);
requestAnimationFrame(render);
}
</script>enter code here