Project

General

Profile

« Previous | Next » 

Revision f046b159

Added by Leszek Koltunski almost 4 years ago

First attempt at the MeshBase.apply(VertexEffect) API.

View differences:

src/main/java/org/distorted/library/effect/VertexEffectScale.java
28 28
 */
29 29
public class VertexEffectScale extends VertexEffect
30 30
  {
31
  private static final EffectName NAME = EffectName.VERTEX_SCALE;
32

  
31 33
  private Data3D mScale;
32 34

  
33 35
///////////////////////////////////////////////////////////////////////////////////////////////////
......
38 40
 */
39 41
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
40 42
    {
41
    return mScale.get(uniforms,index,currentDuration,step);
43
    return mScale.get(uniforms,index+VALUES_OFFSET,currentDuration,step);
44
    }
45

  
46
///////////////////////////////////////////////////////////////////////////////////////////////////
47

  
48
  static String code()
49
    {
50
    return "v *= vUniforms[effect].xyz;";
42 51
    }
43 52

  
44 53
///////////////////////////////////////////////////////////////////////////////////////////////////
......
49 58
 */
50 59
  public static void enable()
51 60
    {
52
    addEffect( EffectName.VERTEX_SCALE, "v *= vUniforms[effect].xyz;" );
61
    addEffect( NAME, code() );
53 62
    }
54 63

  
55 64
///////////////////////////////////////////////////////////////////////////////////////////////////
......
60 69
 */
61 70
  public VertexEffectScale(Data3D scale)
62 71
    {
63
    super(EffectName.VERTEX_SCALE);
72
    super(NAME);
64 73
    mScale = scale;
65 74
    }
66 75

  
......
72 81
 */
73 82
  public VertexEffectScale(float scale)
74 83
    {
75
    super(EffectName.VERTEX_SCALE);
84
    super(NAME);
76 85
    mScale = new Static3D(scale,scale,scale);
77 86
    }
78 87
  }

Also available in: Unified diff