Project

General

Profile

« Previous | Next » 

Revision 687263cc

Added by Leszek Koltunski about 4 years ago

Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)

View differences:

src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
93 93
      mPrevRendered = -1;
94 94
      mCurrRendered = -1;
95 95

  
96
      mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE);
97
      DistortedTexture surface = new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE);
96
      mScreenW = 9*LEAF_SIZE;
97
      mScreenH = 9*LEAF_SIZE;
98

  
99
      mLeaf = new DistortedTexture();
100
      DistortedTexture surface = new DistortedTexture();
98 101
      mMesh = new MeshRectangles(1,1);
99 102
      mMove = new Static3D(0,0,0);
100 103
      mScale= new Static3D(1,1,1);
101 104

  
102
      DistortedEffects effects = new DistortedEffects();
103
      effects.apply(new MatrixEffectScale(mScale));
104
      effects.apply(new MatrixEffectMove(mMove));
105
      DistortedEffects rootEffects = new DistortedEffects(mScreenW,mScreenH,0);
106
      rootEffects.apply(new MatrixEffectScale(mScale));
107
      rootEffects.apply(new MatrixEffectMove(mMove));
105 108

  
106
      mScreenW = 9*LEAF_SIZE;
107
      mScreenH = 9*LEAF_SIZE;
108
      mRoot = new DistortedNode(new DistortedTexture(mScreenW,mScreenH), effects, mMesh);
109
      mRoot = new DistortedNode(new DistortedTexture(), rootEffects, mMesh);
109 110
     
110 111
      Dynamic1D rot = new Dynamic1D(5000,0.0f);
111 112
      rot.setMode(Dynamic1D.MODE_JUMP);
......
121 122

  
122 123
      for(int j=0; j<NUM_LEAVES; j++)
123 124
        {
124
        mEffects[j] = new DistortedEffects();
125
        mEffects[j] = new DistortedEffects(LEAF_SIZE,LEAF_SIZE,0);
125 126
        mEffects[j].apply(new MatrixEffectMove(moveVector));
126 127
        mEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) );
127 128
        }
128 129

  
129 130
      for(int i=0; i<NUM_CIRCLES; i++)
130 131
        {
131
        effects = new DistortedEffects();
132
        DistortedEffects effects = new DistortedEffects(3*LEAF_SIZE,3*LEAF_SIZE,0);
132 133
        effects.apply( new MatrixEffectRotate(rot, axis, center) );
133 134
        effects.apply( new MatrixEffectMove(new Static3D(positions[2*i], positions[2*i+1], 0)) );
134 135
        effects.apply( new FragmentEffectChroma(new Static1D(0.5f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2])) );

Also available in: Unified diff