Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"scripts": {
"build": "rollup -c",
"build-test": "rollup -c test/rollup.unit.config.js",
"build-uglify": "rollup -c rollup.uglify.config.js",
"build-closure": "rollup -c && java -jar node_modules/google-closure-compiler/compiler.jar --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs utils/build/externs.js --language_in=ECMASCRIPT5_STRICT --js build/three.js --js_output_file build/three.min.js",
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c -w -m inline\" \"http-server -c-1 -p 8080\"",
"dev-test": "concurrently --names \"ROLLUP,ROLLUPTEST,HTTP\" -c \"bgBlue.bold,bgRed.bold,bgGreen.bold\" \"rollup -c -w -m inline\" \"rollup -c test/rollup.unit.config.js -w -m inline\" \"http-server -p 8080\"",
Expand All @@ -50,14 +51,23 @@
},
"homepage": "https://threejs.org/",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"concurrently": "^4.0.1",
"electron": "^2.0.8",
"eslint": "^5.5.0",
"eslint-config-mdcs": "^4.2.3",
"google-closure-compiler": "20180805.0.0",
"http-server": "^0.11.1",
"qunit": "^2.6.2",
"rollup": "^0.65.0"
"qunit": "^2.6.1",
"rollup": "^0.63.5",
"rollup-watch": "^4.3.1",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-eslint": "^5.0.0",
"rollup-plugin-three-glsl": "^1.0.1",
"rollup-plugin-uglify": "^5.0.2",
"uglify-js": "^3.3.28"
},
"jspm": {
"files": [
Expand All @@ -70,4 +80,4 @@
],
"directories": {}
}
}
}
40 changes: 14 additions & 26 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
function glsl() {

return {

transform( code, id ) {

if ( /\.glsl$/.test( id ) === false ) return;

var transformedCode = 'export default ' + JSON.stringify(
code
.replace( /[ \t]*\/\/.*\n/g, '' ) // remove //
.replace( /[ \t]*\/\*[\s\S]*?\*\//g, '' ) // remove /* */
.replace( /\n{2,}/g, '\n' ) // # \n+ to \n
) + ';';
return {
code: transformedCode,
map: { mappings: '' }
};

}

};

}
import babel from 'rollup-plugin-babel';
import { eslint } from 'rollup-plugin-eslint';
import { glsl } from 'rollup-plugin-three-glsl';

export default {
input: 'src/Three.js',
plugins: [
glsl()
glsl(),
eslint( {
include: '**/*.js'
} ),
babel( {
babelrc: false,
'plugins': [
'external-helpers'
],
presets: [[ 'env', { modules: false } ]]
} )
],
// sourceMap: true,
output: [
{
format: 'umd',
Expand Down
33 changes: 33 additions & 0 deletions rollup.uglify.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import { eslint } from 'rollup-plugin-eslint';
import { glsl } from 'rollup-plugin-three-glsl';

console.log( glsl );

export default {
input: 'src/Three.js',
plugins: [
glsl(),
eslint( {
include: '**/*.js'
} ),
babel( {
babelrc: false,
'plugins': [
'external-helpers'
],
presets: [[ 'env', { modules: false } ]]
} ),
uglify()
],
output: [
{
sourcemap: true,
format: 'umd',
name: 'THREE',
file: 'build/three.min.js',
indent: '\t'
}
]
};
4 changes: 2 additions & 2 deletions src/renderers/webvr/WebXRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function WebXRManager( renderer ) {
this.setDevice = function ( value ) {

if ( value !== undefined ) device = value;
if ( value instanceof XRDevice ) gl.setCompatibleXRDevice( value );
if ( value instanceof window.XRDevice ) gl.setCompatibleXRDevice( value );

};

Expand Down Expand Up @@ -111,7 +111,7 @@ function WebXRManager( renderer ) {
session.addEventListener( 'selectend', onSessionEvent );
session.addEventListener( 'end', onSessionEnd );

session.baseLayer = new XRWebGLLayer( session, gl );
session.baseLayer = new window.XRWebGLLayer( session, gl );
session.requestFrameOfReference( frameOfReferenceType ).then( function ( value ) {

frameOfReference = value;
Expand Down