Revision 3521c6fe
Added by Leszek Koltunski over 8 years ago
| src/main/java/org/distorted/library/effect/EffectName.java | ||
|---|---|---|
| 42 | 42 |
|
| 43 | 43 |
public enum EffectName |
| 44 | 44 |
{
|
| 45 |
// EFFECT NAME /////// EFFECT TYPE /////// EFFECT UNITY //////////// DIM // REGION // CENTER
|
|
| 45 |
// EFFECT NAME /////// EFFECT TYPE ////////// EFFECT UNITY //////////// DIM REGION CENTER
|
|
| 46 | 46 |
ROTATE ( EffectType.MATRIX , new float[] {0.0f} , 4, false, true ),
|
| 47 | 47 |
QUATERNION ( EffectType.MATRIX , new float[] {0.0f,0.0f,0.0f} , 4, false, true ),
|
| 48 | 48 |
MOVE ( EffectType.MATRIX , new float[] {0.0f,0.0f,0.0f} , 3, false, false ),
|
| ... | ... | |
| 68 | 68 |
SMOOTH_CONTRAST ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ),
|
| 69 | 69 |
|
| 70 | 70 |
BLUR ( EffectType.POSTPROCESS,new float[] {0.0f} , 1, false, false ),
|
| 71 |
GLOW ( EffectType.POSTPROCESS,new float[] {0.0f} , 1, false, false );
|
|
| 71 |
GLOW ( EffectType.POSTPROCESS,new float[] {0.0f} , 4, false, false );
|
|
| 72 | 72 |
|
| 73 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 74 | 74 |
|
| src/main/java/org/distorted/library/effect/EffectQuality.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2016 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 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 23 |
|
|
| 24 |
import org.distorted.library.main.DistortedEffects; |
|
| 25 |
|
|
| 26 |
/** |
|
| 27 |
* A list of quality levels. |
|
| 28 |
* <p> |
|
| 29 |
* One can set quality of a Postprocessing Effect to one of those. The lower the quality, the faster |
|
| 30 |
* the rendering will be. |
|
| 31 |
* |
|
| 32 |
* @see DistortedEffects |
|
| 33 |
*/ |
|
| 34 |
public enum EffectQuality |
|
| 35 |
{
|
|
| 36 |
HIGHEST ( 0 ), // has to start from 0 |
|
| 37 |
HIGH ( 1 ), |
|
| 38 |
MEDIUM ( 2 ), |
|
| 39 |
LOW ( 3 ); |
|
| 40 |
|
|
| 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 42 |
|
|
| 43 |
public static final float MULTIPLIER = 0.5f; // each next Quality level renders into 1/0.5 smaller buffers |
|
| 44 |
public static final int LENGTH = values().length; |
|
| 45 |
|
|
| 46 |
private final int level; |
|
| 47 |
|
|
| 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 49 |
|
|
| 50 |
EffectQuality(int level) |
|
| 51 |
{
|
|
| 52 |
this.level = level; |
|
| 53 |
} |
|
| 54 |
|
|
| 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 56 |
|
|
| 57 |
public int getLevel() |
|
| 58 |
{
|
|
| 59 |
return level; |
|
| 60 |
} |
|
| 61 |
} |
|
| 62 |
|
|
| src/main/java/org/distorted/library/main/DistortedEffects.java | ||
|---|---|---|
| 25 | 25 |
import org.distorted.library.R; |
| 26 | 26 |
import org.distorted.library.effect.Effect; |
| 27 | 27 |
import org.distorted.library.effect.EffectName; |
| 28 |
import org.distorted.library.effect.EffectQuality; |
|
| 28 | 29 |
import org.distorted.library.effect.EffectType; |
| 29 | 30 |
import org.distorted.library.effect.FragmentEffect; |
| 30 | 31 |
import org.distorted.library.effect.VertexEffect; |
| ... | ... | |
| 305 | 306 |
case MIPMAP: int level = job.level; |
| 306 | 307 |
mP.mQualityLevel = level; |
| 307 | 308 |
mP.mQualityScale = 1.0f; |
| 308 |
for(int j=0; j<level; j++) mP.mQualityScale*=EffectQuality.MULTIPLIER; |
|
| 309 |
for(int j=0; j<level; j++) mP.mQualityScale*= EffectQuality.MULTIPLIER;
|
|
| 309 | 310 |
break; |
| 310 | 311 |
} |
| 311 | 312 |
} |
| ... | ... | |
| 638 | 639 |
*/ |
| 639 | 640 |
public void setPostprocessingQuality(EffectQuality quality) |
| 640 | 641 |
{
|
| 641 |
mJobs.add(new Job(MIPMAP,quality.level));
|
|
| 642 |
mJobs.add(new Job(MIPMAP,quality.getLevel()));
|
|
| 642 | 643 |
DistortedMaster.newSlave(this); |
| 643 | 644 |
} |
| 644 | 645 |
|
| src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
|---|---|---|
| 22 | 22 |
import android.opengl.GLES30; |
| 23 | 23 |
import android.opengl.Matrix; |
| 24 | 24 |
|
| 25 |
import org.distorted.library.effect.EffectQuality; |
|
| 26 |
|
|
| 25 | 27 |
import java.util.ArrayList; |
| 26 | 28 |
|
| 27 | 29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/library/main/EffectQuality.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2016 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.main; |
|
| 21 |
|
|
| 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 23 |
/** |
|
| 24 |
* A list of quality levels. |
|
| 25 |
* <p> |
|
| 26 |
* One can set quality of a Postprocessing Effect to one of those. The lower the quality, the faster |
|
| 27 |
* the rendering will be. |
|
| 28 |
* |
|
| 29 |
* @see DistortedEffectsPostprocess |
|
| 30 |
*/ |
|
| 31 |
public enum EffectQuality |
|
| 32 |
{
|
|
| 33 |
HIGHEST ( 0 ), // has to start from 0 |
|
| 34 |
HIGH ( 1 ), |
|
| 35 |
MEDIUM ( 2 ), |
|
| 36 |
LOW ( 3 ); |
|
| 37 |
|
|
| 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 39 |
|
|
| 40 |
final static float MULTIPLIER = 0.5f; // each next Quality level renders into 1/0.5 smaller buffers |
|
| 41 |
final static int LENGTH = values().length; |
|
| 42 |
|
|
| 43 |
final int level; |
|
| 44 |
|
|
| 45 |
EffectQuality(int level) |
|
| 46 |
{
|
|
| 47 |
this.level = level; |
|
| 48 |
} |
|
| 49 |
} |
|
| 50 |
|
|
Also available in: Unified diff
move EffectQuality to the effect package.