1 | /**
|
---|
2 | * @author mrdoob / http://mrdoob.com/
|
---|
3 | * @author alteredq / http://alteredqualia.com/
|
---|
4 | * @author mikael emtinger / http://gomo.se/
|
---|
5 | * @author jonobr1 / http://jonobr1.com/
|
---|
6 | */
|
---|
7 |
|
---|
8 | THREE.Mesh = function ( geometry, material ) {
|
---|
9 |
|
---|
10 | THREE.Object3D.call( this );
|
---|
11 |
|
---|
12 | this.geometry = geometry !== undefined ? geometry : new THREE.Geometry();
|
---|
13 | this.material = material !== undefined ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } );
|
---|
14 |
|
---|
15 | this.updateMorphTargets();
|
---|
16 |
|
---|
17 | };
|
---|
18 |
|
---|
19 | THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
|
---|
20 |
|
---|
21 | THREE.Mesh.prototype.updateMorphTargets = function () {
|
---|
22 |
|
---|
23 | if ( this.geometry.morphTargets.length > 0 ) {
|
---|
24 |
|
---|
25 | this.morphTargetBase = -1;
|
---|
26 | this.morphTargetForcedOrder = [];
|
---|
27 | this.morphTargetInfluences = [];
|
---|
28 | this.morphTargetDictionary = {};
|
---|
29 |
|
---|
30 | for ( var m = 0, ml = this.geometry.morphTargets.length; m < ml; m ++ ) {
|
---|
31 |
|
---|
32 | this.morphTargetInfluences.push( 0 );
|
---|
33 | this.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m;
|
---|
34 |
|
---|
35 | }
|
---|
36 |
|
---|
37 | }
|
---|
38 |
|
---|
39 | };
|
---|
40 |
|
---|
41 | THREE.Mesh.prototype.getMorphTargetIndexByName = function ( name ) {
|
---|
42 |
|
---|
43 | if ( this.morphTargetDictionary[ name ] !== undefined ) {
|
---|
44 |
|
---|
45 | return this.morphTargetDictionary[ name ];
|
---|
46 |
|
---|
47 | }
|
---|
48 |
|
---|
49 | console.log( "THREE.Mesh.getMorphTargetIndexByName: morph target " + name + " does not exist. Returning 0." );
|
---|
50 |
|
---|
51 | return 0;
|
---|
52 |
|
---|
53 | };
|
---|
54 |
|
---|
55 | THREE.Mesh.prototype.clone = function ( object ) {
|
---|
56 |
|
---|
57 | if ( object === undefined ) object = new THREE.Mesh( this.geometry, this.material );
|
---|
58 |
|
---|
59 | THREE.Object3D.prototype.clone.call( this, object );
|
---|
60 |
|
---|
61 | return object;
|
---|
62 |
|
---|
63 | };
|
---|