«
Previous
|
Next
»
Revision 828498b1
Added by Leszek Koltunski 3 days ago
- ID 828498b151d1a3d34e08cf4bd4e423a0c7ad4979
- Parent d9a683de
src/main/java/org/distorted/examples/singlemesh/SingleMeshActivity.java | ||
---|---|---|
106 | 106 |
if( id == R.id.singlemesh6 ) r.disappear(6); |
107 | 107 |
if( id == R.id.singlemesh7 ) r.disappear(7); |
108 | 108 |
} |
109 |
|
|
110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
111 |
|
|
112 |
public void NotAffected(View view) |
|
113 |
{ |
|
114 |
CheckBox box = (CheckBox)view; |
|
115 |
int id = box.getId(); |
|
116 |
SingleMeshSurfaceView v = findViewById(R.id.singlemeshSurfaceView); |
|
117 |
SingleMeshRenderer r = v.getRenderer(); |
|
118 |
|
|
119 |
if( id == R.id.singlemeshNot0 ) r.notAffected(0); |
|
120 |
if( id == R.id.singlemeshNot1 ) r.notAffected(1); |
|
121 |
if( id == R.id.singlemeshNot2 ) r.notAffected(2); |
|
122 |
if( id == R.id.singlemeshNot3 ) r.notAffected(3); |
|
123 |
if( id == R.id.singlemeshNot4 ) r.notAffected(4); |
|
124 |
if( id == R.id.singlemeshNot5 ) r.notAffected(5); |
|
125 |
if( id == R.id.singlemeshNot6 ) r.notAffected(6); |
|
126 |
if( id == R.id.singlemeshNot7 ) r.notAffected(7); |
|
127 |
} |
|
109 | 128 |
} |
src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java | ||
---|---|---|
119 | 119 |
private final Static1D mAngle; |
120 | 120 |
private final Static3D mAxis; |
121 | 121 |
private final boolean[] mInvisible; |
122 |
private final boolean[] mNotAffected; |
|
122 | 123 |
|
123 | 124 |
private int mDisappearAssociation; |
124 | 125 |
private DistortedTexture mTexture; |
... | ... | |
132 | 133 |
SingleMeshRenderer(GLSurfaceView v) |
133 | 134 |
{ |
134 | 135 |
mInvisible = new boolean[NUM_CUBITS]; |
136 |
mNotAffected = new boolean[NUM_CUBITS]; |
|
135 | 137 |
mResources = v.getResources(); |
136 | 138 |
|
137 | 139 |
mScreen = new DistortedScreen(); |
... | ... | |
270 | 272 |
mDisappear.setMeshAssociation(mDisappearAssociation,-1); |
271 | 273 |
} |
272 | 274 |
|
275 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
276 |
|
|
277 |
void notAffected(int cubit) |
|
278 |
{ |
|
279 |
mNotAffected[cubit] = !mNotAffected[cubit]; |
|
280 |
|
|
281 |
int numComponents = 0; |
|
282 |
for(int c=0; c<NUM_CUBITS; c++) if( mNotAffected[c] ) numComponents++; |
|
283 |
int[] components = new int[numComponents]; |
|
284 |
|
|
285 |
int index =0; |
|
286 |
for(int c=0; c<NUM_CUBITS; c++) |
|
287 |
if( mNotAffected[c] ) components[index++]=c; |
|
288 |
|
|
289 |
mMesh.setComponentsNotAffectedByPostprocessing(components); |
|
290 |
} |
|
291 |
|
|
273 | 292 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
274 | 293 |
|
275 | 294 |
int addAssociation(int cubit, int assoc) { return (assoc | (1<<cubit)); } |
src/main/res/layout/singlemeshlayout.xml | ||
---|---|---|
140 | 140 |
|
141 | 141 |
</LinearLayout> |
142 | 142 |
|
143 |
<LinearLayout |
|
144 |
android:orientation="horizontal" |
|
145 |
android:layout_width="match_parent" |
|
146 |
android:layout_height="wrap_content"> |
|
147 |
|
|
148 |
<CheckBox |
|
149 |
android:id="@+id/singlemeshNot0" |
|
150 |
android:layout_width="wrap_content" |
|
151 |
android:layout_height="match_parent" |
|
152 |
android:layout_weight="1" |
|
153 |
android:checked="false" |
|
154 |
android:onClick="NotAffected" |
|
155 |
android:text="1" |
|
156 |
android:textSize="12sp"/> |
|
157 |
<CheckBox |
|
158 |
android:id="@+id/singlemeshNot1" |
|
159 |
android:layout_width="wrap_content" |
|
160 |
android:layout_height="match_parent" |
|
161 |
android:layout_weight="1" |
|
162 |
android:checked="false" |
|
163 |
android:onClick="NotAffected" |
|
164 |
android:text="2" |
|
165 |
android:textSize="12sp"/> |
|
166 |
<CheckBox |
|
167 |
android:id="@+id/singlemeshNot2" |
|
168 |
android:layout_width="wrap_content" |
|
169 |
android:layout_height="match_parent" |
|
170 |
android:layout_weight="1" |
|
171 |
android:checked="false" |
|
172 |
android:onClick="NotAffected" |
|
173 |
android:text="3" |
|
174 |
android:textSize="12sp"/> |
|
175 |
<CheckBox |
|
176 |
android:id="@+id/singlemeshNot3" |
|
177 |
android:layout_width="wrap_content" |
|
178 |
android:layout_height="match_parent" |
|
179 |
android:layout_weight="1" |
|
180 |
android:checked="false" |
|
181 |
android:onClick="NotAffected" |
|
182 |
android:text="4" |
|
183 |
android:textSize="12sp"/> |
|
184 |
<CheckBox |
|
185 |
android:id="@+id/singlemeshNot4" |
|
186 |
android:layout_width="wrap_content" |
|
187 |
android:layout_height="match_parent" |
|
188 |
android:layout_weight="1" |
|
189 |
android:checked="false" |
|
190 |
android:onClick="NotAffected" |
|
191 |
android:text="5" |
|
192 |
android:textSize="12sp"/> |
|
193 |
<CheckBox |
|
194 |
android:id="@+id/singlemeshNot5" |
|
195 |
android:layout_width="wrap_content" |
|
196 |
android:layout_height="match_parent" |
|
197 |
android:layout_weight="1" |
|
198 |
android:checked="false" |
|
199 |
android:onClick="NotAffected" |
|
200 |
android:text="6" |
|
201 |
android:textSize="12sp"/> |
|
202 |
<CheckBox |
|
203 |
android:id="@+id/singlemeshNot6" |
|
204 |
android:layout_width="wrap_content" |
|
205 |
android:layout_height="match_parent" |
|
206 |
android:layout_weight="1" |
|
207 |
android:checked="false" |
|
208 |
android:onClick="NotAffected" |
|
209 |
android:text="7" |
|
210 |
android:textSize="12sp"/> |
|
211 |
<CheckBox |
|
212 |
android:id="@+id/singlemeshNot7" |
|
213 |
android:layout_width="wrap_content" |
|
214 |
android:layout_height="match_parent" |
|
215 |
android:layout_weight="1" |
|
216 |
android:checked="false" |
|
217 |
android:onClick="NotAffected" |
|
218 |
android:text="8" |
|
219 |
android:textSize="12sp"/> |
|
220 |
|
|
221 |
</LinearLayout> |
|
143 | 222 |
</LinearLayout> |
Also available in: Unified diff
Make it possible to apply Postprocessing effects to only an arbitrary subset of components.