Преглед изворни кода

Lucy Model (PLY): Fixed Transformation

Mugen87 пре 8 година
родитељ
комит
ece5ead98f

BIN
examples/models/ply/binary/Lucy100k.ply


+ 0 - 3
examples/obj/lucy/.htaccess

@@ -1,3 +0,0 @@
-<Files *.js>
-SetOutputFilter DEFLATE
-</Files>

BIN
examples/obj/lucy/Lucy100k_bin.bin


Разлика између датотеке није приказан због своје велике величине
+ 0 - 23
examples/obj/lucy/Lucy100k_slim.js


+ 3 - 4
examples/webgl_loader_ply.html

@@ -116,10 +116,9 @@
 					var material = new THREE.MeshStandardMaterial( { color: 0x0055ff, shading: THREE.FlatShading } );
 					var mesh = new THREE.Mesh( geometry, material );
 
-					mesh.position.x = - 0.4;
-					mesh.position.y = - 0.14;
-					mesh.position.z = - 0.3;
-					mesh.rotation.x = - Math.PI / 2;
+					mesh.position.x = - 0.2;
+					mesh.position.y = - 0.02;
+					mesh.position.z = - 0.2;
 					mesh.scale.multiplyScalar( 0.0006 );
 
 					mesh.castShadow = true;

+ 13 - 14
examples/webgl_materials_cubemap_refraction.html

@@ -36,7 +36,7 @@
 
 		<script src="../build/three.js"></script>
 
-		<script src="js/loaders/BinaryLoader.js"></script>
+		<script src="js/loaders/PLYLoader.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/libs/stats.min.js"></script>
@@ -71,7 +71,7 @@
 				document.body.appendChild(container);
 
 				camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 100000 );
-				camera.position.z = 2000;
+				camera.position.z =  - 4000;
 
 				//
 
@@ -99,7 +99,7 @@
 
 				// light representation
 
-				var sphere = new THREE.SphereGeometry( 100, 16, 8 );
+				var sphere = new THREE.SphereBufferGeometry( 100, 16, 8 );
 
 				var mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
 				mesh.scale.set( 0.05, 0.05, 0.05 );
@@ -107,9 +107,9 @@
 
 				// material samples
 
-				var cubeMaterial3 = new THREE.MeshBasicMaterial( { color: 0xccddff, envMap: textureCube, refractionRatio: 0.98, reflectivity:0.9 } );
-				var cubeMaterial2 = new THREE.MeshBasicMaterial( { color: 0xccfffd, envMap: textureCube, refractionRatio: 0.985 } );
-				var cubeMaterial1 = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.98 } );
+				var cubeMaterial3 = new THREE.MeshPhongMaterial( { color: 0xccddff, envMap: textureCube, refractionRatio: 0.98, reflectivity: 0.9 } );
+				var cubeMaterial2 = new THREE.MeshPhongMaterial( { color: 0xccfffd, envMap: textureCube, refractionRatio: 0.985 } );
+				var cubeMaterial1 = new THREE.MeshPhongMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.98 } );
 
 				//
 
@@ -121,8 +121,8 @@
 				stats = new Stats();
 				container.appendChild( stats.dom );
 
-				loader = new THREE.BinaryLoader();
-				loader.load( 'obj/lucy/Lucy100k_bin.js', function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } );
+				loader = new THREE.PLYLoader();
+				loader.load( 'models/ply/binary/Lucy100k.ply', function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } );
 
 				document.addEventListener('mousemove', onDocumentMouseMove, false);
 
@@ -146,22 +146,21 @@
 
 			function createScene( geometry, m1, m2, m3 ) {
 
-				var s = 1.5, z = - 1000;
+				geometry.computeVertexNormals();
+
+				var s = 1.5;
 
 				var mesh = new THREE.Mesh( geometry, m1 );
-				mesh.position.z = z;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = s;
 				scene.add( mesh );
 
 				var mesh = new THREE.Mesh( geometry, m2 );
-				mesh.position.x = - 900;
-				mesh.position.z = z;
+				mesh.position.x = - 1500;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = s;
 				scene.add( mesh );
 
 				var mesh = new THREE.Mesh( geometry, m3 );
-				mesh.position.x = 900;
-				mesh.position.z = z;
+				mesh.position.x = 1500;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = s;
 				scene.add( mesh );
 

+ 2 - 15
examples/webgl_octree_raycasting.html

@@ -35,7 +35,7 @@
 		var objectsSearch = [];
 		var totalFaces = 0;
 
-		var simpleMeshCount = 2000;
+		var simpleMeshCount = 5000;
 		var radius = 100;
 		var radiusMax = radius * 10;
 		var radiusMaxHalf = radiusMax * 0.5;
@@ -114,19 +114,6 @@
 
 			}
 
-			var loader = new THREE.JSONLoader();
-
-			loader.load( 'obj/lucy/Lucy100k_slim.js', function ( geometry ) {
-
-				geometry.computeVertexNormals();
-				totalFaces += geometry.faces.length;
-
-				var material = new THREE.MeshPhongMaterial( { color: 0x030303, specular: 0x030303, shininess: 30 } );
-
-				modifyOctree( geometry, material, true );
-
-			} );
-
 			// camera controls
 
 			controls = new THREE.TrackballControls( camera );
@@ -147,7 +134,7 @@
 			info.style.textAlign = 'center';
 			info.style.padding = '10px';
 			info.style.background = '#FFFFFF';
-			info.innerHTML = '<a href="http://threejs.org" target="_blank">three.js</a> webgl - octree (raycasting performance) - by <a href="http://github.com/collinhover/threeoctree" target="_blank">collinhover</a><br><small style="opacity:0.5">Lucy model from <a href="http://graphics.stanford.edu/data/3Dscanrep/">Stanford 3d scanning repository</a>(decimated with <a href="http://meshlab.sourceforge.net/">Meshlab</a>)</small>';
+			info.innerHTML = '<a href="http://threejs.org" target="_blank">three.js</a> webgl - octree (raycasting performance) - by <a href="http://github.com/collinhover/threeoctree" target="_blank">collinhover</a>)</small>';
 			document.body.appendChild( info );
 
 			// stats

Неке датотеке нису приказане због велике количине промена