Revision df80818c
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/examples/generic/GenericEffect.java | ||
---|---|---|
177 | 177 |
float zm = (mInter[2]-50)*(sw+sh)/2; |
178 | 178 |
mSta3.set(xm,ym,zm); |
179 | 179 |
break; |
180 |
case SCALE : float xs = (mInter[0]>50 ? 0.18f : 0.018f)*(mInter[0]-50) + 1;
|
|
181 |
float ys = (mInter[1]>50 ? 0.18f : 0.018f)*(mInter[1]-50) + 1;
|
|
182 |
float zs = (mInter[2]>50 ? 0.18f : 0.018f)*(mInter[2]-50) + 1;
|
|
180 |
case SCALE : float xs = (mInter[0]>50 ? 0.04f : 0.013f)*(mInter[0]-50) + 1;
|
|
181 |
float ys = (mInter[1]>50 ? 0.04f : 0.013f)*(mInter[1]-50) + 1;
|
|
182 |
float zs = (mInter[2]>50 ? 0.04f : 0.013f)*(mInter[2]-50) + 1;
|
|
183 | 183 |
mSta3.set(xs,ys,zs); |
184 | 184 |
break; |
185 | 185 |
case SHEAR : float xsh = (mInter[0]-50)/25.0f; |
src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
---|---|---|
61 | 61 |
private float mBmpRatio; |
62 | 62 |
|
63 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 |
// girl bitmap: 400x600 |
|
64 |
// girl bitmap: 400x600 but we setStretch() the Mesh so
|
|
65 | 65 |
|
66 | 66 |
GirlRenderer(GLSurfaceView v) |
67 | 67 |
{ |
68 | 68 |
mView = v; |
69 | 69 |
|
70 |
Static3D pLeft = new Static3D(-68/400.0f, 36/600.0f, 0);
|
|
71 |
Static3D pRight= new Static3D( 47/400.0f, 36/600.0f, 0);
|
|
70 |
Static3D pLeft = new Static3D(-68/400.0f, 36/400.0f, 0);
|
|
71 |
Static3D pRight= new Static3D( 47/400.0f, 36/400.0f, 0);
|
|
72 | 72 |
|
73 | 73 |
// Size |
74 | 74 |
Static4D sinkRegion = new Static4D(0,0,0,60/400.0f); |
... | ... | |
100 | 100 |
diR.add(v1); |
101 | 101 |
|
102 | 102 |
// Lower Movement |
103 |
Static3D pHips = new Static3D( 16/400.0f,-205/600.0f,0);
|
|
103 |
Static3D pHips = new Static3D( 16/400.0f,-205/400.0f,0);
|
|
104 | 104 |
Static4D HipsRegion = new Static4D(0,0,0,120/400.0f); |
105 | 105 |
Dynamic1D diHips = new Dynamic1D(1500,0.0f); |
106 | 106 |
|
... | ... | |
166 | 166 |
|
167 | 167 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
168 | 168 |
{ |
169 |
if( width<height ) mScale.set( width, width*mBmpRatio, width ); |
|
170 |
else mScale.set( height/mBmpRatio, height, height ); |
|
171 |
|
|
169 |
float factor = width<height ? width : height/mBmpRatio; |
|
170 |
mScale.set( factor,factor,factor ); |
|
172 | 171 |
mScreen.resize(width, height); |
173 | 172 |
} |
174 | 173 |
|
... | ... | |
195 | 194 |
mBmpRatio = (float)bitmap.getHeight()/bitmap.getWidth(); |
196 | 195 |
mTexture.setTexture(bitmap); |
197 | 196 |
|
198 |
if( mMesh==null ) mMesh = new MeshRectangles(30, (int)(30*mBmpRatio)); |
|
197 |
if( mMesh==null ) |
|
198 |
{ |
|
199 |
mMesh = new MeshRectangles(30, (int)(30*mBmpRatio)); |
|
200 |
mMesh.setStretch(1.0f,mBmpRatio,1.0f); |
|
201 |
} |
|
199 | 202 |
|
200 | 203 |
mScreen.detachAll(); |
201 | 204 |
mScreen.attach(mTexture,mEffects,mMesh); |
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java | ||
---|---|---|
143 | 143 |
texW = width; |
144 | 144 |
texH = height; |
145 | 145 |
|
146 |
mScale.set(width,height,width);
|
|
146 |
mScale.set(width,width,width);
|
|
147 | 147 |
|
148 | 148 |
mBitmap = Bitmap.createBitmap(texW,texH, Bitmap.Config.ARGB_8888); |
149 | 149 |
mCanvas = new Canvas(mBitmap); |
150 | 150 |
|
151 | 151 |
if( mMesh!=null ) mMesh.markForDeletion(); |
152 | 152 |
mMesh = new MeshRectangles(80,80*texH/texW); |
153 |
mMesh.setStretch(1.0f, (float)texH/texW, 1.0f); |
|
153 | 154 |
|
154 | 155 |
mScreen.detachAll(); |
155 | 156 |
mScreen.attach(mTexture,mEffects,mMesh); |
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java | ||
---|---|---|
245 | 245 |
{ |
246 | 246 |
mPaint.setColor( 0xffffffff ); |
247 | 247 |
mCenter.get( drawCoord, 0, (long)(i*step) ); |
248 |
c.drawCircle( (drawCoord[0]+0.5f)*mScrWidth, mScrHeight*(0.5f-drawCoord[1]), mSize1, mPaint );
|
|
248 |
c.drawCircle( (drawCoord[0]+0.5f)*mScrWidth, 0.5f*mScrHeight-drawCoord[1]*mScrWidth, mSize1, mPaint );
|
|
249 | 249 |
} |
250 | 250 |
} |
251 | 251 |
|
... | ... | |
254 | 254 |
for(int curr=0; curr<len; curr++) |
255 | 255 |
{ |
256 | 256 |
cu = mCenter.getPoint(curr); |
257 |
c.drawCircle( (cu.get0()+0.5f)*mScrWidth, mScrHeight*(0.5f-cu.get1()), mSize2, mPaint);
|
|
257 |
c.drawCircle( (cu.get0()+0.5f)*mScrWidth, 0.5f*mScrHeight-cu.get1()*mScrWidth, mSize2, mPaint);
|
|
258 | 258 |
} |
259 | 259 |
|
260 | 260 |
if( time-mTime > LOOP_TIME ) mTime = time; |
... | ... | |
269 | 269 |
if( mCurrEffect!=EFFECT_POINTS ) return true; |
270 | 270 |
|
271 | 271 |
float xDown = event.getX()/mScrWidth - 0.5f; |
272 |
float yDown = 0.5f - event.getY()/mScrHeight;
|
|
272 |
float yDown = (0.5f*mScrHeight - event.getY())/mScrWidth;
|
|
273 | 273 |
|
274 | 274 |
switch(event.getAction()) |
275 | 275 |
{ |
Also available in: Unified diff
Further corrections.