Project

General

Profile

« Previous | Next » 

Revision 04fe7f80

Added by Leszek Koltunski over 7 years ago

Around The World: implement blackness

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldEffectsManager.java
40 40
  // WHITENESS
41 41
  // Vertex effects:
42 42
  // a) make the lips smaller (SINK)
43
  private Static4D wRegionLips;
44
  private Static3D wCenterLips;
43
  private Static4D wLipsRegion;
44
  private Static3D wLipsCenter;
45 45
  private Static1D wLipsFactor;
46 46
  private Dynamic1D wLipsDyn;
47 47

  
48 48
  // ASIANNESS
49 49
  // Vertex Effects:
50 50
  // a) move lips & nose higher (DISTORT)
51
  private Static4D aRegionLipsNose;
52
  private Static3D aCenterLipsNose;
51
  private Static4D aLipsNoseRegion;
52
  private Static3D aLipsNoseCenter;
53 53
  private Static3D aLipsNoseFactor;
54 54
  private Dynamic3D aLipsNoseDyn;
55 55
  // b) make the nose broader (PINCH)
56
  private Static4D aRegionNoseBroader;
57
  private Static3D aCenterNoseBroader;
56
  private Static4D aNoseBroaderRegion;
57
  private Static3D aNoseBroaderCenter;
58 58
  private Static2D aNoseBroaderFactor;
59 59
  private Dynamic2D aNoseBroaderDyn;
60 60
  // c) make the nostrils more visible (DISTORT)
61
  private Static4D aRegionNostrils;
62
  private Static3D aCenterNostrils;
61
  private Static4D aNostrilsRegion;
62
  private Static3D aNostrilsCenter;
63 63
  private Static3D aNostrilsFactor;
64 64
  private Dynamic3D aNostrilsDyn;
65 65
  // d) rotate eyes (2 x SWIRL)
66
  private Static4D aRegionEyes;
67
  private Static3D aCenterLEye, aCenterREye;
66
  private Static4D aEyesRegion;
67
  private Static3D aLEyeCenter, aREyeCenter;
68 68
  private Static1D aLEyeFactor, aREyeFactor;
69 69
  private Dynamic1D aLEyeDyn, aREyeDyn;
70 70
  // e) move eyebrow higher (DISTORT)
71
  private Static4D aRegionEyebrows;
72
  private Static3D aCenterEyebrows;
71
  private Static4D aEyebrowsRegion;
72
  private Static3D aEyebrowsCenter;
73 73
  private Static3D aEyebrowsFactor;
74 74
  private Dynamic3D aEyebrowsDyn;
75 75

  
76 76
  // Fragment effects:
77 77
  // a) change color of the skin to more brown and less red (CHROMA)
78
  private Static4D aRegionSkinColor;
78
  private Static4D aSkinColorRegion;
79 79
  private Static3D aChromaSkin;
80 80
  private Static1D aChromaSkinFactor;
81 81
  private Dynamic1D aChromaSkinDyn;
82 82
  // b) darken both eyes (2 x SMOOTH_CHROMA)
83
  private Static4D aRegionLEyeColor, aRegionREyeColor;
83
  private Static4D aLEyeColorRegion, aREyeColorRegion;
84 84
  private Static3D aChromaEyes;
85 85
  private Static1D aChromaEyesFactor;
86 86
  private Dynamic1D aChromaEyesDyn;
87 87

  
88 88
  // BLACKNESS
89
  // Vertex Effects
90
  // a) make the whole face broader (PINCH)
91
  private Static4D bFaceRegion;
92
  private Static3D bFaceCenter;
93
  private Static2D bFaceFactor;
94
  private Dynamic2D bFaceDyn;
95
  // b) tip of the nose lower (DISTORT)
96
  private Static4D bTipLowerRegion;
97
  private Static3D bTipLowerCenter;
98
  private Static3D bTipLowerFactor;
99
  private Dynamic3D bTipLowerDyn;
100
  // c) broaden the whole nose: (PINCH)
101
  private Static4D bWholeNoseRegion;
102
  private Static3D bWholeNoseCenter;
103
  private Static2D bWholeNoseFactor;
104
  private Dynamic2D bWholeNoseDyn;
105
  // d) broaden the tip of the nose some more: (PINCH)
106
  private Static4D bNoseBroaderRegion;
107
  private Static3D bNoseBroaderCenter;
108
  private Static2D bNoseBroaderFactor;
109
  private Dynamic2D bNoseBroaderDyn;
110
  // 3) make lips higher: (PINCH)
111
  private Static4D bLipsRegion;
112
  private Static3D bLipsCenter;
113
  private Static2D bLipsFactor;
114
  private Dynamic2D bLipsDyn;
115
  // Fragment effects
116
  // a) make the whole face darker (CHROMA)
117
  private Static4D bSkinColorRegion;
118
  private Static3D bChromaSkin;
119
  private Static1D bChromaSkinFactor;
120
  private Dynamic1D bChromaSkinDyn;
121
  // b) move both eyes back to whiteness (2 x SMOOTH CHROMA)
122
  private Static4D bLEyeColorRegion, bREyeColorRegion;
123
  private Static3D bChromaEyes;
124
  private Static1D bChromaEyesFactor;
125
  private Dynamic1D bChromaEyesDyn;
126
  // c) darken both pupils (2 x SMOOTH_CHROMA)
127
  private Static4D bLPupilColorRegion, bRPupilColorRegion;
128
  private Static3D bChromaPupil;
129
  private Static1D bChromaPupilFactor;
130
  private Dynamic1D bChromaPupilDyn;
89 131

  
90 132
///////////////////////////////////////////////////////////////////////////////////////////////////
91 133

  
......
97 139

  
98 140
    // WHITENESS
99 141
    // Vertex Effects
100
    wRegionLips = new Static4D(0,0,100,100);
101
    wCenterLips = new Static3D(300,500,0);
142
    wLipsRegion = new Static4D(0,0,100,100);
143
    wLipsCenter = new Static3D(300,500,0);
102 144
    wLipsFactor = new Static1D(0.7f);
103 145
    wLipsDyn    = new Dynamic1D();
104 146
    wLipsDyn.add(wLipsFactor);
105 147

  
106 148
    // ASIANNESS
107 149
    // Vertex Effects
108
    aRegionLipsNose    = new Static4D(0,0,267,267);
109
    aCenterLipsNose    = new Static3D(300,560,0);
150
    aLipsNoseRegion    = new Static4D(0,0,267,267);
151
    aLipsNoseCenter    = new Static3D(300,560,0);
110 152
    aLipsNoseDyn       = new Dynamic3D();
111 153
    aLipsNoseFactor    = new Static3D(0,0,0);
112 154
    aLipsNoseDyn.add(aLipsNoseFactor);
113 155

  
114
    aRegionNoseBroader = new Static4D(0,0,130,130);
115
    aCenterNoseBroader = new Static3D(300,307,0);
156
    aNoseBroaderRegion = new Static4D(0,0,130,130);
157
    aNoseBroaderCenter = new Static3D(300,307,0);
116 158
    aNoseBroaderDyn    = new Dynamic2D();
117 159
    aNoseBroaderFactor = new Static2D(0,90);
118 160
    aNoseBroaderDyn.add(aNoseBroaderFactor);
119 161

  
120
    aRegionNostrils    = new Static4D(0,0,60,60);
121
    aCenterNostrils    = new Static3D(300,336,0);
162
    aNostrilsRegion    = new Static4D(0,0,60,60);
163
    aNostrilsCenter    = new Static3D(300,336,0);
122 164
    aNostrilsDyn       = new Dynamic3D();
123 165
    aNostrilsFactor    = new Static3D(0,0,0);
124 166
    aNostrilsDyn.add(aNostrilsFactor);
125 167

  
126
    aRegionEyes        = new Static4D(0,0,83,83);
127
    aCenterLEye        = new Static3D(176,230,0);
128
    aCenterREye        = new Static3D(420,230,0);
168
    aEyesRegion        = new Static4D(0,0,83,83);
169
    aLEyeCenter        = new Static3D(176,230,0);
170
    aREyeCenter        = new Static3D(420,230,0);
129 171
    aLEyeDyn           = new Dynamic1D();
130 172
    aREyeDyn           = new Dynamic1D();
131 173
    aLEyeFactor        = new Static1D(0);
......
133 175
    aLEyeDyn.add(aLEyeFactor);
134 176
    aREyeDyn.add(aREyeFactor);
135 177

  
136
    aRegionEyebrows    = new Static4D(0,0,142,142);
137
    aCenterEyebrows    = new Static3D(300,100,0);
178
    aEyebrowsRegion    = new Static4D(0,0,142,142);
179
    aEyebrowsCenter    = new Static3D(300,100,0);
138 180
    aEyebrowsDyn       = new Dynamic3D();
139 181
    aEyebrowsFactor    = new Static3D(0,0,0);
140 182
    aEyebrowsDyn.add(aEyebrowsFactor);
141 183

  
142 184
    // Fragment Effects
143
    aRegionSkinColor   = new Static4D(300,300,600,600);
144
    aRegionLEyeColor   = new Static4D(172,230,29,25);
145
    aRegionREyeColor   = new Static4D(423,230,29,25);
185
    aSkinColorRegion   = new Static4D(300,300,600,600);
186
    aLEyeColorRegion   = new Static4D(172,230,29,25);
187
    aREyeColorRegion   = new Static4D(423,230,29,25);
146 188

  
147 189
    aChromaSkin        = new Static3D(0.5f, 0.5f, 0.5f);
148 190
    aChromaEyes        = new Static3D(0.5f, 0.14f, 0.14f);
......
153 195
    aChromaSkinDyn.add(aChromaSkinFactor);
154 196
    aChromaEyesDyn = new Dynamic1D();
155 197
    aChromaEyesDyn.add(aChromaEyesFactor);
198

  
199
    // BLACKNESS
200
    // Vertex Effects
201
    bFaceRegion        = new Static4D(0,0,600,600);
202
    bFaceCenter        = new Static3D(300,300,0);
203
    bFaceFactor        = new Static2D(1.0f,90.0f);
204
    bFaceDyn           = new Dynamic2D();
205
    bFaceDyn.add(bFaceFactor);
206

  
207
    bTipLowerRegion    = new Static4D(0,0,41,41);
208
    bTipLowerCenter    = new Static3D(300,393,0);
209
    bTipLowerFactor    = new Static3D(0,0,0);
210
    bTipLowerDyn       = new Dynamic3D();
211
    bTipLowerDyn.add(bTipLowerFactor);
212

  
213
    bWholeNoseRegion   = new Static4D(0,0,130,130);
214
    bWholeNoseCenter   = new Static3D(300,357,0);
215
    bWholeNoseFactor   = new Static2D(1.0f,90.0f);
216
    bWholeNoseDyn      = new Dynamic2D();
217
    bWholeNoseDyn.add(bWholeNoseFactor);
218

  
219
    bNoseBroaderRegion = new Static4D(0,0,95,95);
220
    bNoseBroaderCenter = new Static3D(300,408,0);
221
    bNoseBroaderFactor = new Static2D(1.0f,90.0f);
222
    bNoseBroaderDyn    = new Dynamic2D();
223
    bNoseBroaderDyn.add(bNoseBroaderFactor);
224

  
225
    bLipsRegion        = new Static4D(0,96,118,118);
226
    bLipsCenter        = new Static3D(300,458,0);
227
    bLipsFactor        = new Static2D(1.0f,0.0f);
228
    bLipsDyn           = new Dynamic2D();
229
    bLipsDyn.add(bLipsFactor);
230

  
231
    // Fragment Effects
232
    bSkinColorRegion   = new Static4D(300,300,600,600);
233
    bLEyeColorRegion = new Static4D(158,241,55,24);
234
    bREyeColorRegion = new Static4D(436,241,55,24);
235
    bLPupilColorRegion   = new Static4D(166,230,28,23);
236
    bRPupilColorRegion   = new Static4D(431,230,28,23);
237

  
238
    bChromaSkin        = new Static3D(0.66f, 0.4f, 0.5f);
239
    bChromaEyes        = new Static3D(1.0f, 1.0f, 1.0f);
240
    bChromaPupil       = new Static3D(0.5f, 0.14f, 0.14f);
241
    bChromaSkinFactor  = new Static1D(0.0f);
242
    bChromaPupilFactor = new Static1D(0.0f);
243
    bChromaEyesFactor  = new Static1D(0.0f);
244

  
245
    bChromaSkinDyn = new Dynamic1D();
246
    bChromaSkinDyn.add(bChromaSkinFactor);
247
    bChromaEyesDyn = new Dynamic1D();
248
    bChromaEyesDyn.add(bChromaEyesFactor);
249
    bChromaPupilDyn = new Dynamic1D();
250
    bChromaPupilDyn.add(bChromaPupilFactor);
156 251
    }
157 252

  
158 253
///////////////////////////////////////////////////////////////////////////////////////////////////
......
162 257
    setRace(mBlackness, mAsianness);
163 258

  
164 259
    // WHITENESS
165
    obj.sink(wLipsDyn, wCenterLips, wRegionLips);
260
    obj.sink(wLipsDyn, wLipsCenter, wLipsRegion);
166 261

  
167 262
    // ASIANNESS
168
    obj.distort(aLipsNoseDyn, aCenterLipsNose, aRegionLipsNose);
169
    obj.pinch(aNoseBroaderDyn, aCenterNoseBroader, aRegionNoseBroader);
170
    obj.distort(aNostrilsDyn, aCenterNostrils, aRegionNostrils);
171
    obj.swirl(aLEyeDyn, aCenterLEye, aRegionEyes);
172
    obj.swirl(aREyeDyn, aCenterREye, aRegionEyes);
173
    obj.distort(aEyebrowsDyn, aCenterEyebrows, aRegionEyebrows);
263
    obj.distort(aLipsNoseDyn, aLipsNoseCenter, aLipsNoseRegion);
264
    obj.pinch(aNoseBroaderDyn, aNoseBroaderCenter, aNoseBroaderRegion);
265
    obj.distort(aNostrilsDyn, aNostrilsCenter, aNostrilsRegion);
266
    obj.swirl(aLEyeDyn, aLEyeCenter, aEyesRegion);
267
    obj.swirl(aREyeDyn, aREyeCenter, aEyesRegion);
268
    obj.distort(aEyebrowsDyn, aEyebrowsCenter, aEyebrowsRegion);
174 269

  
175
    obj.chroma(aChromaSkinDyn, aChromaSkin, aRegionSkinColor, false);
176
    obj.chroma(aChromaEyesDyn, aChromaEyes, aRegionLEyeColor, true);
177
    obj.chroma(aChromaEyesDyn, aChromaEyes, aRegionREyeColor, true);
270
    obj.chroma(aChromaSkinDyn, aChromaSkin, aSkinColorRegion, false);
271
    obj.chroma(aChromaEyesDyn, aChromaEyes, aLEyeColorRegion, true);
272
    obj.chroma(aChromaEyesDyn, aChromaEyes, aREyeColorRegion, true);
178 273

  
179 274
    // BLACKNESS
275
    obj.pinch(bFaceDyn, bFaceCenter, bFaceRegion);
276
    obj.distort(bTipLowerDyn, bTipLowerCenter, bTipLowerRegion);
277
    obj.pinch(bWholeNoseDyn, bWholeNoseCenter, bWholeNoseRegion);
278
    obj.pinch(bNoseBroaderDyn, bNoseBroaderCenter, bNoseBroaderRegion);
279
    obj.pinch(bLipsDyn, bLipsCenter, bLipsRegion);
280

  
281
    obj.chroma(bChromaSkinDyn, bChromaSkin, bSkinColorRegion, false);
282
    obj.chroma(bChromaEyesDyn, bChromaEyes, bLEyeColorRegion, true);
283
    obj.chroma(bChromaEyesDyn, bChromaEyes, bREyeColorRegion, true);
284
    obj.chroma(bChromaPupilDyn, bChromaPupil, bLPupilColorRegion, true);
285
    obj.chroma(bChromaPupilDyn, bChromaPupil, bRPupilColorRegion, true);
180 286
    }
181 287

  
182 288
///////////////////////////////////////////////////////////////////////////////////////////////////
......
184 290
  synchronized void setRace(float blackness, float asianness)
185 291
    {
186 292
    mWhiteness = 1 - blackness - asianness;
187
    mBlackness = blackness;
188 293
    mAsianness = asianness;
294
    mBlackness = blackness;
189 295

  
190 296
    //android.util.Log.e("manager", "blackness="+blackness+" asianness="+asianness);
191 297

  
......
204 310
    aChromaEyesFactor.set(0.7f*mAsianness);
205 311

  
206 312
    // BLACKNESS
313
    bFaceFactor.set1(1.0f + 0.1f*mBlackness);
314
    bTipLowerFactor.set2(23.0f*mBlackness);
315
    bWholeNoseFactor.set1(1.0f+0.5f*mBlackness);
316
    bNoseBroaderFactor.set1(1.0f+0.38f*mBlackness);
317
    bLipsFactor.set1(1.0f+1.0f*mBlackness);
318

  
319
    bChromaSkinFactor.set(0.55f*mBlackness);
320
    bChromaEyesFactor.set(0.35f*mBlackness);
321
    bChromaPupilFactor.set(0.7f*mBlackness);
207 322
    }
208 323
  }
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
54 54
      mEffects = new AroundTheWorldEffectsManager();
55 55

  
56 56
      Distorted.setMaxVertex(12);
57
      Distorted.setMaxFragment(3);
57
      Distorted.setMaxFragment(8);
58 58
      }
59 59

  
60 60
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff