UNPKG

threepipe

Version:

A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.

67 lines 3.1 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { uiFolderContainer, uiSlider, uiToggle } from 'uiconfig.js'; import { glsl, onChange, serialize } from 'ts-browser-helpers'; import { uniform } from '../../three'; import ChromaticAberration from './shaders/ChromaticAberrationPlugin.glsl'; import { AScreenPassExtensionPlugin } from './AScreenPassExtensionPlugin'; /** * Chromatic Aberration Plugin * Adds an extension to {@link ScreenPass} material * for applying chromatic aberration effect on the final buffer before rendering to screen. * The intensity of the aberration can be controlled with the `intensity`(previously aberrationIntensity) property. * * @category Plugins */ let ChromaticAberrationPlugin = class ChromaticAberrationPlugin extends AScreenPassExtensionPlugin { get aberrationIntensity() { console.warn('ChromaticAberrationPlugin.aberrationIntensity is deprecated, use ChromaticAberrationPlugin.intensity instead'); return this.intensity; } set aberrationIntensity(v) { console.warn('ChromaticAberrationPlugin.aberrationIntensity is deprecated, use ChromaticAberrationPlugin.intensity instead'); this.intensity = v; } constructor(enabled = true) { super(); this.extraUniforms = { aberrationIntensity: { value: 1 }, }; this.intensity = 0.5; /** * The priority of the material extension when applied to the material in ScreenPass * set to very low priority, so applied at the end */ this.priority = -50; this.parsFragmentSnippet = () => { if (this.isDisabled()) return ''; return glsl ` uniform float aberrationIntensity; ${ChromaticAberration} `; }; this._shaderPatch = 'diffuseColor = ChromaticAberration(diffuseColor);'; this.enabled = enabled; } }; ChromaticAberrationPlugin.PluginType = 'ChromaticAberration'; __decorate([ onChange(ChromaticAberrationPlugin.prototype.setDirty), uiToggle('Enable'), serialize() ], ChromaticAberrationPlugin.prototype, "enabled", void 0); __decorate([ uiSlider('Intensity', [0., 0.3], 0.001), uniform({ propKey: 'aberrationIntensity' }), serialize('aberrationIntensity') ], ChromaticAberrationPlugin.prototype, "intensity", void 0); ChromaticAberrationPlugin = __decorate([ uiFolderContainer('ChromaticAberration') ], ChromaticAberrationPlugin); export { ChromaticAberrationPlugin }; //# sourceMappingURL=ChromaticAberrationPlugin.js.map