File tree Expand file tree Collapse file tree 7 files changed +57
-11
lines changed Expand file tree Collapse file tree 7 files changed +57
-11
lines changed Original file line number Diff line number Diff line change 11{
2- "name" : " three" ,
3- "version" : " 0.137.5 " ,
2+ "name" : " @oppentech/ three" ,
3+ "version" : " 0.137.0 " ,
44 "description" : " JavaScript 3D library" ,
55 "type" : " module" ,
66 "main" : " ./build/three.js" ,
1616 },
1717 "repository" : {
1818 "type" : " git" ,
19- "url" : " https://github.com/mrdoob /three.js"
19+ "url" : " https://github.com/oppenfuture /three.js"
2020 },
21- "sideEffects" : false ,
21+ "sideEffects" : [
22+ " src/Three.js"
23+ ],
2224 "files" : [
2325 " build/three.js" ,
2426 " build/three.cjs" ,
118120 "author" : " mrdoob" ,
119121 "license" : " MIT" ,
120122 "bugs" : {
121- "url" : " https://github.com/mrdoob /three.js/issues"
123+ "url" : " https://github.com/oppenfuture /three.js/issues"
122124 },
123125 "homepage" : " https://threejs.org/" ,
124126 "devDependencies" : {
Original file line number Diff line number Diff line change 11import { REVISION } from './constants.js' ;
22
3+ export { platform } from './platform.js' ;
34export { WebGLMultipleRenderTargets } from './renderers/WebGLMultipleRenderTargets.js' ;
45export { WebGLMultisampleRenderTarget } from './renderers/WebGLMultisampleRenderTarget.js' ;
56export { WebGLCubeRenderTarget } from './renderers/WebGLCubeRenderTarget.js' ;
Original file line number Diff line number Diff line change 11let _context ;
22
3+ import { platform } from '../platform.js' ;
4+
35const AudioContext = {
46
57 getContext : function ( ) {
68
79 if ( _context === undefined ) {
810
9- _context = new ( window . AudioContext || window . webkitAudioContext ) ( ) ;
11+ _context = new platform . AudioContext ( ) ;
1012
1113 }
1214
Original file line number Diff line number Diff line change 11import { Cache } from './Cache.js' ;
22import { Loader } from './Loader.js' ;
3+ import { platform } from '../platform.js' ;
34
45const loading = { } ;
56
@@ -63,8 +64,8 @@ class FileLoader extends Loader {
6364 } ) ;
6465
6566 // create request
66- const req = new Request ( url , {
67- headers : new Headers ( this . requestHeader ) ,
67+ const req = new platform . Request ( url , {
68+ headers : new platform . Headers ( this . requestHeader ) ,
6869 credentials : this . withCredentials ? 'include' : 'same-origin' ,
6970 // An abort controller could be added within a future PR
7071 } ) ;
@@ -74,7 +75,7 @@ class FileLoader extends Loader {
7475 const responseType = this . responseType ;
7576
7677 // start the fetch
77- fetch ( req )
78+ platform . fetch ( req )
7879 . then ( response => {
7980
8081 if ( response . status === 200 || response . status === 0 ) {
Original file line number Diff line number Diff line change 1+ const platform = {
2+
3+ updateplatform ( params ) {
4+
5+ this . AudioContext = params . AudioContext ;
6+ this . fetch = params . fetch ;
7+ this . Request = params . Request ;
8+ this . Headers = params . Headers ;
9+ this . createElementNS = params . createElementNS ;
10+ this . animationContext = {
11+
12+ requestAnimationFrame : params . requestAnimationFrame ,
13+ cancelAnimationFrame : params . cancelAnimationFrame ,
14+
15+ } ;
16+
17+ }
18+
19+ } ;
20+
21+ if ( typeof window !== 'undefined' && typeof window . window !== 'undefined' ) {
22+
23+ platform . updateplatform ( {
24+
25+ AudioContext : ( window . AudioContext || window . webkitAudioContext ) . bind ( window ) ,
26+ fetch : window . fetch . bind ( window ) ,
27+ Request : window . Request . bind ( window ) ,
28+ Headers : window . Headers . bind ( window ) ,
29+ createElementNS : document . createElementNS . bind ( document ) ,
30+ requestAnimationFrame : window . requestAnimationFrame . bind ( window ) ,
31+ cancelAnimationFrame : window . cancelAnimationFrame . bind ( window ) ,
32+
33+ } ) ;
34+
35+ }
36+
37+ export { platform } ;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 NearestFilter ,
1414 ClampToEdgeWrapping
1515} from '../constants.js' ;
16+ import { platform } from '../platform.js' ;
1617import { Frustum } from '../math/Frustum.js' ;
1718import { Matrix4 } from '../math/Matrix4.js' ;
1819import { Vector3 } from '../math/Vector3.js' ;
@@ -880,7 +881,7 @@ function WebGLRenderer( parameters = {} ) {
880881 const animation = new WebGLAnimation ( ) ;
881882 animation . setAnimationLoop ( onAnimationFrame ) ;
882883
883- if ( typeof window !== 'undefined' ) animation . setContext ( window ) ;
884+ animation . setContext ( platform . animationContext ) ;
884885
885886 this . setAnimationLoop = function ( callback ) {
886887
Original file line number Diff line number Diff line change 1+ import { platform } from './platform.js' ;
2+
13function arrayMin ( array ) {
24
35 if ( array . length === 0 ) return Infinity ;
@@ -64,7 +66,7 @@ function getTypedArray( type, buffer ) {
6466
6567function createElementNS ( name ) {
6668
67- return document . createElementNS ( 'http://www.w3.org/1999/xhtml' , name ) ;
69+ return platform . createElementNS ( 'http://www.w3.org/1999/xhtml' , name ) ;
6870
6971}
7072
You can’t perform that action at this time.
0 commit comments