Project

General

Profile

« Previous | Next » 

Revision 9ff0c8c3

Added by Leszek Koltunski about 8 years ago

Fix 4D and 5D noise, make noise N dimensional.

View differences:

src/main/java/org/distorted/examples/dynamic/DynamicSurfaceView.java
68 68
    private static Static1D p1D;
69 69
    private static Static2D p2D;
70 70
    private static Static3D p3D;
71
    
71

  
72
    private static Static1D p1N;
73
    private static Static2D p2N;
74
    private static Static3D p3N;
75

  
72 76
    private static float[] mDrawCoord = new float[3];
73 77
      
74 78
///////////////////////////////////////////////////////////////////
......
87 91
      mNoise    = 0.0f;
88 92
      
89 93
      di1D = new Dynamic1D(mDuration,0.5f);
90
      di1D.setNoise(mNoise);
94
      p1N = new Static1D(mNoise);
95
      di1D.setNoise(p1N);
91 96
      
92 97
      di2D = new Dynamic2D(mDuration,0.5f);
93
      di2D.setNoise(mNoise);
98
      p2N = new Static2D(mNoise,mNoise);
99
      di2D.setNoise(p2N);
94 100
      
95 101
      di3D = new Dynamic3D(mDuration,0.5f);
96
      di3D.setNoise(mNoise);
102
      p3N = new Static3D(mNoise,mNoise,mNoise);
103
      di3D.setNoise(p3N);
97 104
        
98 105
      if(!isInEditMode())
99 106
        {
......
145 152
    public static void setNoise(float noise)
146 153
      {
147 154
      mNoise = noise;
148
      
149
      di1D.setNoise(noise);
150
      di2D.setNoise(noise);
151
      di3D.setNoise(noise);
155

  
156
      p1N.set(mNoise);
157
      p2N.set(mNoise,mNoise);
158
      p3N.set(mNoise,mNoise,mNoise);
159

  
160
      di1D.setNoise(p1N);
161
      di2D.setNoise(p2N);
162
      di3D.setNoise(p3N);
152 163
      }
153 164
    
154 165
///////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/flag/FlagRenderer.java
78 78
      mWaveDyn.add(mWaveSta2);
79 79
      mWaveDyn.setMode(Dynamic.MODE_JUMP);
80 80

  
81
mWaveDyn.setNoise(0.000000f);
81
mWaveDyn.setNoise( new Static5D(0.1f, 0.1f, 0.1f, 0.1f, 0.1f) );
82 82

  
83 83
      mQuat1 = new Static4D(0,0,0,1);  // unity
84 84
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
165 165
    Static3D center = new Static3D(0,0,0);
166 166
    Static3D axis   = new Static3D(0,0,1);
167 167

  
168
    Static1D alphaNoise = new Static1D(0.4f);
169

  
168 170
    for(int i=0; i<NUM_STARS; i++)
169 171
      {
170 172
      randomX = mRnd.nextInt(w);
......
180 182
      mStars[i].rotate( new Static1D(randomA), axis, center );
181 183
      
182 184
      Dynamic1D di = new Dynamic1D(randomTime,0.0f);
183
      di.setNoise(0.5f);
185
      di.setNoise(alphaNoise);
184 186
      di.add(new Static1D(randomAlpha1));
185 187
      di.add(new Static1D(randomAlpha2));
186 188
      

Also available in: Unified diff