Project

General

Profile

« Previous | Next » 

Revision b24e4719

Added by Leszek Koltunski over 5 years ago

Make the Fragment effects truly 3D: change their 4D 'region' into a 3D 'center' (a point in 3D) and 3D 'region' (which is now a set of 3 radii defining an ellipsoid around the center)

Also corresponding changes to the applications.

View differences:

src/main/java/org/distorted/library/effect/FragmentEffectChroma.java
21 21

  
22 22
import org.distorted.library.type.Data1D;
23 23
import org.distorted.library.type.Data3D;
24
import org.distorted.library.type.Data4D;
25
import org.distorted.library.type.Static4D;
24
import org.distorted.library.type.Static3D;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
28 27
/**
......
32 31
  {
33 32
  private Data1D mBlend;
34 33
  private Data3D mColor;
35
  private Data4D mRegion;
34
  private Data3D mCenter;
35
  private Data3D mRegion;
36 36

  
37 37
///////////////////////////////////////////////////////////////////////////////////////////////////
38 38
/**
......
42 42
 */
43 43
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
44 44
    {
45
    mRegion.get(uniforms,index+4,currentDuration,step);
46 45
    mColor.get(uniforms,index+1,currentDuration,step);
46
    mCenter.get(uniforms,index+CENTER_OFFSET,currentDuration,step);
47
    mRegion.get(uniforms,index+REGION_OFFSET,currentDuration,step);
47 48
    return mBlend.get(uniforms,index,currentDuration,step);
48 49
    }
49 50

  
......
57 58
 *               pixel = (1-level)*pixel + level*color.
58 59
 *               Valid range: <0,1>
59 60
 * @param color  Color to mix. (1,0,0) is RED.
60
 * @param region Region this Effect is limited to.
61
 * @param center center of the Effect (point in 3D).
62
 * @param region Region this Effect is limited to (3 radii defining an ellipsoid).
61 63
 * @param smooth If true, the level of 'blend' will smoothly fade out towards the edges of the region.
62 64
 */
63
  public FragmentEffectChroma(Data1D blend, Data3D color, Data4D region, boolean smooth)
65
  public FragmentEffectChroma(Data1D blend, Data3D color, Data3D center, Data3D region, boolean smooth)
64 66
    {
65 67
    super(smooth?EffectName.SMOOTH_CHROMA:EffectName.CHROMA);
66
    mBlend = blend;
67
    mColor = color;
68
    mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region);
68
    mBlend  = blend;
69
    mColor  = color;
70
    mCenter = center;
71
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
69 72
    }
70 73

  
71 74
///////////////////////////////////////////////////////////////////////////////////////////////////
......
82 85
    super(EffectName.CHROMA);
83 86
    mBlend = blend;
84 87
    mColor = color;
85
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
88
    mCenter = new Static3D(0,0,0);
89
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
86 90
    }
87 91

  
88 92
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff