Revision bcbd5b45
Added by Leszek Koltunski almost 5 years ago
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldEffectsManager.java | ||
---|---|---|
321 | 321 |
wLipsFactor.set(1.0f-0.3f*mWhiteness); |
322 | 322 |
|
323 | 323 |
// ASIANNESS |
324 |
aLipsNoseFactor.set2(23.0f*mAsianness);
|
|
325 |
aNoseBroaderFactor.set1(1.0f+0.85f*mAsianness);
|
|
326 |
aNostrilsFactor.set2(12.0f*mAsianness);
|
|
324 |
aLipsNoseFactor.set1(23.0f*mAsianness);
|
|
325 |
aNoseBroaderFactor.set0(1.0f+0.85f*mAsianness);
|
|
326 |
aNostrilsFactor.set1(12.0f*mAsianness);
|
|
327 | 327 |
aLEyeFactor.set(+10.0f*mAsianness); |
328 | 328 |
aREyeFactor.set(-10.0f*mAsianness); |
329 |
aEyebrowsFactor.set2(40.0f*mAsianness);
|
|
329 |
aEyebrowsFactor.set1(40.0f*mAsianness);
|
|
330 | 330 |
|
331 | 331 |
aChromaSkinFactor.set(0.2f*mAsianness); |
332 | 332 |
aChromaEyesFactor.set(0.7f*mAsianness); |
333 | 333 |
|
334 | 334 |
// BLACKNESS |
335 |
bFaceFactor.set1(1.0f + 0.1f*mBlackness);
|
|
336 |
bTipLowerFactor.set2(-23.0f*mBlackness);
|
|
337 |
bWholeNoseFactor.set1(1.0f+0.5f*mBlackness);
|
|
338 |
bNoseBroaderFactor.set1(1.0f+0.38f*mBlackness);
|
|
339 |
bLipsFactor.set1(1.0f+1.0f*mBlackness);
|
|
335 |
bFaceFactor.set0(1.0f + 0.1f*mBlackness);
|
|
336 |
bTipLowerFactor.set1(-23.0f*mBlackness);
|
|
337 |
bWholeNoseFactor.set0(1.0f+0.5f*mBlackness);
|
|
338 |
bNoseBroaderFactor.set0(1.0f+0.38f*mBlackness);
|
|
339 |
bLipsFactor.set0(1.0f+1.0f*mBlackness);
|
|
340 | 340 |
|
341 | 341 |
bChromaSkinFactor.set(0.75f*mBlackness); |
342 | 342 |
bChromaEyesFactor.set(0.2f*mBlackness); |
src/main/java/org/distorted/examples/deform/DeformRenderer.java | ||
---|---|---|
159 | 159 |
void setRegionRadius(int r) |
160 | 160 |
{ |
161 | 161 |
mRadius = ( r==100 ? 100.0f : r/200.0f); |
162 |
mRegion.set4(mRadius*scrWidth);
|
|
162 |
mRegion.set3(mRadius*scrWidth);
|
|
163 | 163 |
} |
164 | 164 |
|
165 | 165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
185 | 185 |
scrHeight = height; |
186 | 186 |
scrWidth = width; |
187 | 187 |
|
188 |
mRegion.set4(mRadius*scrWidth);
|
|
188 |
mRegion.set3(mRadius*scrWidth);
|
|
189 | 189 |
|
190 | 190 |
Canvas stretchCanvas; |
191 | 191 |
int w=width/2; |
... | ... | |
295 | 295 |
{ |
296 | 296 |
case DISTORT: for(int i=1; i<NUM_VECTORS-1; i++) |
297 | 297 |
{ |
298 |
vDistort[i].set( vDistort[i-1].get1()*damp, vDistort[i-1].get2()*damp, 0 );
|
|
298 |
vDistort[i].set( vDistort[i-1].get0()*damp, vDistort[i-1].get1()*damp, 0 );
|
|
299 | 299 |
} |
300 | 300 |
vDistort[NUM_VECTORS-1].set(0,0,0); |
301 | 301 |
mEffects.apply(mReleasedDistort); |
... | ... | |
303 | 303 |
break; |
304 | 304 |
case DEFORM : for(int i=1; i<NUM_VECTORS-1; i++) |
305 | 305 |
{ |
306 |
vDeform[i].set( vDeform[i-1].get1()*damp, vDeform[i-1].get2()*damp, 0 );
|
|
306 |
vDeform[i].set( vDeform[i-1].get0()*damp, vDeform[i-1].get1()*damp, 0 );
|
|
307 | 307 |
} |
308 | 308 |
vDeform[NUM_VECTORS-1].set(0,0,0); |
309 | 309 |
mEffects.apply(mReleasedDeform); |
... | ... | |
311 | 311 |
break; |
312 | 312 |
case SHEAR : for(int i=1; i<NUM_VECTORS-1; i++) |
313 | 313 |
{ |
314 |
vShear[i].set( vShear[i-1].get1()*damp, vShear[i-1].get2()*damp, 0 );
|
|
314 |
vShear[i].set( vShear[i-1].get0()*damp, vShear[i-1].get1()*damp, 0 );
|
|
315 | 315 |
} |
316 | 316 |
vShear[NUM_VECTORS-1].set(0,0,0); |
317 | 317 |
mEffects.apply(mReleasedShear); |
src/main/java/org/distorted/examples/dynamic/DynamicSurfaceView.java | ||
---|---|---|
482 | 482 |
for(int curr=0; curr<len; curr++) |
483 | 483 |
{ |
484 | 484 |
p1D = di1D.getPoint(curr); |
485 |
drawRedPoint(c,curr+"", p1D.get1(), halfScreenHeight);
|
|
485 |
drawRedPoint(c,curr+"", p1D.get0(), halfScreenHeight);
|
|
486 | 486 |
} |
487 | 487 |
} |
488 | 488 |
|
... | ... | |
495 | 495 |
for(int curr=0; curr<len; curr++) |
496 | 496 |
{ |
497 | 497 |
p2D = di2D.getPoint(curr); |
498 |
drawRedPoint(c,curr+"", p2D.get1(), p2D.get2());
|
|
498 |
drawRedPoint(c,curr+"", p2D.get0(), p2D.get1());
|
|
499 | 499 |
} |
500 | 500 |
} |
501 | 501 |
|
... | ... | |
508 | 508 |
for(int curr=0; curr<len; curr++) |
509 | 509 |
{ |
510 | 510 |
p3D = di3D.getPoint(curr); |
511 |
drawRedPoint(c,curr+"", p3D.get1(), currentDim==DIM_3DXY ? p3D.get2():p3D.get3());
|
|
511 |
drawRedPoint(c,curr+"", p3D.get0(), currentDim==DIM_3DXY ? p3D.get1():p3D.get2());
|
|
512 | 512 |
} |
513 | 513 |
} |
514 | 514 |
|
... | ... | |
522 | 522 |
{ |
523 | 523 |
p4D = di4D.getPoint(curr); |
524 | 524 |
|
525 |
if( currentDim==DIM_4DXY ) drawRedPoint(c,curr+"", p4D.get1(), p4D.get2());
|
|
526 |
else drawRedPoint(c,curr+"", p4D.get3(), p4D.get4());
|
|
525 |
if( currentDim==DIM_4DXY ) drawRedPoint(c,curr+"", p4D.get0(), p4D.get1());
|
|
526 |
else drawRedPoint(c,curr+"", p4D.get2(), p4D.get3());
|
|
527 | 527 |
} |
528 | 528 |
} |
529 | 529 |
|
... | ... | |
540 | 540 |
|
541 | 541 |
if( currentDim==DIM_Q_XY ) |
542 | 542 |
{ |
543 |
x = pQD.get1()*min + halfScreenWidth;
|
|
544 |
y = pQD.get2()*min + halfScreenHeight;
|
|
543 |
x = pQD.get0()*min + halfScreenWidth;
|
|
544 |
y = pQD.get1()*min + halfScreenHeight;
|
|
545 | 545 |
} |
546 | 546 |
else |
547 | 547 |
{ |
548 |
x = pQD.get3()*min + halfScreenWidth;
|
|
549 |
y = pQD.get4()*min + halfScreenHeight;
|
|
548 |
x = pQD.get2()*min + halfScreenWidth;
|
|
549 |
y = pQD.get3()*min + halfScreenHeight;
|
|
550 | 550 |
} |
551 | 551 |
|
552 | 552 |
drawRedPoint(c,curr+"", x,y); |
... | ... | |
578 | 578 |
for(int g=0; g<len; g++) |
579 | 579 |
{ |
580 | 580 |
p1D = di1D.getPoint(g); |
581 |
gx = p1D.get1();
|
|
581 |
gx = p1D.get0();
|
|
582 | 582 |
|
583 | 583 |
if( (x-gx)*(x-gx) < minDist ) |
584 | 584 |
{ |
... | ... | |
600 | 600 |
for(int g=0; g<len; g++) |
601 | 601 |
{ |
602 | 602 |
p2D = di2D.getPoint(g); |
603 |
gx = p2D.get1();
|
|
604 |
gy = p2D.get2();
|
|
603 |
gx = p2D.get0();
|
|
604 |
gy = p2D.get1();
|
|
605 | 605 |
|
606 | 606 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < minDist ) |
607 | 607 |
{ |
... | ... | |
624 | 624 |
for(int g=0; g<len; g++) |
625 | 625 |
{ |
626 | 626 |
p3D = di3D.getPoint(g); |
627 |
gx = p3D.get1();
|
|
628 |
gy = p3D.get2();
|
|
629 |
gz = p3D.get3();
|
|
627 |
gx = p3D.get0();
|
|
628 |
gy = p3D.get1();
|
|
629 |
gz = p3D.get2();
|
|
630 | 630 |
|
631 | 631 |
if( currentDim==DIM_3DXY ) |
632 | 632 |
{ |
... | ... | |
662 | 662 |
for(int g=0; g<len; g++) |
663 | 663 |
{ |
664 | 664 |
p4D = di4D.getPoint(g); |
665 |
gx = p4D.get1();
|
|
666 |
gy = p4D.get2();
|
|
667 |
gz = p4D.get3();
|
|
668 |
gw = p4D.get4();
|
|
665 |
gx = p4D.get0();
|
|
666 |
gy = p4D.get1();
|
|
667 |
gz = p4D.get2();
|
|
668 |
gw = p4D.get3();
|
|
669 | 669 |
|
670 | 670 |
if( currentDim==DIM_4DXY ) |
671 | 671 |
{ |
... | ... | |
705 | 705 |
|
706 | 706 |
if( currentDim==DIM_Q_XY ) |
707 | 707 |
{ |
708 |
gx = pQD.get1()*min + halfScreenWidth;
|
|
709 |
gy = pQD.get2()*min + halfScreenHeight;
|
|
708 |
gx = pQD.get0()*min + halfScreenWidth;
|
|
709 |
gy = pQD.get1()*min + halfScreenHeight;
|
|
710 | 710 |
|
711 | 711 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < minDist ) |
712 | 712 |
{ |
... | ... | |
716 | 716 |
} |
717 | 717 |
if( currentDim==DIM_Q_ZW ) |
718 | 718 |
{ |
719 |
gz = pQD.get3()*min + halfScreenWidth;
|
|
720 |
gw = pQD.get4()*min + halfScreenHeight;
|
|
719 |
gz = pQD.get2()*min + halfScreenWidth;
|
|
720 |
gw = pQD.get3()*min + halfScreenHeight;
|
|
721 | 721 |
|
722 | 722 |
if( (x-gz)*(x-gz) + (y-gw)*(y-gw) < minDist ) |
723 | 723 |
{ |
... | ... | |
808 | 808 |
break; |
809 | 809 |
case DIM_2D : di2D.setPoint(mMoving, xDown, yDown); |
810 | 810 |
break; |
811 |
case DIM_3DXY: di3D.setPoint(mMoving, xDown, yDown, (int)di3D.getPoint(mMoving).get3());
|
|
811 |
case DIM_3DXY: di3D.setPoint(mMoving, xDown, yDown, (int)di3D.getPoint(mMoving).get2());
|
|
812 | 812 |
break; |
813 |
case DIM_3DXZ: di3D.setPoint(mMoving, xDown, (int)di3D.getPoint(mMoving).get2(), yDown);
|
|
813 |
case DIM_3DXZ: di3D.setPoint(mMoving, xDown, (int)di3D.getPoint(mMoving).get1(), yDown);
|
|
814 | 814 |
break; |
815 |
case DIM_4DXY: di4D.setPoint(mMoving, xDown, yDown, (int)di4D.getPoint(mMoving).get3(), (int)di4D.getPoint(mMoving).get4());
|
|
815 |
case DIM_4DXY: di4D.setPoint(mMoving, xDown, yDown, (int)di4D.getPoint(mMoving).get2(), (int)di4D.getPoint(mMoving).get3());
|
|
816 | 816 |
break; |
817 |
case DIM_4DZW: di4D.setPoint(mMoving, (int)di4D.getPoint(mMoving).get1(), (int)di4D.getPoint(mMoving).get2(), xDown, yDown);
|
|
817 |
case DIM_4DZW: di4D.setPoint(mMoving, (int)di4D.getPoint(mMoving).get0(), (int)di4D.getPoint(mMoving).get1(), xDown, yDown);
|
|
818 | 818 |
break; |
819 | 819 |
case DIM_Q_XY: float min1 = QUAT_QUOT* (halfScreenWidth<halfScreenHeight ? halfScreenWidth:halfScreenHeight ); |
820 | 820 |
float x1 = (xDown - halfScreenWidth ) / min1; |
821 | 821 |
float y1 = (yDown - halfScreenHeight) / min1; |
822 |
float z1 = diQu.getPoint(mMoving).get3();
|
|
823 |
float w1 = diQu.getPoint(mMoving).get4();
|
|
822 |
float z1 = diQu.getPoint(mMoving).get2();
|
|
823 |
float w1 = diQu.getPoint(mMoving).get3();
|
|
824 | 824 |
float len1 = x1*x1 + y1*y1; |
825 | 825 |
|
826 | 826 |
if( len1 <= 1.0f ) |
... | ... | |
858 | 858 |
diQu.setPoint(mMoving, x1,y1,z1,w1); |
859 | 859 |
break; |
860 | 860 |
case DIM_Q_ZW: float min2 = QUAT_QUOT* (halfScreenWidth<halfScreenHeight ? halfScreenWidth:halfScreenHeight ); |
861 |
float x2 = diQu.getPoint(mMoving).get1();
|
|
862 |
float y2 = diQu.getPoint(mMoving).get2();
|
|
861 |
float x2 = diQu.getPoint(mMoving).get0();
|
|
862 |
float y2 = diQu.getPoint(mMoving).get1();
|
|
863 | 863 |
float z2 = (xDown - halfScreenWidth ) / min2; |
864 | 864 |
float w2 = (yDown - halfScreenHeight) / min2; |
865 | 865 |
float len3 = z2*z2 + w2*w2; |
src/main/java/org/distorted/examples/earth/EarthRenderer.java | ||
---|---|---|
217 | 217 |
float lon = longitude; |
218 | 218 |
float latInDegrees = (float)(lat*180.0f/Math.PI); |
219 | 219 |
float lonInDegrees = (float)(lon*180.0f/Math.PI); |
220 |
mPinch.set2(latInDegrees);
|
|
221 |
mPinch.set3(lonInDegrees);
|
|
220 |
mPinch.set1(latInDegrees);
|
|
221 |
mPinch.set2(lonInDegrees);
|
|
222 | 222 |
effect = new VertexEffectPinch (mPinch , center, mRegionV); break; |
223 | 223 |
case SWIRL : effect = new VertexEffectSwirl (mSwirl , center, mRegionV); break; // SWIRL & WAVE are not really fully |
224 | 224 |
case WAVE : Static5D wave = new Static5D( RADIUS_V/2, RADIUS_V/2, 0, 90-latitude, 90); // 3D effects. They will not look |
src/main/java/org/distorted/examples/earth/EarthSurfaceView.java | ||
---|---|---|
101 | 101 |
case MotionEvent.ACTION_UP : mX = -1; |
102 | 102 |
mY = -1; |
103 | 103 |
|
104 |
float qx = mRenderer.mQuat1.get1();
|
|
105 |
float qy = mRenderer.mQuat1.get2();
|
|
106 |
float qz = mRenderer.mQuat1.get3();
|
|
107 |
float qw = mRenderer.mQuat1.get4();
|
|
104 |
float qx = mRenderer.mQuat1.get0();
|
|
105 |
float qy = mRenderer.mQuat1.get1();
|
|
106 |
float qz = mRenderer.mQuat1.get2();
|
|
107 |
float qw = mRenderer.mQuat1.get3();
|
|
108 | 108 |
|
109 |
float rx = mRenderer.mQuat2.get1();
|
|
110 |
float ry = mRenderer.mQuat2.get2();
|
|
111 |
float rz = mRenderer.mQuat2.get3();
|
|
112 |
float rw = mRenderer.mQuat2.get4();
|
|
109 |
float rx = mRenderer.mQuat2.get0();
|
|
110 |
float ry = mRenderer.mQuat2.get1();
|
|
111 |
float rz = mRenderer.mQuat2.get2();
|
|
112 |
float rw = mRenderer.mQuat2.get3();
|
|
113 | 113 |
|
114 | 114 |
// This is quaternion multiplication. (tx,ty,tz,tw) |
115 | 115 |
// is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw) |
src/main/java/org/distorted/examples/flag/FlagActivity.java | ||
---|---|---|
83 | 83 |
barNoiseAngleA.setOnSeekBarChangeListener(this); |
84 | 84 |
barNoiseAngleB.setOnSeekBarChangeListener(this); |
85 | 85 |
|
86 |
barNoiseAmplitude.setProgress( (int)mNoise.get1() );
|
|
87 |
barNoiseLength.setProgress ( (int)mNoise.get2() );
|
|
88 |
barNoiseAngleA.setProgress ( (int)mNoise.get4() );
|
|
89 |
barNoiseAngleB.setProgress ( (int)mNoise.get5() );
|
|
86 |
barNoiseAmplitude.setProgress( (int)mNoise.get0() );
|
|
87 |
barNoiseLength.setProgress ( (int)mNoise.get1() );
|
|
88 |
barNoiseAngleA.setProgress ( (int)mNoise.get3() );
|
|
89 |
barNoiseAngleB.setProgress ( (int)mNoise.get4() );
|
|
90 | 90 |
|
91 | 91 |
textNoiseAmplitude.setText(getString(R.string.noise_placeholder,"0.00")); |
92 | 92 |
textNoiseLength.setText(getString(R.string.noise_placeholder,"0.00")); |
... | ... | |
148 | 148 |
case R.id.flagSeekAmplitude : renderer.setAmplitude(progress); |
149 | 149 |
textAmplitude.setText(getString(R.string.amplitude_placeholder,progress)); |
150 | 150 |
break; |
151 |
case R.id.flagSeekNoiseAmplitude: mNoise.set1((float)progress/100);
|
|
151 |
case R.id.flagSeekNoiseAmplitude: mNoise.set0((float)progress/100);
|
|
152 | 152 |
renderer.setNoise(mNoise); |
153 | 153 |
convert(progress); |
154 | 154 |
textNoiseAmplitude.setText(getString(R.string.noise_placeholder,mStr)); |
... | ... | |
157 | 157 |
renderer.setLength(progress); |
158 | 158 |
textLength.setText(getString(R.string.length_placeholder,progress)); |
159 | 159 |
break; |
160 |
case R.id.flagSeekNoiseLength : mNoise.set2((float)progress/100);
|
|
160 |
case R.id.flagSeekNoiseLength : mNoise.set1((float)progress/100);
|
|
161 | 161 |
renderer.setNoise(mNoise); |
162 | 162 |
convert(progress); |
163 | 163 |
textNoiseLength.setText(getString(R.string.noise_placeholder,mStr)); |
... | ... | |
166 | 166 |
renderer.setAngleA(progress); |
167 | 167 |
textAngleA.setText(getString(R.string.alpha_placeholder,progress)); |
168 | 168 |
break; |
169 |
case R.id.flagSeekNoiseAngleA : mNoise.set4((float)progress/100);
|
|
169 |
case R.id.flagSeekNoiseAngleA : mNoise.set3((float)progress/100);
|
|
170 | 170 |
renderer.setNoise(mNoise); |
171 | 171 |
convert(progress); |
172 | 172 |
textNoiseAngleA.setText(getString(R.string.noise_placeholder,mStr)); |
... | ... | |
175 | 175 |
renderer.setAngleB(progress); |
176 | 176 |
textAngleB.setText(getString(R.string.beta_placeholder,progress)); |
177 | 177 |
break; |
178 |
case R.id.flagSeekNoiseAngleB : mNoise.set5((float)progress/100);
|
|
178 |
case R.id.flagSeekNoiseAngleB : mNoise.set4((float)progress/100);
|
|
179 | 179 |
renderer.setNoise(mNoise); |
180 | 180 |
convert(progress); |
181 | 181 |
textNoiseAngleB.setText(getString(R.string.noise_placeholder,mStr)); |
src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
---|---|---|
112 | 112 |
|
113 | 113 |
void setAmplitude(int a) |
114 | 114 |
{ |
115 |
mWaveSta1.set1(a);
|
|
116 |
mWaveSta2.set1(a);
|
|
115 |
mWaveSta1.set0(a);
|
|
116 |
mWaveSta2.set0(a);
|
|
117 | 117 |
} |
118 | 118 |
|
119 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
120 | 120 |
|
121 | 121 |
void setLength(int l) |
122 | 122 |
{ |
123 |
mWaveSta1.set2(l);
|
|
124 |
mWaveSta2.set2(l);
|
|
123 |
mWaveSta1.set1(l);
|
|
124 |
mWaveSta2.set1(l);
|
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
128 | 128 |
|
129 | 129 |
void setAngleA(int a) |
130 | 130 |
{ |
131 |
mWaveSta1.set4(a);
|
|
132 |
mWaveSta2.set4(a);
|
|
131 |
mWaveSta1.set3(a);
|
|
132 |
mWaveSta2.set3(a);
|
|
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
136 | 136 |
|
137 | 137 |
void setAngleB(int b) |
138 | 138 |
{ |
139 |
mWaveSta1.set5(b);
|
|
140 |
mWaveSta2.set5(b);
|
|
139 |
mWaveSta1.set4(b);
|
|
140 |
mWaveSta2.set4(b);
|
|
141 | 141 |
} |
142 | 142 |
|
143 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/flag/FlagSurfaceView.java | ||
---|---|---|
97 | 97 |
case MotionEvent.ACTION_UP : mX = -1; |
98 | 98 |
mY = -1; |
99 | 99 |
|
100 |
float qx = mRenderer.mQuat1.get1();
|
|
101 |
float qy = mRenderer.mQuat1.get2();
|
|
102 |
float qz = mRenderer.mQuat1.get3();
|
|
103 |
float qw = mRenderer.mQuat1.get4();
|
|
100 |
float qx = mRenderer.mQuat1.get0();
|
|
101 |
float qy = mRenderer.mQuat1.get1();
|
|
102 |
float qz = mRenderer.mQuat1.get2();
|
|
103 |
float qw = mRenderer.mQuat1.get3();
|
|
104 | 104 |
|
105 |
float rx = mRenderer.mQuat2.get1();
|
|
106 |
float ry = mRenderer.mQuat2.get2();
|
|
107 |
float rz = mRenderer.mQuat2.get3();
|
|
108 |
float rw = mRenderer.mQuat2.get4();
|
|
105 |
float rx = mRenderer.mQuat2.get0();
|
|
106 |
float ry = mRenderer.mQuat2.get1();
|
|
107 |
float rz = mRenderer.mQuat2.get2();
|
|
108 |
float rw = mRenderer.mQuat2.get3();
|
|
109 | 109 |
|
110 | 110 |
// This is quaternion multiplication. (tx.ty.tz.tw) |
111 | 111 |
// is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw) |
src/main/java/org/distorted/examples/generic/GenericActivity2.java | ||
---|---|---|
234 | 234 |
void setCenter(Static3D center) |
235 | 235 |
{ |
236 | 236 |
GenericSurfaceView view = findViewById(R.id.genericSurfaceView); |
237 |
view.getRenderer().setCenter( center.get1(), center.get2(), center.get3() );
|
|
237 |
view.getRenderer().setCenter( center.get0(), center.get1(), center.get2() );
|
|
238 | 238 |
} |
239 | 239 |
|
240 | 240 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
242 | 242 |
void setRegion(Static4D region) |
243 | 243 |
{ |
244 | 244 |
GenericSurfaceView view = findViewById(R.id.genericSurfaceView); |
245 |
view.getRenderer().setRegion( region.get1(), region.get2(), region.get3(), region.get4() );
|
|
245 |
view.getRenderer().setRegion( region.get0(), region.get1(), region.get2(), region.get3() );
|
|
246 | 246 |
} |
247 | 247 |
|
248 | 248 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/generic/GenericEffect.java | ||
---|---|---|
277 | 277 |
|
278 | 278 |
if( mSta1 !=null ) |
279 | 279 |
{ |
280 |
float f1 = ((int)(mSta1.get1()*100))/100.0f;
|
|
280 |
float f1 = ((int)(mSta1.get0()*100))/100.0f;
|
|
281 | 281 |
text += " "+f1; |
282 | 282 |
} |
283 | 283 |
|
284 | 284 |
if( mSta2 !=null ) |
285 | 285 |
{ |
286 |
float f1 = ((int)(mSta2.get1()*100))/100.0f;
|
|
287 |
float f2 = ((int)(mSta2.get2()*100))/100.0f;
|
|
286 |
float f1 = ((int)(mSta2.get0()*100))/100.0f;
|
|
287 |
float f2 = ((int)(mSta2.get1()*100))/100.0f;
|
|
288 | 288 |
text += " ("+f1+","+f2+")"; |
289 | 289 |
} |
290 | 290 |
|
291 | 291 |
if( mSta3 !=null ) |
292 | 292 |
{ |
293 |
float f1 = ((int)(mSta3.get1()*100))/100.0f;
|
|
294 |
float f2 = ((int)(mSta3.get2()*100))/100.0f;
|
|
295 |
float f3 = ((int)(mSta3.get3()*100))/100.0f;
|
|
293 |
float f1 = ((int)(mSta3.get0()*100))/100.0f;
|
|
294 |
float f2 = ((int)(mSta3.get1()*100))/100.0f;
|
|
295 |
float f3 = ((int)(mSta3.get2()*100))/100.0f;
|
|
296 | 296 |
text += " ("+f1+","+f2+","+f3+")"; |
297 | 297 |
} |
298 | 298 |
|
299 | 299 |
if( mSta4 !=null ) |
300 | 300 |
{ |
301 |
float f1 = ((int)(mSta4.get1()*100))/100.0f;
|
|
302 |
float f2 = ((int)(mSta4.get2()*100))/100.0f;
|
|
303 |
float f3 = ((int)(mSta4.get3()*100))/100.0f;
|
|
304 |
float f4 = ((int)(mSta4.get4()*100))/100.0f;
|
|
301 |
float f1 = ((int)(mSta4.get0()*100))/100.0f;
|
|
302 |
float f2 = ((int)(mSta4.get1()*100))/100.0f;
|
|
303 |
float f3 = ((int)(mSta4.get2()*100))/100.0f;
|
|
304 |
float f4 = ((int)(mSta4.get3()*100))/100.0f;
|
|
305 | 305 |
text += " ("+f1+","+f2+","+f3+","+f4+")"; |
306 | 306 |
} |
307 | 307 |
|
308 | 308 |
if( mSta5 !=null ) |
309 | 309 |
{ |
310 |
float f1 = ((int)(mSta5.get1()*100))/100.0f;
|
|
311 |
float f2 = ((int)(mSta5.get2()*100))/100.0f;
|
|
312 |
float f3 = ((int)(mSta5.get3()*100))/100.0f;
|
|
313 |
float f4 = ((int)(mSta5.get4()*100))/100.0f;
|
|
314 |
float f5 = ((int)(mSta5.get5()*100))/100.0f;
|
|
310 |
float f1 = ((int)(mSta5.get0()*100))/100.0f;
|
|
311 |
float f2 = ((int)(mSta5.get1()*100))/100.0f;
|
|
312 |
float f3 = ((int)(mSta5.get2()*100))/100.0f;
|
|
313 |
float f4 = ((int)(mSta5.get3()*100))/100.0f;
|
|
314 |
float f5 = ((int)(mSta5.get4()*100))/100.0f;
|
|
315 | 315 |
text += " ("+f1+","+f2+","+f3+","+f4+","+f5+")"; |
316 | 316 |
} |
317 | 317 |
|
... | ... | |
344 | 344 |
|
345 | 345 |
private void setCenterText() |
346 | 346 |
{ |
347 |
float f0 = ((int)(mCenterSta.get1()*100))/100.0f;
|
|
348 |
float f1 = ((int)(mCenterSta.get2()*100))/100.0f;
|
|
349 |
float f2 = ((int)(mCenterSta.get3()*100))/100.0f;
|
|
347 |
float f0 = ((int)(mCenterSta.get0()*100))/100.0f;
|
|
348 |
float f1 = ((int)(mCenterSta.get1()*100))/100.0f;
|
|
349 |
float f2 = ((int)(mCenterSta.get2()*100))/100.0f;
|
|
350 | 350 |
|
351 | 351 |
mTextCenter.setText("center ("+f0+","+f1+","+f2+")"); |
352 | 352 |
} |
... | ... | |
388 | 388 |
{ |
389 | 389 |
if( mRegionDimension==4 ) |
390 | 390 |
{ |
391 |
float f0 = ((int)(mRegion4Sta.get1()*100))/100.0f;
|
|
392 |
float f1 = ((int)(mRegion4Sta.get2()*100))/100.0f;
|
|
393 |
float f2 = ((int)(mRegion4Sta.get3()*100))/100.0f;
|
|
394 |
float f3 = ((int)(mRegion4Sta.get4()*100))/100.0f;
|
|
391 |
float f0 = ((int)(mRegion4Sta.get0()*100))/100.0f;
|
|
392 |
float f1 = ((int)(mRegion4Sta.get1()*100))/100.0f;
|
|
393 |
float f2 = ((int)(mRegion4Sta.get2()*100))/100.0f;
|
|
394 |
float f3 = ((int)(mRegion4Sta.get3()*100))/100.0f;
|
|
395 | 395 |
|
396 | 396 |
mTextRegion.setText("region (" + f0 + "," + f1 + "," + f2 + "," + f3 + ")"); |
397 | 397 |
} |
398 | 398 |
|
399 | 399 |
if( mRegionDimension==3 ) |
400 | 400 |
{ |
401 |
float f0 = ((int)(mRegion4Sta.get1()*100))/100.0f;
|
|
402 |
float f1 = ((int)(mRegion4Sta.get2()*100))/100.0f;
|
|
403 |
float f2 = ((int)(mRegion4Sta.get3()*100))/100.0f;
|
|
401 |
float f0 = ((int)(mRegion4Sta.get0()*100))/100.0f;
|
|
402 |
float f1 = ((int)(mRegion4Sta.get1()*100))/100.0f;
|
|
403 |
float f2 = ((int)(mRegion4Sta.get2()*100))/100.0f;
|
|
404 | 404 |
|
405 | 405 |
mTextRegion.setText("region (" + f0 + "," + f1 + "," + f2 + ")"); |
406 | 406 |
} |
... | ... | |
648 | 648 |
seek[i].setProgress(mInterRegion[i]); |
649 | 649 |
} |
650 | 650 |
|
651 |
act.setRegion( new Static4D( mRegion3Sta.get1(), mRegion3Sta.get2(), mRegion3Sta.get3(), 1.0f) );
|
|
651 |
act.setRegion( new Static4D( mRegion3Sta.get0(), mRegion3Sta.get1(), mRegion3Sta.get2(), 1.0f) );
|
|
652 | 652 |
} |
653 | 653 |
|
654 | 654 |
return mRegion; |
src/main/java/org/distorted/examples/generic/GenericSurfaceView.java | ||
---|---|---|
95 | 95 |
case MotionEvent.ACTION_UP : mX = -1; |
96 | 96 |
mY = -1; |
97 | 97 |
|
98 |
float qx = mRenderer.mQuat1.get1();
|
|
99 |
float qy = mRenderer.mQuat1.get2();
|
|
100 |
float qz = mRenderer.mQuat1.get3();
|
|
101 |
float qw = mRenderer.mQuat1.get4();
|
|
102 |
|
|
103 |
float rx = mRenderer.mQuat2.get1();
|
|
104 |
float ry = mRenderer.mQuat2.get2();
|
|
105 |
float rz = mRenderer.mQuat2.get3();
|
|
106 |
float rw = mRenderer.mQuat2.get4();
|
|
98 |
float qx = mRenderer.mQuat1.get0();
|
|
99 |
float qy = mRenderer.mQuat1.get1();
|
|
100 |
float qz = mRenderer.mQuat1.get2();
|
|
101 |
float qw = mRenderer.mQuat1.get3();
|
|
102 |
|
|
103 |
float rx = mRenderer.mQuat2.get0();
|
|
104 |
float ry = mRenderer.mQuat2.get1();
|
|
105 |
float rz = mRenderer.mQuat2.get2();
|
|
106 |
float rw = mRenderer.mQuat2.get3();
|
|
107 | 107 |
|
108 | 108 |
float tx = rw*qx - rz*qy + ry*qz + rx*qw; |
109 | 109 |
float ty = rw*qy + rz*qx + ry*qw - rx*qz; |
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
106 | 106 |
float setGlowAlpha(float glow) |
107 | 107 |
{ |
108 | 108 |
float alpha = glow/100.0f; |
109 |
mColor.set4(alpha);
|
|
109 |
mColor.set3(alpha);
|
|
110 | 110 |
return alpha; |
111 | 111 |
} |
112 | 112 |
|
src/main/java/org/distorted/examples/inflate/InflateSurfaceView.java | ||
---|---|---|
101 | 101 |
case MotionEvent.ACTION_UP : mX = -1; |
102 | 102 |
mY = -1; |
103 | 103 |
|
104 |
float qx = mRenderer.mQuat1.get1();
|
|
105 |
float qy = mRenderer.mQuat1.get2();
|
|
106 |
float qz = mRenderer.mQuat1.get3();
|
|
107 |
float qw = mRenderer.mQuat1.get4();
|
|
104 |
float qx = mRenderer.mQuat1.get0();
|
|
105 |
float qy = mRenderer.mQuat1.get1();
|
|
106 |
float qz = mRenderer.mQuat1.get2();
|
|
107 |
float qw = mRenderer.mQuat1.get3();
|
|
108 | 108 |
|
109 |
float rx = mRenderer.mQuat2.get1();
|
|
110 |
float ry = mRenderer.mQuat2.get2();
|
|
111 |
float rz = mRenderer.mQuat2.get3();
|
|
112 |
float rw = mRenderer.mQuat2.get4();
|
|
109 |
float rx = mRenderer.mQuat2.get0();
|
|
110 |
float ry = mRenderer.mQuat2.get1();
|
|
111 |
float rz = mRenderer.mQuat2.get2();
|
|
112 |
float rw = mRenderer.mQuat2.get3();
|
|
113 | 113 |
|
114 | 114 |
// This is quaternion multiplication. (tx,ty,tz,tw) |
115 | 115 |
// is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw) |
src/main/java/org/distorted/examples/mirror/MirrorRenderer.java | ||
---|---|---|
104 | 104 |
|
105 | 105 |
float headW = (HEAD_SCALE *mScreenH* mHeadW) / (mScreenW* mHeadH); |
106 | 106 |
|
107 |
mHeadPosition.set1(mX*(1.0f-2*MIRROR_MARGIN-headW)*mScreenW / 100.0f + MIRROR_MARGIN*mScreenW);
|
|
107 |
mHeadPosition.set0(mX*(1.0f-2*MIRROR_MARGIN-headW)*mScreenW / 100.0f + MIRROR_MARGIN*mScreenW);
|
|
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
146 | 146 |
|
147 | 147 |
float headScale = HEAD_SCALE *mScreenH/ mHeadH; |
148 | 148 |
mScaleHead.set(headScale,headScale,headScale); |
149 |
mHeadPosition.set2( mScreenH*MIRROR_MARGIN*mMirrorW/mMirrorH );
|
|
149 |
mHeadPosition.set1( mScreenH*MIRROR_MARGIN*mMirrorW/mMirrorH );
|
|
150 | 150 |
setPosition(mX); |
151 | 151 |
|
152 | 152 |
mOffScreen1.attach( mTextureMirror, mEffectsMirror , mQuad ); |
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java | ||
---|---|---|
127 | 127 |
|
128 | 128 |
mRegionVertex.set(0,0,0,rad); |
129 | 129 |
mRegionFragment.set(rad,rad,rad); |
130 |
mDeform.set3(max/7);
|
|
130 |
mDeform.set2(max/7);
|
|
131 | 131 |
} |
132 | 132 |
|
133 | 133 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
260 | 260 |
for(int curr=0; curr<len; curr++) |
261 | 261 |
{ |
262 | 262 |
cu = mCenter.getPoint(curr); |
263 |
c.drawCircle(cu.get1(), mScrHeight-cu.get2(), mSize2, mPaint);
|
|
263 |
c.drawCircle(cu.get0(), mScrHeight-cu.get1(), mSize2, mPaint);
|
|
264 | 264 |
} |
265 | 265 |
|
266 | 266 |
if( time-mTime > LOOP_TIME ) mTime = time; |
... | ... | |
288 | 288 |
for(int g=0; g<len; g++) |
289 | 289 |
{ |
290 | 290 |
dv = mCenter.getPoint(g); |
291 |
gx = dv.get1();
|
|
292 |
gy = dv.get2();
|
|
291 |
gx = dv.get0();
|
|
292 |
gy = dv.get1();
|
|
293 | 293 |
|
294 |
float Z = mDeform.get3()/7;
|
|
294 |
float Z = mDeform.get2()/7;
|
|
295 | 295 |
|
296 | 296 |
if( (xDown-gx)*(xDown-gx) + (yDown-gy)*(yDown-gy) < Z*Z ) |
297 | 297 |
{ |
src/main/java/org/distorted/examples/multiblur/MultiblurSurfaceView.java | ||
---|---|---|
101 | 101 |
case MotionEvent.ACTION_UP : mX = -1; |
102 | 102 |
mY = -1; |
103 | 103 |
|
104 |
float qx = mRenderer.mQuat1.get1();
|
|
105 |
float qy = mRenderer.mQuat1.get2();
|
|
106 |
float qz = mRenderer.mQuat1.get3();
|
|
107 |
float qw = mRenderer.mQuat1.get4();
|
|
104 |
float qx = mRenderer.mQuat1.get0();
|
|
105 |
float qy = mRenderer.mQuat1.get1();
|
|
106 |
float qz = mRenderer.mQuat1.get2();
|
|
107 |
float qw = mRenderer.mQuat1.get3();
|
|
108 | 108 |
|
109 |
float rx = mRenderer.mQuat2.get1();
|
|
110 |
float ry = mRenderer.mQuat2.get2();
|
|
111 |
float rz = mRenderer.mQuat2.get3();
|
|
112 |
float rw = mRenderer.mQuat2.get4();
|
|
109 |
float rx = mRenderer.mQuat2.get0();
|
|
110 |
float ry = mRenderer.mQuat2.get1();
|
|
111 |
float rz = mRenderer.mQuat2.get2();
|
|
112 |
float rw = mRenderer.mQuat2.get3();
|
|
113 | 113 |
|
114 | 114 |
// This is quaternion multiplication. (tx,ty,tz,tw) |
115 | 115 |
// is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw) |
src/main/java/org/distorted/examples/transparency/TransparencySurfaceView.java | ||
---|---|---|
101 | 101 |
case MotionEvent.ACTION_UP : mX = -1; |
102 | 102 |
mY = -1; |
103 | 103 |
|
104 |
float qx = mRenderer.mQuat1.get1();
|
|
105 |
float qy = mRenderer.mQuat1.get2();
|
|
106 |
float qz = mRenderer.mQuat1.get3();
|
|
107 |
float qw = mRenderer.mQuat1.get4();
|
|
108 |
|
|
109 |
float rx = mRenderer.mQuat2.get1();
|
|
110 |
float ry = mRenderer.mQuat2.get2();
|
|
111 |
float rz = mRenderer.mQuat2.get3();
|
|
112 |
float rw = mRenderer.mQuat2.get4();
|
|
104 |
float qx = mRenderer.mQuat1.get0();
|
|
105 |
float qy = mRenderer.mQuat1.get1();
|
|
106 |
float qz = mRenderer.mQuat1.get2();
|
|
107 |
float qw = mRenderer.mQuat1.get3();
|
|
108 |
|
|
109 |
float rx = mRenderer.mQuat2.get0();
|
|
110 |
float ry = mRenderer.mQuat2.get1();
|
|
111 |
float rz = mRenderer.mQuat2.get2();
|
|
112 |
float rw = mRenderer.mQuat2.get3();
|
|
113 | 113 |
|
114 | 114 |
// This is quaternion multiplication. (tx,ty,tz,tw) |
115 | 115 |
// is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw) |
src/main/java/org/distorted/examples/triblur/TriblurSurfaceView.java | ||
---|---|---|
101 | 101 |
case MotionEvent.ACTION_UP : mX = -1; |
102 | 102 |
mY = -1; |
103 | 103 |
|
104 |
float qx = mRenderer.mQuat1.get1();
|
|
105 |
float qy = mRenderer.mQuat1.get2();
|
|
106 |
float qz = mRenderer.mQuat1.get3();
|
|
107 |
float qw = mRenderer.mQuat1.get4();
|
|
108 |
|
|
109 |
float rx = mRenderer.mQuat2.get1();
|
|
110 |
float ry = mRenderer.mQuat2.get2();
|
|
111 |
float rz = mRenderer.mQuat2.get3();
|
|
112 |
float rw = mRenderer.mQuat2.get4();
|
|
104 |
float qx = mRenderer.mQuat1.get0();
|
|
105 |
float qy = mRenderer.mQuat1.get1();
|
|
106 |
float qz = mRenderer.mQuat1.get2();
|
|
107 |
float qw = mRenderer.mQuat1.get3();
|
|
108 |
|
|
109 |
float rx = mRenderer.mQuat2.get0();
|
|
110 |
float ry = mRenderer.mQuat2.get1();
|
|
111 |
float rz = mRenderer.mQuat2.get2();
|
|
112 |
float rw = mRenderer.mQuat2.get3();
|
|
113 | 113 |
|
114 | 114 |
// This is quaternion multiplication. (tx,ty,tz,tw) |
115 | 115 |
// is now equal to (qx,qy,qz,qw)*(rx,ry,rz,rw) |
src/main/java/org/distorted/examples/wind/WindEffectsManager.java | ||
---|---|---|
128 | 128 |
mWind = wind; |
129 | 129 |
|
130 | 130 |
float tanAngle = (wind-50)/50.0f; |
131 |
shearFactor.set2(tanAngle);
|
|
132 |
scaleFactor.set1(1/(float)Math.sqrt(1+tanAngle*tanAngle));
|
|
131 |
shearFactor.set1(tanAngle);
|
|
132 |
scaleFactor.set0(1/(float)Math.sqrt(1+tanAngle*tanAngle));
|
|
133 | 133 |
|
134 | 134 |
windDynamic1.setDuration( wind > 0 ? 900 + 10000/wind : Long.MAX_VALUE); |
135 | 135 |
windDynamic2.setDuration( wind > 0 ? 720 + 8000/wind : Long.MAX_VALUE); |
136 | 136 |
windDynamic3.setDuration( wind > 0 ? 900 + 10000/wind : Long.MAX_VALUE); |
137 | 137 |
|
138 | 138 |
float wave2 = mHeight*( 0.05f + 0.002f*wind); |
139 |
windFactor21.set1(wave2);
|
|
140 |
windFactor22.set1(wave2);
|
|
139 |
windFactor21.set0(wave2);
|
|
140 |
windFactor22.set0(wave2);
|
|
141 | 141 |
|
142 | 142 |
float wave3 = (mHeight/(wind+5.0f)); |
143 |
windFactor31.set1(wave3);
|
|
144 |
windFactor32.set1(wave3);
|
|
143 |
windFactor31.set0(wave3);
|
|
144 |
windFactor32.set0(wave3);
|
|
145 | 145 |
|
146 | 146 |
float wave4 = (mHeight*(wind*(100-wind)/50000.0f)); |
147 |
windFactor41.set1(wave4);
|
|
148 |
windFactor42.set1(wave4);
|
|
147 |
windFactor41.set0(wave4);
|
|
148 |
windFactor42.set0(wave4);
|
|
149 | 149 |
} |
150 | 150 |
|
151 | 151 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Adjustment to Static's API.