Revision 698ad0a8
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java | ||
---|---|---|
35 | 35 |
import org.distorted.library.main.DistortedLibrary; |
36 | 36 |
import org.distorted.library.main.DistortedScreen; |
37 | 37 |
import org.distorted.library.main.DistortedNode; |
38 |
import org.distorted.library.mesh.MeshRectangles;
|
|
38 |
import org.distorted.library.mesh.MeshQuad;
|
|
39 | 39 |
import org.distorted.library.type.Dynamic1D; |
40 | 40 |
import org.distorted.library.type.Static3D; |
41 | 41 |
import org.distorted.library.type.Static1D; |
... | ... | |
57 | 57 |
private DistortedNode mRoot; |
58 | 58 |
private DistortedTexture mLeaf; |
59 | 59 |
private DistortedScreen mScreen; |
60 |
private MeshRectangles mMesh;
|
|
60 |
private MeshQuad mLeafMesh;
|
|
61 | 61 |
private int mScreenW, mScreenH; |
62 | 62 |
private int mPrevRendered, mCurrRendered; |
63 | 63 |
private Static3D mMove, mScale; |
... | ... | |
78 | 78 |
} |
79 | 79 |
else if( number>0 && number<=NUM_LEAVES ) |
80 | 80 |
{ |
81 |
if( checked ) mCircleNode[color].attach( mLeaf, mEffects[number-1], mMesh); |
|
81 |
if( checked ) mCircleNode[color].attach( mLeaf, mEffects[number-1], mLeafMesh);
|
|
82 | 82 |
else mCircleNode[color].detach(mEffects[number-1]); |
83 | 83 |
} |
84 | 84 |
} |
... | ... | |
98 | 98 |
|
99 | 99 |
mLeaf = new DistortedTexture(); |
100 | 100 |
DistortedTexture surface = new DistortedTexture(); |
101 |
mMesh = new MeshRectangles(1,1); |
|
101 |
|
|
102 |
mLeafMesh = new MeshQuad(); |
|
103 |
mLeafMesh.setStretch(LEAF_SIZE,LEAF_SIZE,0); |
|
104 |
MeshQuad circleMesh = new MeshQuad(); |
|
105 |
circleMesh.setStretch(3*LEAF_SIZE,3*LEAF_SIZE,0); |
|
106 |
MeshQuad rootMesh = new MeshQuad(); |
|
107 |
rootMesh.setStretch(mScreenW,mScreenH,0); |
|
108 |
|
|
102 | 109 |
mMove = new Static3D(0,0,0); |
103 | 110 |
mScale= new Static3D(1,1,1); |
104 | 111 |
|
105 |
DistortedEffects rootEffects = new DistortedEffects(mScreenW,mScreenH,0);
|
|
112 |
DistortedEffects rootEffects = new DistortedEffects(); |
|
106 | 113 |
rootEffects.apply(new MatrixEffectScale(mScale)); |
107 | 114 |
rootEffects.apply(new MatrixEffectMove(mMove)); |
108 | 115 |
|
109 |
mRoot = new DistortedNode(new DistortedTexture(), rootEffects, mMesh);
|
|
116 |
mRoot = new DistortedNode(new DistortedTexture(), rootEffects, rootMesh);
|
|
110 | 117 |
|
111 | 118 |
Dynamic1D rot = new Dynamic1D(5000,0.0f); |
112 | 119 |
rot.setMode(Dynamic1D.MODE_JUMP); |
... | ... | |
122 | 129 |
|
123 | 130 |
for(int j=0; j<NUM_LEAVES; j++) |
124 | 131 |
{ |
125 |
mEffects[j] = new DistortedEffects(LEAF_SIZE,LEAF_SIZE,0);
|
|
132 |
mEffects[j] = new DistortedEffects(); |
|
126 | 133 |
mEffects[j].apply(new MatrixEffectMove(moveVector)); |
127 | 134 |
mEffects[j].apply( new MatrixEffectRotate(new Static1D(j*(360/NUM_LEAVES)), axis, center) ); |
128 | 135 |
} |
129 | 136 |
|
130 | 137 |
for(int i=0; i<NUM_CIRCLES; i++) |
131 | 138 |
{ |
132 |
DistortedEffects effects = new DistortedEffects(3*LEAF_SIZE,3*LEAF_SIZE,0);
|
|
139 |
DistortedEffects effects = new DistortedEffects(); |
|
133 | 140 |
effects.apply( new MatrixEffectRotate(rot, axis, center) ); |
134 | 141 |
effects.apply( new MatrixEffectMove(new Static3D(positions[2*i], positions[2*i+1], 0)) ); |
135 | 142 |
effects.apply( new FragmentEffectChroma(new Static1D(0.5f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2])) ); |
136 | 143 |
|
137 |
mCircleNode[i] = new DistortedNode( surface, effects, mMesh);
|
|
144 |
mCircleNode[i] = new DistortedNode( surface, effects, circleMesh);
|
|
138 | 145 |
mRoot.attach(mCircleNode[i]); |
139 | 146 |
|
140 |
for(int j=0; j<NUM_LEAVES; j++) mCircleNode[i].attach(mLeaf, mEffects[j], mMesh); |
|
147 |
for(int j=0; j<NUM_LEAVES; j++) mCircleNode[i].attach(mLeaf, mEffects[j], mLeafMesh);
|
|
141 | 148 |
} |
142 | 149 |
|
143 | 150 |
mScreen = new DistortedScreen(); |
Also available in: Unified diff
Move the Effects.setStretch to Meshbase.setStretch