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/flag/FlagRenderer.java
66 66
      {
67 67
      mView = v;
68 68

  
69
      mTexture = new DistortedTexture(500,300);
69
      final int GRIDX = 50;
70
      final int GRIDY = 30;
71

  
72
      final Static4D mapFB = new Static4D(0.0f,0.0f,1.0f      ,1.0f      );
73
      final Static4D mapLR = new Static4D(0.0f,0.0f,1.0f/GRIDX,1.0f      );
74
      final Static4D mapTB = new Static4D(0.0f,0.0f,1.0f      ,1.0f/GRIDY);
75

  
76
      MeshCubes mesh = new MeshCubes(GRIDX,GRIDY,1, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
70 77

  
71
      mObjWidth = mTexture.getWidth();
72
      mObjHeight= mTexture.getHeight();
78
      mTexture = new DistortedTexture();
79

  
80
      mObjWidth = 500;
81
      mObjHeight= 300;
73 82

  
74 83
      mWaveDyn = new Dynamic5D(1000,0.0f);
75 84
      mWaveSta1= new Static5D(0,0,-180,0,0);  // all other values besides the
......
85 94
      Static3D waveCenter = new Static3D(mObjWidth, mObjHeight/2, 0);  // middle of the right edge
86 95
      Static4D waveRegion = new Static4D(0,0,0,mObjWidth);
87 96

  
88
      DistortedEffects effects = new DistortedEffects();
97
      DistortedEffects effects = new DistortedEffects(mObjWidth,mObjHeight,1);
89 98
      effects.apply( new VertexEffectWave(mWaveDyn, waveCenter, waveRegion) );
90 99

  
91 100
      mMove  = new Static3D(0,0,0);
......
97 106
      effects.apply( new MatrixEffectScale(mScale));
98 107
      effects.apply( new MatrixEffectMove(mMove));
99 108

  
100
      final int GRIDX = 50;
101
      final int GRIDY = 30;
102

  
103
      final Static4D mapFB = new Static4D(0.0f,0.0f,1.0f      ,1.0f      );
104
      final Static4D mapLR = new Static4D(0.0f,0.0f,1.0f/GRIDX,1.0f      );
105
      final Static4D mapTB = new Static4D(0.0f,0.0f,1.0f      ,1.0f/GRIDY);
106 109

  
107 110
      mScreen = new DistortedScreen();
108
      mScreen.attach(mTexture, effects, new MeshCubes(GRIDX,GRIDY,1, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB) );
111
      mScreen.attach(mTexture, effects, mesh );
109 112
      }
110 113

  
111 114
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff