提交 584a8440 编写于 作者: M Mr.doob

Merging with alteredq's branch.

上级 cee17e10
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -95,6 +95,7 @@
GeometryUtils.merge( geometry, sphere );
}
geometry.sortFacesByMaterial();
var path = "textures/cube/pisa/";
var format = '.png';
......
......@@ -94,6 +94,7 @@
GeometryUtils.merge( geometry, sphere );
}
geometry.sortFacesByMaterial();
var path = "textures/cube/skybox/";
var format = '.jpg';
......
......@@ -66,10 +66,6 @@
}
// Spheres
var geometry1 = new Sphere( 70, 32, 16, true );
var generatedTexture = new THREE.Texture( generateTexture() );
generatedTexture.image.loaded = 1;
......@@ -89,13 +85,15 @@
materials.push( { material: new THREE.MeshBasicMaterial( { map: generatedTexture } ), overdraw: true, doubleSided: false } );
materials.push( { material: new THREE.MeshLambertMaterial( { map: generatedTexture } ), overdraw: true, doubleSided: false } );
// Extra mesh to be broken down for MeshFaceMaterial
var geometry2 = new Sphere( 70, 32, 16, true );
// Spheres geometry
var geometry_smooth = new Sphere( 70, 32, 16, true );
var geometry_flat = new Sphere( 70, 32, 16, false );
var geometry_pieces = new Sphere( 70, 32, 16, true ); // Extra geometry to be broken down for MeshFaceMaterial
for ( var i = 0, l = geometry2.faces.length; i < l; i ++ ) {
for ( var i = 0, l = geometry_pieces.faces.length; i < l; i ++ ) {
var face = geometry2.faces[ i ];
var face = geometry_pieces.faces[ i ];
if ( Math.random() > 0.7 ) face.material = [ materials[ Math.floor( Math.random() * materials.length ) ].material ];
}
......@@ -104,16 +102,19 @@
objects = [];
var sphere, geometry;
var sphere, geometry, material;
for ( var i = 0, l = materials.length; i < l; i ++ ) {
geometry = materials[ i ].material instanceof THREE.MeshFaceMaterial ? geometry2 : geometry1;
sphere = new THREE.Mesh( geometry, materials[ i ].material );
material = materials[ i ].material;
geometry = material instanceof THREE.MeshFaceMaterial ? geometry_pieces :
( material.shading == THREE.FlatShading ? geometry_flat : geometry_smooth );
sphere = new THREE.Mesh( geometry, material );
sphere.overdraw = materials[ i ].overdraw;
sphere.doubleSided = materials[ i ].doubleSided;
sphere.overdraw = material.overdraw;
sphere.doubleSided = material.doubleSided;
sphere.position.x = ( i % 4 ) * 200 - 400;
sphere.position.z = Math.floor( i / 4 ) * 200 - 200;
......
......@@ -92,7 +92,8 @@
GeometryUtils.merge( geometry, sphere );
}
geometry.sortFacesByMaterial();
var path = "textures/cube/Park2/";
var format = '.jpg';
var urls = [
......
......@@ -20,6 +20,10 @@ var Bird = function () {
f3( 4, 7, 6 );
f3( 5, 6, 7 );
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
function v( x, y, z ) {
scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
......
......@@ -1435,6 +1435,7 @@ var Qrcode = function () {
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
function v( x, y, z ) {
......
......@@ -4885,6 +4885,7 @@ var WaltHead = function () {
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
function v( x, y, z ) {
......
......@@ -175,6 +175,7 @@
geometry.computeNormals();
geometry.computeCentroids();
geometry.sortFacesByMaterial();
mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, wireframe: true, wireframe_linewidth: 10 } ) ] );
mesh.doubleSided = true;
......
此差异已折叠。
......@@ -245,6 +245,7 @@ THREE.Loader.prototype = {
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
//var e = (new Date).getTime();
......@@ -706,6 +707,7 @@ THREE.Loader.prototype = {
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
function init_vertices() {
......
......@@ -158,6 +158,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
}
......
......@@ -67,6 +67,7 @@ var Cylinder = function (numSegs, topRad, botRad, height, topOffset, botOffset)
this.computeCentroids();
this.computeNormals();
this.sortFacesByMaterial();
function v(x, y, z) {
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -4,6 +4,8 @@
THREE.Object3D = function ( material ) {
this.id = THREE.Object3DCounter.value ++;
this.position = new THREE.Vector3();
this.rotation = new THREE.Vector3();
this.scale = new THREE.Vector3( 1, 1, 1 );
......@@ -35,3 +37,5 @@ THREE.Object3D = function ( material ) {
};
};
THREE.Object3DCounter = { value: 0 };
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册