Project

General

Profile

« Previous | Next » 

Revision 125cee3d

Added by Leszek Koltunski over 7 years ago

Progress with support for Effect classes.

View differences:

src/main/java/org/distorted/library/EffectNames.java
90 90

  
91 91
 /////////////////////////////////////////////////////////////////////////////////
92 92
 // VERTEX EFFECTS
93
 // Always 12 Uniforms: 6 per-effect interpolated values, 2-dimensional center of
93
 // Always 12 Uniforms: 5 per-effect interpolated values, 3-dimensional center of
94 94
 // the effect, 4-dimensional Region
95 95
 /**
96 96
   * Apply a 3D vector of force to area around a point on the surface of the Object.
src/main/java/org/distorted/library/effect/FragmentEffect.java
20 20
package org.distorted.library.effect;
21 21

  
22 22
import org.distorted.library.type.Data4D;
23
import org.distorted.library.type.Dynamic;
24
import org.distorted.library.type.Static;
23 25

  
24 26
///////////////////////////////////////////////////////////////////////////////////////////////////
25 27

  
......
38 40
  public static int SATURATION        = 8;
39 41
  public static int SMOOTH_SATURATION = 9;
40 42

  
41

  
43
  Dynamic mDynamic0, mDynamic1;
44
  Static mStatic0, mStatic1;
42 45
  Data4D mRegion;
43 46

  
44 47
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Dynamic1D;
25
import org.distorted.library.type.Static1D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public class FragmentEffectAlpha extends FragmentEffect
30
  {
31
  private static final float[] UNITIES = new float[] {1.0f};
32
  private static final int DIMENSION = 1;
33
  private static final boolean SUPPORTS_CENTER = false;
34
  private static final boolean SUPPORTS_REGION = true;
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public FragmentEffectAlpha(Data1D alpha, Data4D region, boolean smooth)
39
    {
40
    super(smooth?SMOOTH_ALPHA:ALPHA ,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
41

  
42
    if( alpha instanceof Dynamic1D )
43
      {
44
      mDynamic0 = (Dynamic1D)alpha;
45
      }
46
    else if ( alpha instanceof Static1D )
47
      {
48
      mStatic0 = (Static1D)alpha;
49
      }
50

  
51
    mRegion = region;
52
    }
53

  
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

  
56
  public FragmentEffectAlpha(Data1D alpha)
57
    {
58
    super(ALPHA,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
59

  
60
    if( alpha instanceof Dynamic1D )
61
      {
62
      mDynamic0 = (Dynamic1D)alpha;
63
      }
64
    else if ( alpha instanceof Static1D )
65
      {
66
      mStatic0 = (Static1D)alpha;
67
      }
68
    }
69
  }
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Dynamic1D;
25
import org.distorted.library.type.Static1D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public class FragmentEffectBrightness extends FragmentEffect
30
  {
31
  private static final float[] UNITIES = new float[] {1.0f};
32
  private static final int DIMENSION = 1;
33
  private static final boolean SUPPORTS_CENTER = false;
34
  private static final boolean SUPPORTS_REGION = true;
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public FragmentEffectBrightness(Data1D brightness, Data4D region, boolean smooth)
39
    {
40
    super(smooth?SMOOTH_BRIGHTNESS:BRIGHTNESS ,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
41

  
42
    if( brightness instanceof Dynamic1D )
43
      {
44
      mDynamic0 = (Dynamic1D)brightness;
45
      }
46
    else if ( brightness instanceof Static1D )
47
      {
48
      mStatic0 = (Static1D)brightness;
49
      }
50

  
51
    mRegion = region;
52
    }
53

  
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

  
56
  public FragmentEffectBrightness(Data1D brightness)
57
    {
58
    super(BRIGHTNESS,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
59

  
60
    if( brightness instanceof Dynamic1D )
61
      {
62
      mDynamic0 = (Dynamic1D)brightness;
63
      }
64
    else if ( brightness instanceof Static1D )
65
      {
66
      mStatic0 = (Static1D)brightness;
67
      }
68
    }
69
  }
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data3D;
24
import org.distorted.library.type.Data4D;
25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Dynamic3D;
27
import org.distorted.library.type.Static1D;
28
import org.distorted.library.type.Static3D;
29

  
30
///////////////////////////////////////////////////////////////////////////////////////////////////
31

  
32
public class FragmentEffectChroma extends FragmentEffect
33
  {
34
  private static final float[] UNITIES = new float[] {0.0f};
35
  private static final int DIMENSION = 4;
36
  private static final boolean SUPPORTS_CENTER = false;
37
  private static final boolean SUPPORTS_REGION = true;
38

  
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40

  
41
  public FragmentEffectChroma(Data1D blend, Data3D color, Data4D region, boolean smooth)
42
    {
43
    super(smooth?SMOOTH_CHROMA:CHROMA ,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
44

  
45
    if( blend instanceof Dynamic1D )
46
      {
47
      mDynamic0 = (Dynamic1D)blend;
48
      }
49
    else if ( blend instanceof Static1D )
50
      {
51
      mStatic0 = (Static1D)blend;
52
      }
53

  
54
    if( color instanceof Dynamic3D )
55
      {
56
      mDynamic1 = (Dynamic3D)color;
57
      }
58
    else if ( color instanceof Static3D)
59
      {
60
      mStatic1 = (Static3D)color;
61
      }
62

  
63
    mRegion = region;
64
    }
65

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

  
68
  public FragmentEffectChroma(Data1D blend, Data3D color)
69
    {
70
    super(CHROMA,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
71

  
72
    if( blend instanceof Dynamic1D )
73
      {
74
      mDynamic0 = (Dynamic1D)blend;
75
      }
76
    else if ( blend instanceof Static1D )
77
      {
78
      mStatic0 = (Static1D)blend;
79
      }
80

  
81
    if( color instanceof Dynamic3D )
82
      {
83
      mDynamic1 = (Dynamic3D)color;
84
      }
85
    else if ( color instanceof Static3D)
86
      {
87
      mStatic1 = (Static3D)color;
88
      }
89
    }
90
  }
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Dynamic1D;
25
import org.distorted.library.type.Static1D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public class FragmentEffectContrast extends FragmentEffect
30
  {
31
  private static final float[] UNITIES = new float[] {1.0f};
32
  private static final int DIMENSION = 1;
33
  private static final boolean SUPPORTS_CENTER = false;
34
  private static final boolean SUPPORTS_REGION = true;
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public FragmentEffectContrast(Data1D contrast, Data4D region, boolean smooth)
39
    {
40
    super(smooth?SMOOTH_CONTRAST:CONTRAST ,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
41

  
42
    if( contrast instanceof Dynamic1D )
43
      {
44
      mDynamic0 = (Dynamic1D)contrast;
45
      }
46
    else if ( contrast instanceof Static1D )
47
      {
48
      mStatic0 = (Static1D)contrast;
49
      }
50

  
51
    mRegion = region;
52
    }
53

  
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

  
56
  public FragmentEffectContrast(Data1D contrast)
57
    {
58
    super(CONTRAST,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
59

  
60
    if( contrast instanceof Dynamic1D )
61
      {
62
      mDynamic0 = (Dynamic1D)contrast;
63
      }
64
    else if ( contrast instanceof Static1D )
65
      {
66
      mStatic0 = (Static1D)contrast;
67
      }
68
    }
69
  }
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Dynamic1D;
25
import org.distorted.library.type.Static1D;
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public class FragmentEffectSaturation extends FragmentEffect
30
  {
31
  private static final float[] UNITIES = new float[] {1.0f};
32
  private static final int DIMENSION = 1;
33
  private static final boolean SUPPORTS_CENTER = false;
34
  private static final boolean SUPPORTS_REGION = true;
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public FragmentEffectSaturation(Data1D saturation, Data4D region, boolean smooth)
39
    {
40
    super(smooth?SMOOTH_SATURATION:SATURATION ,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
41

  
42
    if( saturation instanceof Dynamic1D )
43
      {
44
      mDynamic0 = (Dynamic1D)saturation;
45
      }
46
    else if ( saturation instanceof Static1D )
47
      {
48
      mStatic0 = (Static1D)saturation;
49
      }
50

  
51
    mRegion = region;
52
    }
53

  
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

  
56
  public FragmentEffectSaturation(Data1D saturation)
57
    {
58
    super(SATURATION,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
59

  
60
    if( saturation instanceof Dynamic1D )
61
      {
62
      mDynamic0 = (Dynamic1D)saturation;
63
      }
64
    else if ( saturation instanceof Static1D )
65
      {
66
      mStatic0 = (Static1D)saturation;
67
      }
68
    }
69
  }
src/main/java/org/distorted/library/effect/PostprocessEffect.java
19 19

  
20 20
package org.distorted.library.effect;
21 21

  
22
import org.distorted.library.type.Dynamic;
23
import org.distorted.library.type.Static;
24

  
22 25
///////////////////////////////////////////////////////////////////////////////////////////////////
23 26

  
24 27
public abstract class PostprocessEffect extends Effect
......
28 31
  public static int BLUR = 0;
29 32
  public static int GLOW = 1;
30 33

  
34
  Dynamic mDynamic0, mDynamic1;
35
  Static mStatic0, mStatic1;
36

  
31 37
///////////////////////////////////////////////////////////////////////////////////////////////////
32 38

  
33 39
  public PostprocessEffect(int name, float[] unity, int dimension, boolean center, boolean region)
src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Dynamic1D;
24
import org.distorted.library.type.Static1D;
25

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

  
28
public class PostprocessEffectBlur extends PostprocessEffect
29
  {
30
  private static final float[] UNITIES = new float[] {0.0f};
31
  private static final int DIMENSION = 1;
32
  private static final boolean SUPPORTS_CENTER = false;
33
  private static final boolean SUPPORTS_REGION = false;
34

  
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

  
37
  public PostprocessEffectBlur(Data1D radius)
38
    {
39
    super(BLUR,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
40

  
41
    if( radius instanceof Dynamic1D)
42
      {
43
      mDynamic0 = (Dynamic1D)radius;
44
      }
45
    else if ( radius instanceof Static1D )
46
      {
47
      mStatic0  = (Static1D)radius;
48
      }
49
    }
50
  }
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Dynamic1D;
25
import org.distorted.library.type.Dynamic4D;
26
import org.distorted.library.type.Static1D;
27
import org.distorted.library.type.Static4D;
28

  
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

  
31
public class PostprocessEffectGlow extends PostprocessEffect
32
  {
33
  private static final float[] UNITIES = new float[] {0.0f};
34
  private static final int DIMENSION = 5;
35
  private static final boolean SUPPORTS_CENTER = false;
36
  private static final boolean SUPPORTS_REGION = false;
37

  
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

  
40
  public PostprocessEffectGlow(Data1D radius, Data4D color)
41
    {
42
    super(GLOW,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
43

  
44
    if( radius instanceof Dynamic1D)
45
      {
46
      mDynamic0 = (Dynamic1D)radius;
47
      }
48
    else if ( radius instanceof Static1D )
49
      {
50
      mStatic0  = (Static1D)radius;
51
      }
52

  
53
    if( color instanceof Dynamic4D)
54
      {
55
      mDynamic1 = (Dynamic4D)color;
56
      }
57
    else if ( color instanceof Static4D)
58
      {
59
      mStatic1  = (Static4D)color;
60
      }
61
    }
62
  }
src/main/java/org/distorted/library/effect/VertexEffect.java
19 19

  
20 20
package org.distorted.library.effect;
21 21

  
22
import org.distorted.library.type.Data3D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Dynamic;
25
import org.distorted.library.type.Static;
26

  
22 27
///////////////////////////////////////////////////////////////////////////////////////////////////
23 28

  
24 29
public abstract class VertexEffect extends Effect
......
32 37
  public static int SWIRL   = 4;
33 38
  public static int WAVE    = 5;
34 39

  
40
  Dynamic mDynamic0;
41
  Static mStatic0;
42
  Data3D mCenter;
43
  Data4D mRegion;
44

  
35 45
///////////////////////////////////////////////////////////////////////////////////////////////////
36 46

  
37 47
  public VertexEffect(int name, float[] unity, int dimension, boolean center, boolean region)
src/main/java/org/distorted/library/effect/VertexEffectDeform.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

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

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public class VertexEffectDeform extends VertexEffect
30
  {
31
  private static final float[] UNITIES = new float[] {0.0f,0.0f,0.0f};
32
  private static final int DIMENSION = 3;
33
  private static final boolean SUPPORTS_CENTER = true;
34
  private static final boolean SUPPORTS_REGION = true;
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public VertexEffectDeform(Data3D vector, Data3D center, Data4D region)
39
    {
40
    super(DEFORM,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
41

  
42
    if( vector instanceof Dynamic3D )
43
      {
44
      mDynamic0 = (Dynamic3D)vector;
45
      }
46
    else if ( vector instanceof Static3D )
47
      {
48
      mStatic0 = (Static3D)vector;
49
      }
50

  
51
    mCenter = center;
52
    mRegion = region;
53
    }
54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
57
  public VertexEffectDeform(Data3D vector, Data3D center)
58
    {
59
    super(DEFORM,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
60

  
61
    if( vector instanceof Dynamic3D )
62
      {
63
      mDynamic0 = (Dynamic3D)vector;
64
      }
65
    else if ( vector instanceof Static3D )
66
      {
67
      mStatic0 = (Static3D)vector;
68
      }
69

  
70
    mCenter = center;
71
    }
72
  }
src/main/java/org/distorted/library/effect/VertexEffectDistort.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

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

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
public class VertexEffectDistort extends VertexEffect
30
  {
31
  private static final float[] UNITIES = new float[] {0.0f,0.0f,0.0f};
32
  private static final int DIMENSION = 3;
33
  private static final boolean SUPPORTS_CENTER = true;
34
  private static final boolean SUPPORTS_REGION = true;
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public VertexEffectDistort(Data3D vector, Data3D center, Data4D region)
39
    {
40
    super(DISTORT,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
41

  
42
    if( vector instanceof Dynamic3D )
43
      {
44
      mDynamic0 = (Dynamic3D)vector;
45
      }
46
    else if ( vector instanceof Static3D )
47
      {
48
      mStatic0 = (Static3D)vector;
49
      }
50

  
51
    mCenter = center;
52
    mRegion = region;
53
    }
54

  
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

  
57
  public VertexEffectDistort(Data3D vector, Data3D center)
58
    {
59
    super(DISTORT,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
60

  
61
    if( vector instanceof Dynamic3D )
62
      {
63
      mDynamic0 = (Dynamic3D)vector;
64
      }
65
    else if ( vector instanceof Static3D )
66
      {
67
      mStatic0 = (Static3D)vector;
68
      }
69

  
70
    mCenter = center;
71
    }
72
  }
src/main/java/org/distorted/library/effect/VertexEffectPinch.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data3D;
24
import org.distorted.library.type.Data4D;
25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Static1D;
27

  
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

  
30
public class VertexEffectPinch extends VertexEffect
31
  {
32
  private static final float[] UNITIES = new float[] {1.0f};
33
  private static final int DIMENSION = 2;
34
  private static final boolean SUPPORTS_CENTER = true;
35
  private static final boolean SUPPORTS_REGION = true;
36

  
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

  
39
  public VertexEffectPinch(Data1D pinch, Data3D center, Data4D region)
40
    {
41
    super(PINCH,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
42

  
43
    if( pinch instanceof Dynamic1D)
44
      {
45
      mDynamic0 = (Dynamic1D)pinch;
46
      }
47
    else if ( pinch instanceof Static1D )
48
      {
49
      mStatic0  = (Static1D)pinch;
50
      }
51

  
52
    mCenter = center;
53
    mRegion = region;
54
    }
55

  
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

  
58
  public VertexEffectPinch(Data1D pinch, Data3D center)
59
    {
60
    super(PINCH,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
61

  
62
    if( pinch instanceof Dynamic1D)
63
      {
64
      mDynamic0 = (Dynamic1D)pinch;
65
      }
66
    else if ( pinch instanceof Static1D )
67
      {
68
      mStatic0  = (Static1D)pinch;
69
      }
70

  
71
    mCenter = center;
72
    }
73
  }
src/main/java/org/distorted/library/effect/VertexEffectSink.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data3D;
24
import org.distorted.library.type.Data4D;
25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Static1D;
27

  
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

  
30
public class VertexEffectSink extends VertexEffect
31
  {
32
  private static final float[] UNITIES = new float[] {1.0f};
33
  private static final int DIMENSION = 1;
34
  private static final boolean SUPPORTS_CENTER = true;
35
  private static final boolean SUPPORTS_REGION = true;
36

  
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

  
39
  public VertexEffectSink(Data1D sink, Data3D center, Data4D region)
40
    {
41
    super(SINK,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
42

  
43
    if( sink instanceof Dynamic1D)
44
      {
45
      mDynamic0 = (Dynamic1D)sink;
46
      }
47
    else if ( sink instanceof Static1D )
48
      {
49
      mStatic0  = (Static1D)sink;
50
      }
51

  
52
    mCenter = center;
53
    mRegion = region;
54
    }
55

  
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

  
58
  public VertexEffectSink(Data1D sink, Data3D center)
59
    {
60
    super(SINK,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
61

  
62
    if( sink instanceof Dynamic1D)
63
      {
64
      mDynamic0 = (Dynamic1D)sink;
65
      }
66
    else if ( sink instanceof Static1D )
67
      {
68
      mStatic0  = (Static1D)sink;
69
      }
70

  
71
    mCenter = center;
72
    }
73
  }
src/main/java/org/distorted/library/effect/VertexEffectSwirl.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data1D;
23
import org.distorted.library.type.Data3D;
24
import org.distorted.library.type.Data4D;
25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Static1D;
27

  
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

  
30
public class VertexEffectSwirl extends VertexEffect
31
  {
32
  private static final float[] UNITIES = new float[] {0.0f};
33
  private static final int DIMENSION = 1;
34
  private static final boolean SUPPORTS_CENTER = true;
35
  private static final boolean SUPPORTS_REGION = true;
36

  
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

  
39
  public VertexEffectSwirl(Data1D swirl, Data3D center, Data4D region)
40
    {
41
    super(SWIRL,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
42

  
43
    if( swirl instanceof Dynamic1D)
44
      {
45
      mDynamic0 = (Dynamic1D)swirl;
46
      }
47
    else if ( swirl instanceof Static1D )
48
      {
49
      mStatic0  = (Static1D)swirl;
50
      }
51

  
52
    mCenter = center;
53
    mRegion = region;
54
    }
55

  
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

  
58
  public VertexEffectSwirl(Data1D swirl, Data3D center)
59
    {
60
    super(SWIRL,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
61

  
62
    if( swirl instanceof Dynamic1D)
63
      {
64
      mDynamic0 = (Dynamic1D)swirl;
65
      }
66
    else if ( swirl instanceof Static1D )
67
      {
68
      mStatic0  = (Static1D)swirl;
69
      }
70

  
71
    mCenter = center;
72
    }
73
  }
src/main/java/org/distorted/library/effect/VertexEffectWave.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2017 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.library.effect;
21

  
22
import org.distorted.library.type.Data3D;
23
import org.distorted.library.type.Data4D;
24
import org.distorted.library.type.Data5D;
25
import org.distorted.library.type.Dynamic5D;
26
import org.distorted.library.type.Static5D;
27

  
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

  
30
public class VertexEffectWave extends VertexEffect
31
  {
32
  private static final float[] UNITIES = new float[] {0.0f};
33
  private static final int DIMENSION = 5;
34
  private static final boolean SUPPORTS_CENTER = true;
35
  private static final boolean SUPPORTS_REGION = true;
36

  
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

  
39
  public VertexEffectWave(Data5D wave, Data3D center, Data4D region)
40
    {
41
    super(WAVE,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
42

  
43
    if( wave instanceof Dynamic5D)
44
      {
45
      mDynamic0 = (Dynamic5D)wave;
46
      }
47
    else if ( wave instanceof Static5D)
48
      {
49
      mStatic0  = (Static5D)wave;
50
      }
51

  
52
    mCenter = center;
53
    mRegion = region;
54
    }
55

  
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

  
58
  public VertexEffectWave(Data5D wave, Data3D center)
59
    {
60
    super(WAVE,UNITIES,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION);
61

  
62
    if( wave instanceof Dynamic5D)
63
      {
64
      mDynamic0 = (Dynamic5D)wave;
65
      }
66
    else if ( wave instanceof Static5D)
67
      {
68
      mStatic0  = (Static5D)wave;
69
      }
70

  
71
    mCenter = center;
72
    }
73
  }

Also available in: Unified diff