Project

General

Profile

« Previous | Next » 

Revision 52e8e76a

Added by Leszek Koltunski almost 4 years ago

Before somehow the Dynamics sometimes tolerated not being reset to beginning before next use. New version doesn't - correct that in two apps.

View differences:

src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java
66 66
   private PostprocessEffectGlow[] mGlow = new PostprocessEffectGlow[NUM_LEAVES];
67 67
   private int mGlowing;
68 68
   private Static3D mScale;
69
   private Dynamic2D mHaloAndRadiusDyn;
70
   private Dynamic4D[] mColorDyn;
69 71

  
70 72
///////////////////////////////////////////////////////////////////////////////////////////////////
71 73

  
......
108 110
        root.attach(node);
109 111
        }
110 112

  
111
      Dynamic2D haloAndRadiusDyn = new Dynamic2D(FLASH_TIME,1.0f);
112
      haloAndRadiusDyn.add(new Static2D( 0, 0));
113
      haloAndRadiusDyn.add(new Static2D(70,50));
113
      mHaloAndRadiusDyn = new Dynamic2D(FLASH_TIME,1.0f);
114
      mHaloAndRadiusDyn.add(new Static2D( 0, 0));
115
      mHaloAndRadiusDyn.add(new Static2D(70,50));
116

  
117
      mColorDyn = new Dynamic4D[NUM_LEAVES];
114 118

  
115 119
      for(int leaf=0; leaf<NUM_LEAVES; leaf++)
116 120
        {
117
        Dynamic4D color= new Dynamic4D(FLASH_TIME,1.0f);
118
        Static4D P1    = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 0.0f);
119
        Static4D P2    = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1.0f);
120
        color.add(P1);
121
        color.add(P2);
121
        mColorDyn[leaf] = new Dynamic4D(FLASH_TIME,1.0f);
122
        Static4D P1     = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 0.0f);
123
        Static4D P2     = new Static4D(colors[3*leaf],colors[3*leaf+1], colors[3*leaf+2], 1.0f);
124
        mColorDyn[leaf].add(P1);
125
        mColorDyn[leaf].add(P2);
122 126

  
123
        mGlow[leaf] = new PostprocessEffectGlow(haloAndRadiusDyn,color);
127
        mGlow[leaf] = new PostprocessEffectGlow(mHaloAndRadiusDyn,mColorDyn[leaf]);
124 128
        }
125 129

  
126 130
      makeGlow(0);
......
135 139
     {
136 140
     mGlowing = leaf;
137 141
     mLeafEffects[leaf].apply(mGlow[leaf]);
142
     mHaloAndRadiusDyn.resetToBeginning();
143
     mColorDyn[leaf].resetToBeginning();
138 144
     mGlow[leaf].notifyWhenFinished(this);
139 145
     }
140 146

  

Also available in: Unified diff