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/stencil/StencilRenderer.java
36 36
import org.distorted.library.main.DistortedScreen;
37 37
import org.distorted.library.main.DistortedTexture;
38 38
import org.distorted.library.mesh.MeshCubes;
39
import org.distorted.library.mesh.MeshBase;
40 39
import org.distorted.library.mesh.MeshQuad;
41 40
import org.distorted.library.type.Dynamic1D;
42 41
import org.distorted.library.type.Static1D;
......
86 85
      {
87 86
      mView = v;
88 87

  
89
      MeshBase cube = new MeshCubes(1,1,1);
90
      MeshBase quad = new MeshQuad();
88
      MeshCubes cube = new MeshCubes(1,1,1);
89
      MeshQuad  quad = new MeshQuad();
91 90

  
92 91
      mMove       = new Static3D(0,0,0);
93 92
      mScale      = new Static3D(1,1,1);
94 93
      mRotCenter  = new Static3D(0,0,0);
95 94
      mFBOScale   = new Static3D(1,1,1);
96 95

  
97
      mCubeTex   = new DistortedTexture(1,1);
98
      mFloorTex  = new DistortedTexture(2,2);
99
      mFBOTex    = new DistortedTexture(1,1);
96
      mCubeTex   = new DistortedTexture();
97
      mFloorTex  = new DistortedTexture();
98
      mFBOTex    = new DistortedTexture();
100 99

  
101
      DistortedEffects cube1Effects = new DistortedEffects();
102
      DistortedEffects cube2Effects = new DistortedEffects();
103
      DistortedEffects floorEffects = new DistortedEffects();
104
      DistortedEffects FBOEffects   = new DistortedEffects();
100
      DistortedEffects cube1Effects = new DistortedEffects(1);
101
      DistortedEffects cube2Effects = new DistortedEffects(1);
102
      DistortedEffects floorEffects = new DistortedEffects(1);
103
      DistortedEffects FBOEffects   = new DistortedEffects(1);
104

  
105
      floorEffects.setStretch(2,2,0);
105 106

  
106 107
      mCube1Node = new DistortedNode(mCubeTex , cube1Effects, cube );
107 108
      mCube2Node = new DistortedNode(mCubeTex , cube2Effects, cube );
......
136 137

  
137 138
      setScreen(true);
138 139

  
139
      float cw = mCubeTex.getWidth();
140
      float ch = mCubeTex.getHeight();
140
      float cw = cube1Effects.getStartchX();
141
      float ch = cube1Effects.getStartchY();
141 142

  
142
      float fw = mFloorTex.getWidth();
143
      float fh = mFloorTex.getHeight();
143
      float fw = floorEffects.getStartchX();
144
      float fh = floorEffects.getStartchY();
144 145

  
145 146
      Static3D axisX = new Static3D(1,0,0);
146 147
      Static3D axisZ = new Static3D(0,0,1);
......
199 200
    
200 201
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
201 202
      {
202
      float cw = mCubeTex.getWidth();
203
      float ch = mCubeTex.getHeight();
203
      float cw = mCube1Node.getEffects().getStartchX();
204
      float ch = mCube1Node.getEffects().getStartchY();
204 205

  
205
      float fw = mFloorTex.getWidth();
206
      float fh = mFloorTex.getHeight();
206
      float fw = mFloorNode.getEffects().getStartchX();
207
      float fh = mFloorNode.getEffects().getStartchY();
207 208

  
208
      float bw = mFBOTex.getWidth();
209
      float bh = mFBOTex.getHeight();
209
      float bw = mFBONode.getEffects().getStartchX();
210
      float bh = mFBONode.getEffects().getStartchY();
210 211

  
211 212
      float scale = 0.4f*(width>height ? height/ch:width/cw);
212 213

  

Also available in: Unified diff