Revision 698ad0a8
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/stencil/StencilRenderer.java | ||
---|---|---|
85 | 85 |
{ |
86 | 86 |
mView = v; |
87 | 87 |
|
88 |
MeshCubes cube = new MeshCubes(1,1,1); |
|
89 |
MeshQuad quad = new MeshQuad(); |
|
88 |
MeshCubes cube = new MeshCubes(1,1,1); |
|
89 |
MeshQuad quaFlo = new MeshQuad(); |
|
90 |
MeshQuad quaFBO = new MeshQuad(); |
|
90 | 91 |
|
91 | 92 |
mMove = new Static3D(0,0,0); |
92 | 93 |
mScale = new Static3D(1,1,1); |
... | ... | |
97 | 98 |
mFloorTex = new DistortedTexture(); |
98 | 99 |
mFBOTex = new DistortedTexture(); |
99 | 100 |
|
100 |
DistortedEffects cube1Effects = new DistortedEffects(1);
|
|
101 |
DistortedEffects cube2Effects = new DistortedEffects(1);
|
|
102 |
DistortedEffects floorEffects = new DistortedEffects(1);
|
|
103 |
DistortedEffects FBOEffects = new DistortedEffects(1);
|
|
101 |
DistortedEffects cube1Effects = new DistortedEffects(); |
|
102 |
DistortedEffects cube2Effects = new DistortedEffects(); |
|
103 |
DistortedEffects floorEffects = new DistortedEffects(); |
|
104 |
DistortedEffects FBOEffects = new DistortedEffects(); |
|
104 | 105 |
|
105 |
floorEffects.setStretch(2,2,0);
|
|
106 |
quaFlo.setStretch(2,2,0);
|
|
106 | 107 |
|
107 |
mCube1Node = new DistortedNode(mCubeTex , cube1Effects, cube ); |
|
108 |
mCube2Node = new DistortedNode(mCubeTex , cube2Effects, cube ); |
|
109 |
mFloorNode = new DistortedNode(mFloorTex, floorEffects, quad );
|
|
110 |
mFBONode = new DistortedNode(mFBOTex , FBOEffects , quad );
|
|
108 |
mCube1Node = new DistortedNode(mCubeTex , cube1Effects, cube );
|
|
109 |
mCube2Node = new DistortedNode(mCubeTex , cube2Effects, cube );
|
|
110 |
mFloorNode = new DistortedNode(mFloorTex, floorEffects, quaFlo );
|
|
111 |
mFBONode = new DistortedNode(mFBOTex , FBOEffects , quaFBO );
|
|
111 | 112 |
|
112 | 113 |
///////////////// The Meat of this App - shamelessly ripped off https://open.gl/depthstencils /////////////////////// |
113 | 114 |
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
137 | 138 |
|
138 | 139 |
setScreen(true); |
139 | 140 |
|
140 |
float cw = cube1Effects.getStartchX();
|
|
141 |
float ch = cube1Effects.getStartchY();
|
|
141 |
float cw = cube.getStretchX();
|
|
142 |
float ch = cube.getStretchY();
|
|
142 | 143 |
|
143 |
float fw = floorEffects.getStartchX();
|
|
144 |
float fh = floorEffects.getStartchY();
|
|
144 |
float fw = quaFlo.getStretchX();
|
|
145 |
float fh = quaFlo.getStretchY();
|
|
145 | 146 |
|
146 | 147 |
Static3D axisX = new Static3D(1,0,0); |
147 | 148 |
Static3D axisZ = new Static3D(0,0,1); |
... | ... | |
200 | 201 |
|
201 | 202 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
202 | 203 |
{ |
203 |
float cw = mCube1Node.getEffects().getStartchX();
|
|
204 |
float ch = mCube1Node.getEffects().getStartchY();
|
|
204 |
float cw = mCube1Node.getMesh().getStretchX();
|
|
205 |
float ch = mCube1Node.getMesh().getStretchY();
|
|
205 | 206 |
|
206 |
float fw = mFloorNode.getEffects().getStartchX();
|
|
207 |
float fh = mFloorNode.getEffects().getStartchY();
|
|
207 |
float fw = mFloorNode.getMesh().getStretchX();
|
|
208 |
float fh = mFloorNode.getMesh().getStretchY();
|
|
208 | 209 |
|
209 |
float bw = mFBONode.getEffects().getStartchX();
|
|
210 |
float bh = mFBONode.getEffects().getStartchY();
|
|
210 |
float bw = mFBONode.getMesh().getStretchX();
|
|
211 |
float bh = mFBONode.getMesh().getStretchY();
|
|
211 | 212 |
|
212 | 213 |
float scale = 0.4f*(width>height ? height/ch:width/cw); |
213 | 214 |
|
Also available in: Unified diff
Move the Effects.setStretch to Meshbase.setStretch