1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2017 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Distorted. //
|
5
|
// //
|
6
|
// Distorted is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Distorted is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.library.effect;
|
21
|
|
22
|
import org.distorted.library.main.DistortedFramebuffer;
|
23
|
import org.distorted.library.type.Data1D;
|
24
|
import org.distorted.library.type.Data4D;
|
25
|
|
26
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
27
|
|
28
|
public class PostprocessEffectGlow extends PostprocessEffect
|
29
|
{
|
30
|
private Data1D mGlowRadius;
|
31
|
private Data4D mColor;
|
32
|
|
33
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
/**
|
35
|
* Make the object glow with a specific color and a halo of specific radius.
|
36
|
*
|
37
|
* @param glowRadius The 'strength' if the effect, in pixels. 0 = no halo, 10 = halo of roughly 10 pixels
|
38
|
* around the whole object.
|
39
|
* @param color RGBA of the color with which to draw the glow.
|
40
|
*/
|
41
|
public PostprocessEffectGlow(Data1D glowRadius, Data4D color)
|
42
|
{
|
43
|
super(EffectName.GLOW);
|
44
|
mGlowRadius = glowRadius;
|
45
|
mColor = color;
|
46
|
}
|
47
|
|
48
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
49
|
|
50
|
public boolean compute(float[] uniforms, int index, long currentDuration, long step )
|
51
|
{
|
52
|
mColor.get(uniforms,index+1,currentDuration,step);
|
53
|
return mGlowRadius.get(uniforms,index,currentDuration,step);
|
54
|
}
|
55
|
|
56
|
|
57
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58
|
|
59
|
public int apply(float[] uniforms, int index, float qualityScale, DistortedFramebuffer buffer)
|
60
|
{
|
61
|
return 0;
|
62
|
}
|
63
|
}
|