You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import*asTHREEfrom"three";import{GLTFLoader}from"three/addons/loaders/GLTFLoader.js";constscene=newTHREE.Scene();constcamera=newTHREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,0.1,1000);camera.position.set(3,2,5);camera.lookAt(0,0,0);constrenderer=newTHREE.WebGLRenderer({antialias: true});renderer.setSize(window.innerWidth,window.innerHeight);document.body.appendChild(renderer.domElement);constdirectionalLight=newTHREE.DirectionalLight(0xffffff,6);// 方向光directionalLight.position.set(3,3,1);scene.add(directionalLight);constloader=newGLTFLoader();loader.load('/house.glb',function(gltf){constmodel=gltf.scene;scene.add(model);// 可选:调整模型的位置和缩放model.position.set(0,0,0);model.scale.set(1,1,1);renderer.render(scene,camera);},undefined,function(error){console.error('An error happened while loading the model:',error);});
在SketchUp中建个小房子,随便拉个长方体,画个中线,然后用move来一下中线,导出glB
main.js
最后附上模型: house.glb.zip
代码在: https://github.com/nonocast/hello-map
The text was updated successfully, but these errors were encountered: