提交 5720ae4e 编写于 作者: M Mr.doob

Geometry: Removed morphColors.

上级 a5cbf885
......@@ -88,13 +88,6 @@
Morph vertices match number and order of primary vertices.
</div>
<h3>[property:Array morphColors]</h3>
<div>
Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:
<code>morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }</code>
Morph colors can match either the number and order of faces (face colors) or the number of vertices (vertex colors).
</div>
<h3>[property:Array morphNormals]</h3>
<div>
Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
......
......@@ -409,10 +409,6 @@
"!type": "[]",
"!doc": "Array of morph targets. Each morph target is a Javascript object:\n\t\t<code>{ name: \"targetName\", vertices: [ new THREE.Vector3(), ... ] }</code>\n\t\tMorph vertices match number and order of primary vertices."
},
"morphColors": {
"!type": "[]",
"!doc": "Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:\n\t\t<code>morphColor = { name: \"colorName\", colors: [ new THREE.Color(), ... ] }</code>\n\t\tMorph colors can match either the number and order of faces (face colors) or the number of vertices (vertex colors)."
},
"morphNormals": {
"!type": "[]",
"!doc": "Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:\n\t\t<code>morphNormal = { name: \"NormalName\", normals: [ new THREE.Vector3(), ... ] }</code>"
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -25,8 +25,6 @@
"morphTargets": [],
"morphColors": [],
"normals": [],
"colors": [],
此差异已折叠。
此差异已折叠。
此差异已折叠。
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -201,8 +201,6 @@
loader.load( "models/animated/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, shading: THREE.FlatShading } );
var mesh = new THREE.Mesh( geometry, material );
......@@ -248,22 +246,6 @@
}
function morphColorsToFaceColors( geometry ) {
if ( geometry.morphColors && geometry.morphColors.length ) {
var colorMap = geometry.morphColors[ 0 ];
for ( var i = 0; i < colorMap.colors.length; i ++ ) {
geometry.faces[ i ].color = colorMap.colors[ i ];
}
}
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
......
......@@ -87,12 +87,10 @@
//
var loader = new THREE.JSONLoader();
loader.load( "models/animated/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, morphTargets: true, vertexColors: THREE.FaceColors, shading: THREE.FlatShading } );
var mesh = new THREE.Mesh( geometry, material );
......@@ -110,13 +108,12 @@
loader.load( "models/animated/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
geometry.computeVertexNormals();
geometry.computeMorphNormals();
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, morphNormals: true, vertexColors: THREE.FaceColors, shading: THREE.SmoothShading } );
var mesh = new THREE.Mesh( geometry, material );
mesh.scale.set( 1.5, 1.5, 1.5 );
mesh.position.y = 150;
......@@ -154,23 +151,6 @@
}
function morphColorsToFaceColors( geometry ) {
if ( geometry.morphColors && geometry.morphColors.length ) {
var colorMap = geometry.morphColors[ 0 ];
for ( var i = 0; i < colorMap.colors.length; i ++ ) {
geometry.faces[ i ].color = colorMap.colors[ i ];
geometry.faces[ i ].color.offsetHSL( 0, 0.3, 0 );
}
}
}
//
function onWindowResize( event ) {
......
......@@ -328,35 +328,17 @@
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
morphs.push( mesh );
}
function morphColorsToFaceColors( geometry ) {
if ( geometry.morphColors && geometry.morphColors.length ) {
var colorMap = geometry.morphColors[ 0 ];
for ( var i = 0; i < colorMap.colors.length; i ++ ) {
geometry.faces[ i ].color = colorMap.colors[ i ];
}
}
}
var loader = new THREE.JSONLoader();
loader.load( "models/animated/horse.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 550, 1, 100 - Math.random() * 1000, FLOOR, 300, true );
addMorph( geometry, 550, 1, 100 - Math.random() * 1000, FLOOR, 450, true );
addMorph( geometry, 550, 1, 100 - Math.random() * 1000, FLOOR, 600, true );
......@@ -369,21 +351,18 @@
loader.load( "models/animated/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 500, 1, 500 - Math.random() * 500, FLOOR + 350, 40 );
} );
loader.load( "models/animated/stork.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 350, 1, 500 - Math.random() * 500, FLOOR + 350, 340 );
} );
loader.load( "models/animated/parrot.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 450, 0.5, 500 - Math.random() * 500, FLOOR + 300, 700 );
} );
......
......@@ -238,7 +238,7 @@
scene.add( mesh );
mixer = new THREE.AnimationMixer( scene );
// MORPHS
function addMorph( geometry, speed, duration, x, y, z, fudgeColor ) {
......@@ -255,7 +255,7 @@
mesh.speed = speed;
mixer.addAction( new THREE.AnimationAction( geometry.animations[0], Math.random() ).warpToDuration( duration ).setLocalRoot( mesh ) );
mesh.position.set( x, y, z );
mesh.rotation.y = Math.PI/2;
......@@ -268,28 +268,10 @@
}
function morphColorsToFaceColors( geometry ) {
if ( geometry.morphColors && geometry.morphColors.length ) {
var colorMap = geometry.morphColors[ 0 ];
for ( var i = 0; i < colorMap.colors.length; i ++ ) {
geometry.faces[ i ].color = colorMap.colors[ i ];
}
}
}
var loader = new THREE.JSONLoader();
loader.load( "models/animated/horse.js", function( geometry ) {
morphColorsToFaceColors( geometry );
for ( var i = - 600; i < 601; i += 2 ) {
addMorph( geometry, 550, 1, 100 - Math.random() * 3000, FLOOR, i, true );
......@@ -301,49 +283,42 @@
/*
loader.load( "obj/morphs/fox.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 200, 1000, 100 - Math.random() * 500, FLOOR - 5, 600 );
} );
loader.load( "obj/morphs/shdw3walk.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 40, 2000, -500, FLOOR + 60, 245 );
} );
loader.load( "obj/morphs/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 500, 1000, 500 - Math.random() * 500, FLOOR + 350, 40 );
} );
loader.load( "obj/morphs/stork.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 350, 1000, 500 - Math.random() * 500, FLOOR + 350, 340 );
} );
loader.load( "obj/morphs/mountainlion.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 400, 1000, 500 - Math.random() * 500, FLOOR - 5, 700 );
} );
loader.load( "obj/morphs/bearBrown.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 300, 2500, -500, FLOOR - 5, -750 );
} );
loader.load( "obj/morphs/parrot.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 450, 500, 500 - Math.random() * 500, FLOOR + 300, 700 );
} );
......
......@@ -518,29 +518,12 @@
}
function morphColorsToFaceColors( geometry ) {
if ( geometry.morphColors && geometry.morphColors.length ) {
var colorMap = geometry.morphColors[ 0 ];
for ( var i = 0; i < colorMap.colors.length; i ++ ) {
geometry.faces[ i ].color = colorMap.colors[ i ];
}
}
}
var loader = new THREE.JSONLoader();
var startX = -3000;
loader.load( "models/animated/parrot.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 250, 0.5, startX -500, 500, 700 );
addMorph( geometry, 250, 0.5, startX - Math.random() * 500, 500, -200 );
addMorph( geometry, 250, 0.5, startX - Math.random() * 500, 500, 200 );
......@@ -550,14 +533,12 @@
loader.load( "models/animated/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 500, 1, startX - Math.random() * 500, 350, 40 );
} );
loader.load( "models/animated/stork.js", function( geometry ) {
morphColorsToFaceColors( geometry );
addMorph( geometry, 350, 1, startX - Math.random() * 500, 350, 340 );
} );
......
......@@ -22,7 +22,6 @@ THREE.Geometry = function () {
this.faceVertexUvs = [ [] ];
this.morphTargets = [];
this.morphColors = [];
this.morphNormals = [];
this.skinWeights = [];
......
......@@ -477,30 +477,21 @@ THREE.JSONLoader.prototype = {
}
if ( json.morphColors !== undefined ) {
if ( json.morphColors !== undefined && json.morphColors.length > 0 ) {
var i, l, c, cl, dstColors, srcColors, color;
console.warn( 'THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.' );
for ( i = 0, l = json.morphColors.length; i < l; i ++ ) {
var faces = geometry.faces;
var morphColors = json.morphColors[ 0 ].colors;
geometry.morphColors[ i ] = {};
geometry.morphColors[ i ].name = json.morphColors[ i ].name;
geometry.morphColors[ i ].colors = [];
for ( var i = 0, l = faces.length; i < l; i ++ ) {
dstColors = geometry.morphColors[ i ].colors;
srcColors = json.morphColors[ i ].colors;
for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {
color = new THREE.Color( 0xffaa00 );
color.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] );
dstColors.push( color );
}
faces[ i ].color.fromArray( morphColors, i * 3 );
}
}
}
function parseAnimations() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册