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/FragmentEffectBrightness.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 FragmentEffectBrightness extends FragmentEffect
31 31
  {
32 32
  private Data1D mBrightness;
33
  private Data4D mRegion;
34

  
33
  private Data3D mCenter;
34
  private Data3D mRegion;
35 35

  
36 36
///////////////////////////////////////////////////////////////////////////////////////////////////
37 37
/**
......
41 41
 */
42 42
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
43 43
    {
44
    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);
45 46
    return mBrightness.get(uniforms,index,currentDuration,step);
46 47
    }
47 48

  
......
52 53
 * Makes a certain sub-region of the Object smoothly change its brightness level.
53 54
 *
54 55
 * @param brightness level of brightness we want to have at any given moment. Valid range: <0,infinity)
55
 * @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).
56 58
 * @param smooth     If true, the level of 'brightness' will smoothly fade out towards the edges of the region.
57 59
 */
58
  public FragmentEffectBrightness(Data1D brightness, Data4D region, boolean smooth)
60
  public FragmentEffectBrightness(Data1D brightness, Data3D center, Data3D region, boolean smooth)
59 61
    {
60 62
    super(smooth?EffectName.SMOOTH_BRIGHTNESS:EffectName.BRIGHTNESS);
61 63
    mBrightness = brightness;
62
    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);
63 66
    }
64 67

  
65 68
///////////////////////////////////////////////////////////////////////////////////////////////////
......
72 75
    {
73 76
    super(EffectName.BRIGHTNESS);
74 77
    mBrightness = brightness;
75
    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);
76 80
    }
77 81

  
78 82
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff