source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/src/objects/Mesh.js@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 1.5 KB
Line 
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
8THREE.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
19THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
20
21THREE.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
41THREE.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
55THREE.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};
Note: See TracBrowser for help on using the repository browser.