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/VertexEffectDeform.java
24 24
import org.distorted.library.type.Static4D;
25 25

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

  
27
/**
28
 * Deform the Mesh by applying a 3D vector of force.
29
 */
28 30
public class VertexEffectDeform extends VertexEffect
29 31
  {
30 32
  private Data3D mVector, mCenter;
......
32 34

  
33 35
///////////////////////////////////////////////////////////////////////////////////////////////////
34 36
/**
35
 * Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
36
 * a (possibly changing in time) point on the Object.
37
 *
38
 * @param vector Vector of force that deforms the shape of the whole Object.
39
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
40
 * @param region Region that masks the Effect.
41
 */
42
  public VertexEffectDeform(Data3D vector, Data3D center, Data4D region)
43
    {
44
    super(EffectName.DEFORM);
45
    mVector = vector;
46
    mCenter = center;
47
    mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region);
48
    }
49

  
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51
/**
52
 * Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
53
 * a (possibly changing in time) point on the Object.
37
 * Only for use by the library itself.
54 38
 *
55
 * @param vector Vector of force that deforms the shape of the whole Object.
56
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
39
 * @y.exclude
57 40
 */
58
  public VertexEffectDeform(Data3D vector, Data3D center)
59
    {
60
    super(EffectName.DEFORM);
61
    mVector = vector;
62
    mCenter = center;
63
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
64
    }
65

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

  
68 41
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
69 42
    {
70 43
    mCenter.get(uniforms,index+5,currentDuration,step);
......
76 49
    return ret;
77 50
    }
78 51

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53
// PUBLIC API
79 54
///////////////////////////////////////////////////////////////////////////////////////////////////
80 55
// Deform the whole shape of the Object by force V. Algorithm is as follows:
81 56
//
......
127 102
//        even when we apply only small vertical force to it. The higher C is, the more 'uniform' movement
128 103
//        along the force line is.
129 104
//        0<=C<1 looks completely ridiculous and C<0 destroys the system.
130

  
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106
/**
107
 * Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work.
108
 */
131 109
  public static void enable()
132 110
    {
133 111
    addEffect( EffectName.DEFORM,
......
169 147
      + "n.xy += n.z*b*ps;"
170 148
      );
171 149
    }
150

  
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152
/**
153
 * Deform the whole Mesh with a (possibly changing in time) vector of force applied to
154
 * a (possibly changing in time) point on the Object.
155
 *
156
 * @param vector Vector of force that deforms the shape of the whole Object.
157
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
158
 * @param region Region that masks the Effect.
159
 */
160
  public VertexEffectDeform(Data3D vector, Data3D center, Data4D region)
161
    {
162
    super(EffectName.DEFORM);
163
    mVector = vector;
164
    mCenter = center;
165
    mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region);
166
    }
167

  
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169
/**
170
 * Deform the whole Mesh with a (possibly changing in time) vector of force applied to
171
 * a (possibly changing in time) point on the Object.
172
 *
173
 * @param vector Vector of force that deforms the shape of the whole Object.
174
 * @param center 3-dimensional Data that, at any given time, returns the Center of the Effect.
175
 */
176
  public VertexEffectDeform(Data3D vector, Data3D center)
177
    {
178
    super(EffectName.DEFORM);
179
    mVector = vector;
180
    mCenter = center;
181
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
182
    }
172 183
  }

Also available in: Unified diff