123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833 |
- <!DOCTYPE HTML>
- <html lang="en">
- <head>
- <title>three.js webgl - deferred rendering [morphs]</title>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <style>
- body {
- background-color: #000;
- margin: 0px;
- overflow: hidden;
- }
- #info {
- position: absolute;
- top: 20px; width: 100%;
- color: #ffffff;
- padding: 5px;
- font-family: Monospace;
- font-size: 13px;
- text-align: center;
- }
- a {
- color: #ff0080;
- text-decoration: none;
- }
- a:hover {
- color: #0080ff;
- }
- #stats { position: absolute; top:10px; left: 5px }
- #stats #fps { background: transparent !important }
- #stats #fps #fpsText { color: #aaa !important }
- #stats #fps #fpsGraph { display: none }
- </style>
- </head>
- <body>
- <div id="info">
- <a href="http://threejs.org" target="_blank">three.js</a> - webgl deferred rendering with morph animation -
- character from <a href="http://www.sintel.org/">Sintel</a>
- </div>
- <div id="container"></div>
- <script src="js/libs/stats.min.js"></script>
- <script src="../build/three.min.js"></script>
- <script src="js/Detector.js"></script>
- <script src="js/ShaderDeferred.js"></script>
- <script src="js/shaders/CopyShader.js"></script>
- <script src="js/shaders/FXAAShader.js"></script>
- <script src="js/shaders/ColorCorrectionShader.js"></script>
- <script src="js/postprocessing/EffectComposer.js"></script>
- <script src="js/postprocessing/RenderPass.js"></script>
- <script src="js/postprocessing/ShaderPass.js"></script>
- <script src="js/postprocessing/MaskPass.js"></script>
- <script src="js/controls/TrackballControls.js"></script>
- <script>
- if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
- var SCALE = 0.75;
- var MARGIN = 100;
- var WIDTH = window.innerWidth;
- var HEIGHT = window.innerHeight - 2 * MARGIN;
- var SCALED_WIDTH = Math.floor( SCALE * WIDTH );
- var SCALED_HEIGHT = Math.floor( SCALE * HEIGHT );
- var NEAR = 1.0, FAR = 350.0;
- var VIEW_ANGLE = 45;
- var ASPECT = WIDTH / HEIGHT;
- var mouseX = 0;
- var mouseY = 0;
- var targetX = 0, targetY = 0;
- var angle = 0;
- var target = new THREE.Vector3( 0, 0, 0 );
- var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
- // core
- var renderer, camera, controls, stats, clock;
- // scenes and scene nodes
- var lightScene, lightNode, scene, sceneNode, emitterScene, emitterNode, quadScene, quadNode;
- // rendertargets
- var rtColor, rtNormals, rtDepth, rtLight, rtEmitter, rtFinal;
- // composer
- var compColor, compNormals, compDepth, compLightBuffer, compFinal, compEmitter, compositePass;
- var effectFXAA;
- // materials
- var colorShader, normalShader, bumpShader, clipDepthShader, lightShader, unlitShader, compositeShader;
- var matNormal, matClipDepth, matBasic, matUnlit;
- // lights
- var numLights = 50;
- var lights = new Array();
- // morphs
- var morphs = [];
- // -----------------------------
- function bootstrap() {
- renderer = new THREE.WebGLRenderer( { alpha: false } );
- renderer.setSize( WIDTH, HEIGHT );
- renderer.setClearColorHex( 0x000000, 1 );
- renderer.domElement.style.position = "absolute";
- renderer.domElement.style.top = MARGIN + "px";
- renderer.domElement.style.left = "0px";
- var container = document.getElementById( 'container' );
- container.appendChild( renderer.domElement );
- // scene camera
- camera = new THREE.PerspectiveCamera( VIEW_ANGLE, ASPECT, NEAR, FAR );
- camera.position.z = 150;
- controls = new THREE.TrackballControls( camera, renderer.domElement );
- // scene for walt's head model
- scene = new THREE.Scene();
- sceneNode = new THREE.Object3D();
- scene.add( sceneNode );
- scene.add( camera );
- // scene for light proxy geometry
- lightScene = new THREE.Scene();
- lightNode = new THREE.Object3D();
- lightScene.add( lightNode );
- // scene for the coloured emitter spheres
- emitterScene = new THREE.Scene();
- emitterNode = new THREE.Object3D();
- emitterScene.add( emitterNode );
- // full screen quad for compositing
- quadScene = new THREE.Scene();
- quadNode = new THREE.Object3D();
- quadScene.add( quadNode );
- quadNode.add( new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ) ) );
- // stats
- stats = new Stats();
- stats.domElement.style.position = 'absolute';
- stats.domElement.style.top = '8px';
- stats.domElement.style.zIndex = 100;
- container.appendChild( stats.domElement );
- // clock
- clock = new THREE.Clock();
- }
- // -----------------------------
- function createRenderTargets() {
- var rtParamsFloatLinear = { minFilter: THREE.NearestFilter, magFilter: THREE.LinearFilter, stencilBuffer: false,
- format: THREE.RGBAFormat, type: THREE.FloatType };
- var rtParamsFloatNearest = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, stencilBuffer: false,
- format: THREE.RGBAFormat, type: THREE.FloatType };
- var rtParamsUByte = { minFilter: THREE.NearestFilter, magFilter: THREE.LinearFilter, stencilBuffer: false,
- format: THREE.RGBFormat, type: THREE.UnsignedByteType };
- // ----------------------------------------------------------
- // g-buffer
- // ----------------------------------------------------------
- rtNormals = new THREE.WebGLRenderTarget( SCALED_WIDTH, SCALED_HEIGHT, rtParamsFloatLinear );
- rtDepth = new THREE.WebGLRenderTarget( SCALED_WIDTH, SCALED_HEIGHT, rtParamsFloatLinear );
- rtColor = new THREE.WebGLRenderTarget( SCALED_WIDTH, SCALED_HEIGHT, rtParamsFloatNearest );
- rtLight = new THREE.WebGLRenderTarget( SCALED_WIDTH, SCALED_HEIGHT, rtParamsFloatLinear );
- rtEmitter = new THREE.WebGLRenderTarget( SCALED_WIDTH, SCALED_HEIGHT, rtParamsUByte );
- rtFinal = new THREE.WebGLRenderTarget( SCALED_WIDTH, SCALED_HEIGHT, rtParamsUByte );
- rtNormals.generateMipmaps = false;
- rtDepth.generateMipmaps = false;
- rtColor.generateMipmaps = false;
- rtLight.generateMipmaps = false;
- rtEmitter.generateMipmaps = false;
- rtFinal.generateMipmaps = false;
- var passNormals = new THREE.RenderPass( scene, camera );
- compNormals = new THREE.EffectComposer( renderer, rtNormals );
- compNormals.addPass( passNormals );
- var passDepth = new THREE.RenderPass( scene, camera );
- compDepth = new THREE.EffectComposer( renderer, rtDepth );
- compDepth.addPass( passDepth );
- var passColor = new THREE.RenderPass( scene, camera );
- compColor = new THREE.EffectComposer( renderer, rtColor );
- compColor.addPass( passColor );
- // ----------------------------------------------------------
- // light emitter spheres
- // ----------------------------------------------------------
- var emitterPass = new THREE.RenderPass( emitterScene, camera );
- compEmitter = new THREE.EffectComposer( renderer, rtEmitter );
- compEmitter.addPass( emitterPass );
- // ----------------------------------------------------------
- // lighting pass
- // ----------------------------------------------------------
- var passLight = new THREE.RenderPass( lightScene, camera );
- compLightBuffer = new THREE.EffectComposer( renderer, rtLight );
- compLightBuffer.addPass( passLight );
- lightShader.uniforms[ 'samplerColor' ].value = compColor.renderTarget2;
- lightShader.uniforms[ 'samplerNormals' ].value = compNormals.renderTarget2;
- lightShader.uniforms[ 'samplerDepth' ].value = compDepth.renderTarget2;
- lightShader.uniforms[ 'samplerLightBuffer' ].value = rtLight;
- var geomEmitter = new THREE.SphereGeometry( 0.7, 7, 7 );
- for ( var x = 0; x < numLights; x ++ ) {
- var light = lights[ x ];
- // setup material
- var matLight = new THREE.ShaderMaterial( {
- uniforms: THREE.UniformsUtils.clone( lightShader.uniforms ),
- vertexShader: lightShader.vertexShader,
- fragmentShader: lightShader.fragmentShader,
- defines: { "ADDITIVE_SPECULAR": true, "SPECULAR_INTENSITY" : 0.125, "SHININESS": 75.01 },
- blending: THREE.AdditiveBlending,
- depthWrite: false,
- transparent: true
- } );
- matLight.uniforms[ "lightPos" ].value = light.position;
- matLight.uniforms[ "lightRadius" ].value = light.distance;
- matLight.uniforms[ "lightIntensity" ].value = light.intensity;
- matLight.uniforms[ "lightColor" ].value = light.color;
- // setup proxy geometry for this light
- var geomLight = new THREE.SphereGeometry( light.distance, 16, 8 );
- var meshLight = new THREE.Mesh( geomLight, matLight );
- lightNode.add( meshLight );
- // create emitter sphere
- var matEmitter = new THREE.ShaderMaterial( {
- uniforms: THREE.UniformsUtils.clone( unlitShader.uniforms ),
- vertexShader: unlitShader.vertexShader,
- fragmentShader: unlitShader.fragmentShader
- } );
- var meshEmitter = new THREE.Mesh( geomEmitter, matEmitter );
- meshEmitter.position = light.position;
- emitterNode.add( meshEmitter );
- // add emitter to light node
- meshLight.emitter = meshEmitter;
- }
- // ----------------------------------------------------------
- // composite
- // ----------------------------------------------------------
- compositeShader.uniforms[ 'samplerLightBuffer' ].value = compLightBuffer.renderTarget2;
- compositeShader.uniforms[ 'samplerEmitter' ].value = compEmitter.renderTarget2;
- compositePass = new THREE.ShaderPass( compositeShader );
- compositePass.needsSwap = true;
- effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
- effectFXAA.uniforms[ 'resolution' ].value.set( 1 / SCALED_WIDTH, 1 / SCALED_HEIGHT );
- var effectColor = new THREE.ShaderPass( THREE.ColorCorrectionShader );
- effectColor.renderToScreen = true;
- effectColor.uniforms[ 'powRGB' ].value.set( 1, 1, 1 );
- effectColor.uniforms[ 'mulRGB' ].value.set( 2, 2, 2 );
- compFinal = new THREE.EffectComposer( renderer, rtFinal );
- compFinal.addPass( compositePass );
- compFinal.addPass( effectFXAA );
- compFinal.addPass( effectColor );
- }
- // -----------------------------
- function initScene( object, y, scale ) {
- object.traverse( function( node ) {
- if ( node.material ) {
- // color material
- var uniforms = THREE.UniformsUtils.clone( colorShader.uniforms );
- var defines = { "USE_MAP": !!node.material.map, "GAMMA_INPUT": true };
- var material = new THREE.ShaderMaterial( {
- fragmentShader: colorShader.fragmentShader,
- vertexShader: colorShader.vertexShader,
- uniforms: uniforms,
- defines: defines,
- shading: node.material.shading
- } );
- uniforms.diffuse.value.copy( node.material.color );
- uniforms.map.value = node.material.map;
- material.vertexColors = node.material.vertexColors;
- material.morphTargets = node.material.morphTargets;
- material.morphNormals = node.material.morphNormals;
- if ( node.material.bumpMap ) {
- var offset = node.material.bumpMap.offset;
- var repeat = node.material.bumpMap.repeat;
- uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y );
- }
- if ( node.material.transparent ) {
- material.alphaTest = 0.1;
- }
- if ( node.material.name === "eyetrans" ) {
- material.visible = false;
- }
- node.properties.colorMaterial = material;
- // normal material
- if ( node.material.bumpMap ) {
- var uniforms = THREE.UniformsUtils.clone( bumpShader.uniforms );
- var normalMaterial = new THREE.ShaderMaterial( {
- uniforms: uniforms,
- vertexShader: bumpShader.vertexShader,
- fragmentShader: bumpShader.fragmentShader,
- defines: { "USE_BUMPMAP": true }
- } );
- uniforms.bumpMap.value = node.material.bumpMap;
- uniforms.bumpScale.value = node.material.bumpScale;
- var offset = node.material.bumpMap.offset;
- var repeat = node.material.bumpMap.repeat;
- uniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y );
- node.properties.normalMaterial = normalMaterial;
- } else if ( node.material.morphTargets ) {
- var normalMaterial = new THREE.ShaderMaterial( {
- uniforms: THREE.UniformsUtils.clone( normalShader.uniforms ),
- vertexShader: normalShader.vertexShader,
- fragmentShader: normalShader.fragmentShader,
- shading: node.material.shading
- } );
- normalMaterial.morphTargets = node.material.morphTargets;
- normalMaterial.morphNormals = node.material.morphNormals;
- node.properties.normalMaterial = normalMaterial;
- } else {
- node.properties.normalMaterial = matNormal;
- }
- // depth material
- if ( node.material.morphTargets ) {
- var depthMaterial = new THREE.ShaderMaterial({
- uniforms: THREE.UniformsUtils.clone( clipDepthShader.uniforms ),
- vertexShader: clipDepthShader.vertexShader,
- fragmentShader: clipDepthShader.fragmentShader
- });
- depthMaterial.morphTargets = node.material.morphTargets;
- node.properties.depthMaterial = depthMaterial;
- } else {
- node.properties.depthMaterial = matClipDepth;
- }
- }
- } );
- object.position.y = y;
- object.scale.set( scale, scale, scale );
- sceneNode.add( object );
- }
- // -----------------------------
- function initMaterials() {
- // -----------------------
- // shader definitions
- // -----------------------
- colorShader = THREE.ShaderDeferred[ "color" ];
- normalShader = THREE.ShaderDeferred[ "normals" ];
- bumpShader = THREE.ShaderDeferred[ "bump" ];
- clipDepthShader = THREE.ShaderDeferred[ "clipDepth" ];
- unlitShader = THREE.ShaderDeferred[ "unlit" ];
- lightShader = THREE.ShaderDeferred[ "light" ];
- compositeShader = THREE.ShaderDeferred[ "composite" ];
- unlitShader.uniforms[ "viewWidth" ].value = SCALED_WIDTH;
- unlitShader.uniforms[ "viewHeight" ].value = SCALED_HEIGHT;
- lightShader.uniforms[ "viewWidth" ].value = SCALED_WIDTH;
- lightShader.uniforms[ "viewHeight" ].value = SCALED_HEIGHT;
- // -----------------------
- // default materials
- // -----------------------
- matNormal = new THREE.ShaderMaterial( {
- uniforms: THREE.UniformsUtils.clone( normalShader.uniforms ),
- vertexShader: normalShader.vertexShader,
- fragmentShader: normalShader.fragmentShader
- } );
- matClipDepth = new THREE.ShaderMaterial({
- uniforms: THREE.UniformsUtils.clone( clipDepthShader.uniforms ),
- vertexShader: clipDepthShader.vertexShader,
- fragmentShader: clipDepthShader.fragmentShader
- });
- }
- // -----------------------------
- function initLights() {
- var distance = 40;
- // front light
- var light = new THREE.PointLight();
- light.color = new THREE.Vector3( 1, 1, 1 );
- light.intensity = 1.5;
- light.distance = 1.5 * distance;
- lights.push( light );
- // random lights
- for ( var i = 1; i < numLights; i ++ ) {
- var light = new THREE.PointLight();
- light.color = new THREE.Vector3( Math.random(), Math.random(), Math.random() ).normalize();
- // gamma to linear
- light.color.x *= light.color.x;
- light.color.y *= light.color.y;
- light.color.z *= light.color.z;
- light.intensity = 2.0;
- light.distance = distance;
- lights.push( light );
- }
- }
- // -----------------------------
- function onDocumentMouseMove( event ) {
- mouseX = ( event.clientX - windowHalfX ) * 1;
- mouseY = ( event.clientY - windowHalfY ) * 1;
- }
- // -----------------------------
- function animate() {
- var delta = clock.getDelta();
- requestAnimationFrame( animate );
- //controls.update( delta );
- targetX = mouseX * .001;
- targetY = mouseY * .001;
- angle += 0.05 * ( targetX - angle );
- camera.position.x = -Math.sin( angle ) * 150;
- camera.position.z = Math.cos( angle ) * 150;
- camera.lookAt( target );
- for ( var i = 0; i < morphs.length; i ++ ) {
- morph = morphs[ i ];
- morph.updateAnimation( 1000 * delta );
- morph.position.x += morph.properties.delta * delta;
- if ( morph.position.x < -50 ) morph.position.x = 200;
- }
- stats.update();
- render();
- }
- // -----------------------------
- function render() {
- // -----------------------------
- // g-buffer color
- // -----------------------------
- sceneNode.traverse( function( node ) {
- if ( node.material ) {
- node.material = node.properties.colorMaterial;
- }
- } );
- compColor.render();
- // -----------------------------
- // g-buffer depth
- // -----------------------------
- sceneNode.traverse( function( node ) {
- if ( node.material ) {
- node.material = node.properties.depthMaterial;
- }
- } );
- compDepth.render();
- // -----------------------------
- // g-buffer normals
- // -----------------------------
- sceneNode.traverse( function( node ) {
- if ( node.material ) {
- node.material = node.properties.normalMaterial;
- }
- } );
- compNormals.render();
- // -----------------------------
- // emitter pass
- // -----------------------------
- for ( var i = 0, il = lightNode.children.length; i < il; i ++ ) {
- var light = lightNode.children[ i ];
- var color = light.material.uniforms[ "lightColor" ].value;
- var emitter = light.emitter;
- emitter.material.uniforms[ "samplerDepth" ].value = compDepth.renderTarget2;
- emitter.material.uniforms[ "lightColor" ].value = color;
- }
- compEmitter.render();
- // -----------------------------
- // light pass
- // -----------------------------
- camera.projectionMatrixInverse.getInverse( camera.projectionMatrix );
- for ( var i = 0, il = lightNode.children.length; i < il; i ++ ) {
- var uniforms = lightNode.children[ i ].material.uniforms;
- uniforms[ "matProjInverse" ].value = camera.projectionMatrixInverse;
- uniforms[ "matView" ].value = camera.matrixWorldInverse;
- }
- var time = Date.now() * 0.0005;
- // update lights
- var x, y, z;
- for ( var i = 0; i < numLights; i ++ ) {
- if ( i > 0 ) {
- x = Math.sin( time + i * 1.7 ) * 80;
- y = Math.cos( time + i * 1.5 ) * 40;
- z = Math.cos( time + i * 1.3 ) * 30;
- } else {
- x = Math.sin( time * 3 ) * 20;
- y = 15;
- z = Math.cos( time * 3 ) * 25 + 10;
- }
- var light = lightNode.children[ i ];
- var lightPosition = light.material.uniforms[ "lightPos" ].value;
- lightPosition.x = x;
- lightPosition.y = y;
- lightPosition.z = z;
- light.emitter.position = lightPosition;
- light.position = lightPosition;
- light.frustumCulled = false;
- }
- compLightBuffer.render();
- // -----------------------------
- // composite pass
- // -----------------------------
- compFinal.render( 0.1 );
- }
- function generateBox() {
- var object = new THREE.Object3D();
- var mapHeight2 = THREE.ImageUtils.loadTexture( "obj/lightmap/rocks.jpg" );
- mapHeight2.repeat.set( 3, 1.5 );
- mapHeight2.wrapS = mapHeight2.wrapT = THREE.RepeatWrapping;
- mapHeight2.anisotropy = 4;
- mapHeight2.format = THREE.RGBFormat;
- var mapHeight3 = THREE.ImageUtils.loadTexture( "textures/water.jpg" );
- mapHeight3.repeat.set( 16, 8 );
- mapHeight3.wrapS = mapHeight3.wrapT = THREE.RepeatWrapping;
- mapHeight3.anisotropy = 4;
- mapHeight3.format = THREE.RGBFormat;
- var geoPlane = new THREE.PlaneGeometry( 40, 20 );
- var matPlane = new THREE.MeshPhongMaterial( { color: 0x000000, bumpMap: mapHeight2, bumpScale: 0.5 } );
- var matPlane2 = new THREE.MeshPhongMaterial( { color: 0x000000, bumpMap: mapHeight3, bumpScale: 0.5 } );
- var matPlane3 = new THREE.MeshPhongMaterial( { color: 0x000000, bumpMap: mapHeight3, bumpScale: 1 } );
- // bottom
- var mesh = new THREE.Mesh( geoPlane, matPlane2 );
- mesh.position.z = -2;
- mesh.position.y = -6;
- mesh.rotation.x = -Math.PI/2;
- object.add( mesh );
- // top
- var mesh = new THREE.Mesh( geoPlane, matPlane3 );
- mesh.position.z = -2;
- mesh.position.y = 7;
- mesh.rotation.x = Math.PI/2;
- object.add( mesh );
- // back
- var mesh = new THREE.Mesh( geoPlane, matPlane );
- mesh.position.z = -4;
- mesh.position.y = 0;
- object.add( mesh );
- // right
- var mesh = new THREE.Mesh( geoPlane, matPlane );
- mesh.position.z = 0;
- mesh.position.y = 0;
- mesh.position.x = 13;
- mesh.rotation.y = -Math.PI/2;
- //object.add( mesh );
- // left
- var mesh = new THREE.Mesh( geoPlane, matPlane );
- mesh.position.z = 0;
- mesh.position.y = 0;
- mesh.position.x = -13;
- mesh.rotation.y = Math.PI/2;
- //object.add( mesh );
- return object;
- }
- // -----------------------------
- // entry point
- // -----------------------------
- bootstrap();
- initMaterials();
- initLights();
- createRenderTargets();
- // create animated model
- var loader = new THREE.JSONLoader();
- loader.load( "models/animated/elderlyWalk.js", function( geometry ) {
- geometry.computeMorphNormals();
- var material = new THREE.MeshPhongMaterial( { color: 0xffffff, morphTargets: true, morphNormals: true, vertexColors: THREE.NoColors, shading: THREE.FlatShading } );
- var meshAnim = new THREE.MorphAnimMesh( geometry, material );
- meshAnim.duration = 3000;
- meshAnim.properties.delta = -13;
- var s = 1;
- meshAnim.scale.set( s, s, s );
- meshAnim.position.x = 180;
- meshAnim.position.z = -10;
- meshAnim.rotation.y = -Math.PI/2;
- morphs.push( meshAnim );
- initScene( meshAnim, -48, 50 );
- } );
- // create box
- var object = generateBox();
- initScene( object, 0, 8 );
- animate();
- document.addEventListener( 'mousemove', onDocumentMouseMove, false );
- </script>
- </body>
- </html>
|