Revision 8664ea2e
Added by Leszek Koltunski over 4 years ago
src/main/AndroidManifest.xml | ||
---|---|---|
42 | 42 |
<activity android:name=".quaternion.QuaternionActivity" /> |
43 | 43 |
<activity android:name=".generic.GenericActivity" /> |
44 | 44 |
<activity android:name=".generic.GenericActivity2"/> |
45 |
<activity android:name=".plainmonalisa.PlainMonaLisaActivity" />
|
|
45 |
<activity android:name=".surfaceview.SurfaceViewActivity" />
|
|
46 | 46 |
<activity android:name=".save.SaveActivity"/> |
47 | 47 |
<activity android:name=".flag.FlagActivity"/> |
48 | 48 |
<activity android:name=".wind.WindActivity"/> |
src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
---|---|---|
54 | 54 |
private Dynamic5D mWaveDyn; |
55 | 55 |
private Static5D mWaveSta1, mWaveSta2; |
56 | 56 |
private int mObjWidth, mObjHeight, mObjDepth; |
57 |
private Static3D mMove, mScale, mCenter;
|
|
57 |
private Static3D mScale;
|
|
58 | 58 |
|
59 | 59 |
Static4D mQuat1, mQuat2; |
60 | 60 |
int mScreenMin; |
... | ... | |
161 | 161 |
{ |
162 | 162 |
mScreenMin = width<height ? width:height; |
163 | 163 |
float factor = ( width*mObjHeight > height*mObjWidth ) ? (0.8f*height)/mObjHeight : (0.8f*width)/mObjWidth; |
164 |
mMove.set((width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0); |
|
165 | 164 |
mScale.set(factor,factor,factor); |
166 |
mCenter.set(mObjWidth/2,mObjHeight/2, 0); |
|
167 | 165 |
mScreen.resize(width, height); |
168 | 166 |
} |
169 | 167 |
|
src/main/java/org/distorted/examples/mirror/MirrorRenderer.java | ||
---|---|---|
95 | 95 |
mEffectsMirror.apply( new MatrixEffectScale(mScaleMirror)); |
96 | 96 |
mEffectsOffscreen1.apply( new MatrixEffectScale( new Static3D(MIRROR_SCALE,MIRROR_SCALE,MIRROR_SCALE))); |
97 | 97 |
mEffectsOffscreen2.apply( new MatrixEffectMove(mMoveOffscreen2) ); |
98 |
mEffectsHead.apply( new MatrixEffectMove(mHeadPosition) ); |
|
99 | 98 |
mEffectsHead.apply( new MatrixEffectScale(mScaleHead) ); |
99 |
mEffectsHead.apply( new MatrixEffectMove(mHeadPosition) ); |
|
100 | 100 |
mEffectsOffscreen1.apply(new FragmentEffectBrightness(new Static1D(MIRROR_BRIGHTNESS))); |
101 | 101 |
} |
102 | 102 |
|
... | ... | |
157 | 157 |
|
158 | 158 |
float headScale = HEAD_SCALE *mScreenH/ mHeadH; |
159 | 159 |
mScaleHead.set(headScale,headScale,headScale); |
160 |
mHeadPosition.set1( mScreenH*MIRROR_MARGIN*mMirrorW/mMirrorH ); |
|
161 | 160 |
|
162 | 161 |
float scaleW = (float)mScreenW/mMirrorW; |
163 | 162 |
float scaleH = (float)mScreenH/mMirrorH; |
... | ... | |
165 | 164 |
mScaleMirror.set( scaleW, scaleH, 1.0f); |
166 | 165 |
|
167 | 166 |
mMoveOffscreen2.set( (MIRROR_MOVE_H-0.5f+0.5f*MIRROR_SCALE)*mScreenW, (MIRROR_MOVE_V-0.5f+0.5f*MIRROR_SCALE)*mScreenH*mMirrorW/mMirrorH, 0); |
168 |
mHeadPosition.set2( (0.5f*HEAD_SCALE - 0.5f + MIRROR_MARGIN*mMirrorW/mMirrorH)*mScreenH ); |
|
169 |
|
|
167 |
mHeadPosition.set1( (0.5f*HEAD_SCALE - 0.5f + MIRROR_MARGIN*mMirrorW/mMirrorH)*mScreenH ); |
|
170 | 168 |
setPosition(mX); |
171 | 169 |
|
172 | 170 |
mOffScreen1.attach( mTextureMirror, mEffectsMirror , mQuadMirror ); |
src/main/java/org/distorted/examples/wind/WindEffectsManager.java | ||
---|---|---|
26 | 26 |
import org.distorted.library.effect.VertexEffectDeform; |
27 | 27 |
import org.distorted.library.effect.VertexEffectWave; |
28 | 28 |
import org.distorted.library.main.DistortedEffects; |
29 |
import org.distorted.library.main.DistortedTexture; |
|
30 | 29 |
import org.distorted.library.type.Dynamic; |
31 | 30 |
import org.distorted.library.type.Dynamic5D; |
32 | 31 |
import org.distorted.library.type.Static3D; |
... | ... | |
105 | 104 |
|
106 | 105 |
void apply(DistortedEffects effects) |
107 | 106 |
{ |
108 |
Static3D midLeftMatrix= new Static3D(-mWidth/2,0,0); // matrix effects have their origin in the center!
|
|
107 |
Static3D midLeftMatrix= new Static3D(-mWidth/2,0,0); // matrix effects center is in the middle
|
|
109 | 108 |
Static3D midRight = new Static3D(mWidth,mHeight/2,0); // |
110 |
Static3D tadRight = new Static3D(3*mWidth/4,mHeight/2,0); // whereas vertex effects - in the bottom-left corner
|
|
109 |
Static3D tadRight = new Static3D(3*mWidth/4,mHeight/2,0); // vertex & fragment - in the lower-left
|
|
111 | 110 |
Static4D windRegion = new Static4D(0,0,0,mHeight); // |
112 | 111 |
|
113 | 112 |
setWind(0); |
114 | 113 |
|
115 |
effects.apply( new MatrixEffectShear(shearFactor,midLeftMatrix) ); |
|
116 | 114 |
effects.apply( new MatrixEffectScale(scaleFactor) ); |
115 |
effects.apply( new MatrixEffectShear(shearFactor,midLeftMatrix) ); |
|
116 |
|
|
117 | 117 |
effects.apply( new VertexEffectDeform(deformForce,midRight) ); |
118 | 118 |
effects.apply( new VertexEffectWave(windDynamic1, midRight, windRegion) ); |
119 | 119 |
effects.apply( new VertexEffectWave(windDynamic2, midRight, windRegion) ); |
src/main/java/org/distorted/examples/wind/WindRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.library.effect.MatrixEffectMove; |
28 | 28 |
import org.distorted.library.effect.MatrixEffectRotate; |
29 | 29 |
import org.distorted.library.effect.MatrixEffectScale; |
30 |
import org.distorted.library.effect.MatrixEffectShear; |
|
30 | 31 |
import org.distorted.library.effect.VertexEffectDeform; |
31 | 32 |
import org.distorted.library.effect.VertexEffectWave; |
32 | 33 |
import org.distorted.library.main.DistortedLibrary; |
... | ... | |
36 | 37 |
import org.distorted.library.main.DistortedTexture; |
37 | 38 |
import org.distorted.library.type.Static1D; |
38 | 39 |
import org.distorted.library.type.Static3D; |
40 |
import org.distorted.library.type.Static4D; |
|
39 | 41 |
|
40 | 42 |
import java.io.IOException; |
41 | 43 |
import java.io.InputStream; |
Also available in: Unified diff
Fixes for the merge.