8000 #200 - Moving three.js outside of whs build by sasha240100 · Pull Request #201 · WhitestormJS/whs.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

#200 - Moving three.js outside of whs build #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 2 additions & 15 deletions build/whitestorm.compact.js

Large diffs are not rendered by default.

22 changes: 4 additions & 18 deletions build/whitestorm.js

Large diffs are not rendered by default.

859 changes: 859 additions & 0 deletions examples/assets/vendor/three.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ html
block body

block dependencies
script(src='/assets/vendor/three.min.js')
script(src='../../../build/whitestorm.js')
block additional
script(src='../../../modules/whs-module-statsjs/build/StatsModule.js')
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"semantic-ui-less": "^2.2.9",
"snyk": "^1.25.1",
"surge": "^0.18.0",
"three": "^0.84.0",
"uglify-loader": "^1.4.0",
"webpack": "^2.2.1",
"webpack-dashboard": "^0.3.0",
Expand Down
5 changes: 3 additions & 2 deletions src/components/meshes/Parametric.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
Mesh,
ParametricBufferGeometry,
ParametricGeometry
ParametricGeometry,
Vector3
} from 'three';

import {MeshComponent} from '../../core/MeshComponent';
Expand All @@ -10,7 +11,7 @@ class Parametric extends MeshComponent {
static defaults = {
...MeshComponent.defaults,
geometry: {
func: (u, v) => new THREE.Vector3(u, v, 0),
func: (u, v) => new Vector3(u, v, 0),
slices: 10,
stacks: 10
}
Expand Down
13 changes: 12 additions & 1 deletion src/core/ModuleSystem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import {REVISION} from 'three';
import Events from 'minivents';

import {ManagerError} from './errors';

// Check for Three.js
const warnDeps = () => {
throw new Error('WhitestormJS Framework requires Three.js r74. https://threejs.org/');
};

try {
if (!REVISION) warnDeps();
} catch (err) {
warnDeps();
}

export class ModuleSystem extends Events {
// INTEGRATING

8000 Expand Down
5 changes: 0 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as THREE from 'three';

export * from './core/index';
export * from './components/lights/index';
export * from './components/cameras/index';
Expand All @@ -13,6 +11,3 @@ export * from './modules/presets/index';

// DEPRECATION
export * from './deprecation';

if (typeof window !== 'undefined') window.THREE = THREE;
else if (typeof global !== 'undefined') global.THREE = THREE;
8 changes: 5 additions & 3 deletions src/modules/app/PostProcessorModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
LinearFilter,
RGBAFormat,
WebGLRenderTarget
} from 'three';

Expand Down Expand Up @@ -45,9 +47,9 @@ export class PostProcessorModule {
size.width,
size.height,
{
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBAFormat,
minFilter: LinearFilter,
magFilter: LinearFilter,
format: RGBAFormat,
stencilBuffer: false
}
);
Expand Down
1 change: 0 additions & 1 deletion src/three.js

This file was deleted.

3 changes: 2 additions & 1 deletion test/components.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as WHS from '../src/index';
import {Mesh} from 'three';

const meshes = [
'Box',
Expand Down Expand Up @@ -61,6 +62,6 @@ test('Group', () => {
const sphere = new WHS.Sphere();
const box = new WHS.Box();

const group = new WHS.Group(sphere, box, new THREE.Mesh());
const group = new WHS.Group(sphere, box, new Mesh());
group.addTo(app);
});
31 changes: 18 additions & 13 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import HappyPack from 'happypack';
import DashboardPlugin from 'webpack-dashboard/plugin';

export function config(
{
isProduction,
src,
dest,
filename = 'whitestorm.js',
plugins = [],
compact = false,
version = require('./package.json').version
}
{
isProduction,
src,
dest,
filename = 'whitestorm.js',
plugins = [],
compact = false,
version = require('./package.json').version
}
) {
if (process.env.CI) isProduction = true;
console.log(`Mode: ${isProduction ? 'production' : 'development'}`);
Expand Down Expand Up @@ -47,6 +47,14 @@ export function config(
}
]
},
externals: {
three: {
commonjs: 'three',
commonjs2: 'three',
amd: 'three',
root: 'THREE'
}
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: isProduction,
Expand Down Expand Up @@ -81,10 +89,7 @@ export function config(
modules: [
path.resolve(__dirname, 'node_modules'),
src
],
alias: {
three$: path.join(__dirname, './node_modules/three/build/three.module.js')
}
]
}
};
}
Expand Down
0