-
Notifications
You must be signed in to change notification settings - Fork 354
/
Copy pathseriously.exposure.js
executable file
·58 lines (52 loc) · 1.24 KB
/
seriously.exposure.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* global define, require */
(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['seriously'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
factory(require('seriously'));
} else {
if (!root.Seriously) {
root.Seriously = { plugin: function (name, opt) { this[name] = opt; } };
}
factory(root.Seriously);
}
}(window, function (Seriously) {
'use strict';
Seriously.plugin('exposure', {
commonShader: true,
shader: function (inputs, shaderSource) {
shaderSource.fragment = [
'precision mediump float;',
'varying vec2 vTexCoord;',
'uniform sampler2D source;',
'uniform float exposure;',
'void main (void) {',
' vec4 pixel = texture2D(source, vTexCoord);',
' gl_FragColor = vec4(pow(2.0, exposure) * pixel.rgb, pixel.a);',
'}'
].join('\n');
return shaderSource;
},
inPlace: true,
inputs: {
source: {
type: 'image',
uniform: 'source',
shaderDirty: false
},
exposure: {
type: 'number',
uniform: 'exposure',
defaultValue: 1,
min: -8,
max: 8
}
},
title: 'Exposure',
categories: ['film'],
description: 'Exposure control'
});
}));