Permalink
Please sign in to comment.
Showing
with
222 additions
and 561 deletions.
- +1 −0 CHANGELOG.md
- +0 −167 build/whitestorm.js
- +3 −3 build/whitestorm.min.js
- +3 −3 build/whitestorm.test.js
- +0 −5 examples/basic.html
- +0 −5 examples/basic_material.html
- +0 −4 examples/basic_model.html
- +1 −0 examples/fps.html
- +6 −7 examples/js/game.js
- +0 −4 examples/plugin_example.html
- +1 −1 examples/plugins/whs.preload.js
- +205 −0 examples/plugins/whs.wagner.js
- +0 −5 examples/skybox.html
- +1 −6 examples/stone_wall.html
- +0 −3 gulpfile.js
- +1 −4 src/Core.js
- +0 −172 src/Wagner/AddWagner.js
- +0 −172 src/Wagner/addWagner.js
1
CHANGELOG.md
167
build/whitestorm.js
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.
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.
5
examples/basic.html
5
examples/basic_material.html
4
examples/basic_model.html
1
examples/fps.html
13
examples/js/game.js
4
examples/plugin_example.html
2
examples/plugins/whs.preload.js
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); | ||
| +}; |
5
examples/skybox.html
7
examples/stone_wall.html
3
gulpfile.js
5
src/Core.js
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() ); | ||
| - | ||
| -} |
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