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/FragmentEffectContrast.java
20 20
package org.distorted.library.effect;
21 21

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

  
26 26
///////////////////////////////////////////////////////////////////////////////////////////////////
27 27
/**
......
30 30
public class FragmentEffectContrast extends FragmentEffect
31 31
  {
32 32
  private Data1D mContrast;
33
  private Data4D mRegion;
33
  private Data3D mCenter;
34
  private Data3D mRegion;
34 35

  
35 36
///////////////////////////////////////////////////////////////////////////////////////////////////
36 37
/**
......
40 41
 */
41 42
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
42 43
    {
43
    mRegion.get(uniforms,index+4,currentDuration,step);
44
    mCenter.get(uniforms,index+CENTER_OFFSET,currentDuration,step);
45
    mRegion.get(uniforms,index+REGION_OFFSET,currentDuration,step);
44 46
    return mContrast.get(uniforms,index,currentDuration,step);
45 47
    }
46 48

  
......
51 53
 * Makes a certain sub-region of the Object smoothly change its contrast level.
52 54
 *
53 55
 * @param contrast level of contrast we want to have at any given moment. Valid range: <0,infinity)
54
 * @param region   Region this Effect is limited to.
56
 * @param center center of the Effect (point in 3D).
57
 * @param region Region this Effect is limited to (3 radii defining an ellipsoid).
55 58
 * @param smooth   If true, the level of 'contrast' will smoothly fade out towards the edges of the region.
56 59
 */
57
  public FragmentEffectContrast(Data1D contrast, Data4D region, boolean smooth)
60
  public FragmentEffectContrast(Data1D contrast, Data3D center, Data3D region, boolean smooth)
58 61
    {
59 62
    super(smooth?EffectName.SMOOTH_CONTRAST:EffectName.CONTRAST);
60 63
    mContrast = contrast;
61
    mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region);
64
    mCenter = center;
65
    mRegion = (region==null ? new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE) : region);
62 66
    }
63 67

  
64 68
///////////////////////////////////////////////////////////////////////////////////////////////////
......
71 75
    {
72 76
    super(EffectName.CONTRAST);
73 77
    mContrast = contrast;
74
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
78
    mCenter = new Static3D(0,0,0);
79
    mRegion = new Static3D(Float.MAX_VALUE,Float.MAX_VALUE, Float.MAX_VALUE);
75 80
    }
76 81

  
77 82
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff