Revision 5e23b17b
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldEffectsManager.java | ||
---|---|---|
29 | 29 |
import org.distorted.library.effect.VertexEffectSwirl; |
30 | 30 |
import org.distorted.library.main.DistortedEffects; |
31 | 31 |
import org.distorted.library.type.Dynamic1D; |
32 |
import org.distorted.library.type.Dynamic2D; |
|
33 | 32 |
import org.distorted.library.type.Dynamic3D; |
34 | 33 |
import org.distorted.library.type.Static1D; |
35 |
import org.distorted.library.type.Static2D; |
|
36 | 34 |
import org.distorted.library.type.Static3D; |
37 | 35 |
import org.distorted.library.type.Static4D; |
38 | 36 |
|
... | ... | |
58 | 56 |
// b) make the nose broader (PINCH) |
59 | 57 |
private Static4D aNoseBroaderRegion; |
60 | 58 |
private Static3D aNoseBroaderCenter; |
61 |
private Static2D aNoseBroaderFactor;
|
|
62 |
private Dynamic2D aNoseBroaderDyn;
|
|
59 |
private Static3D aNoseBroaderFactor;
|
|
60 |
private Dynamic3D aNoseBroaderDyn;
|
|
63 | 61 |
// c) make the nostrils more visible (DISTORT) |
64 | 62 |
private Static4D aNostrilsRegion; |
65 | 63 |
private Static3D aNostrilsCenter; |
... | ... | |
95 | 93 |
// a) make the whole face broader (PINCH) |
96 | 94 |
private Static4D bFaceRegion; |
97 | 95 |
private Static3D bFaceCenter; |
98 |
private Static2D bFaceFactor;
|
|
99 |
private Dynamic2D bFaceDyn;
|
|
96 |
private Static3D bFaceFactor;
|
|
97 |
private Dynamic3D bFaceDyn;
|
|
100 | 98 |
// b) tip of the nose lower (DISTORT) |
101 | 99 |
private Static4D bTipLowerRegion; |
102 | 100 |
private Static3D bTipLowerCenter; |
... | ... | |
105 | 103 |
// c) broaden the whole nose: (PINCH) |
106 | 104 |
private Static4D bWholeNoseRegion; |
107 | 105 |
private Static3D bWholeNoseCenter; |
108 |
private Static2D bWholeNoseFactor;
|
|
109 |
private Dynamic2D bWholeNoseDyn;
|
|
106 |
private Static3D bWholeNoseFactor;
|
|
107 |
private Dynamic3D bWholeNoseDyn;
|
|
110 | 108 |
// d) broaden the tip of the nose some more: (PINCH) |
111 | 109 |
private Static4D bNoseBroaderRegion; |
112 | 110 |
private Static3D bNoseBroaderCenter; |
113 |
private Static2D bNoseBroaderFactor;
|
|
114 |
private Dynamic2D bNoseBroaderDyn;
|
|
111 |
private Static3D bNoseBroaderFactor;
|
|
112 |
private Dynamic3D bNoseBroaderDyn;
|
|
115 | 113 |
// 3) make lips higher: (PINCH) |
116 | 114 |
private Static4D bLipsRegion; |
117 | 115 |
private Static3D bLipsCenter; |
118 |
private Static2D bLipsFactor;
|
|
119 |
private Dynamic2D bLipsDyn;
|
|
116 |
private Static3D bLipsFactor;
|
|
117 |
private Dynamic3D bLipsDyn;
|
|
120 | 118 |
// Fragment effects |
121 | 119 |
// a) make the whole face darker (CHROMA) |
122 | 120 |
private Static3D bSkinColorCenter; |
... | ... | |
166 | 164 |
|
167 | 165 |
aNoseBroaderRegion = new Static4D(0,0,0,130); |
168 | 166 |
aNoseBroaderCenter = new Static3D(300,293,0); |
169 |
aNoseBroaderDyn = new Dynamic2D();
|
|
170 |
aNoseBroaderFactor = new Static2D(0,90);
|
|
167 |
aNoseBroaderDyn = new Dynamic3D();
|
|
168 |
aNoseBroaderFactor = new Static3D(0,0,90);
|
|
171 | 169 |
aNoseBroaderDyn.add(aNoseBroaderFactor); |
172 | 170 |
|
173 | 171 |
aNostrilsRegion = new Static4D(0,0,0,60); |
... | ... | |
214 | 212 |
// Vertex Effects |
215 | 213 |
bFaceRegion = new Static4D(0,0,0,600); |
216 | 214 |
bFaceCenter = new Static3D(300,300,0); |
217 |
bFaceFactor = new Static2D(1.0f,90.0f);
|
|
218 |
bFaceDyn = new Dynamic2D();
|
|
215 |
bFaceFactor = new Static3D(1.0f,0.0f,90.0f);
|
|
216 |
bFaceDyn = new Dynamic3D();
|
|
219 | 217 |
bFaceDyn.add(bFaceFactor); |
220 | 218 |
|
221 | 219 |
bTipLowerRegion = new Static4D(0,0,0,41); |
... | ... | |
226 | 224 |
|
227 | 225 |
bWholeNoseRegion = new Static4D(0,0,0,130); |
228 | 226 |
bWholeNoseCenter = new Static3D(300,243,0); |
229 |
bWholeNoseFactor = new Static2D(1.0f,90.0f);
|
|
230 |
bWholeNoseDyn = new Dynamic2D();
|
|
227 |
bWholeNoseFactor = new Static3D(1.0f,0.0f,90.0f);
|
|
228 |
bWholeNoseDyn = new Dynamic3D();
|
|
231 | 229 |
bWholeNoseDyn.add(bWholeNoseFactor); |
232 | 230 |
|
233 | 231 |
bNoseBroaderRegion = new Static4D(0,0,0,95); |
234 | 232 |
bNoseBroaderCenter = new Static3D(300,192,0); |
235 |
bNoseBroaderFactor = new Static2D(1.0f,90.0f);
|
|
236 |
bNoseBroaderDyn = new Dynamic2D();
|
|
233 |
bNoseBroaderFactor = new Static3D(1.0f,0.0f,90.0f);
|
|
234 |
bNoseBroaderDyn = new Dynamic3D();
|
|
237 | 235 |
bNoseBroaderDyn.add(bNoseBroaderFactor); |
238 | 236 |
|
239 | 237 |
bLipsRegion = new Static4D(0,-96,0,118); |
240 | 238 |
bLipsCenter = new Static3D(300,142,0); |
241 |
bLipsFactor = new Static2D(1.0f,0.0f);
|
|
242 |
bLipsDyn = new Dynamic2D();
|
|
239 |
bLipsFactor = new Static3D(1.0f,90.0f,0.0f);
|
|
240 |
bLipsDyn = new Dynamic3D();
|
|
243 | 241 |
bLipsDyn.add(bLipsFactor); |
244 | 242 |
|
245 | 243 |
// Fragment Effects |
src/main/java/org/distorted/examples/earth/EarthRenderer.java | ||
---|---|---|
50 | 50 |
import org.distorted.library.type.Dynamic3D; |
51 | 51 |
import org.distorted.library.type.DynamicQuat; |
52 | 52 |
import org.distorted.library.type.Static1D; |
53 |
import org.distorted.library.type.Static2D; |
|
54 | 53 |
import org.distorted.library.type.Static3D; |
55 | 54 |
import org.distorted.library.type.Static4D; |
56 | 55 |
import org.distorted.library.type.Static5D; |
... | ... | |
89 | 88 |
private Static3D mRegionF; |
90 | 89 |
private Static4D mRegionV; |
91 | 90 |
private Static1D mStrength; |
92 |
private Static2D mPinch;
|
|
91 |
private Static3D mPinch;
|
|
93 | 92 |
private Static1D mSwirl; |
94 | 93 |
|
95 | 94 |
Static4D mQuat1, mQuat2; |
... | ... | |
110 | 109 |
mMove = new Static3D(0,0,0); |
111 | 110 |
mScaleFactor= new Static3D(1,1,1); |
112 | 111 |
mCenter = new Static3D(0,0,0); |
113 |
mPinch = new Static2D(0.5f,0.0f);
|
|
112 |
mPinch = new Static3D(0.5f,0.0f,0.0f);
|
|
114 | 113 |
mSwirl = new Static1D(45.0f); |
115 | 114 |
|
116 | 115 |
Dynamic3D scale = new Dynamic3D(0,0.5f); |
... | ... | |
214 | 213 |
case DEFORM : vector = new Static3D( +x*mObjWidth/CORR, +y*mObjHeight/CORR, +z*mObjDepth/CORR); |
215 | 214 |
effect = new VertexEffectDeform ( vector, center, mRegionV); break; |
216 | 215 |
case SINK : effect = new VertexEffectSink (mStrength, center, mRegionV); break; |
217 |
case PINCH : effect = new VertexEffectPinch (mPinch , center, mRegionV); break; // Those 3 are not really |
|
218 |
case SWIRL : effect = new VertexEffectSwirl (mSwirl , center, mRegionV); break; // fully 3D effects. They |
|
219 |
case WAVE : Static5D wave = new Static5D( RADIUS_V/2, RADIUS_V/2, 0, 90-latitude, 90); // will not look good |
|
220 |
effect = new VertexEffectWave (wave , center, mRegionV); break; // everywhere on the sphere. |
|
216 |
case PINCH : mPinch.set2(latitude);//>0 ? (float)(Math.PI/2 - latitude) : (float)(-Math.PI/2 - latitude) ); |
|
217 |
mPinch.set3(longitude);// (float)(Math.PI+longitude) ); |
|
218 |
effect = new VertexEffectPinch (mPinch , center, mRegionV); break; |
|
219 |
case SWIRL : effect = new VertexEffectSwirl (mSwirl , center, mRegionV); break; // SWIRL & WAVE are not really fully |
|
220 |
case WAVE : Static5D wave = new Static5D( RADIUS_V/2, RADIUS_V/2, 0, 90-latitude, 90); // 3D effects. They will not look |
|
221 |
effect = new VertexEffectWave (wave , center, mRegionV); break; // good everywhere on the sphere. |
|
221 | 222 |
|
222 | 223 |
case ALPHA : effect = new FragmentEffectAlpha (mStrength, center, mRegionF, false); break; |
223 | 224 |
case SMOOTH_ALPHA : effect = new FragmentEffectAlpha (mStrength, center, mRegionF, true ); break; |
src/main/java/org/distorted/examples/generic/GenericEffect.java | ||
---|---|---|
116 | 116 |
case DISTORT : effect = new VertexEffectDistort (mDyn3, mCenterDyn, mRegion4Dyn); break; |
117 | 117 |
case DEFORM : effect = new VertexEffectDeform (mDyn3, mCenterDyn, mRegion4Dyn); break; |
118 | 118 |
case SINK : effect = new VertexEffectSink (mDyn1, mCenterDyn, mRegion4Dyn); break; |
119 |
case PINCH : effect = new VertexEffectPinch (mDyn2, mCenterDyn, mRegion4Dyn); break;
|
|
119 |
case PINCH : effect = new VertexEffectPinch (mDyn3, mCenterDyn, mRegion4Dyn); break;
|
|
120 | 120 |
case SWIRL : effect = new VertexEffectSwirl (mDyn1, mCenterDyn, mRegion4Dyn); break; |
121 | 121 |
case WAVE : effect = new VertexEffectWave (mDyn5, mCenterDyn, mRegion4Dyn); break; |
122 | 122 |
|
... | ... | |
153 | 153 |
// MATRIX |
154 | 154 |
/////////////////////////////////////////////////////////////////////////////////////// |
155 | 155 |
|
156 |
case ROTATE : float an = (mInter[0]-50)*180/50; |
|
156 |
case ROTATE : float an = (mInter[0]-50)*180/50.0f;
|
|
157 | 157 |
float rx = (mInter[1]-50)/ 50.0f; |
158 | 158 |
float ry = (mInter[2]-50)/ 50.0f; |
159 | 159 |
float rz = (mInter[3]-50)/ 50.0f; |
... | ... | |
202 | 202 |
case WAVE : float l2 = mAct.get().getWidth()/50.0f; |
203 | 203 |
float x2 = (mInter[0]-50)*l2; |
204 | 204 |
float y2 = (mInter[1]-50)*l2; |
205 |
float z2 = (mInter[2]-50)*180 / 50; |
|
206 |
float w2 = (mInter[3]-50)*180 / 50; |
|
207 |
float v2 = (mInter[4]-50)*180 / 50; |
|
205 |
float z2 = (mInter[2]-50)*180 / 50.0f;
|
|
206 |
float w2 = (mInter[3]-50)*180 / 50.0f;
|
|
207 |
float v2 = (mInter[4]-50)*180 / 50.0f;
|
|
208 | 208 |
mSta5.set(x2,y2,z2,w2,v2); |
209 | 209 |
break; |
210 | 210 |
case SWIRL : mSta1.set( 3.6f*(mInter[0]-50) ); |
... | ... | |
212 | 212 |
case SINK : mSta1.set(mInter[0] > 50 ? 50.0f/(100.01f-mInter[0]) : mInter[0] / 50.0f); |
213 | 213 |
break; |
214 | 214 |
case PINCH : float dp = mInter[0] > 50 ? 50.0f/(100.01f-mInter[0]) : mInter[0] / 50.0f; |
215 |
float ap = (mInter[1]-50)*180 / 50; |
|
216 |
mSta2.set(dp,ap); |
|
215 |
float ap = (mInter[1]-50)*180 / 50.0f; |
|
216 |
float bp = (mInter[2]-50)*180 / 50.0f; |
|
217 |
mSta3.set(dp,ap,bp); |
|
217 | 218 |
break; |
218 | 219 |
|
219 | 220 |
/////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Make the 'PINCH' effect fully 3D (define its acting line in terms of (latitude,longitude) angle pair).
Still, something is not fully working in the Earth app with the effect - investigate.