提交 55504ff8 编写于 作者: M Mugen87

removal of THREE.MeshFaceMaterial

上级 de30c4d4
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<h3>[property:Integer materialIndex]</h3> <h3>[property:Integer materialIndex]</h3>
<div> <div>
Material index (points to [page:MeshFaceMaterial MeshFaceMaterial.materials]). Material index (points to [page:MultiMaterial MultiMaterial.materials]).
</div> </div>
<h2>Methods</h2> <h2>Methods</h2>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
materials -- The materials for the object. materials -- The materials for the object.
</div> </div>
<div> <div>
Creates an new Object3D an new mesh for each material defined in materials. Beware that this is not the same as Meshfacematerial which defines multiple material for 1 mesh.<br /> Creates an new Object3D an new mesh for each material defined in materials. Beware that this is not the same as MultiMaterial which defines multiple material for 1 mesh.<br />
This is mostly useful for object that need a material and a wireframe implementation. This is mostly useful for object that need a material and a wireframe implementation.
</div> </div>
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
'models/animated/monster/monster.js', 'models/animated/monster/monster.js',
// Function when resource is loaded // Function when resource is loaded
function ( geometry, materials ) { function ( geometry, materials ) {
var material = new THREE.MeshFaceMaterial( materials ); var material = new THREE.MultiMaterial( materials );
var object = new THREE.Mesh( geometry, material ); var object = new THREE.Mesh( geometry, material );
scene.add( object ); scene.add( object );
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<h1>[name]</h1> <h1>[name]</h1>
<div class="desc"> <div class="desc">
A Material to define multiple materials for the same geometry. A Material to define multiple materials for the same geometry.
The geometry decides which material is used for which faces by the [page:Face3 faces materialindex]. The geometry decides which material is used for which faces by the [page:Face3 faces materialindex].
The materialindex corresponds with the index of the material in the materials array. The materialindex corresponds with the index of the material in the materials array.
</div> </div>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
materials -- The materials for the geometry. materials -- The materials for the geometry.
</div> </div>
<div> <div>
Creates a MeshFaceMaterial with the correct materials. Creates a MultiMaterial with the correct materials.
</div> </div>
......
...@@ -72,7 +72,7 @@ var list = { ...@@ -72,7 +72,7 @@ var list = {
[ "Material", "api/materials/Material" ], [ "Material", "api/materials/Material" ],
[ "MeshBasicMaterial", "api/materials/MeshBasicMaterial" ], [ "MeshBasicMaterial", "api/materials/MeshBasicMaterial" ],
[ "MeshDepthMaterial", "api/materials/MeshDepthMaterial" ], [ "MeshDepthMaterial", "api/materials/MeshDepthMaterial" ],
[ "MeshFaceMaterial", "api/materials/MeshFaceMaterial" ], [ "MultiMaterial", "api/materials/MultiMaterial" ],
[ "MeshLambertMaterial", "api/materials/MeshLambertMaterial" ], [ "MeshLambertMaterial", "api/materials/MeshLambertMaterial" ],
[ "MeshNormalMaterial", "api/materials/MeshNormalMaterial" ], [ "MeshNormalMaterial", "api/materials/MeshNormalMaterial" ],
[ "MeshPhongMaterial", "api/materials/MeshPhongMaterial" ], [ "MeshPhongMaterial", "api/materials/MeshPhongMaterial" ],
......
...@@ -451,7 +451,7 @@ var Loader = function ( editor ) { ...@@ -451,7 +451,7 @@ var Loader = function ( editor ) {
if ( result.materials.length > 1 ) { if ( result.materials.length > 1 ) {
material = new THREE.MeshFaceMaterial( result.materials ); material = new THREE.MultiMaterial( result.materials );
} else { } else {
......
...@@ -36,7 +36,7 @@ Sidebar.Animation = function ( editor ) { ...@@ -36,7 +36,7 @@ Sidebar.Animation = function ( editor ) {
var material = child.material; var material = child.material;
if ( material instanceof THREE.MeshFaceMaterial ) { if ( material instanceof THREE.MultiMaterial ) {
for ( var i = 0; i < material.materials.length; i ++ ) { for ( var i = 0; i < material.materials.length; i ++ ) {
......
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
}, },
"materialIndex": { "materialIndex": {
"!type": "number", "!type": "number",
"!doc": "Material index (points to [page:MeshFaceMaterial MeshFaceMaterial.materials])." "!doc": "Material index (points to [page:MultiMaterial MultiMaterial.materials])."
}, },
"clone": { "clone": {
"!type": "fn() -> +THREE.Face3", "!type": "fn() -> +THREE.Face3",
...@@ -960,7 +960,7 @@ ...@@ -960,7 +960,7 @@
"prototype": { "prototype": {
"createMultiMaterialObject": { "createMultiMaterialObject": {
"!type": "fn(geometry: +THREE.Geometry, materials: []) -> +THREE.Object3D", "!type": "fn(geometry: +THREE.Geometry, materials: []) -> +THREE.Object3D",
"!doc": "Creates an new Object3D an new mesh for each material defined in materials. Beware that this is not the same as Meshfacematerial which defines multiple material for 1 mesh.<br>\n\t\tThis is mostly useful for object that need a material and a wireframe implementation." "!doc": "Creates an new Object3D an new mesh for each material defined in materials. Beware that this is not the same as MultiMaterial which defines multiple material for 1 mesh.<br>\n\t\tThis is mostly useful for object that need a material and a wireframe implementation."
}, },
"attach": { "attach": {
"!type": "fn(child: +THREE.Object3D, scene: +THREE.Object3D, parent: +THREE.Object3D)", "!type": "fn(child: +THREE.Object3D, scene: +THREE.Object3D, parent: +THREE.Object3D)",
...@@ -2839,8 +2839,8 @@ ...@@ -2839,8 +2839,8 @@
"!doc": "A material for drawing geometry by depth. Depth is based off of the camera near and far plane. White is nearest, black is farthest.", "!doc": "A material for drawing geometry by depth. Depth is based off of the camera near and far plane. White is nearest, black is farthest.",
"!type": "fn(parameters: object)" "!type": "fn(parameters: object)"
}, },
"MeshFaceMaterial": { "MultiMaterial": {
"!url": "http://threejs.org/docs/#Reference/materials/MeshFaceMaterial", "!url": "http://threejs.org/docs/#Reference/materials/MultiMaterial",
"prototype": { "prototype": {
"materials": { "materials": {
"!type": "[]", "!type": "[]",
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
]; ];
mesh = new THREE.Mesh( new THREE.BoxGeometry( 300, 300, 300, 7, 7, 7 ), new THREE.MeshFaceMaterial( materials ) ); mesh = new THREE.Mesh( new THREE.BoxGeometry( 300, 300, 300, 7, 7, 7 ), new THREE.MultiMaterial( materials ) );
mesh.scale.x = - 1; mesh.scale.x = - 1;
scene.add( mesh ); scene.add( mesh );
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
]; ];
mesh = new THREE.Mesh( new THREE.BoxGeometry( 300, 300, 300, 7, 7, 7 ), new THREE.MeshFaceMaterial( materials ) ); mesh = new THREE.Mesh( new THREE.BoxGeometry( 300, 300, 300, 7, 7, 7 ), new THREE.MultiMaterial( materials ) );
mesh.scale.x = - 1; mesh.scale.x = - 1;
scene.add( mesh ); scene.add( mesh );
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
var centerOffset = -0.5 * ( geometry.boundingBox.max.x - geometry.boundingBox.min.x ); var centerOffset = -0.5 * ( geometry.boundingBox.max.x - geometry.boundingBox.min.x );
var material = new THREE.MeshFaceMaterial( [ var material = new THREE.MultiMaterial( [
new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: 0.5 } ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: 0.5 } ),
new THREE.MeshBasicMaterial( { color: 0x000000, overdraw: 0.5 } ) new THREE.MeshBasicMaterial( { color: 0x000000, overdraw: 0.5 } )
] ); ] );
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
} }
materials.push( new THREE.MeshFaceMaterial( materials ) ); materials.push( new THREE.MultiMaterial( materials ) );
objects = []; objects = [];
......
...@@ -299,8 +299,8 @@ THREE.Car = function () { ...@@ -299,8 +299,8 @@ THREE.Car = function () {
var s = scope.modelScale, var s = scope.modelScale,
delta = new THREE.Vector3(); delta = new THREE.Vector3();
var bodyFaceMaterial = new THREE.MeshFaceMaterial( scope.bodyMaterials ); var bodyFaceMaterial = new THREE.MultiMaterial( scope.bodyMaterials );
var wheelFaceMaterial = new THREE.MeshFaceMaterial( scope.wheelMaterials ); var wheelFaceMaterial = new THREE.MultiMaterial( scope.wheelMaterials );
// body // body
......
...@@ -44,7 +44,7 @@ THREE.UCSCharacter = function() { ...@@ -44,7 +44,7 @@ THREE.UCSCharacter = function() {
geometry.computeBoundingBox(); geometry.computeBoundingBox();
geometry.computeVertexNormals(); geometry.computeVertexNormals();
mesh = new THREE.SkinnedMesh( geometry, new THREE.MeshFaceMaterial() ); mesh = new THREE.SkinnedMesh( geometry, new THREE.MultiMaterial() );
mesh.name = config.character; mesh.name = config.character;
scope.root.add( mesh ); scope.root.add( mesh );
......
...@@ -1169,7 +1169,7 @@ THREE.ColladaLoader = function () { ...@@ -1169,7 +1169,7 @@ THREE.ColladaLoader = function () {
if ( num_materials > 1 ) { if ( num_materials > 1 ) {
material = new THREE.MeshFaceMaterial( used_materials_array ); material = new THREE.MultiMaterial( used_materials_array );
} }
......
...@@ -1693,7 +1693,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress ...@@ -1693,7 +1693,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
var scope = this; var scope = this;
var geometry = new THREE.Geometry(); var geometry = new THREE.Geometry();
var material = new THREE.MeshFaceMaterial(); var material = new THREE.MultiMaterial();
var helper = new THREE.MMDLoader.DataCreationHelper(); var helper = new THREE.MMDLoader.DataCreationHelper();
var initVartices = function () { var initVartices = function () {
...@@ -2534,7 +2534,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress ...@@ -2534,7 +2534,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
var bodyB = rigidBodies[ p.rigidBodyIndex2 ]; var bodyB = rigidBodies[ p.rigidBodyIndex2 ];
/* /*
* Refer http://www20.atpages.jp/katwat/wp/?p=4135 * Refer http://www20.atpages.jp/katwat/wp/?p=4135
* for what this is for * for what this is for
*/ */
if ( bodyA.type !== 0 && bodyB.type === 2 ) { if ( bodyA.type !== 0 && bodyB.type === 2 ) {
...@@ -4516,4 +4516,3 @@ THREE.MMDHelper.prototype = { ...@@ -4516,4 +4516,3 @@ THREE.MMDHelper.prototype = {
} }
}; };
...@@ -224,7 +224,7 @@ THREE.SceneLoader.prototype = { ...@@ -224,7 +224,7 @@ THREE.SceneLoader.prototype = {
if ( ! objJSON.material ) { if ( ! objJSON.material ) {
material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); material = new THREE.MultiMaterial( result.face_materials[ objJSON.geometry ] );
} }
...@@ -232,9 +232,9 @@ THREE.SceneLoader.prototype = { ...@@ -232,9 +232,9 @@ THREE.SceneLoader.prototype = {
// if there is just empty face material // if there is just empty face material
// (must create new material as each model has its own face material) // (must create new material as each model has its own face material)
if ( ( material instanceof THREE.MeshFaceMaterial ) && material.materials.length === 0 ) { if ( ( material instanceof THREE.MultiMaterial ) && material.materials.length === 0 ) {
material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] ); material = new THREE.MultiMaterial( result.face_materials[ objJSON.geometry ] );
} }
...@@ -1077,7 +1077,7 @@ THREE.SceneLoader.prototype = { ...@@ -1077,7 +1077,7 @@ THREE.SceneLoader.prototype = {
} }
// second pass through all materials to initialize MeshFaceMaterials // second pass through all materials to initialize MultiMaterials
// that could be referring to other materials out of order // that could be referring to other materials out of order
for ( matID in data.materials ) { for ( matID in data.materials ) {
......
...@@ -478,7 +478,7 @@ THREE.Projector = function () { ...@@ -478,7 +478,7 @@ THREE.Projector = function () {
var material = object.material; var material = object.material;
var isFaceMaterial = material instanceof THREE.MeshFaceMaterial; var isFaceMaterial = material instanceof THREE.MultiMaterial;
var objectMaterials = isFaceMaterial === true ? object.material : null; var objectMaterials = isFaceMaterial === true ? object.material : null;
for ( var v = 0, vl = vertices.length; v < vl; v ++ ) { for ( var v = 0, vl = vertices.length; v < vl; v ++ ) {
......
...@@ -685,22 +685,22 @@ ...@@ -685,22 +685,22 @@
}, },
"face": { "face": {
"type": "MeshFaceMaterial", "type": "MultiMaterial",
"parameters": {} "parameters": {}
}, },
"multi_1": { "multi_1": {
"type": "MeshFaceMaterial", "type": "MultiMaterial",
"parameters": {} "parameters": {}
}, },
"multi_2": { "multi_2": {
"type": "MeshFaceMaterial", "type": "MultiMaterial",
"parameters": { "materials": [ "phong_compressed_cube", "phong_man", "phong_hand", "minecraft", "backsignals" ] } "parameters": { "materials": [ "phong_compressed_cube", "phong_man", "phong_hand", "minecraft", "backsignals" ] }
}, },
"multi_veyron": { "multi_veyron": {
"type": "MeshFaceMaterial", "type": "MultiMaterial",
"parameters": { "materials": [ "interior", "chrome", "darkerchrome", "glass", "chrome", "chrome", "backlights", "backsignals" ] } "parameters": { "materials": [ "interior", "chrome", "darkerchrome", "glass", "chrome", "chrome", "backlights", "backsignals" ] }
} }
......
...@@ -223,7 +223,7 @@ ...@@ -223,7 +223,7 @@
} }
mesh = new THREE.SkinnedMesh( geometry, new THREE.MeshFaceMaterial( materials ) ); mesh = new THREE.SkinnedMesh( geometry, new THREE.MultiMaterial( materials ) );
mesh.name = "Knight Mesh"; mesh.name = "Knight Mesh";
mesh.position.set( x, y - bb.min.y * s, z ); mesh.position.set( x, y - bb.min.y * s, z );
mesh.scale.set( s, s, s ); mesh.scale.set( s, s, s );
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
mesh.receiveShadow = true; mesh.receiveShadow = true;
mesh2 = new THREE.SkinnedMesh( geometry, new THREE.MeshFaceMaterial( materials ) ); mesh2 = new THREE.SkinnedMesh( geometry, new THREE.MultiMaterial( materials ) );
mesh2.name = "Lil' Bro Mesh"; mesh2.name = "Lil' Bro Mesh";
mesh2.position.set( x - 240, y - bb.min.y * s, z + 500 ); mesh2.position.set( x - 240, y - bb.min.y * s, z + 500 );
mesh2.scale.set( s / 2, s / 2, s / 2 ); mesh2.scale.set( s / 2, s / 2, s / 2 );
......
...@@ -564,7 +564,7 @@ ...@@ -564,7 +564,7 @@
geometry.sortFacesByMaterialIndex(); geometry.sortFacesByMaterialIndex();
var m = new THREE.MeshFaceMaterial(), var m = new THREE.MultiMaterial(),
s = CARS[ car ].scale * 1, s = CARS[ car ].scale * 1,
r = CARS[ car ].init_rotation, r = CARS[ car ].init_rotation,
materials = CARS[ car ].materials, materials = CARS[ car ].materials,
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
materials[ 0 ].shading = THREE.FlatShading; materials[ 0 ].shading = THREE.FlatShading;
mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); mesh = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
mesh.position.x = 400; mesh.position.x = 400;
mesh.scale.x = mesh.scale.y = mesh.scale.z = 250; mesh.scale.x = mesh.scale.y = mesh.scale.z = 250;
scene.add( mesh ); scene.add( mesh );
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
materials[ 0 ].shading = THREE.FlatShading; materials[ 0 ].shading = THREE.FlatShading;
mesh2 = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); mesh2 = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
mesh2.position.x = - 400; mesh2.position.x = - 400;
mesh2.scale.x = mesh2.scale.y = mesh2.scale.z = 250; mesh2.scale.x = mesh2.scale.y = mesh2.scale.z = 250;
scene.add( mesh2 ); scene.add( mesh2 );
......
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings ); var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); var mesh = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
mesh.position.set( 50, 100, 50 ); mesh.position.set( 50, 100, 50 );
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
loader.load( 'obj/lucy/Lucy100k_bin.js', function ( geometry, materials ) { loader.load( 'obj/lucy/Lucy100k_bin.js', function ( geometry, materials ) {
addMesh( geometry, 0.75, 900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x030303, specular: 0x990000, shininess: 30 } ) ); addMesh( geometry, 0.75, 900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x030303, specular: 0x990000, shininess: 30 } ) );
addMesh( geometry, 0.75, 300, 0, 0, 0,0,0, new THREE.MeshFaceMaterial( materials ) ); addMesh( geometry, 0.75, 300, 0, 0, 0,0,0, new THREE.MultiMaterial( materials ) );
addMesh( geometry, 0.75, -300, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x111111, specular: 0xffaa00, shininess: 10 } ) ); addMesh( geometry, 0.75, -300, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x111111, specular: 0xffaa00, shininess: 10 } ) );
addMesh( geometry, 0.75, -900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x555555, specular: 0x666666, shininess: 10 } ) ); addMesh( geometry, 0.75, -900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { color: 0x555555, specular: 0x666666, shininess: 10 } ) );
......
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
} }
material = new THREE.MeshFaceMaterial( [ material = new THREE.MultiMaterial( [
new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front
new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side
] ); ] );
......
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
} }
material = new THREE.MeshFaceMaterial( [ material = new THREE.MultiMaterial( [
new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front
new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side
] ); ] );
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
} }
material = new THREE.MeshFaceMaterial( [ material = new THREE.MultiMaterial( [
new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front
new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side
] ); ] );
......
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
hackMaterials( materials ); hackMaterials( materials );
var material = new THREE.MeshFaceMaterial( materials ); var material = new THREE.MultiMaterial( materials );
mesh = new THREE.Mesh( geometry, material ); mesh = new THREE.Mesh( geometry, material );
mesh.position.set( x, y, z ); mesh.position.set( x, y, z );
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
material.morphTargets = true; material.morphTargets = true;
material.color.setHex( 0xffaaaa ); material.color.setHex( 0xffaaaa );
var faceMaterial = new THREE.MeshFaceMaterial( materials ); var faceMaterial = new THREE.MultiMaterial( materials );
for ( var i = 0; i < 729; i ++ ) { for ( var i = 0; i < 729; i ++ ) {
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
mesh.updateMatrix(); mesh.updateMatrix();
scene.add( mesh ); scene.add( mesh );
mixer.clipAction( geometry.animations[0], mesh ) mixer.clipAction( geometry.animations[0], mesh )
.setDuration( 1 ) // one second .setDuration( 1 ) // one second
.startAt( - Math.random() ) // random phase (already running) .startAt( - Math.random() ) // random phase (already running)
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
function createScene( geometry, materials, x, y, z, b ) { function createScene( geometry, materials, x, y, z, b ) {
zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); zmesh = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
zmesh.position.set( x, y, z ); zmesh.position.set( x, y, z );
zmesh.scale.set( 3, 3, 3 ); zmesh.scale.set( 3, 3, 3 );
scene.add( zmesh ); scene.add( zmesh );
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
} }
addMesh( geometry, new THREE.MeshFaceMaterial( materials ) ); addMesh( geometry, new THREE.MultiMaterial( materials ) );
particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ); particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
scene.add( particleLight ); scene.add( particleLight );
......
...@@ -572,7 +572,7 @@ ...@@ -572,7 +572,7 @@
geometry.sortFacesByMaterialIndex(); geometry.sortFacesByMaterialIndex();
var m = new THREE.MeshFaceMaterial(), var m = new THREE.MultiMaterial(),
s = CARS[ car ].scale * 1, s = CARS[ car ].scale * 1,
r = CARS[ car ].init_rotation, r = CARS[ car ].init_rotation,
materials = CARS[ car ].materials, materials = CARS[ car ].materials,
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
} }
var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); var mesh = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
mesh.scale.multiplyScalar( 100 ); mesh.scale.multiplyScalar( 100 );
scene.add( mesh ); scene.add( mesh );
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
]; ];
mesh = new THREE.Mesh( new THREE.BoxGeometry( 10000, 10000, 10000, 7, 7, 7 ), new THREE.MeshFaceMaterial( materials ) ); mesh = new THREE.Mesh( new THREE.BoxGeometry( 10000, 10000, 10000, 7, 7, 7 ), new THREE.MultiMaterial( materials ) );
mesh.scale.x = - 1; mesh.scale.x = - 1;
scene.add(mesh); scene.add(mesh);
......
...@@ -61,45 +61,45 @@ ...@@ -61,45 +61,45 @@
// //
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( -400, 0, 200 ); object.position.set( -400, 0, 200 );
scene.add( object ); scene.add( object );
objectNewGeometry = object; objectNewGeometry = object;
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( -200, 0, 200 ); object.position.set( -200, 0, 200 );
scene.add( object ); scene.add( object );
objectToggleAddRemove = object; objectToggleAddRemove = object;
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( 0, 0, 200 ); object.position.set( 0, 0, 200 );
scene.add( object ); scene.add( object );
objectRandomizeFaces = object; objectRandomizeFaces = object;
/* /*
These are not yet used but they are ready to be shown These are not yet used but they are ready to be shown
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( 200, 0, 200 ); object.position.set( 200, 0, 200 );
scene.add( object ); scene.add( object );
// //
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( -400, 0, 0 ); object.position.set( -400, 0, 0 );
scene.add( object ); scene.add( object );
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( -200, 0, 0 ); object.position.set( -200, 0, 0 );
scene.add( object ); scene.add( object );
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( 0, 0, 0 ); object.position.set( 0, 0, 0 );
scene.add( object ); scene.add( object );
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( 200, 0, 0 ); object.position.set( 200, 0, 0 );
scene.add( object ); scene.add( object );
object = createObject( createMeshFaceMaterial(), 4 ); object = createObject( createMultiMaterial(), 4 );
object.position.set( 400, 0, 0 ); object.position.set( 400, 0, 0 );
scene.add( object ); scene.add( object );
*/ */
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
return geometry; return geometry;
} }
function createMeshFaceMaterial(){ function createMultiMaterial(){
var materials = []; var materials = [];
materials.push(new THREE.MeshBasicMaterial({color: 0xff0000})); materials.push(new THREE.MeshBasicMaterial({color: 0xff0000}));
materials.push(new THREE.MeshBasicMaterial({color: 0xffff00})); materials.push(new THREE.MeshBasicMaterial({color: 0xffff00}));
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
materials.push(new THREE.MeshBasicMaterial({color: 0x00ffff})); materials.push(new THREE.MeshBasicMaterial({color: 0x00ffff}));
materials.push(new THREE.MeshBasicMaterial({color: 0x0000ff})); materials.push(new THREE.MeshBasicMaterial({color: 0x0000ff}));
materials.push(new THREE.MeshBasicMaterial({color: 0xff00ff})); materials.push(new THREE.MeshBasicMaterial({color: 0xff00ff}));
var material = new THREE.MeshFaceMaterial(materials); var material = new THREE.MultiMaterial(materials);
return material; return material;
} }
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
} }
skinnedMesh = new THREE.SkinnedMesh(geometry, new THREE.MeshFaceMaterial(materials)); skinnedMesh = new THREE.SkinnedMesh(geometry, new THREE.MultiMaterial(materials));
skinnedMesh.scale.set( 1, 1, 1 ); skinnedMesh.scale.set( 1, 1, 1 );
scene.add( skinnedMesh ); scene.add( skinnedMesh );
......
...@@ -136,7 +136,7 @@ THREE.MaterialLoader.prototype = { ...@@ -136,7 +136,7 @@ THREE.MaterialLoader.prototype = {
if ( json.aoMap !== undefined ) material.aoMap = this.getTexture( json.aoMap ); if ( json.aoMap !== undefined ) material.aoMap = this.getTexture( json.aoMap );
if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity; if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
// MeshFaceMaterial // MultiMaterial
if ( json.materials !== undefined ) { if ( json.materials !== undefined ) {
......
...@@ -252,7 +252,7 @@ THREE.Mesh.prototype.raycast = ( function () { ...@@ -252,7 +252,7 @@ THREE.Mesh.prototype.raycast = ( function () {
} else if ( geometry instanceof THREE.Geometry ) { } else if ( geometry instanceof THREE.Geometry ) {
var fvA, fvB, fvC; var fvA, fvB, fvC;
var isFaceMaterial = material instanceof THREE.MeshFaceMaterial; var isFaceMaterial = material instanceof THREE.MultiMaterial;
var materials = isFaceMaterial === true ? material.materials : null; var materials = isFaceMaterial === true ? material.materials : null;
var vertices = geometry.vertices; var vertices = geometry.vertices;
......
...@@ -251,7 +251,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) { ...@@ -251,7 +251,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
var geometry = _objects.update( object ); var geometry = _objects.update( object );
var material = object.material; var material = object.material;
if ( material instanceof THREE.MeshFaceMaterial ) { if ( material instanceof THREE.MultiMaterial ) {
var groups = geometry.groups; var groups = geometry.groups;
var materials = material.materials; var materials = material.materials;
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"src/materials/MeshPhongMaterial.js", "src/materials/MeshPhongMaterial.js",
"src/materials/MeshDepthMaterial.js", "src/materials/MeshDepthMaterial.js",
"src/materials/MeshNormalMaterial.js", "src/materials/MeshNormalMaterial.js",
"src/materials/MeshFaceMaterial.js", "src/materials/MultiMaterial.js",
"src/materials/SpriteMaterial.js", "src/materials/SpriteMaterial.js",
"src/textures/Texture.js", "src/textures/Texture.js",
"src/textures/CompressedTexture.js", "src/textures/CompressedTexture.js",
......
...@@ -53,7 +53,7 @@ How to use generated JS file in your HTML document ...@@ -53,7 +53,7 @@ How to use generated JS file in your HTML document
function createScene( geometry, materials ) { function createScene( geometry, materials ) {
var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); var mesh = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
} }
......
...@@ -53,7 +53,7 @@ How to use generated JS file in your HTML document ...@@ -53,7 +53,7 @@ How to use generated JS file in your HTML document
function createScene( geometry, materials ) { function createScene( geometry, materials ) {
var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ); var mesh = new THREE.Mesh( geometry, new THREE.MultiMaterial( materials ) );
} }
......
...@@ -132,7 +132,7 @@ function loadGeometry( data, url ) { ...@@ -132,7 +132,7 @@ function loadGeometry( data, url ) {
} }
var material = new THREE.MeshFaceMaterial( data.materials ); var material = new THREE.MultiMaterial( data.materials );
var mesh; var mesh;
if ( data.geometry.animations !== undefined && data.geometry.animations.length > 0 ) { if ( data.geometry.animations !== undefined && data.geometry.animations.length > 0 ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册