Mapping modified kind of right
[SugarCubes.git] / AlexGreen.pde
1 class SineSphere extends DPat {
2 float modelrad = sqrt((model.xMax)*(model.xMax) + (model.yMax)*(model.yMax) + (model.zMax)*(model.zMax));
3
4 PVector modelcenter = new PVector(model.xMax, model.yMax, model.zMax);
5 BasicParameter widthparameter = new BasicParameter("Width", 10);
6
7
8 class Sphery {
9 float f1xcenter, f1ycenter, f1zcenter, f2xcenter, f2ycenter, f2zcenter;
10 private SinLFO vibration;
11 private SinLFO surface;
12 private SinLFO vx;
13 float vibration_min, vibration_max, vperiod;
14
15 Sphery(float f1xcenter, float f1ycenter, float f1zcenter, float vibration_min, float vibration_max, float vperiod) {
16 this.f1xcenter = f1xcenter;
17 this.f1ycenter = f1ycenter;
18 this.f1zcenter = f1zcenter;
19 this.vibration_min = vibration_min;
20 this.vibration_max = vibration_max;
21 this.vperiod = vperiod;
22 addModulator( vibration = new SinLFO(vibration_min , vibration_max, vperiod)).trigger(); vibration.modulateDurationBy(vx);
23 addModulator( vx = new SinLFO(-4000, 10000, 100000)).trigger();
24 }
25 float distfromcirclecenter(float px, float py, float pz, float f1x, float f1y, float f1z) {
26 return dist(px, py, pz, f1x, f1y, f1z);
27 }
28
29 color spheryvalue (float px, float py, float pz , float f1xcenter, float f1ycenter, float f1zcenter) {
30
31 return color(px, dist(px, py, pz, f1xcenter, f1ycenter, f1zcenter) , max(0, 100 - 10*abs(dist(px, py, pz, f1xcenter, f1ycenter, f1zcenter)- vibration.getValuef() ) ) );
32
33 }
34
35 void run(int deltaMS) {
36 final float vv = vibration.getValuef();
37 final float vvx = vx.getValuef();
38 }
39
40 }
41 final int NUM_SPHERES = 5;
42 final Sphery[] spherys;
43 SineSphere(GLucose glucose) {
44 super(glucose);
45
46 spherys = new Sphery[NUM_SPHERES];
47 spherys[1] = new Sphery(model.xMax/4, model.yMax/2, model.zMax/2, modelrad/16, modelrad/8, 2500) ;
48 spherys[2] = new Sphery(.75*model.xMax, model.yMax/2, model.zMax/2, modelrad/20, modelrad/10, 2000);
49 spherys[3] = new Sphery(model.xMax/2, model.yMax/2, model.zMax/2, modelrad/4, modelrad/8, 5000);
50 }
51
52
53 float rsv, noiseyv, bandv;
54
55 public void StartRun(int deltaMs) {
56
57 spherys[1].run(deltaMs);
58 spherys[2].run(deltaMs);
59 spherys[3].run(deltaMs);
60 }
61
62
63 color CalcPoint(xyz Px) {
64
65 color c = 0;
66
67 c = blendColor(c, spherys[2].spheryvalue(Px.x, Px.y, Px.z, .75*model.xMax, model.yMax/2, model.zMax/2), ADD);
68 c = blendColor(c, spherys[1].spheryvalue(Px.x, Px.y, Px.z, model.xMax/4, model.yMax/4, model.zMax/2), ADD);
69 c = blendColor(c, spherys[3].spheryvalue(Px.x, Px.y, Px.z, model.xMax/2, model.yMax/2, model.zMax/2),ADD);
70
71
72
73
74 return c;
75 }
76 }
77
78