| 1 |
434f2f5a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
// Copyright 2019 Leszek Koltunski //
|
| 3 |
|
|
// //
|
| 4 |
fdec60a3
|
Leszek Koltunski
|
// This file is part of Magic Cube. //
|
| 5 |
434f2f5a
|
Leszek Koltunski
|
// //
|
| 6 |
fdec60a3
|
Leszek Koltunski
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
| 7 |
434f2f5a
|
Leszek Koltunski
|
// 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 |
fdec60a3
|
Leszek Koltunski
|
// Magic Cube is distributed in the hope that it will be useful, //
|
| 12 |
434f2f5a
|
Leszek Koltunski
|
// 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 |
fdec60a3
|
Leszek Koltunski
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
| 18 |
434f2f5a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 19 |
|
|
|
| 20 |
1f9772f3
|
Leszek Koltunski
|
package org.distorted.effects.sizechange;
|
| 21 |
434f2f5a
|
Leszek Koltunski
|
|
| 22 |
f291130e
|
Leszek Koltunski
|
import org.distorted.library.effect.Effect;
|
| 23 |
434f2f5a
|
Leszek Koltunski
|
import org.distorted.library.effect.FragmentEffectAlpha;
|
| 24 |
39fb9047
|
Leszek Koltunski
|
import org.distorted.library.effect.VertexEffectWave;
|
| 25 |
434f2f5a
|
Leszek Koltunski
|
import org.distorted.library.type.Dynamic1D;
|
| 26 |
39fb9047
|
Leszek Koltunski
|
import org.distorted.library.type.Dynamic5D;
|
| 27 |
434f2f5a
|
Leszek Koltunski
|
import org.distorted.library.type.Static1D;
|
| 28 |
39fb9047
|
Leszek Koltunski
|
import org.distorted.library.type.Static3D;
|
| 29 |
|
|
import org.distorted.library.type.Static5D;
|
| 30 |
434f2f5a
|
Leszek Koltunski
|
|
| 31 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 32 |
|
|
|
| 33 |
086a24d0
|
Leszek Koltunski
|
class SizeChangeEffectTransparency extends SizeChangeEffect
|
| 34 |
434f2f5a
|
Leszek Koltunski
|
{
|
| 35 |
086a24d0
|
Leszek Koltunski
|
public int createEffectsPhase0(int duration)
|
| 36 |
434f2f5a
|
Leszek Koltunski
|
{
|
| 37 |
17a7c91a
|
Leszek Koltunski
|
mNodeEffectPosition[0] = new int[] {-1,-1};
|
| 38 |
086a24d0
|
Leszek Koltunski
|
mNodeEffects[0] = new Effect[mNodeEffectPosition[0].length];
|
| 39 |
|
|
|
| 40 |
|
|
float init_amplitude = 0.0f;
|
| 41 |
17a7c91a
|
Leszek Koltunski
|
float end_amplitude = 1/8.0f;
|
| 42 |
|
|
float length = 1/8.0f;
|
| 43 |
086a24d0
|
Leszek Koltunski
|
float init_phase = 360.0f;
|
| 44 |
|
|
float end_phase = 0.0f;
|
| 45 |
|
|
float alpha = 30.0f;
|
| 46 |
|
|
float beta = 90.0f;
|
| 47 |
|
|
|
| 48 |
ff065f8f
|
Leszek Koltunski
|
Dynamic5D d1 = new Dynamic5D(duration/2, 0.5f);
|
| 49 |
086a24d0
|
Leszek Koltunski
|
d1.add(new Static5D( init_amplitude, length, init_phase, alpha, beta) );
|
| 50 |
|
|
d1.add(new Static5D( end_amplitude , length, end_phase , alpha, beta) );
|
| 51 |
5ba13c05
|
Leszek Koltunski
|
Static3D center = new Static3D(0,0,0);
|
| 52 |
086a24d0
|
Leszek Koltunski
|
mNodeEffects[0][0] = new VertexEffectWave(d1, center, null);
|
| 53 |
|
|
|
| 54 |
17a7c91a
|
Leszek Koltunski
|
Dynamic1D d0 = new Dynamic1D(duration/2, 0.5f);
|
| 55 |
|
|
d0.add(new Static1D(1.0f));
|
| 56 |
|
|
d0.add(new Static1D(0.0f));
|
| 57 |
|
|
mNodeEffects[0][1] = new FragmentEffectAlpha(d0);
|
| 58 |
|
|
|
| 59 |
086a24d0
|
Leszek Koltunski
|
return 2;
|
| 60 |
|
|
}
|
| 61 |
|
|
|
| 62 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 63 |
|
|
|
| 64 |
|
|
public int createEffectsPhase1(int duration)
|
| 65 |
|
|
{
|
| 66 |
17a7c91a
|
Leszek Koltunski
|
mNodeEffectPosition[1] = new int[] {-1,-1};
|
| 67 |
086a24d0
|
Leszek Koltunski
|
mNodeEffects[1] = new Effect[mNodeEffectPosition[1].length];
|
| 68 |
39fb9047
|
Leszek Koltunski
|
|
| 69 |
17a7c91a
|
Leszek Koltunski
|
float init_amplitude = 1/8.0f;
|
| 70 |
39fb9047
|
Leszek Koltunski
|
float end_amplitude = 0.0f;
|
| 71 |
17a7c91a
|
Leszek Koltunski
|
float length = 1/8.0f;
|
| 72 |
39fb9047
|
Leszek Koltunski
|
float init_phase = 0.0f;
|
| 73 |
|
|
float end_phase = 360.0f;
|
| 74 |
|
|
float alpha = 30.0f;
|
| 75 |
|
|
float beta = 90.0f;
|
| 76 |
|
|
|
| 77 |
ff065f8f
|
Leszek Koltunski
|
Dynamic5D d1 = new Dynamic5D(duration/2, 0.5f);
|
| 78 |
39fb9047
|
Leszek Koltunski
|
d1.add(new Static5D( init_amplitude, length, init_phase, alpha, beta) );
|
| 79 |
|
|
d1.add(new Static5D( end_amplitude , length, end_phase , alpha, beta) );
|
| 80 |
5ba13c05
|
Leszek Koltunski
|
Static3D center = new Static3D(0,0,0);
|
| 81 |
086a24d0
|
Leszek Koltunski
|
mNodeEffects[1][0] = new VertexEffectWave(d1, center, null);
|
| 82 |
39fb9047
|
Leszek Koltunski
|
|
| 83 |
17a7c91a
|
Leszek Koltunski
|
Dynamic1D d0 = new Dynamic1D(duration/2, 0.5f);
|
| 84 |
|
|
d0.add(new Static1D(0.0f));
|
| 85 |
|
|
d0.add(new Static1D(1.0f));
|
| 86 |
|
|
mNodeEffects[1][1] = new FragmentEffectAlpha(d0);
|
| 87 |
|
|
|
| 88 |
39fb9047
|
Leszek Koltunski
|
return 2;
|
| 89 |
434f2f5a
|
Leszek Koltunski
|
}
|
| 90 |
|
|
|
| 91 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 92 |
c909b8e3
|
Leszek Koltunski
|
// Enable all effects used in this Effect. Called by reflection from the parent class.
|
| 93 |
434f2f5a
|
Leszek Koltunski
|
|
| 94 |
9208e27b
|
Leszek Koltunski
|
@SuppressWarnings("unused")
|
| 95 |
|
|
static void enable()
|
| 96 |
434f2f5a
|
Leszek Koltunski
|
{
|
| 97 |
9208e27b
|
Leszek Koltunski
|
FragmentEffectAlpha.enable();
|
| 98 |
39fb9047
|
Leszek Koltunski
|
VertexEffectWave.enable();
|
| 99 |
434f2f5a
|
Leszek Koltunski
|
}
|
| 100 |
|
|
}
|