Revision 698ad0a8
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeRenderer.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.MeshQuad; |
|
37 | 38 |
import org.distorted.library.mesh.MeshRectangles; |
38 | 39 |
import org.distorted.library.type.Dynamic1D; |
39 | 40 |
import org.distorted.library.type.Static1D; |
... | ... | |
78 | 79 |
|
79 | 80 |
mLeaf = new DistortedTexture(); |
80 | 81 |
|
81 |
MeshRectangles mesh = new MeshRectangles(1,1); |
|
82 |
MeshQuad rootMesh = new MeshQuad(); |
|
83 |
rootMesh.setStretch(mScreenW,mScreenH,0); |
|
84 |
MeshQuad innerMesh = new MeshQuad(); |
|
85 |
innerMesh.setStretch(INNER*LEAF_SIZE,INNER*LEAF_SIZE,0); |
|
86 |
MeshQuad leafMesh = new MeshQuad(); |
|
87 |
leafMesh.setStretch(LEAF_SIZE,LEAF_SIZE,0); |
|
88 |
|
|
82 | 89 |
mMove = new Static3D(0,0,0); |
83 | 90 |
mScale= new Static3D(1,1,1); |
84 | 91 |
|
85 |
DistortedEffects rootEffects = new DistortedEffects(mScreenW,mScreenH,0);
|
|
86 |
DistortedEffects innerEffects = new DistortedEffects(INNER*LEAF_SIZE,INNER*LEAF_SIZE,0);
|
|
92 |
DistortedEffects rootEffects = new DistortedEffects(); |
|
93 |
DistortedEffects innerEffects = new DistortedEffects(); |
|
87 | 94 |
DistortedEffects[] innerLeafEffects= new DistortedEffects[NUM_LEAVES]; |
88 | 95 |
DistortedEffects[] outerLeafEffects= new DistortedEffects[NUM_LEAVES]; |
89 | 96 |
|
90 |
DistortedNode root = new DistortedNode(new DistortedTexture(), rootEffects, mesh);
|
|
97 |
DistortedNode root = new DistortedNode(new DistortedTexture(), rootEffects, rootMesh);
|
|
91 | 98 |
|
92 | 99 |
rootEffects.apply(new MatrixEffectScale(mScale)); |
93 | 100 |
rootEffects.apply(new MatrixEffectMove(mMove)); |
... | ... | |
107 | 114 |
|
108 | 115 |
for(int j=0; j<NUM_LEAVES; j++) |
109 | 116 |
{ |
110 |
outerLeafEffects[j] = new DistortedEffects(LEAF_SIZE,LEAF_SIZE,0);
|
|
117 |
outerLeafEffects[j] = new DistortedEffects(); |
|
111 | 118 |
outerLeafEffects[j].apply(new MatrixEffectMove(outerMoveVector)); |
112 | 119 |
outerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, outerCenter) ); |
113 | 120 |
|
114 |
root.attach(mLeaf, outerLeafEffects[j], mesh);
|
|
121 |
root.attach(mLeaf, outerLeafEffects[j], leafMesh);
|
|
115 | 122 |
} |
116 | 123 |
|
117 | 124 |
innerEffects.apply( new MatrixEffectRotate(rotate, axis, innerCenter) ); |
... | ... | |
119 | 126 |
innerEffects.apply( new FragmentEffectChroma(new Static1D(0.5f), new Static3D(1,0,0) ) ); |
120 | 127 |
innerEffects.apply(blurEffect); |
121 | 128 |
|
122 |
DistortedNode innerNode = new DistortedNode( new DistortedTexture(), innerEffects, mesh);
|
|
129 |
DistortedNode innerNode = new DistortedNode( new DistortedTexture(), innerEffects, innerMesh);
|
|
123 | 130 |
root.attach(innerNode); |
124 | 131 |
|
125 | 132 |
for(int j=0; j<NUM_LEAVES; j++) |
126 | 133 |
{ |
127 |
innerLeafEffects[j] = new DistortedEffects(LEAF_SIZE,LEAF_SIZE,0);
|
|
134 |
innerLeafEffects[j] = new DistortedEffects(); |
|
128 | 135 |
innerLeafEffects[j].apply(new MatrixEffectMove(innerMoveVector)); |
129 | 136 |
innerLeafEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, innerCenter) ); |
130 | 137 |
|
131 |
innerNode.attach( mLeaf, innerLeafEffects[j], mesh );
|
|
138 |
innerNode.attach( mLeaf, innerLeafEffects[j], leafMesh );
|
|
132 | 139 |
} |
133 | 140 |
|
134 | 141 |
mScreen = new DistortedScreen(); |
Also available in: Unified diff
Move the Effects.setStretch to Meshbase.setStretch