Skip to content
Browse files

Wagner moved to plugins. Fixed #53

  • Loading branch information...
1 parent b4d7018 commit 937c4293e5f6484f22e10bb2ea2a84a1647d2134 @sasha240100 sasha240100 committed
View
1 CHANGELOG.md
@@ -22,6 +22,7 @@
- _process in start()
- *this.update -> this._update*
- _initScene()
+- #53: Wagner moved to plugins.
**v0.0.7**
- Fixed #16 "object.assign() chrome bug."
View
167 build/whitestorm.js
@@ -2680,14 +2680,12 @@ WHS.init = function() {
if (!THREE) console.warn('whitestormJS requires THREE.js. {Object} THREE not found.');
if (!Physijs) console.warn('whitestormJS requires PHYSI.js. {Object} Physijs not found.');
- if (!WAGNER) console.warn('whitestormJS requires WAGNER.js. {Object} WAGNER not found.');
var target = api.extend(params, {
anaglyph: false,
helper: false,
stats: false,
- wagner: true,
autoresize: false,
shadowmap: true,
@@ -4136,171 +4134,6 @@ WHS.init.prototype.SpotLight = function(params) {
};
/**
- * Wagner.
- *
- * @param {Object} type Type of wagner effect. (REQUIRED)
- * @param {Object} params Parameters. (OPTIONAL)
- * @return {Object} Scope.
- */
-WHS.init.prototype.addWagner = function(type, params) {
-
- 'use strict';
-
- params = params || {};
-
- var scope = {
- _composer: this._composer
- };
-
- var target = api.extend(params, {
- hex: 0x000000,
- near: 0.015,
- far: 1000,
- density: 0.00025
- });
-
- switch (type) {
- case "ZoomBlurPass":
- scope.effect = new WAGNER.ZoomBlurPass();
-
- target = api.extend(target, {
- strength: .05,
-
- center: {
- x: .5 * this._composer.width,
- y: .5 * this._composer.height
- }
- });
-
- break;
-
- case "MultiPassBloomPass":
- scope.effect = new WAGNER.MultiPassBloomPass();
-
- target = api.extend(target, {
- strength: .5,
- blurAmount: 1.32,
- applyZoomBlur: true,
- zoomBlurStrength: 0.84,
- useTexture: true,
-
- center: {
- x: .5 * this._composer.width,
- y: .5 * this._composer.height
- }
- });
-
- scope.effect.glowTexture = WAGNER.Pass.prototype.getOfflineTexture(this._composer.width, this._composer.height, false);
-
- break;
-
- case "VignettePass":
- scope.effect = new WAGNER.VignettePass();
-
- target = api.extend(target, {
- amount: 0.7,
- falloff: 0.2
- });
-
- break;
-
- case "DirectionalBlurPass":
- scope.effect = new WAGNER.DirectionalBlurPass();
-
- target = api.extend(target, {
- delta: 0.1
- });
-
- break;
-
- case "MotionBlurPass":
- scope.effect = new WAGNER.DirectionalBlurPass();
-
- scope.motionBlurEnable = true;
-
- target = api.extend(target, {
- delta: 0
- });
-
- break;
-
- case "ASCIIPass":
- scope.effect = new WAGNER.ASCIIPass();
-
- break;
-
- case "DotScreenPass":
- scope.effect = new WAGNER.DotScreenPass();
-
- break;
-
- case "FxaaPass":
- scope.effect = new WAGNER.FXAAPass();
-
- break;
-
- case "ChromaticAberrationPass":
- scope.effect = new WAGNER.ChromaticAberrationPass();
-
- break;
-
- case "DirtPass":
- scope.effect = new WAGNER.DirtPass();
-
- break;
-
- case "EdgeDetectionPass":
- scope.effect = new WAGNER.SobelEdgeDetectionPass();
-
- break;
-
- case "HighPassPass":
- scope.effect = new WAGNER.HighPassPass();
-
- break;
-
- case "GrayscalePass":
- scope.effect = new WAGNER.GrayscalePass();
-
- break;
-
- case "HalftonePass":
- scope.effect = new WAGNER.HalftonePass();
-
- break;
-
- case "InvertPass":
- scope.effect = new WAGNER.InvertPass();
-
- break;
-
- default:
- console.warn("No Wagner effect \"" + type + "\" exists. If it should exist, open an issue. (@addWagner)");
-
- return;
- }
-
- scope.effect.params = target;
-
- this._composer.stack.addPass(type, true, target);
-
- return scope;
-};
-
-WHS.init.prototype.initWagner = function() {
-
- this._composer = new WAGNER.Composer(this._renderer);
-
- this._composer.setSize(this._settings.rWidth, this._settings.rHeight);
- this._composer.autoClearColor = true;
-
- this._composer.reset();
- this._composer.render(this.scene, this._camera);
-
- this._composer.stack = new WAGNER.Stack(new WAGNER.ShadersPool());
-};
-
-/**
* MAKEFIRSTPERSON.
*
* @param {Object} object *WHS* figure/object. (REQUIRED)
View
6 build/whitestorm.min.js
3 additions, 3 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
6 build/whitestorm.test.js
3 additions, 3 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
5 examples/basic.html
@@ -24,8 +24,6 @@
<meta name="msapplication-square150x150logo" content="../development/art/logo/Icon-72@2.png" />
<script src="../libs/three.js"></script>
<script src="../libs/physi.js"></script>
- <script src="../libs/Wagner.js"></script>
- <script src="../libs/Wagner.base.js"></script>
<script src="plugins/whs.preload.js"></script>
<style>
/* Preloading animation */
@@ -102,10 +100,7 @@
var GAME = new WHS.init({
- anaglyph: false,
- helper: true,
stats: "fps", // fps, ms, mb
- wagner: WAGNER,
autoresize: true,
gravity: {
View
5 examples/basic_material.html
@@ -24,8 +24,6 @@
<meta name="msapplication-square150x150logo" content="../development/art/logo/Icon-72@2.png" />
<script src="../libs/three.js"></script>
<script src="../libs/physi.js"></script>
- <script src="../libs/Wagner.js"></script>
- <script src="../libs/Wagner.base.js"></script>
<script src="plugins/whs.preload.js"></script>
<style>
@@ -103,10 +101,7 @@
var GAME = new WHS.init({
- anaglyph: false,
- helper: true,
stats: "fps", // fps, ms, mb
- wagner: WAGNER,
autoresize: true,
gravity: {
View
4 examples/basic_model.html
@@ -24,8 +24,6 @@
<meta name="msapplication-square150x150logo" content="../development/art/logo/Icon-72@2.png" />
<script src="../libs/three.js"></script>
<script src="../libs/physi.js"></script>
- <script src="../libs/Wagner.js"></script>
- <script src="../libs/Wagner.base.js"></script>
<script src="plugins/whs.preload.js"></script>
<style>
/* Preloading animation */
@@ -102,9 +100,7 @@
var GAME = new WHS.init({
- anaglyph: false,
stats: "fps", // fps, ms, mb
- wagner: WAGNER,
autoresize: true,
gravity: {
View
1 examples/fps.html
@@ -119,6 +119,7 @@
<script src="assets/terrain/default_terrain.js"></script>
<script src="../build/whitestorm.js" defer></script>
+ <script src="plugins/whs.wagner.js" defer></script>
<script src="plugins/whs.preload.js" defer></script>
<script src="js/game.js" defer></script>
</body>
View
13 examples/js/game.js
@@ -2,10 +2,8 @@ var preloader = Preloader();
// INITIALIZATION SCENE.
var GAME = new WHS.init( {
- anaglyph: false,
- //helper: true,
+
stats: "fps", // fps, ms, mb
- wagner: true,
autoresize: true,
gravity: {
@@ -183,11 +181,12 @@ GAME.person = GAME.Sphere( {
} );
-GAME.initWagner();
-
// EFFECTS.
-var zoomEffect = GAME.addWagner( "ZoomBlurPass", {} );
-var vignettePass = GAME.addWagner( "VignettePass", {} );
+var effects = GAME.Wagner();
+
+effects.add( "ZoomBlurPass", {} );
+effects.add( "VignettePass", {} );
+
//var directionalblurEffect = GAME.addWagner( "motionBlurPass", {} ).apply();
GAME.MakeFirstPerson( GAME.person, { // *WHS* object, Pointer lock controls object, Jquery blocker div selector.
View
4 examples/plugin_example.html
@@ -24,8 +24,6 @@
<meta name="msapplication-square150x150logo" content="../development/art/logo/Icon-72@2.png" />
<script src="../libs/three.js"></script>
<script src="../libs/physi.js"></script>
- <script src="../libs/Wagner.js"></script>
- <script src="../libs/Wagner.base.js"></script>
<script src="plugins/whs.preload.js"></script>
<style>
/* Preloading animation */
@@ -180,9 +178,7 @@
var GAME = new WHS.init({
- anaglyph: false,
stats: "fps", // fps, ms, mb
- wagner: WAGNER,
autoresize: true,
gravity: {
View
2 examples/plugins/whs.preload.js
@@ -15,7 +15,7 @@ var Preloader = function() {
done: function() {
console.log("Objects loaded!");
- setTimeout(function() {scope.element.fadeOut("slow")}, 1000);
+ setTimeout(function() { scope.element.fadeOut(1) }, 1000);
},
check: function(...objects) {
View
205 examples/plugins/whs.wagner.js
@@ -0,0 +1,205 @@
+"use strict";
+
+var _createClass = function() {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+ return function(Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+}();
+
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
+
+/**
+ * © Alexander Buzin, 2014-2015
+ * Site: http://alexbuzin.me/
+ * Email: alexbuzin88@gmail.com
+ */
+
+/**
+ * Wagner.
+ *
+ * @param {Object} type Type of wagner effect. (REQUIRED)
+ * @param {Object} params Parameters. (OPTIONAL)
+ * @return {Object} Scope.
+ */
+
+WHS.Wagner = function() {
+ function Wagner(scope) {
+ _classCallCheck(this, Wagner);
+
+ scope._composer = new WAGNER.Composer(scope._renderer);
+
+ scope._composer.setSize(scope._settings.rWidth, scope._settings.rHeight);
+ scope._composer.autoClearColor = true;
+
+ scope._composer.reset();
+ scope._composer.render(scope.scene, scope._camera);
+
+ scope._composer.stack = new WAGNER.Stack(new WAGNER.ShadersPool());
+
+ this._settings = {
+ composer: scope._composer
+ };
+ }
+
+ _createClass(Wagner, [{
+ key: "add",
+ value: function add(type, params) {
+
+ 'use strict';
+
+ var target = api.extend(params, {
+ hex: 0x000000,
+ near: 0.015,
+ far: 1000,
+ density: 0.00025
+ });
+
+ switch (type) {
+ case "ZoomBlurPass":
+
+ target = api.extend(target, {
+ strength: .05,
+
+ center: {
+ x: .5 * this._settings.composer.width,
+ y: .5 * this._settings.composer.height
+ }
+ });
+
+ break;
+
+ case "MultiPassBloomPass":
+
+ target = api.extend(target, {
+ strength: .5,
+ blurAmount: 1.32,
+ applyZoomBlur: true,
+ zoomBlurStrength: 0.84,
+ useTexture: true,
+
+ center: {
+ x: .5 * this._settings.composer.width,
+ y: .5 * this._settings.composer.height
+ }
+ });
+
+ break;
+
+ case "VignettePass":
+
+ target = api.extend(target, {
+ amount: 0.7,
+ falloff: 0.2
+ });
+
+ break;
+
+ case "DirectionalBlurPass":
+
+ target = api.extend(target, {
+ delta: 0.1
+ });
+
+ break;
+
+ case "MotionBlurPass":
+
+ target = api.extend(target, {
+ delta: 0
+ });
+
+ break;
+
+ case "ASCIIPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "DotScreenPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "FxaaPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "ChromaticAberrationPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "DirtPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "EdgeDetectionPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "HighPassPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "GrayscalePass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "HalftonePass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ case "InvertPass":
+
+ // TODO: Params defaults for this effect.
+
+ break;
+
+ default:
+ console.warn("No Wagner effect \"" + type + "\" exists. If it should exist, open an issue. (@addWagner)");
+
+ return;
+ }
+
+ this._settings.composer.stack.addPass(type, true, target);
+
+ return this;
+ }
+ }]);
+
+ return Wagner;
+}();
+
+WHS.init.prototype.Wagner = function() {
+ return new WHS.Wagner(this);
+};
View
5 examples/skybox.html
@@ -24,8 +24,6 @@
<meta name="msapplication-square150x150logo" content="../development/art/logo/Icon-72@2.png" />
<script src="../libs/three.js"></script>
<script src="../libs/physi.js"></script>
- <script src="../libs/Wagner.js"></script>
- <script src="../libs/Wagner.base.js"></script>
<script src="plugins/whs.preload.js"></script>
<style>
/* Preloading animation */
@@ -101,10 +99,7 @@
var GAME = new WHS.init({
- anaglyph: false,
- helper: true,
stats: "fps", // fps, ms, mb
- wagner: WAGNER,
autoresize: true,
gravity: {
View
7 examples/stone_wall.html
@@ -24,8 +24,6 @@
<meta name="msapplication-square150x150logo" content="../development/art/logo/Icon-72@2.png" />
<script src="../libs/three.js"></script>
<script src="../libs/physi.js"></script>
- <script src="../libs/Wagner.js"></script>
- <script src="../libs/Wagner.base.js"></script>
<script src="plugins/whs.preload.js"></script>
<style>
/* Preloading animation */
@@ -101,11 +99,8 @@
var preloader = Preloader();
var GAME = new WHS.init({
-
- anaglyph: false,
- helper: true,
+
stats: "fps", // fps, ms, mb
- wagner: WAGNER,
autoresize: true,
gravity: {
View
3 gulpfile.js
@@ -23,7 +23,6 @@ var sources = [
'src/Ground/*.js',
'src/Fog/*.js',
'src/Light/*.js',
- 'src/Wagner/*.js',
'src/Controls/*.js',
'src/GUI/*.js',
'src/Skybox/*.js'
@@ -43,7 +42,6 @@ var sources_test = [
'src/Ground/*.js',
'src/Fog/*.js',
'src/Light/*.js',
- 'src/Wagner/*.js',
'src/Controls/*.js',
'src/GUI/*.js',
'src/Skybox/*.js'
@@ -60,7 +58,6 @@ var codes = [
'src/Ground/*.js',
'src/Fog/*.js',
'src/Light/*.js',
- 'src/Wagner/*.js',
'src/Controls/*.js',
'src/GUI/*.js',
'src/Skybox/*.js'
View
5 src/Core.js
@@ -12,7 +12,7 @@
*/
WHS.init = class {
- constructor (params) {
+ constructor( params ) {
'use strict';
@@ -22,15 +22,12 @@ WHS.init = class {
console.warn('whitestormJS requires THREE.js. {Object} THREE not found.');
if (!Physijs)
console.warn('whitestormJS requires PHYSI.js. {Object} Physijs not found.');
- if (!WAGNER)
- console.warn('whitestormJS requires WAGNER.js. {Object} WAGNER not found.');
var target = api.extend(params, {
anaglyph: false,
helper: false,
stats: false,
- wagner: true,
autoresize: false,
shadowmap: true,
View
172 src/Wagner/AddWagner.js
@@ -1,172 +0,0 @@
-/**
- * © Alexander Buzin, 2014-2015
- * Site: http://alexbuzin.me/
- * Email: alexbuzin88@gmail.com
-*/
-
-/**
- * Wagner.
- *
- * @param {Object} type Type of wagner effect. (REQUIRED)
- * @param {Object} params Parameters. (OPTIONAL)
- * @return {Object} Scope.
- */
-WHS.init.prototype.addWagner = function( type, params ) {
-
- 'use strict';
-
- params = params || {};
-
- var scope = {
- _composer: this._composer
- };
-
- var target = api.extend(params, {
- hex: 0x000000,
- near: 0.015,
- far: 1000,
- density: 0.00025
- });
-
- switch (type) {
- case "ZoomBlurPass":
- scope.effect = new WAGNER.ZoomBlurPass();
-
- target = api.extend(target, {
- strength: .05,
-
- center: {
- x: .5 * this._composer.width,
- y: .5 * this._composer.height
- }
- });
-
- break;
-
- case "MultiPassBloomPass":
- scope.effect = new WAGNER.MultiPassBloomPass();
-
- target = api.extend(target, {
- strength: .5,
- blurAmount: 1.32,
- applyZoomBlur: true,
- zoomBlurStrength: 0.84,
- useTexture: true,
-
- center: {
- x: .5 * this._composer.width,
- y: .5 * this._composer.height
- }
- });
-
- scope.effect.glowTexture = WAGNER.Pass.prototype.getOfflineTexture(
- this._composer.width,
- this._composer.height,
- false
- );
-
- break;
-
- case "VignettePass":
- scope.effect = new WAGNER.VignettePass();
-
- target = api.extend(target, {
- amount: 0.7,
- falloff: 0.2
- });
-
- break;
-
- case "DirectionalBlurPass":
- scope.effect = new WAGNER.DirectionalBlurPass();
-
- target = api.extend(target, { delta: 0.1 });
-
- break;
-
- case "MotionBlurPass":
- scope.effect = new WAGNER.DirectionalBlurPass();
-
- scope.motionBlurEnable = true;
-
- target = api.extend(target, { delta: 0 });
-
- break;
-
- case "ASCIIPass":
- scope.effect = new WAGNER.ASCIIPass();
-
- break;
-
- case "DotScreenPass":
- scope.effect = new WAGNER.DotScreenPass();
-
- break;
-
- case "FxaaPass":
- scope.effect = new WAGNER.FXAAPass();
-
- break;
-
- case "ChromaticAberrationPass":
- scope.effect = new WAGNER.ChromaticAberrationPass();
-
- break;
-
- case "DirtPass":
- scope.effect = new WAGNER.DirtPass();
-
- break;
-
- case "EdgeDetectionPass":
- scope.effect = new WAGNER.SobelEdgeDetectionPass();
-
- break;
-
- case "HighPassPass":
- scope.effect = new WAGNER.HighPassPass();
-
- break;
-
- case "GrayscalePass":
- scope.effect = new WAGNER.GrayscalePass();
-
- break;
-
- case "HalftonePass":
- scope.effect = new WAGNER.HalftonePass();
-
- break;
-
- case "InvertPass":
- scope.effect = new WAGNER.InvertPass();
-
- break;
-
- default:
- console.warn("No Wagner effect \"" + type + "\" exists. If it should exist, open an issue. (@addWagner)");
-
- return;
- }
-
- scope.effect.params = target;
-
- this._composer.stack.addPass(type, true, target);
-
- return scope;
-
-}
-
-WHS.init.prototype.initWagner = function() {
-
- this._composer = new WAGNER.Composer(this._renderer);
-
- this._composer.setSize(this._settings.rWidth, this._settings.rHeight);
- this._composer.autoClearColor = true;
-
- this._composer.reset();
- this._composer.render(this.scene, this._camera);
-
- this._composer.stack = new WAGNER.Stack( new WAGNER.ShadersPool() );
-
-}
View
172 src/Wagner/addWagner.js
@@ -1,172 +0,0 @@
-/**
- * © Alexander Buzin, 2014-2015
- * Site: http://alexbuzin.me/
- * Email: alexbuzin88@gmail.com
-*/
-
-/**
- * Wagner.
- *
- * @param {Object} type Type of wagner effect. (REQUIRED)
- * @param {Object} params Parameters. (OPTIONAL)
- * @return {Object} Scope.
- */
-WHS.init.prototype.addWagner = function( type, params ) {
-
- 'use strict';
-
- params = params || {};
-
- var scope = {
- _composer: this._composer
- };
-
- var target = api.extend(params, {
- hex: 0x000000,
- near: 0.015,
- far: 1000,
- density: 0.00025
- });
-
- switch (type) {
- case "ZoomBlurPass":
- scope.effect = new WAGNER.ZoomBlurPass();
-
- target = api.extend(target, {
- strength: .05,
-
- center: {
- x: .5 * this._composer.width,
- y: .5 * this._composer.height
- }
- });
-
- break;
-
- case "MultiPassBloomPass":
- scope.effect = new WAGNER.MultiPassBloomPass();
-
- target = api.extend(target, {
- strength: .5,
- blurAmount: 1.32,
- applyZoomBlur: true,
- zoomBlurStrength: 0.84,
- useTexture: true,
-
- center: {
- x: .5 * this._composer.width,
- y: .5 * this._composer.height
- }
- });
-
- scope.effect.glowTexture = WAGNER.Pass.prototype.getOfflineTexture(
- this._composer.width,
- this._composer.height,
- false
- );
-
- break;
-
- case "VignettePass":
- scope.effect = new WAGNER.VignettePass();
-
- target = api.extend(target, {
- amount: 0.7,
- falloff: 0.2
- });
-
- break;
-
- case "DirectionalBlurPass":
- scope.effect = new WAGNER.DirectionalBlurPass();
-
- target = api.extend(target, { delta: 0.1 });
-
- break;
-
- case "MotionBlurPass":
- scope.effect = new WAGNER.DirectionalBlurPass();
-
- scope.motionBlurEnable = true;
-
- target = api.extend(target, { delta: 0 });
-
- break;
-
- case "ASCIIPass":
- scope.effect = new WAGNER.ASCIIPass();
-
- break;
-
- case "DotScreenPass":
- scope.effect = new WAGNER.DotScreenPass();
-
- break;
-
- case "FxaaPass":
- scope.effect = new WAGNER.FXAAPass();
-
- break;
-
- case "ChromaticAberrationPass":
- scope.effect = new WAGNER.ChromaticAberrationPass();
-
- break;
-
- case "DirtPass":
- scope.effect = new WAGNER.DirtPass();
-
- break;
-
- case "EdgeDetectionPass":
- scope.effect = new WAGNER.SobelEdgeDetectionPass();
-
- break;
-
- case "HighPassPass":
- scope.effect = new WAGNER.HighPassPass();
-
- break;
-
- case "GrayscalePass":
- scope.effect = new WAGNER.GrayscalePass();
-
- break;
-
- case "HalftonePass":
- scope.effect = new WAGNER.HalftonePass();
-
- break;
-
- case "InvertPass":
- scope.effect = new WAGNER.InvertPass();
-
- break;
-
- default:
- console.warn("No Wagner effect \"" + type + "\" exists. If it should exist, open an issue. (@addWagner)");
-
- return;
- }
-
- scope.effect.params = target;
-
- this._composer.stack.addPass(type, true, target);
-
- return scope;
-
-}
-
-WHS.init.prototype.initWagner = function() {
-
- this._composer = new WAGNER.Composer(this._renderer);
-
- this._composer.setSize(this._settings.rWidth, this._settings.rHeight);
- this._composer.autoClearColor = true;
-
- this._composer.reset();
- this._composer.render(this.scene, this._camera);
-
- this._composer.stack = new WAGNER.Stack( new WAGNER.ShadersPool() );
-
-}

0 comments on commit 937c429

Please sign in to comment.
Something went wrong with that request. Please try again.