Project

General

Profile

Download (3.39 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / effect / PostprocessEffectGlow.java @ 7cd24173

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
  public static void enable()
36
    {
37

    
38
    }
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41
/**
42
 * Make the object glow with a specific color and a halo of specific radius.
43
 *
44
 * @param glowRadius The 'strength' if the effect, in pixels. 0 = no halo, 10 = halo of roughly 10 pixels
45
 *                   around the whole object.
46
 * @param color      RGBA of the color with which to draw the glow.
47
 */
48
  public PostprocessEffectGlow(Data1D glowRadius, Data4D color)
49
    {
50
    super(EffectName.GLOW);
51
    mGlowRadius = glowRadius;
52
    mColor      = color;
53
    }
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

    
57
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
58
    {
59
    mColor.get(uniforms,index+1,currentDuration,step);
60
    return mGlowRadius.get(uniforms,index,currentDuration,step);
61
    }
62

    
63

    
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

    
66
  public int apply(float[] uniforms, int index, float qualityScale, DistortedFramebuffer buffer)
67
    {
68
    return 0;
69
    }
70
  }
(18-18/25)