Revision 0ba5de00
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java | ||
---|---|---|
34 | 34 |
import org.distorted.library.main.DistortedNode; |
35 | 35 |
import org.distorted.library.main.DistortedScreen; |
36 | 36 |
import org.distorted.library.main.DistortedTexture; |
37 |
import org.distorted.library.mesh.MeshBase; |
|
38 | 37 |
import org.distorted.library.mesh.MeshQuad; |
39 |
import org.distorted.library.mesh.MeshRectangles; |
|
40 | 38 |
import org.distorted.library.message.EffectListener; |
41 | 39 |
import org.distorted.library.type.Dynamic1D; |
42 | 40 |
import org.distorted.library.type.Dynamic4D; |
... | ... | |
88 | 86 |
DistortedEffects rootEffects = new DistortedEffects(); |
89 | 87 |
DistortedNode root = new DistortedNode(surface, rootEffects, rootMesh); |
90 | 88 |
|
91 |
Static3D moveVector = new Static3D(0.55f*LEAF_SIZE, (mRootH-LEAF_SIZE)/2, 0);
|
|
89 |
Static3D moveVector = new Static3D(-1.45f*LEAF_SIZE, 0, 0);
|
|
92 | 90 |
Static1D chromaLevel= new Static1D(0.5f); |
93 | 91 |
Static3D center = new Static3D(0,0,0); |
94 | 92 |
Static3D axis = new Static3D(0,0,1); |
... | ... | |
98 | 96 |
for(int j=0; j<NUM_LEAVES; j++) |
99 | 97 |
{ |
100 | 98 |
mLeafEffects[j] = new DistortedEffects(); |
101 |
mLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
102 | 99 |
mLeafEffects[j].apply(leafMove); |
100 |
mLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
103 | 101 |
mLeafEffects[j].apply( new FragmentEffectChroma(chromaLevel, new Static3D(colors[3*j],colors[3*j+1], colors[3*j+2])) ); |
104 | 102 |
DistortedNode node = new DistortedNode( mLeaf, mLeafEffects[j], leafMesh); |
105 | 103 |
root.attach(node); |
... | ... | |
113 | 111 |
rot.add(new Static1D(360)); |
114 | 112 |
|
115 | 113 |
DistortedEffects effects = root.getEffects(); |
114 |
effects.apply(new MatrixEffectRotate(rot, axis, center) ); |
|
116 | 115 |
effects.apply(new MatrixEffectScale(mScale)); |
117 |
effects.apply( new MatrixEffectRotate(rot, axis, center) ); |
|
118 | 116 |
|
119 | 117 |
Dynamic1D radiusDyn = new Dynamic1D(FLASH_TIME,1.0f); |
120 | 118 |
radiusDyn.add(new Static1D( 0)); |
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
131 | 131 |
|
132 | 132 |
for(int i=0; i<NUM_OBJECTS; i++) |
133 | 133 |
{ |
134 |
effects[i].apply(scaleEffect); |
|
135 |
effects[i].apply(quatEffect1); |
|
136 |
effects[i].apply(quatEffect2); |
|
137 | 134 |
effects[i].apply(new MatrixEffectMove(mMoveVector[i])); |
135 |
effects[i].apply(quatEffect2); |
|
136 |
effects[i].apply(quatEffect1); |
|
137 |
effects[i].apply(scaleEffect); |
|
138 | 138 |
} |
139 | 139 |
} |
140 | 140 |
|
src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeActivity.java | ||
---|---|---|
41 | 41 |
{ |
42 | 42 |
super.onCreate(savedState); |
43 | 43 |
setContentView(R.layout.postprocesstreelayout); |
44 |
mText = (TextView)findViewById(R.id.postprocesstreeText);
|
|
45 |
SeekBar bar = (SeekBar)findViewById(R.id.postprocesstreeSeek);
|
|
44 |
mText = findViewById(R.id.postprocesstreeText); |
|
45 |
SeekBar bar = findViewById(R.id.postprocesstreeSeek); |
|
46 | 46 |
bar.setOnSeekBarChangeListener(this); |
47 | 47 |
bar.setProgress(50); |
48 | 48 |
} |
... | ... | |
52 | 52 |
@Override |
53 | 53 |
protected void onPause() |
54 | 54 |
{ |
55 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.postprocesstreeSurfaceView);
|
|
55 |
GLSurfaceView view = findViewById(R.id.postprocesstreeSurfaceView); |
|
56 | 56 |
view.onPause(); |
57 | 57 |
DistortedLibrary.onPause(); |
58 | 58 |
super.onPause(); |
... | ... | |
64 | 64 |
protected void onResume() |
65 | 65 |
{ |
66 | 66 |
super.onResume(); |
67 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.postprocesstreeSurfaceView);
|
|
67 |
GLSurfaceView view = findViewById(R.id.postprocesstreeSurfaceView); |
|
68 | 68 |
view.onResume(); |
69 | 69 |
} |
70 | 70 |
|
... | ... | |
81 | 81 |
|
82 | 82 |
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) |
83 | 83 |
{ |
84 |
PostprocessTreeSurfaceView view = (PostprocessTreeSurfaceView) this.findViewById(R.id.postprocesstreeSurfaceView);
|
|
84 |
PostprocessTreeSurfaceView view = findViewById(R.id.postprocesstreeSurfaceView); |
|
85 | 85 |
|
86 | 86 |
switch (bar.getId()) |
87 | 87 |
{ |
src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeRenderer.java | ||
---|---|---|
35 | 35 |
import org.distorted.library.main.DistortedScreen; |
36 | 36 |
import org.distorted.library.main.DistortedTexture; |
37 | 37 |
import org.distorted.library.mesh.MeshQuad; |
38 |
import org.distorted.library.mesh.MeshRectangles; |
|
39 | 38 |
import org.distorted.library.type.Dynamic1D; |
40 | 39 |
import org.distorted.library.type.Static1D; |
41 | 40 |
import org.distorted.library.type.Static3D; |
... | ... | |
111 | 110 |
for(int j=0; j<NUM_LEAVES; j++) |
112 | 111 |
{ |
113 | 112 |
outerLeafEffects[j] = new DistortedEffects(); |
114 |
outerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
115 | 113 |
outerLeafEffects[j].apply(new MatrixEffectMove(outerMoveVector)); |
114 |
outerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
116 | 115 |
|
117 | 116 |
root.attach(mLeaf, outerLeafEffects[j], leafMesh); |
118 | 117 |
} |
... | ... | |
127 | 126 |
for(int j=0; j<NUM_LEAVES; j++) |
128 | 127 |
{ |
129 | 128 |
innerLeafEffects[j] = new DistortedEffects(); |
130 |
innerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
131 | 129 |
innerLeafEffects[j].apply(new MatrixEffectMove(innerMoveVector)); |
130 |
innerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
|
132 | 131 |
|
133 | 132 |
innerNode.attach( mLeaf, innerLeafEffects[j], leafMesh ); |
134 | 133 |
} |
src/main/java/org/distorted/examples/stencil/StencilRenderer.java | ||
---|---|---|
136 | 136 |
|
137 | 137 |
setScreen(true); |
138 | 138 |
|
139 |
float cw = cube.getStretchX(); |
|
140 |
float ch = cube.getStretchY(); |
|
141 |
|
|
142 |
float fw = quaFlo.getStretchX(); |
|
143 |
float fh = quaFlo.getStretchY(); |
|
144 |
|
|
145 | 139 |
Static3D axisX = new Static3D(1,0,0); |
146 | 140 |
Static3D axisZ = new Static3D(0,0,1); |
147 | 141 |
|
... | ... | |
153 | 147 |
Static3D rotCenter = new Static3D(0,0,0); |
154 | 148 |
|
155 | 149 |
MatrixEffectScale scale = new MatrixEffectScale(mScale); |
156 |
MatrixEffectMove move1 = new MatrixEffectMove( new Static3D( 0, 0, cw/2) );
|
|
150 |
MatrixEffectMove move1 = new MatrixEffectMove( new Static3D( 0, 0, cube.getStretchX()/2) );
|
|
157 | 151 |
MatrixEffectRotate rotaX = new MatrixEffectRotate(new Static1D(-60.0f), axisX, rotCenter); |
158 | 152 |
MatrixEffectRotate rotaZ = new MatrixEffectRotate(rotDyn, axisZ, rotCenter); |
159 | 153 |
|
160 | 154 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
161 | 155 |
// First move the cube and its reflection to the middle of the floor. Then scale the floor, the cube |
162 |
// and its reflection. Then keep rotating all along the Z axis, tilt all, and finally move all to the |
|
163 |
// middle of the screen. |
|
156 |
// and its reflection. Then keep rotating all along the Z axis, tilt all. |
|
164 | 157 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
165 | 158 |
// The cube |
166 |
cube1Effects.apply( rotaX ); |
|
167 |
cube1Effects.apply( rotaZ ); |
|
168 |
cube1Effects.apply( scale ); |
|
169 | 159 |
cube1Effects.apply( move1 ); |
160 |
cube1Effects.apply( scale ); |
|
161 |
cube1Effects.apply( rotaZ ); |
|
162 |
cube1Effects.apply( rotaX ); |
|
170 | 163 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
171 | 164 |
// Floor |
172 |
floorEffects.apply( rotaX ); |
|
173 |
floorEffects.apply( rotaZ ); |
|
174 | 165 |
floorEffects.apply( scale ); |
166 |
floorEffects.apply( rotaZ ); |
|
167 |
floorEffects.apply( rotaX ); |
|
175 | 168 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
176 | 169 |
// Reflection |
177 |
cube2Effects.apply( rotaX ); |
|
178 |
cube2Effects.apply( rotaZ ); |
|
179 |
cube2Effects.apply( scale ); |
|
180 |
cube2Effects.apply( new MatrixEffectScale(new Static3D(1,1,-1)) ); |
|
181 | 170 |
cube2Effects.apply( move1 ); |
182 | 171 |
cube2Effects.apply( new MatrixEffectScale(new Static3D(1,1,-1)) ); |
172 |
cube2Effects.apply( scale ); |
|
173 |
cube2Effects.apply( rotaZ ); |
|
174 |
cube2Effects.apply( rotaX ); |
|
183 | 175 |
cube2Effects.apply( new FragmentEffectBrightness(new Static1D(0.5f)) ); |
184 | 176 |
|
185 | 177 |
///////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/transparency/TransparencyRenderer.java | ||
---|---|---|
111 | 111 |
mEffects[i] = new DistortedEffects(); |
112 | 112 |
mEffects[i].apply(mBlur[i]); |
113 | 113 |
mEffects[i].apply(alpha[i]); |
114 |
mEffects[i].apply(scaleEffect); |
|
115 |
mEffects[i].apply(quatEffect1); |
|
116 |
mEffects[i].apply(quatEffect2); |
|
117 | 114 |
mEffects[i].apply(new MatrixEffectMove(mMoveVector[i])); |
115 |
mEffects[i].apply(quatEffect2); |
|
116 |
mEffects[i].apply(quatEffect1); |
|
117 |
mEffects[i].apply(scaleEffect); |
|
118 | 118 |
|
119 | 119 |
mNode[i] = new DistortedNode(mTex[i], mEffects[i], mesh ); |
120 | 120 |
mScreen.attach(mNode[i]); |
src/main/java/org/distorted/examples/triblur/TriblurRenderer.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
private static final int[] OBJECTS = |
58 | 58 |
{ |
59 |
-150, 0, 0, 255, 0, 0, // x,y,z, R,G,B
|
|
59 |
-130, 0, 0, 255, 0, 0, // x,y,z, R,G,B
|
|
60 | 60 |
0, 0, 0, 255, 255, 0, // |
61 |
+150, 0, 0, 0, 255, 0, //
|
|
61 |
+130, 0, 0, 0, 255, 0, //
|
|
62 | 62 |
}; |
63 | 63 |
|
64 | 64 |
private static final int NUM_OBJECTS = OBJECTS.length/NUM; |
... | ... | |
124 | 124 |
mGlow[i] = new PostprocessEffectGlow(mEffectVector[i], new Static4D(1.0f,1.0f,1.0f,0.5f) ); |
125 | 125 |
chroma[i] = new FragmentEffectChroma( new Static1D(0.3f), chromaVector[i]); |
126 | 126 |
effects[i] = new DistortedEffects(); |
127 |
|
|
128 | 127 |
effects[i].apply(mBlur[i]); |
129 | 128 |
effects[i].apply(chroma[i]); |
130 |
effects[i].apply( (i==0||i==NUM_OBJECTS-1) ? scaleEffect1 : scaleEffect2 ); |
|
131 |
effects[i].apply(quatEffect1); |
|
132 |
effects[i].apply(quatEffect2); |
|
129 |
|
|
133 | 130 |
effects[i].apply(new MatrixEffectMove(moveVector[i])); |
131 |
effects[i].apply(quatEffect2); |
|
132 |
effects[i].apply(quatEffect1); |
|
133 |
effects[i].apply( (i==0||i==NUM_OBJECTS-1) ? scaleEffect1 : scaleEffect2 ); |
|
134 | 134 |
|
135 | 135 |
mEffectStatus[i] = 1; |
136 | 136 |
mNode[i] = new DistortedNode(mTex, effects[i], mesh ); |
... | ... | |
212 | 212 |
{ |
213 | 213 |
mScreenMin = width<height ? width:height; |
214 | 214 |
|
215 |
float factor1 = 0.22f*mScreenMin/OBJ_SIZE;
|
|
216 |
float factor2 = 0.80f*factor1;
|
|
215 |
float factor1 = 0.20f*mScreenMin/OBJ_SIZE;
|
|
216 |
float factor2 = 0.75f*factor1;
|
|
217 | 217 |
mScale1.set(factor1,factor1,factor1); |
218 | 218 |
mScale2.set(factor2,factor2,factor2); |
219 | 219 |
mScreen.resize(width, height); |
Also available in: Unified diff
Fixes for the merge.