Project

General

Profile

« Previous | Next » 

Revision faa3ff56

Added by Leszek Koltunski almost 7 years ago

Javadoc.

View differences:

src/main/java/org/distorted/library/effect/VertexEffectSwirl.java
25 25
import org.distorted.library.type.Static4D;
26 26

  
27 27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
28
/**
29
 * 'Swirl' part of the Mesh, i.e rotate part of it around a point.
30
 */
29 31
public class VertexEffectSwirl extends VertexEffect
30 32
  {
31 33
  private Data1D mSwirl;
......
34 36

  
35 37
///////////////////////////////////////////////////////////////////////////////////////////////////
36 38
/**
37
 * Rotate part of the Object around the Center of the Effect by a certain angle.
38
 *
39
 * @param swirl  The angle of Swirl (in degrees). Positive values swirl clockwise.
40
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
41
 * @param region Region that masks the Effect.
42
 */
43
  public VertexEffectSwirl(Data1D swirl, Data3D center, Data4D region)
44
    {
45
    super(EffectName.SWIRL);
46
    mSwirl  = swirl;
47
    mCenter = center;
48
    mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region);
49
    }
50

  
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52
/**
53
 * Rotate the whole Object around the Center of the Effect by a certain angle.
39
 * Only for use by the library itself.
54 40
 *
55
 * @param swirl  The angle of Swirl (in degrees). Positive values swirl clockwise.
56
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
41
 * @y.exclude
57 42
 */
58
  public VertexEffectSwirl(Data1D swirl, Data3D center)
59
    {
60
    super(EffectName.SWIRL);
61
    mSwirl  = swirl;
62
    mCenter = center;
63
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
64
    }
65

  
66
///////////////////////////////////////////////////////////////////////////////////////////////////
67

  
68 43
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
69 44
    {
70 45
    mCenter.get(uniforms,index+5,currentDuration,step);
......
77 52
    return ret;
78 53
    }
79 54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56
// PUBLIC API
80 57
///////////////////////////////////////////////////////////////////////////////////////////////////
81 58
// Let d be the degree of the current vertex V with respect to center of the effect S and Region vRegion.
82 59
// This effect rotates the current vertex V by vInterpolated.x radians clockwise around the circle dilated
83 60
// by (1-d) around the center of the effect S.
84

  
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62
/**
63
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
64
 */
85 65
  public static void enable()
86 66
    {
87 67
    addEffect(EffectName.SWIRL,
......
103 83
      + "v.xy += min(d1_circle,d1_bitmap)*(PS - PS2/(1.0-d2)); \n"        // if d2=1 (i.e P=center) we should have P unchanged. How to do it?
104 84
      );
105 85
    }
86

  
87
///////////////////////////////////////////////////////////////////////////////////////////////////
88
/**
89
 * Rotate part of the Mesh around the Center of the Effect by a certain angle.
90
 *
91
 * @param swirl  The angle of Swirl (in degrees). Positive values swirl clockwise.
92
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
93
 * @param region Region that masks the Effect.
94
 */
95
  public VertexEffectSwirl(Data1D swirl, Data3D center, Data4D region)
96
    {
97
    super(EffectName.SWIRL);
98
    mSwirl  = swirl;
99
    mCenter = center;
100
    mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region);
101
    }
102

  
103
///////////////////////////////////////////////////////////////////////////////////////////////////
104
/**
105
 * Rotate the whole Mesh around the Center of the Effect by a certain angle.
106
 *
107
 * @param swirl  The angle of Swirl (in degrees). Positive values swirl clockwise.
108
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
109
 */
110
  public VertexEffectSwirl(Data1D swirl, Data3D center)
111
    {
112
    super(EffectName.SWIRL);
113
    mSwirl  = swirl;
114
    mCenter = center;
115
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
116
    }
106 117
  }
107 118

  

Also available in: Unified diff