Project

General

Profile

« Previous | Next » 

Revision 698ad0a8

Added by Leszek Koltunski about 4 years ago

Move the Effects.setStretch to Meshbase.setStretch

View differences:

src/main/java/org/distorted/examples/flag/FlagRenderer.java
54 54
    private DistortedScreen mScreen;
55 55
    private Dynamic5D mWaveDyn;
56 56
    private Static5D mWaveSta1, mWaveSta2;
57
    private int mObjWidth, mObjHeight;
57
    private int mObjWidth, mObjHeight, mObjDepth;
58 58
    private Static3D mMove, mScale, mCenter;
59 59

  
60 60
    Static4D mQuat1, mQuat2;
......
73 73
      final Static4D mapLR = new Static4D(0.0f,0.0f,1.0f/GRIDX,1.0f      );
74 74
      final Static4D mapTB = new Static4D(0.0f,0.0f,1.0f      ,1.0f/GRIDY);
75 75

  
76
      mObjWidth = 500;
77
      mObjHeight= 300;
78
      mObjDepth =   5;
79

  
76 80
      MeshCubes mesh = new MeshCubes(GRIDX,GRIDY,1, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
81
      mesh.setStretch(mObjWidth,mObjHeight,mObjDepth);
77 82

  
78 83
      mTexture = new DistortedTexture();
79 84

  
80
      mObjWidth = 500;
81
      mObjHeight= 300;
82

  
83 85
      mWaveDyn = new Dynamic5D(1000,0.0f);
84 86
      mWaveSta1= new Static5D(0,0,-180,0,0);  // all other values besides the
85 87
      mWaveSta2= new Static5D(0,0,+180,0,0);  // fourth will be set from the UI
......
91 93
      mQuat1 = new Static4D(           0,         0,           0,          1);  // unity quaternion
92 94
      mQuat2 = new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);  // something semi-random that looks good
93 95

  
94
      Static3D waveCenter = new Static3D(mObjWidth, mObjHeight/2, 0);  // middle of the right edge
96
      Static3D waveCenter = new Static3D(mObjWidth, mObjHeight/2, mObjDepth/2);  // middle of the right edge
95 97
      Static4D waveRegion = new Static4D(0,0,0,mObjWidth);
96 98

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

  
100 102
      mMove  = new Static3D(0,0,0);
......
163 165
      {
164 166
      mScreenMin = width<height ? width:height;
165 167
      float factor = ( width*mObjHeight > height*mObjWidth ) ? (0.8f*height)/mObjHeight : (0.8f*width)/mObjWidth;
166
      mMove.set((width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0);
168
      mMove.set((width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , -factor*mObjDepth/2);
167 169
      mScale.set(factor,factor,factor);
168
      mCenter.set(mObjWidth/2,mObjHeight/2, 0);
170
      mCenter.set(mObjWidth/2,mObjHeight/2,mObjDepth/2);
169 171
      mScreen.resize(width, height);
170 172
      }
171 173

  

Also available in: Unified diff