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

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

GUI front-end to server base plus web page content

File size: 5.5 KB
Line 
1/**
2 * @author mrdoob / http://mrdoob.com/
3 * @author Larry Battle / http://bateru.com/news
4 * @author bhouston / http://exocortex.com
5 */
6
7var THREE = { REVISION: '65' };
8
9self.console = self.console || {
10
11 info: function () {},
12 log: function () {},
13 debug: function () {},
14 warn: function () {},
15 error: function () {}
16
17};
18
19String.prototype.trim = String.prototype.trim || function () {
20
21 return this.replace( /^\s+|\s+$/g, '' );
22
23};
24
25// based on https://github.com/documentcloud/underscore/blob/bf657be243a075b5e72acc8a83e6f12a564d8f55/underscore.js#L767
26THREE.extend = function ( obj, source ) {
27
28 // ECMAScript5 compatibility based on: http://www.nczonline.net/blog/2012/12/11/are-your-mixins-ecmascript-5-compatible/
29 if ( Object.keys ) {
30
31 var keys = Object.keys( source );
32
33 for (var i = 0, il = keys.length; i < il; i++) {
34
35 var prop = keys[i];
36 Object.defineProperty( obj, prop, Object.getOwnPropertyDescriptor( source, prop ) );
37
38 }
39
40 } else {
41
42 var safeHasOwnProperty = {}.hasOwnProperty;
43
44 for ( var prop in source ) {
45
46 if ( safeHasOwnProperty.call( source, prop ) ) {
47
48 obj[prop] = source[prop];
49
50 }
51
52 }
53
54 }
55
56 return obj;
57
58};
59
60// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
61// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
62
63// requestAnimationFrame polyfill by Erik Möller
64// fixes from Paul Irish and Tino Zijdel
65// using 'self' instead of 'window' for compatibility with both NodeJS and IE10.
66( function () {
67
68 var lastTime = 0;
69 var vendors = [ 'ms', 'moz', 'webkit', 'o' ];
70
71 for ( var x = 0; x < vendors.length && !self.requestAnimationFrame; ++ x ) {
72
73 self.requestAnimationFrame = self[ vendors[ x ] + 'RequestAnimationFrame' ];
74 self.cancelAnimationFrame = self[ vendors[ x ] + 'CancelAnimationFrame' ] || self[ vendors[ x ] + 'CancelRequestAnimationFrame' ];
75
76 }
77
78 if ( self.requestAnimationFrame === undefined && self['setTimeout'] !== undefined ) {
79
80 self.requestAnimationFrame = function ( callback ) {
81
82 var currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) );
83 var id = self.setTimeout( function() { callback( currTime + timeToCall ); }, timeToCall );
84 lastTime = currTime + timeToCall;
85 return id;
86
87 };
88
89 }
90
91 if( self.cancelAnimationFrame === undefined && self['clearTimeout'] !== undefined ) {
92
93 self.cancelAnimationFrame = function ( id ) { self.clearTimeout( id ) };
94
95 }
96
97}() );
98
99// GL STATE CONSTANTS
100
101THREE.CullFaceNone = 0;
102THREE.CullFaceBack = 1;
103THREE.CullFaceFront = 2;
104THREE.CullFaceFrontBack = 3;
105
106THREE.FrontFaceDirectionCW = 0;
107THREE.FrontFaceDirectionCCW = 1;
108
109// SHADOWING TYPES
110
111THREE.BasicShadowMap = 0;
112THREE.PCFShadowMap = 1;
113THREE.PCFSoftShadowMap = 2;
114
115// MATERIAL CONSTANTS
116
117// side
118
119THREE.FrontSide = 0;
120THREE.BackSide = 1;
121THREE.DoubleSide = 2;
122
123// shading
124
125THREE.NoShading = 0;
126THREE.FlatShading = 1;
127THREE.SmoothShading = 2;
128
129// colors
130
131THREE.NoColors = 0;
132THREE.FaceColors = 1;
133THREE.VertexColors = 2;
134
135// blending modes
136
137THREE.NoBlending = 0;
138THREE.NormalBlending = 1;
139THREE.AdditiveBlending = 2;
140THREE.SubtractiveBlending = 3;
141THREE.MultiplyBlending = 4;
142THREE.CustomBlending = 5;
143
144// custom blending equations
145// (numbers start from 100 not to clash with other
146// mappings to OpenGL constants defined in Texture.js)
147
148THREE.AddEquation = 100;
149THREE.SubtractEquation = 101;
150THREE.ReverseSubtractEquation = 102;
151
152// custom blending destination factors
153
154THREE.ZeroFactor = 200;
155THREE.OneFactor = 201;
156THREE.SrcColorFactor = 202;
157THREE.OneMinusSrcColorFactor = 203;
158THREE.SrcAlphaFactor = 204;
159THREE.OneMinusSrcAlphaFactor = 205;
160THREE.DstAlphaFactor = 206;
161THREE.OneMinusDstAlphaFactor = 207;
162
163// custom blending source factors
164
165//THREE.ZeroFactor = 200;
166//THREE.OneFactor = 201;
167//THREE.SrcAlphaFactor = 204;
168//THREE.OneMinusSrcAlphaFactor = 205;
169//THREE.DstAlphaFactor = 206;
170//THREE.OneMinusDstAlphaFactor = 207;
171THREE.DstColorFactor = 208;
172THREE.OneMinusDstColorFactor = 209;
173THREE.SrcAlphaSaturateFactor = 210;
174
175
176// TEXTURE CONSTANTS
177
178THREE.MultiplyOperation = 0;
179THREE.MixOperation = 1;
180THREE.AddOperation = 2;
181
182// Mapping modes
183
184THREE.UVMapping = function () {};
185
186THREE.CubeReflectionMapping = function () {};
187THREE.CubeRefractionMapping = function () {};
188
189THREE.SphericalReflectionMapping = function () {};
190THREE.SphericalRefractionMapping = function () {};
191
192// Wrapping modes
193
194THREE.RepeatWrapping = 1000;
195THREE.ClampToEdgeWrapping = 1001;
196THREE.MirroredRepeatWrapping = 1002;
197
198// Filters
199
200THREE.NearestFilter = 1003;
201THREE.NearestMipMapNearestFilter = 1004;
202THREE.NearestMipMapLinearFilter = 1005;
203THREE.LinearFilter = 1006;
204THREE.LinearMipMapNearestFilter = 1007;
205THREE.LinearMipMapLinearFilter = 1008;
206
207// Data types
208
209THREE.UnsignedByteType = 1009;
210THREE.ByteType = 1010;
211THREE.ShortType = 1011;
212THREE.UnsignedShortType = 1012;
213THREE.IntType = 1013;
214THREE.UnsignedIntType = 1014;
215THREE.FloatType = 1015;
216
217// Pixel types
218
219//THREE.UnsignedByteType = 1009;
220THREE.UnsignedShort4444Type = 1016;
221THREE.UnsignedShort5551Type = 1017;
222THREE.UnsignedShort565Type = 1018;
223
224// Pixel formats
225
226THREE.AlphaFormat = 1019;
227THREE.RGBFormat = 1020;
228THREE.RGBAFormat = 1021;
229THREE.LuminanceFormat = 1022;
230THREE.LuminanceAlphaFormat = 1023;
231
232// Compressed texture formats
233
234THREE.RGB_S3TC_DXT1_Format = 2001;
235THREE.RGBA_S3TC_DXT1_Format = 2002;
236THREE.RGBA_S3TC_DXT3_Format = 2003;
237THREE.RGBA_S3TC_DXT5_Format = 2004;
238
239/*
240// Potential future PVRTC compressed texture formats
241THREE.RGB_PVRTC_4BPPV1_Format = 2100;
242THREE.RGB_PVRTC_2BPPV1_Format = 2101;
243THREE.RGBA_PVRTC_4BPPV1_Format = 2102;
244THREE.RGBA_PVRTC_2BPPV1_Format = 2103;
245*/
Note: See TracBrowser for help on using the repository browser.