Revision efc280af
Added by Leszek Koltunski over 7 years ago
| src/main/AndroidManifest.xml | ||
|---|---|---|
| 46 | 46 |
<activity android:name=".blur.BlurActivity"/> |
| 47 | 47 |
<activity android:name=".multiblur.MultiblurActivity"/> |
| 48 | 48 |
<activity android:name=".triblur.TriblurActivity"/> |
| 49 |
<activity android:name=".postprocesstree.PostprocessTreeActivity"/> |
|
| 49 | 50 |
<activity android:name=".stencil.StencilActivity"/> |
| 50 | 51 |
<activity android:name=".glow.GlowActivity"/> |
| 51 | 52 |
<activity android:name=".movingglow.MovingGlowActivity"/> |
| src/main/java/org/distorted/examples/TableOfContents.java | ||
|---|---|---|
| 64 | 64 |
import org.distorted.examples.blur.BlurActivity; |
| 65 | 65 |
import org.distorted.examples.multiblur.MultiblurActivity; |
| 66 | 66 |
import org.distorted.examples.triblur.TriblurActivity; |
| 67 |
import org.distorted.examples.postprocesstree.PostprocessTreeActivity; |
|
| 67 | 68 |
import org.distorted.examples.stencil.StencilActivity; |
| 68 | 69 |
import org.distorted.examples.glow.GlowActivity; |
| 69 | 70 |
import org.distorted.examples.movingglow.MovingGlowActivity; |
| ... | ... | |
| 359 | 360 |
activityMapping.put(i++, TriblurActivity.class); |
| 360 | 361 |
} |
| 361 | 362 |
|
| 363 |
{
|
|
| 364 |
final Map<String, Object> item = new HashMap<>(); |
|
| 365 |
item.put(ITEM_IMAGE, R.drawable.icon_example_postprocesstree); |
|
| 366 |
item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_postprocesstree)); |
|
| 367 |
item.put(ITEM_SUBTITLE, getText(R.string.example_postprocesstree_subtitle)); |
|
| 368 |
data.add(item); |
|
| 369 |
activityMapping.put(i++, PostprocessTreeActivity.class); |
|
| 370 |
} |
|
| 371 |
|
|
| 362 | 372 |
{
|
| 363 | 373 |
final Map<String, Object> item = new HashMap<>(); |
| 364 | 374 |
item.put(ITEM_IMAGE, R.drawable.icon_example_stencil); |
| src/main/java/org/distorted/examples/blur/BlurActivity.java | ||
|---|---|---|
| 77 | 77 |
Distorted.onDestroy(); |
| 78 | 78 |
super.onDestroy(); |
| 79 | 79 |
} |
| 80 |
|
|
| 81 |
/////////////////////////////////////////////////////////////////// |
|
| 80 |
|
|
| 81 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
| 82 | 82 |
|
| 83 | 83 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
| 84 | 84 |
{
|
| ... | ... | |
| 92 | 92 |
} |
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 |
/////////////////////////////////////////////////////////////////// |
|
| 95 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
| 96 | 96 |
|
| 97 | 97 |
public void onStartTrackingTouch(SeekBar bar) { }
|
| 98 |
|
|
| 99 |
/////////////////////////////////////////////////////////////////// |
|
| 98 |
|
|
| 99 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
| 100 | 100 |
|
| 101 | 101 |
public void onStopTrackingTouch(SeekBar bar) { }
|
| 102 | 102 |
|
| src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeActivity.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.examples.postprocesstree; |
|
| 21 |
|
|
| 22 |
import android.app.Activity; |
|
| 23 |
import android.opengl.GLSurfaceView; |
|
| 24 |
import android.os.Bundle; |
|
| 25 |
import android.widget.SeekBar; |
|
| 26 |
import android.widget.TextView; |
|
| 27 |
|
|
| 28 |
import org.distorted.examples.R; |
|
| 29 |
import org.distorted.library.main.Distorted; |
|
| 30 |
|
|
| 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 32 |
|
|
| 33 |
public class PostprocessTreeActivity extends Activity implements SeekBar.OnSeekBarChangeListener |
|
| 34 |
{
|
|
| 35 |
private TextView mText; |
|
| 36 |
|
|
| 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 38 |
|
|
| 39 |
@Override |
|
| 40 |
protected void onCreate(Bundle savedState) |
|
| 41 |
{
|
|
| 42 |
super.onCreate(savedState); |
|
| 43 |
setContentView(R.layout.postprocesstreelayout); |
|
| 44 |
mText = (TextView)findViewById(R.id.postprocesstreeText); |
|
| 45 |
SeekBar bar = (SeekBar)findViewById(R.id.postprocesstreeSeek); |
|
| 46 |
bar.setOnSeekBarChangeListener(this); |
|
| 47 |
bar.setProgress(50); |
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 51 |
|
|
| 52 |
@Override |
|
| 53 |
protected void onPause() |
|
| 54 |
{
|
|
| 55 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.postprocesstreeSurfaceView); |
|
| 56 |
view.onPause(); |
|
| 57 |
Distorted.onPause(); |
|
| 58 |
super.onPause(); |
|
| 59 |
} |
|
| 60 |
|
|
| 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 62 |
|
|
| 63 |
@Override |
|
| 64 |
protected void onResume() |
|
| 65 |
{
|
|
| 66 |
super.onResume(); |
|
| 67 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.postprocesstreeSurfaceView); |
|
| 68 |
view.onResume(); |
|
| 69 |
} |
|
| 70 |
|
|
| 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 72 |
|
|
| 73 |
@Override |
|
| 74 |
protected void onDestroy() |
|
| 75 |
{
|
|
| 76 |
Distorted.onDestroy(); |
|
| 77 |
super.onDestroy(); |
|
| 78 |
} |
|
| 79 |
|
|
| 80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 81 |
|
|
| 82 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
|
| 83 |
{
|
|
| 84 |
PostprocessTreeSurfaceView view = (PostprocessTreeSurfaceView) this.findViewById(R.id.postprocesstreeSurfaceView); |
|
| 85 |
|
|
| 86 |
switch (bar.getId()) |
|
| 87 |
{
|
|
| 88 |
case R.id.blurSeek: int level = view.getRenderer().setBlur(progress); |
|
| 89 |
mText.setText(getString(R.string.blur_placeholder,level)); |
|
| 90 |
break; |
|
| 91 |
} |
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 95 |
|
|
| 96 |
public void onStartTrackingTouch(SeekBar bar) { }
|
|
| 97 |
|
|
| 98 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 99 |
|
|
| 100 |
public void onStopTrackingTouch(SeekBar bar) { }
|
|
| 101 |
|
|
| 102 |
} |
|
| src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeRenderer.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.examples.postprocesstree; |
|
| 21 |
|
|
| 22 |
import android.graphics.Bitmap; |
|
| 23 |
import android.graphics.BitmapFactory; |
|
| 24 |
import android.opengl.GLSurfaceView; |
|
| 25 |
|
|
| 26 |
import org.distorted.examples.R; |
|
| 27 |
import org.distorted.library.effect.FragmentEffectChroma; |
|
| 28 |
import org.distorted.library.effect.MatrixEffectMove; |
|
| 29 |
import org.distorted.library.effect.MatrixEffectRotate; |
|
| 30 |
import org.distorted.library.effect.MatrixEffectScale; |
|
| 31 |
import org.distorted.library.effect.PostprocessEffectBlur; |
|
| 32 |
import org.distorted.library.main.Distorted; |
|
| 33 |
import org.distorted.library.main.DistortedEffects; |
|
| 34 |
import org.distorted.library.main.DistortedNode; |
|
| 35 |
import org.distorted.library.main.DistortedScreen; |
|
| 36 |
import org.distorted.library.main.DistortedTexture; |
|
| 37 |
import org.distorted.library.main.MeshFlat; |
|
| 38 |
import org.distorted.library.type.Dynamic1D; |
|
| 39 |
import org.distorted.library.type.Static1D; |
|
| 40 |
import org.distorted.library.type.Static3D; |
|
| 41 |
|
|
| 42 |
import java.io.IOException; |
|
| 43 |
import java.io.InputStream; |
|
| 44 |
|
|
| 45 |
import javax.microedition.khronos.egl.EGLConfig; |
|
| 46 |
import javax.microedition.khronos.opengles.GL10; |
|
| 47 |
|
|
| 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 49 |
|
|
| 50 |
class PostprocessTreeRenderer implements GLSurfaceView.Renderer |
|
| 51 |
{
|
|
| 52 |
private static final int LEAF_SIZE = 100; |
|
| 53 |
private static final int NUM_LEAVES = 8; |
|
| 54 |
|
|
| 55 |
private GLSurfaceView mView; |
|
| 56 |
private DistortedTexture mLeaf; |
|
| 57 |
private DistortedScreen mScreen; |
|
| 58 |
private int mScreenW, mScreenH; |
|
| 59 |
private Static3D mMove, mInnerScale, mOuterScale; |
|
| 60 |
private Static1D mRadiusSta; |
|
| 61 |
|
|
| 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 63 |
|
|
| 64 |
PostprocessTreeRenderer(GLSurfaceView v) |
|
| 65 |
{
|
|
| 66 |
mView = v; |
|
| 67 |
|
|
| 68 |
mScreenW = 9*LEAF_SIZE; |
|
| 69 |
mScreenH = 9*LEAF_SIZE; |
|
| 70 |
|
|
| 71 |
mRadiusSta = new Static1D(5); |
|
| 72 |
Dynamic1D radiusDyn = new Dynamic1D(); |
|
| 73 |
radiusDyn.add(mRadiusSta); |
|
| 74 |
|
|
| 75 |
mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE); |
|
| 76 |
|
|
| 77 |
MeshFlat mesh = new MeshFlat(1,1); |
|
| 78 |
mMove = new Static3D(0,0,0); |
|
| 79 |
|
|
| 80 |
mInnerScale= new Static3D(1,1,1); |
|
| 81 |
mOuterScale= new Static3D(1,1,1); |
|
| 82 |
|
|
| 83 |
DistortedEffects rootEffects = new DistortedEffects(); |
|
| 84 |
DistortedEffects innerEffects = new DistortedEffects(); |
|
| 85 |
DistortedEffects[] innerLeafEffects= new DistortedEffects[NUM_LEAVES]; |
|
| 86 |
DistortedEffects[] outerLeafEffects= new DistortedEffects[NUM_LEAVES]; |
|
| 87 |
|
|
| 88 |
DistortedNode root = new DistortedNode(new DistortedTexture(mScreenW,mScreenH), rootEffects, mesh); |
|
| 89 |
|
|
| 90 |
DistortedNode[] innerLeafNodes = new DistortedNode[NUM_LEAVES]; |
|
| 91 |
DistortedNode[] outerLeafNodes = new DistortedNode[NUM_LEAVES]; |
|
| 92 |
|
|
| 93 |
rootEffects.apply(new MatrixEffectMove(mMove)); |
|
| 94 |
rootEffects.apply(new MatrixEffectScale(mOuterScale)); |
|
| 95 |
|
|
| 96 |
Dynamic1D rot = new Dynamic1D(5000,0.0f); |
|
| 97 |
rot.setMode(Dynamic1D.MODE_JUMP); |
|
| 98 |
rot.add(new Static1D( 0)); |
|
| 99 |
rot.add(new Static1D(360)); |
|
| 100 |
|
|
| 101 |
Static3D center = new Static3D(3*LEAF_SIZE/2, 3*LEAF_SIZE/2, 0); |
|
| 102 |
Static3D axis = new Static3D(0,0,1); |
|
| 103 |
Static3D innerMoveVector = new Static3D(0, LEAF_SIZE,0); |
|
| 104 |
Static3D outerMoveVector = new Static3D(0,3*LEAF_SIZE,0); |
|
| 105 |
|
|
| 106 |
for(int j=0; j<NUM_LEAVES; j++) |
|
| 107 |
{
|
|
| 108 |
outerLeafEffects[j] = new DistortedEffects(); |
|
| 109 |
outerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
| 110 |
outerLeafEffects[j].apply(new MatrixEffectMove(outerMoveVector)); |
|
| 111 |
outerLeafNodes[j] = new DistortedNode( mLeaf, outerLeafEffects[j], mesh); |
|
| 112 |
|
|
| 113 |
root.attach(outerLeafNodes[j]); |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
innerEffects.apply( new MatrixEffectMove(new Static3D( mScreenW/2, mScreenH/2, 0)) ); |
|
| 117 |
innerEffects.apply( new MatrixEffectRotate(rot, axis, center) ); |
|
| 118 |
rootEffects.apply(new MatrixEffectScale(mInnerScale)); |
|
| 119 |
innerEffects.apply( new FragmentEffectChroma(new Static1D(0.5f), new Static3D(1,0,0) ) ); |
|
| 120 |
|
|
| 121 |
DistortedNode innerNode = new DistortedNode( new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE), innerEffects, mesh); |
|
| 122 |
root.attach(innerNode); |
|
| 123 |
|
|
| 124 |
for(int j=0; j<NUM_LEAVES; j++) |
|
| 125 |
{
|
|
| 126 |
innerLeafEffects[j] = new DistortedEffects(); |
|
| 127 |
innerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
| 128 |
innerLeafEffects[j].apply(new MatrixEffectMove(innerMoveVector)); |
|
| 129 |
innerLeafNodes[j] = new DistortedNode( mLeaf, innerLeafEffects[j], mesh); |
|
| 130 |
|
|
| 131 |
innerNode.attach(innerLeafNodes[j]); |
|
| 132 |
} |
|
| 133 |
|
|
| 134 |
mScreen = new DistortedScreen(); |
|
| 135 |
mScreen.attach(root); |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 139 |
|
|
| 140 |
int setBlur(int blur) |
|
| 141 |
{
|
|
| 142 |
int radius = blur/2; |
|
| 143 |
mRadiusSta.set(radius); |
|
| 144 |
return radius; |
|
| 145 |
} |
|
| 146 |
|
|
| 147 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 148 |
|
|
| 149 |
public void onDrawFrame(GL10 glUnused) |
|
| 150 |
{
|
|
| 151 |
mScreen.render(System.currentTimeMillis()); |
|
| 152 |
} |
|
| 153 |
|
|
| 154 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 155 |
|
|
| 156 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
|
| 157 |
{
|
|
| 158 |
float iFactor, oFactor; |
|
| 159 |
|
|
| 160 |
if( (float)mScreenH/mScreenW > (float)height/width ) |
|
| 161 |
{
|
|
| 162 |
int w = (height*mScreenW)/mScreenH; |
|
| 163 |
oFactor = (float)height/mScreenH; |
|
| 164 |
iFactor = 0.3f*oFactor; |
|
| 165 |
mMove.set((width-w)/2 ,0, 0); |
|
| 166 |
} |
|
| 167 |
else |
|
| 168 |
{
|
|
| 169 |
int h = (width*mScreenH)/mScreenW; |
|
| 170 |
oFactor = (float)width/mScreenW; |
|
| 171 |
iFactor = 0.3f*oFactor; |
|
| 172 |
mMove.set(0,(height-h)/2,0); |
|
| 173 |
} |
|
| 174 |
|
|
| 175 |
mOuterScale.set(oFactor,oFactor,oFactor); |
|
| 176 |
mInnerScale.set(iFactor,iFactor,iFactor); |
|
| 177 |
|
|
| 178 |
mScreen.resize(width, height); |
|
| 179 |
} |
|
| 180 |
|
|
| 181 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 182 |
|
|
| 183 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
|
| 184 |
{
|
|
| 185 |
InputStream is = mView.getContext().getResources().openRawResource(R.raw.leaf); |
|
| 186 |
Bitmap leaf; |
|
| 187 |
|
|
| 188 |
try |
|
| 189 |
{
|
|
| 190 |
leaf = BitmapFactory.decodeStream(is); |
|
| 191 |
} |
|
| 192 |
finally |
|
| 193 |
{
|
|
| 194 |
try |
|
| 195 |
{
|
|
| 196 |
is.close(); |
|
| 197 |
} |
|
| 198 |
catch(IOException e) { }
|
|
| 199 |
} |
|
| 200 |
|
|
| 201 |
mLeaf.setTexture(leaf); |
|
| 202 |
|
|
| 203 |
FragmentEffectChroma.enable(); |
|
| 204 |
PostprocessEffectBlur.enable(); |
|
| 205 |
|
|
| 206 |
try |
|
| 207 |
{
|
|
| 208 |
Distorted.onCreate(mView.getContext()); |
|
| 209 |
} |
|
| 210 |
catch(Exception ex) |
|
| 211 |
{
|
|
| 212 |
android.util.Log.e("PostprocessTree", ex.getMessage() );
|
|
| 213 |
} |
|
| 214 |
} |
|
| 215 |
} |
|
| src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeSurfaceView.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.examples.postprocesstree; |
|
| 21 |
|
|
| 22 |
import android.app.ActivityManager; |
|
| 23 |
import android.content.Context; |
|
| 24 |
import android.content.pm.ConfigurationInfo; |
|
| 25 |
import android.opengl.GLSurfaceView; |
|
| 26 |
import android.util.AttributeSet; |
|
| 27 |
|
|
| 28 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 29 |
|
|
| 30 |
class PostprocessTreeSurfaceView extends GLSurfaceView |
|
| 31 |
{
|
|
| 32 |
private PostprocessTreeRenderer mRenderer; |
|
| 33 |
|
|
| 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 35 |
|
|
| 36 |
public PostprocessTreeSurfaceView(Context context, AttributeSet attrs) |
|
| 37 |
{
|
|
| 38 |
super(context,attrs); |
|
| 39 |
|
|
| 40 |
if(!isInEditMode()) |
|
| 41 |
{
|
|
| 42 |
mRenderer = new PostprocessTreeRenderer(this); |
|
| 43 |
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
|
| 44 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
|
| 45 |
setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 ); |
|
| 46 |
setRenderer(mRenderer); |
|
| 47 |
} |
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 51 |
|
|
| 52 |
PostprocessTreeRenderer getRenderer() |
|
| 53 |
{
|
|
| 54 |
return mRenderer; |
|
| 55 |
} |
|
| 56 |
} |
|
| 57 |
|
|
| src/main/res/layout/postprocesstreelayout.xml | ||
|---|---|---|
| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
android:layout_width="fill_parent" |
|
| 4 |
android:layout_height="fill_parent" |
|
| 5 |
android:orientation="vertical" > |
|
| 6 |
|
|
| 7 |
<org.distorted.examples.postprocesstree.PostprocessTreeSurfaceView |
|
| 8 |
android:id="@+id/postprocesstreeSurfaceView" |
|
| 9 |
android:layout_width="fill_parent" |
|
| 10 |
android:layout_height="0dp" |
|
| 11 |
android:layout_weight="1" /> |
|
| 12 |
|
|
| 13 |
<LinearLayout |
|
| 14 |
android:id="@+id/linearLayout1" |
|
| 15 |
android:layout_width="fill_parent" |
|
| 16 |
android:layout_height="wrap_content" |
|
| 17 |
android:gravity="center|fill_horizontal" |
|
| 18 |
android:orientation="horizontal" > |
|
| 19 |
|
|
| 20 |
<TextView |
|
| 21 |
android:id="@+id/postprocesstreeText" |
|
| 22 |
android:layout_width="150dp" |
|
| 23 |
android:layout_height="wrap_content" |
|
| 24 |
android:layout_weight="0.5" |
|
| 25 |
android:gravity="center_vertical|center" |
|
| 26 |
android:text="@string/blur" |
|
| 27 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
|
| 28 |
|
|
| 29 |
<SeekBar |
|
| 30 |
android:id="@+id/postprocesstreeSeek" |
|
| 31 |
android:layout_width="fill_parent" |
|
| 32 |
android:layout_height="wrap_content" |
|
| 33 |
android:layout_weight="1" |
|
| 34 |
android:paddingLeft="15dp" |
|
| 35 |
android:paddingRight="10dp" /> |
|
| 36 |
|
|
| 37 |
</LinearLayout> |
|
| 38 |
|
|
| 39 |
</LinearLayout> |
|
| src/main/res/values/strings.xml | ||
|---|---|---|
| 157 | 157 |
<string name="example_multiblur_subtitle">Blur multiple objects which obstruct each other.</string> |
| 158 | 158 |
<string name="example_triblur">Triblur</string> |
| 159 | 159 |
<string name="example_triblur_subtitle">Three different, blurred, obstructing objects.</string> |
| 160 |
<string name="example_postprocesstree">Postprocess Tree</string> |
|
| 161 |
<string name="example_postprocesstree_subtitle">Three layers of postprocessed surfaces.</string> |
|
| 160 | 162 |
<string name="example_stencil">Stencil Buffer</string> |
| 161 | 163 |
<string name="example_stencil_subtitle">Implement the classic stencil example from https://open.gl/depthstencils</string> |
| 162 | 164 |
<string name="example_glow">Glowing Leaf</string> |
Also available in: Unified diff
New 'PostprocessTree' app (unfinished)