<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r123/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/loaders/GLTFLoader.js"></script>
<script language="JavaScript">
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 10;
renderer = new THREE.WebGLRenderer({alpha: true, antialias: true});
renderer.setClearColor(0x000000, 0);
renderer.setSize(1280, 720);
renderer.domElement.setAttribute("id", "Minecraft3DObj" );
document.head.insertBefore(renderer.domElement, document.head.firstChild);
const aLight = new THREE.AmbientLight(0x404040, 1.2);
scene.add(aLight);
const pLight = new THREE.PointLight(0xFFFFFF, 1.2);
pLight.position.set(0, -3, 7);
scene.add(pLight);
//const helper = new THREE.PointLightHelper(pLight)
//scene.add(helper);
let loader = new THREE.GLTFLoader();
let obj = null;
loader.load('C://Users/yakov/Downloads/minecraft_-_pig/scene.gltf', function(gltf) {
obj = gltf;
obf.scene.scale.set(1.3, 1.3, 1.3);
scene.add(obj.scene);
});
</script>
</head>
</html>
"path_chrome_dir\chrome.exe" --allow-file-access-from-files
loader.load('C://Users/yakov/Downloads/minecraft_-_pig/scene.gltf', function(gltf) {
меняем наloader.load('./scene.gltf', function(gltf) {
loader.load('./minecraft_-_pig/scene.gltf', function(gltf) {
?loader.load('C:///Users//yakov//Downloads//minecraft_-_pig//scene.gltf', function(gltf) {
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8 />
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
<script src="three.min.js"></script>
<script src="GLTFLoader.js"></script>
<script>
let scene, camera, renderer;
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0xdddddd);
camera = new THREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1,5000);
camera.rotation.y = 45/180*Math.PI;
camera.position.x = 800;
camera.position.y = 100;
camera.position.z = 1000;
hlight = new THREE.AmbientLight (0x404040,100);
scene.add(hlight);
renderer = new THREE.WebGLRenderer({antialias:true});
renderer.setSize(window.innerWidth,window.innerHeight);
document.body.appendChild(renderer.domElement);
let loader = new THREE.GLTFLoader();
loader.load('./scene.gltf', function(gltf){
car = gltf.scene.children[0];
car.scale.set(0.5,0.5,0.5);
scene.add(gltf.scene);
renderer.render(scene, camera);
});
}
init();
</script>
</body>
</html>
html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r123/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/loaders/GLTFLoader.js"></script>
<script language="JavaScript">
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 10;
renderer = new THREE.WebGLRenderer({alpha: true, antialias: true});
renderer.setClearColor(0x000000, 0);
renderer.setSize(1280, 720);
renderer.domElement.setAttribute("id", "Minecraft3DObj" );
document.head.insertBefore(renderer.domElement, document.head.firstChild);
const aLight = new THREE.AmbientLight(0x404040, 1.2);
scene.add(aLight);
const pLight = new THREE.PointLight(0xFFFFFF, 1.2);
pLight.position.set(0, -3, 7);
scene.add(pLight);
//const helper = new THREE.PointLightHelper(pLight)
//scene.add(helper);
let loader = new THREE.GLTFLoader();
let obj = null;
loader.load('/minecraft_-_pig/scene.gltf', function(gltf) {
obj = gltf;
obf.scene.scale.set(1.3, 1.3, 1.3);
scene.add(obj.scene);
});
</script>
</head>
</html>
loader.load('/minecraft_-_pig/scene.gltf'
точки нет впереди!loader.load('./minecraft_-_pig/scene.gltf'
file:///
, если это возможно (т.е., не запрещено самим браузером).