Project

General

Profile

« Previous | Next » 

Revision febb61ba

Added by Leszek Koltunski about 7 years ago

Still several problems, but the core of Multiblur works now.

View differences:

src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java
22 22
import android.app.Activity;
23 23
import android.opengl.GLSurfaceView;
24 24
import android.os.Bundle;
25
import android.view.View;
26
import android.widget.CheckBox;
25 27
import android.widget.SeekBar;
26 28

  
27 29
import org.distorted.examples.R;
......
101 103
    public void onStopTrackingTouch(SeekBar bar)  { }
102 104

  
103 105
///////////////////////////////////////////////////////////////////////////////////////////////////
106

  
107
  public void onClick(View view)
108
    {
109
    CheckBox box = (CheckBox)view;
110
    int id = box.getId();
111
    boolean checked = box.isChecked();
112
    MultiblurSurfaceView sView = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
113

  
114
    switch(id)
115
      {
116
      case R.id.multiblurCheckBox0  : sView.getRenderer().pressed(0,checked); break;
117
      case R.id.multiblurCheckBox1  : sView.getRenderer().pressed(1,checked); break;
118
      case R.id.multiblurCheckBox2  : sView.getRenderer().pressed(2,checked); break;
119
      case R.id.multiblurCheckBox3  : sView.getRenderer().pressed(3,checked); break;
120
      case R.id.multiblurCheckBox4  : sView.getRenderer().pressed(4,checked); break;
121
      case R.id.multiblurCheckBox5  : sView.getRenderer().pressed(5,checked); break;
122
      case R.id.multiblurCheckBox6  : sView.getRenderer().pressed(6,checked); break;
123
      case R.id.multiblurCheckBox7  : sView.getRenderer().pressed(7,checked); break;
124
      }
125
    }
104 126
}
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
69 69
    private Static3D[]  mMoveVector;
70 70
    private Dynamic3D[] mMoveDynamic;
71 71
    private Static1D  mBlurVector;
72
    private Dynamic1D  mBlurDynamic;
72 73
    private DistortedScreen mScreen;
73 74
    private DynamicQuat mQuatInt1, mQuatInt2;
74 75
    private int mDistance;
......
96 97
        mMoveDynamic[i].add(mMoveVector[i]);
97 98
        }
98 99

  
99
      Dynamic1D blurDynamic= new Dynamic1D();
100
      mBlurDynamic= new Dynamic1D();
100 101
      mBlurVector = new Static1D(10);
101
      blurDynamic.add(mBlurVector);
102
      mBlurDynamic.add(mBlurVector);
102 103

  
103
      mEffects[0].blur(blurDynamic);
104
      mEffects[0].blur(mBlurDynamic);
104 105

  
105 106
      MeshCubes mesh = new MeshCubes(1,1,false);
106 107

  
......
221 222
      mBlurVector.set(range);
222 223
      android.util.Log.e("renderer", "range: "+range);
223 224
      }
225

  
226
///////////////////////////////////////////////////////////////////////////////////////////////////
227

  
228
   void pressed(int number, boolean checked)
229
     {
230
     if( number>=0 && number<=7 && mEffects!=null )
231
       {
232
       if( checked )
233
         {
234
         long effectNum = mEffects[number].blur(mBlurDynamic);
235

  
236
         if( effectNum<0 )
237
           {
238
           android.util.Log.e("renderer", "Error, failed to add BLUR effect, number: "+number );
239
           }
240
         else
241
           {
242
           android.util.Log.e("renderer", "Successfully added BLUR effect, number: "+number );
243
           }
244
         }
245
       else
246
         {
247
         int numAborted = mEffects[number].abortEffects(EffectNames.BLUR);
248

  
249
         if( numAborted!=1 )
250
           {
251
           android.util.Log.e("renderer", "Error, number: "+number+" unexpected number of effects aborted ("+numAborted+" - should have been 1)" );
252
           }
253
         }
254
       }
255
     else
256
       {
257
       android.util.Log.e("renderer", "Error, number: "+number+" checked: "+checked+" mEffects="+ (mEffects==null ? "null":"not null") );
258
       }
259
     }
224 260
}
src/main/res/layout/multiblurlayout.xml
15 15
        android:layout_width="fill_parent"
16 16
        android:layout_height="wrap_content"
17 17
        android:gravity="center|fill_horizontal"
18
        android:orientation="horizontal"
18
        android:orientation="vertical"
19
        android:background="@color/blue"
19 20
        android:paddingBottom="10dp"
20 21
        android:paddingTop="10dp" >
21 22

  
22 23
        <SeekBar
23 24
            android:id="@+id/multiblurDistanceSeek"
24 25
            android:layout_weight="1"
25
            android:layout_width="wrap_content"
26
            android:layout_height="wrap_content"
26
            android:layout_width="fill_parent"
27
            android:layout_height="0dp"
27 28
            android:paddingLeft="10dp"
28 29
            android:paddingRight="10dp" />
29 30

  
31
    </LinearLayout>
32

  
33
    <LinearLayout
34
        android:id="@+id/linearLayout2"
35
        android:layout_width="fill_parent"
36
        android:layout_height="wrap_content"
37
        android:gravity="center|fill_horizontal"
38
        android:orientation="vertical"
39
        android:background="@color/red"
40
        android:paddingBottom="10dp"
41
        android:paddingTop="10dp" >
42

  
30 43
        <SeekBar
31 44
            android:id="@+id/multiblurRangeSeek"
32 45
            android:layout_weight="1"
33
            android:layout_width="wrap_content"
34
            android:layout_height="wrap_content"
46
            android:layout_width="fill_parent"
47
            android:layout_height="0dp"
35 48
            android:paddingLeft="10dp"
36 49
            android:paddingRight="10dp" />
37 50

  
51
        <LinearLayout
52
            android:orientation="horizontal"
53
            android:layout_width="match_parent"
54
            android:layout_height="0dp"
55
            android:layout_weight="1">
56

  
57
            <CheckBox
58
                android:layout_width="wrap_content"
59
                android:layout_height="match_parent"
60
                android:id="@+id/multiblurCheckBox0"
61
                android:onClick="onClick"
62
                android:layout_weight="1"
63
                android:checked="true"/>
64
            <CheckBox
65
                android:layout_width="wrap_content"
66
                android:layout_height="match_parent"
67
                android:id="@+id/multiblurCheckBox1"
68
                android:onClick="onClick"
69
                android:layout_weight="1"
70
                android:checked="false"/>
71
            <CheckBox
72
                android:layout_width="wrap_content"
73
                android:layout_height="match_parent"
74
                android:id="@+id/multiblurCheckBox2"
75
                android:onClick="onClick"
76
                android:layout_weight="1"
77
                android:checked="false"/>
78
            <CheckBox
79
                android:layout_width="wrap_content"
80
                android:layout_height="match_parent"
81
                android:id="@+id/multiblurCheckBox3"
82
                android:onClick="onClick"
83
                android:layout_weight="1"
84
                android:checked="false"/>
85
             <CheckBox
86
                 android:layout_width="wrap_content"
87
                 android:layout_height="match_parent"
88
                 android:id="@+id/multiblurCheckBox4"
89
                 android:onClick="onClick"
90
                 android:layout_weight="1"
91
                 android:checked="false"/>
92
             <CheckBox
93
                 android:layout_width="wrap_content"
94
                 android:layout_height="match_parent"
95
                 android:id="@+id/multiblurCheckBox5"
96
                 android:onClick="onClick"
97
                 android:layout_weight="1"
98
                 android:checked="false"/>
99
             <CheckBox
100
                 android:layout_width="wrap_content"
101
                 android:layout_height="match_parent"
102
                 android:id="@+id/multiblurCheckBox6"
103
                 android:onClick="onClick"
104
                 android:layout_weight="1"
105
                 android:checked="false"/>
106
             <CheckBox
107
                 android:layout_width="wrap_content"
108
                 android:layout_height="match_parent"
109
                 android:id="@+id/multiblurCheckBox7"
110
                 android:onClick="onClick"
111
                 android:layout_weight="1"
112
                 android:checked="false"/>
113
        </LinearLayout>
114

  
38 115
    </LinearLayout>
39 116

  
40 117
</LinearLayout>

Also available in: Unified diff