Revision 2a8ee748
Added by Leszek Koltunski over 7 years ago
| src/main/java/org/distorted/examples/TableOfContents.java | ||
|---|---|---|
| 334 | 334 |
activityMapping.put(i++, MirrorActivity.class); |
| 335 | 335 |
} |
| 336 | 336 |
|
| 337 |
{
|
|
| 338 |
final Map<String, Object> item = new HashMap<>(); |
|
| 339 |
item.put(ITEM_IMAGE, R.drawable.icon_example_stencil); |
|
| 340 |
item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_stencil)); |
|
| 341 |
item.put(ITEM_SUBTITLE, getText(R.string.example_stencil_subtitle)); |
|
| 342 |
data.add(item); |
|
| 343 |
activityMapping.put(i++, StencilActivity.class); |
|
| 344 |
} |
|
| 345 |
|
|
| 337 | 346 |
{
|
| 338 | 347 |
final Map<String, Object> item = new HashMap<>(); |
| 339 | 348 |
item.put(ITEM_IMAGE, R.drawable.icon_example_blur); |
| ... | ... | |
| 379 | 388 |
activityMapping.put(i++, PostprocessTreeActivity.class); |
| 380 | 389 |
} |
| 381 | 390 |
|
| 382 |
{
|
|
| 383 |
final Map<String, Object> item = new HashMap<>(); |
|
| 384 |
item.put(ITEM_IMAGE, R.drawable.icon_example_stencil); |
|
| 385 |
item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_stencil)); |
|
| 386 |
item.put(ITEM_SUBTITLE, getText(R.string.example_stencil_subtitle)); |
|
| 387 |
data.add(item); |
|
| 388 |
activityMapping.put(i++, StencilActivity.class); |
|
| 389 |
} |
|
| 390 |
|
|
| 391 | 391 |
{
|
| 392 | 392 |
final Map<String, Object> item = new HashMap<>(); |
| 393 | 393 |
item.put(ITEM_IMAGE, R.drawable.icon_example_wip); |
| ... | ... | |
| 399 | 399 |
|
| 400 | 400 |
{
|
| 401 | 401 |
final Map<String, Object> item = new HashMap<>(); |
| 402 |
item.put(ITEM_IMAGE, R.drawable.icon_example_wip);
|
|
| 402 |
item.put(ITEM_IMAGE, R.drawable.icon_example_movingglow);
|
|
| 403 | 403 |
item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_moving_glow)); |
| 404 | 404 |
item.put(ITEM_SUBTITLE, getText(R.string.example_moving_glow_subtitle)); |
| 405 | 405 |
data.add(item); |
| src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java | ||
|---|---|---|
| 54 | 54 |
|
| 55 | 55 |
class MovingGlowRenderer implements GLSurfaceView.Renderer,EffectListener |
| 56 | 56 |
{
|
| 57 |
private static final int[] colors = new int[] {0,0,1, 0,0,0, 1,0,0, 1,1,0, 0,1,0, 1,1,1}; // blue, black, red, yellow, green, white
|
|
| 57 |
private static final int[] colors = new int[] {0,0,1, 1,0,1, 1,0,0, 1,1,0, 0,1,0, 1,1,1}; // blue, pink, red, yellow, green, white
|
|
| 58 |
private static final int FLASH_TIME = 2000; |
|
| 58 | 59 |
private static final int LEAF_SIZE = 100; |
| 59 | 60 |
private static final int NUM_LEAVES= colors.length/3; |
| 60 | 61 |
|
| ... | ... | |
| 73 | 74 |
{
|
| 74 | 75 |
mView = v; |
| 75 | 76 |
|
| 76 |
mRootW = 4*LEAF_SIZE;
|
|
| 77 |
mRootH = 4*LEAF_SIZE;
|
|
| 77 |
mRootW = 5*LEAF_SIZE;
|
|
| 78 |
mRootH = 5*LEAF_SIZE;
|
|
| 78 | 79 |
|
| 79 | 80 |
mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE); |
| 80 | 81 |
DistortedTexture surface = new DistortedTexture(mRootW,mRootH); |
| ... | ... | |
| 82 | 83 |
|
| 83 | 84 |
DistortedNode root = new DistortedNode(surface, new DistortedEffects(), mesh); |
| 84 | 85 |
|
| 85 |
Static3D moveVector = new Static3D(0.25f*LEAF_SIZE, (mRootH-LEAF_SIZE)/2, 0);
|
|
| 86 |
Static3D moveVector = new Static3D(0.55f*LEAF_SIZE, (mRootH-LEAF_SIZE)/2, 0);
|
|
| 86 | 87 |
Static1D chromaLevel= new Static1D(0.5f); |
| 87 | 88 |
Static3D center = new Static3D(mRootW/2, mRootH/2, 0); |
| 88 | 89 |
Static3D axis = new Static3D(0,0,1); |
| ... | ... | |
| 113 | 114 |
effects.apply(new MatrixEffectScale(mScale)); |
| 114 | 115 |
effects.apply( new MatrixEffectRotate(rot, axis, center) ); |
| 115 | 116 |
|
| 116 |
Dynamic1D radiusDyn = new Dynamic1D(3000,1.0f);
|
|
| 117 |
Dynamic1D radiusDyn = new Dynamic1D(FLASH_TIME,1.0f);
|
|
| 117 | 118 |
radiusDyn.add(new Static1D( 0)); |
| 118 | 119 |
radiusDyn.add(new Static1D(50)); |
| 119 | 120 |
|
| 120 | 121 |
for(int leaf=0; leaf<NUM_LEAVES; leaf++) |
| 121 | 122 |
{
|
| 122 |
Dynamic4D color= new Dynamic4D(3000,0.5f);
|
|
| 123 |
Static4D P1 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1);
|
|
| 124 |
Static4D P2 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1); |
|
| 123 |
Dynamic4D color= new Dynamic4D(FLASH_TIME,1.0f);
|
|
| 124 |
Static4D P1 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 0.0f);
|
|
| 125 |
Static4D P2 = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1.0f);
|
|
| 125 | 126 |
color.add(P1); |
| 126 | 127 |
color.add(P2); |
| 127 | 128 |
|
Also available in: Unified diff
Progress with thr Glow effect - moving glow app looks ok now.