-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathprototype.js
More file actions
48 lines (30 loc) · 1012 Bytes
/
prototype.js
File metadata and controls
48 lines (30 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Uint8Array.prototype.toString = function() {
var tmp = Array( this.length );
for( var i = 0; i < this.length; i++ ) {
if( this[i] === 0 )
break;
tmp[i] = String.fromCharCode( this[i] );
}
return tmp.join('');
};
String.prototype.toUint8Array = function( len ) {
len = len ? len : this.length;
var tmp = new Uint8Array( len );
for( var i = 0; i < len; i++ ) {
tmp[i] = this.charCodeAt(i) || 0;
}
return tmp;
};
DataView.prototype.getVector3 = function( offset ) {
return new Float32Array( this.buffer.slice( offset, offset + 12 ) );
};
DataView.prototype.getString = function( offset, length ) {
return (new Uint8Array( this.buffer, offset, length )).toString();
};
window.requestAnimationFrame = window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.oRequestAnimationFrame
|| window.msRequestAnimationFrame;
window.requestFileSystem = window.requestFileSystem
|| window.webkitRequestFileSystem;