Project

General

Profile

« Previous | Next » 

Revision e3c87517

Added by Leszek Koltunski about 4 years ago

Convert the first app, Inflate, to the new MeshBase.setStretch-less API ( use VertexEffectScale instead )

View differences:

src/main/java/org/distorted/examples/inflate/InflateRenderer.java
25 25
import org.distorted.library.effect.FragmentEffectAlpha;
26 26
import org.distorted.library.effect.MatrixEffectQuaternion;
27 27
import org.distorted.library.effect.MatrixEffectScale;
28
import org.distorted.library.effect.VertexEffectScale;
28 29
import org.distorted.library.main.DistortedEffects;
29 30
import org.distorted.library.main.DistortedLibrary;
30 31
import org.distorted.library.main.DistortedScreen;
......
63 64
      mView = v;
64 65

  
65 66
      mAlpha = new Static1D(1.0f);
66

  
67 67
      mScale= new Static3D(1,1,1);
68 68

  
69 69
      Static3D center=new Static3D(0,0,0);
......
73 73
      mTexture = act.getTexture();
74 74
      mMesh    = act.getMesh();
75 75

  
76
      mObjWidth = mMesh.getStretchX();
77
      mObjHeight= mMesh.getStretchY();
78
      mObjDepth = mMesh.getStretchZ();
76
      mObjWidth = act.getCols();
77
      mObjHeight= act.getRows();
78
      mObjDepth = act.getSlic();
79 79

  
80 80
      mQuat1 = new Static4D(0,0,0,1);  // unity
81 81
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
......
87 87
      quatInt2.add(mQuat2);
88 88

  
89 89
      mEffects = new DistortedEffects();
90
      mEffects.apply( new VertexEffectScale(new Static3D(mObjWidth,mObjHeight,mObjDepth) ) );
90 91
      mEffects.apply( new MatrixEffectScale(mScale));
91 92
      mEffects.apply( new MatrixEffectQuaternion(quatInt2, center) );
92 93
      mEffects.apply( new MatrixEffectQuaternion(quatInt1, center) );
......
110 111
      {
111 112
      final float SCALE = 0.75f;
112 113

  
113
      mScreenMin = width<height ? width:height;
114
      mScreenMin = Math.min(width, height);
114 115
      float factor = ( width*mObjHeight > height*mObjWidth ) ? (SCALE*height)/mObjHeight :  (SCALE*width)/mObjWidth;
115 116
      mScale.set(factor,factor,factor);
116 117
      mScreen.resize(width, height);
......
150 151
      mScreen.detachAll();
151 152
      mScreen.attach(mTexture,mEffects,mMesh);
152 153

  
154
      VertexEffectScale.enable();
153 155
      FragmentEffectAlpha.enable();
154 156

  
155 157
      try

Also available in: Unified diff