Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
- var camera, scene, renderer;
- var geometry, material, mesh;
- function setup() {
- var W = window.innerWidth, H = window.innerHeight;
- renderer = new THREE.WebGLRenderer();
- renderer.setSize( W, H );
- document.body.appendChild( renderer.domElement );
- camera = new THREE.PerspectiveCamera( 50, W/H, 1, 10000 );
- camera.position.z = 500;
- scene = new THREE.Scene();
- var points = [
- new THREE.Vector3( -97.58, -73.38, 81 ),
- new THREE.Vector3( -28.27, -65.89, 91.31 ),
- new THREE.Vector3( 91.44, -66.84, 37.61 ),
- new THREE.Vector3( 54.28, 14.81, 69.45 ),
- new THREE.Vector3( 15.13, 73.21, 28.95 ),
- new THREE.Vector3( -78.62, -31.83, -20.6 ),
- new THREE.Vector3( 62.57, -32.77, -12.54 ),
- new THREE.Vector3( 25.54, 63.98, -0.82 ),
- ];
- geometry = new THREE.ConvexGeometry( points );
- material = new THREE.MeshLambertMaterial({shading: THREE.FlatShading, color: 0x6e6e6e});
- mesh = new THREE.Mesh(geometry, material);
- mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
- scene.add(mesh);
- bg = document.body.style;
- bg.background = '#ffffff';
- ambientLight = new THREE.AmbientLight( 0x000000 );
- scene.add( ambientLight );
- hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x000000, 0.2);
- scene.add( hemisphereLight );
- directionalLight = new THREE.DirectionalLight(0xffffff, 0.1);
- directionalLight.position.set( 0, 1, 0 );
- directionalLight.castShadow = true;
- scene.add( directionalLight );
- spotLight1 = new THREE.SpotLight( 0xffffff, 0.1 );
- spotLight1.position.set( 100, 1000, 100 );
- spotLight1.castShadow = true;
- spotLight1.shadowDarkness = 0.2;
- scene.add( spotLight1 );
- spotLight2 = new THREE.SpotLight( 0xffffff, 0.1 );
- spotLight2.position.set( 100, 1000, 100 );
- spotLight2.castShadow = true;
- spotLight2.shadowDarkness = 0.2;
- scene.add( spotLight2 );
- }
- function draw() {
- requestAnimationFrame( draw );
- mesh.rotation.x = Date.now() * 0.0005;
- mesh.rotation.y = Date.now() * 0.0002;
- mesh.rotation.z = Date.now() * 0.0001;
- renderer.render( scene, camera );
- }
- setup();
- draw();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement