|
@@ -1,7 +1,7 @@
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<html lang="en">
|
|
<head>
|
|
<head>
|
|
- <title>three.js webgl - geometries</title>
|
|
|
|
|
|
+ <title>three.js webgl - gltf exporter</title>
|
|
<meta charset="utf-8">
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
|
<style>
|
|
<style>
|
|
@@ -69,7 +69,7 @@
|
|
|
|
|
|
var light, object;
|
|
var light, object;
|
|
|
|
|
|
- scene.add( new THREE.AmbientLight( 0x404040 ) );
|
|
|
|
|
|
+ scene.add( new THREE.AmbientLight( 0xffffff ) );
|
|
|
|
|
|
light = new THREE.DirectionalLight( 0xffffff );
|
|
light = new THREE.DirectionalLight( 0xffffff );
|
|
light.position.set( 0, 1, 0 );
|
|
light.position.set( 0, 1, 0 );
|
|
@@ -83,9 +83,6 @@
|
|
|
|
|
|
//
|
|
//
|
|
/*
|
|
/*
|
|
- object = new THREE.Mesh( new THREE.SphereGeometry( 75, 20, 10 ), material );
|
|
|
|
- object.position.set( -400, 0, 200 );
|
|
|
|
- scene.add( object );
|
|
|
|
|
|
|
|
object = new THREE.Mesh( new THREE.IcosahedronGeometry( 75, 1 ), material );
|
|
object = new THREE.Mesh( new THREE.IcosahedronGeometry( 75, 1 ), material );
|
|
object.position.set( -200, 0, 200 );
|
|
object.position.set( -200, 0, 200 );
|
|
@@ -106,8 +103,10 @@
|
|
scene.add( object );
|
|
scene.add( object );
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+ var map2 = new THREE.TextureLoader().load( 'textures/hardwood2_diffuse.jpg' );
|
|
|
|
+
|
|
var material = new THREE.MeshStandardMaterial( {
|
|
var material = new THREE.MeshStandardMaterial( {
|
|
- color: 0xffff00,
|
|
|
|
|
|
+ map: map2,
|
|
metalness: 0.5,
|
|
metalness: 0.5,
|
|
roughness: 1.0
|
|
roughness: 1.0
|
|
} );
|
|
} );
|
|
@@ -116,31 +115,32 @@
|
|
object.position.set( 0, 0, 0 );
|
|
object.position.set( 0, 0, 0 );
|
|
object.name = "Sphere";
|
|
object.name = "Sphere";
|
|
scene.add(object);
|
|
scene.add(object);
|
|
-
|
|
|
|
|
|
+/*
|
|
var material = new THREE.MeshStandardMaterial( {
|
|
var material = new THREE.MeshStandardMaterial( {
|
|
color: 0xff0000,
|
|
color: 0xff0000,
|
|
metalness: 0.1,
|
|
metalness: 0.1,
|
|
roughness: 0.5
|
|
roughness: 0.5
|
|
} );
|
|
} );
|
|
|
|
+*/
|
|
|
|
|
|
- object = new THREE.Mesh( new THREE.BoxBufferGeometry( 100, 100, 100 ), material );
|
|
|
|
- object.position.set( -200, 0, 0 );
|
|
|
|
- object.name = "Cube";
|
|
|
|
|
|
|
|
- var material = new THREE.MeshStandardMaterial( {
|
|
|
|
- color: 0xff00ff
|
|
|
|
- } );
|
|
|
|
|
|
+ var material = new THREE.MeshStandardMaterial( { map: map, side: THREE.DoubleSide } );
|
|
|
|
|
|
|
|
+/*
|
|
object3 = new THREE.Mesh( new THREE.CylinderBufferGeometry( 100, 100, 100 ), material );
|
|
object3 = new THREE.Mesh( new THREE.CylinderBufferGeometry( 100, 100, 100 ), material );
|
|
object3.position.set( 200, 0, 0 );
|
|
object3.position.set( 200, 0, 0 );
|
|
object3.name = "Cube";
|
|
object3.name = "Cube";
|
|
scene.add(object3);
|
|
scene.add(object3);
|
|
|
|
+*/
|
|
|
|
|
|
|
|
+ object = new THREE.Mesh( new THREE.BoxBufferGeometry( 100, 100, 100 ), material );
|
|
|
|
+ object.position.set( -200, 0, 0 );
|
|
|
|
+ object.name = "Cube";
|
|
|
|
|
|
object2 = new THREE.Mesh( new THREE.BoxBufferGeometry( 40, 10, 80, 2, 2, 2 ), material );
|
|
object2 = new THREE.Mesh( new THREE.BoxBufferGeometry( 40, 10, 80, 2, 2, 2 ), material );
|
|
- object2.position.set( 40, 40, 40 );
|
|
|
|
|
|
+ object2.position.set( 0, 0, 50 );
|
|
object2.name = "SubCube";
|
|
object2.name = "SubCube";
|
|
- // object.add(object2);
|
|
|
|
|
|
+ object.add(object2);
|
|
|
|
|
|
scene.add( object );
|
|
scene.add( object );
|
|
|
|
|
|
@@ -233,7 +233,7 @@
|
|
|
|
|
|
function render() {
|
|
function render() {
|
|
|
|
|
|
- var timer = Date.now() * 0.0001;
|
|
|
|
|
|
+ var timer = Date.now() * 0.001;
|
|
|
|
|
|
camera.position.x = Math.cos( timer ) * 800;
|
|
camera.position.x = Math.cos( timer ) * 800;
|
|
camera.position.z = Math.sin( timer ) * 800;
|
|
camera.position.z = Math.sin( timer ) * 800;
|