Revision 7e8b9852
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/objects/RubikCube.java | ||
---|---|---|
150 | 150 |
int association = 1; |
151 | 151 |
MeshBase[] meshes = new MeshRectangles[MESHES]; |
152 | 152 |
meshes[0] = new MeshRectangles(14,14); |
153 |
meshes[0].setEffectAssociation(0,association); |
|
153 |
meshes[0].setEffectAssociation(0,association,0);
|
|
154 | 154 |
|
155 | 155 |
for(int i=1; i<MESHES; i++) |
156 | 156 |
{ |
157 | 157 |
association <<=1; |
158 | 158 |
meshes[i] = meshes[0].copy(true); |
159 |
meshes[i].setEffectAssociation(0,association); |
|
159 |
meshes[i].setEffectAssociation(0,association,0);
|
|
160 | 160 |
} |
161 | 161 |
|
162 | 162 |
mMesh = new MeshJoined(meshes); |
... | ... | |
194 | 194 |
Static1D dRad = new Static1D(1); |
195 | 195 |
|
196 | 196 |
VertexEffectMove effect0 = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
197 |
effect0.setMeshAssociation(-1,63); // all 6 sides
|
|
197 |
effect0.setMeshAssociation(63,-1); // all 6 sides
|
|
198 | 198 |
VertexEffectRotate effect1 = new VertexEffectRotate( angle180, axisX, center ); |
199 |
effect1.setMeshAssociation(-1,32); // back
|
|
199 |
effect1.setMeshAssociation(32,-1); // back
|
|
200 | 200 |
VertexEffectRotate effect2 = new VertexEffectRotate( angle90 , axisX, center ); |
201 |
effect2.setMeshAssociation(-1, 8); // bottom
|
|
201 |
effect2.setMeshAssociation( 8,-1); // bottom
|
|
202 | 202 |
VertexEffectRotate effect3 = new VertexEffectRotate( angle270, axisX, center ); |
203 |
effect3.setMeshAssociation(-1, 4); // top
|
|
203 |
effect3.setMeshAssociation( 4,-1); // top
|
|
204 | 204 |
VertexEffectRotate effect4 = new VertexEffectRotate( angle270, axisY, center ); |
205 |
effect4.setMeshAssociation(-1, 2); // left
|
|
205 |
effect4.setMeshAssociation( 2,-1); // left
|
|
206 | 206 |
VertexEffectRotate effect5 = new VertexEffectRotate( angle90 , axisY, center ); |
207 |
effect5.setMeshAssociation(-1, 1); // right
|
|
207 |
effect5.setMeshAssociation( 1,-1); // right
|
|
208 | 208 |
|
209 | 209 |
VertexEffectDeform effect6 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
210 | 210 |
VertexEffectDeform effect7 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
src/main/java/org/distorted/objects/RubikObject.java | ||
---|---|---|
147 | 147 |
} |
148 | 148 |
} |
149 | 149 |
|
150 |
mesh.setTextureMap(maps); |
|
150 |
mesh.setTextureMap(maps,0);
|
|
151 | 151 |
} |
152 | 152 |
|
153 | 153 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
415 | 415 |
try |
416 | 416 |
{ |
417 | 417 |
maps[face] = new Static4D( newColor*ratio, 0.0f, ratio, 1.0f); |
418 |
mCubits[cubit].getMesh().setTextureMap(maps); |
|
418 |
mCubits[cubit].getMesh().setTextureMap(maps,0);
|
|
419 | 419 |
} |
420 | 420 |
catch(ArrayIndexOutOfBoundsException ignored) |
421 | 421 |
{ |
src/main/java/org/distorted/objects/RubikPyraminx.java | ||
---|---|---|
216 | 216 |
MeshBase[] meshes = new MeshTriangles[MESHES]; |
217 | 217 |
|
218 | 218 |
meshes[0] = new MeshTriangles(5); |
219 |
meshes[0].setEffectAssociation(0,association); |
|
219 |
meshes[0].setEffectAssociation(0,association,0);
|
|
220 | 220 |
|
221 | 221 |
for(int i=1; i<MESHES; i++) |
222 | 222 |
{ |
223 | 223 |
association <<= 1; |
224 | 224 |
meshes[i] = meshes[0].copy(true); |
225 |
meshes[i].setEffectAssociation(0,association); |
|
225 |
meshes[i].setEffectAssociation(0,association,0);
|
|
226 | 226 |
} |
227 | 227 |
|
228 |
Static4D[] textureMaps = new Static4D[MESHES]; |
|
229 |
for(int i=0; i<MESHES; i++) textureMaps[i] = new Static4D(i*0.25f,0.0f,0.25f,1.0f); |
|
230 | 228 |
MeshBase result = new MeshJoined(meshes); |
231 |
result.setTextureMap(textureMaps); |
|
232 | 229 |
|
233 | 230 |
Static3D a0 = new Static3D( 0, 1, 0 ); |
234 | 231 |
Static3D a1 = new Static3D( 0, -1.0f/3, 2*SQ2/3 ); |
... | ... | |
263 | 260 |
Static3D center = new Static3D(0,0,0); |
264 | 261 |
Static4D region = new Static4D(0,0,0,0.6f); |
265 | 262 |
|
266 |
VertexEffectScale effect1 = new VertexEffectScale ( new Static3D(1,SQ3/2,1) ); |
|
267 |
VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) );
|
|
268 |
VertexEffectMove effect3 = new VertexEffectMove ( new Static3D(0,-SQ3*SQ2/12,SQ3/12) ); |
|
269 |
VertexEffectRotate effect4 = new VertexEffectRotate( new Static1D(180), new Static3D(0,0,1), center1 );
|
|
270 |
VertexEffectRotate effect5 = new VertexEffectRotate( angle, axis1, center1 );
|
|
271 |
VertexEffectRotate effect6 = new VertexEffectRotate( angle, axis2, center2 );
|
|
272 |
VertexEffectRotate effect7 = new VertexEffectRotate( angle, axis3, center2 );
|
|
263 |
VertexEffectScale effect1 = new VertexEffectScale ( new Static3D(1,SQ3/2,1) );
|
|
264 |
VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) ); |
|
265 |
VertexEffectMove effect3 = new VertexEffectMove ( new Static3D(0,-SQ3*SQ2/12,SQ3/12) );
|
|
266 |
VertexEffectRotate effect4 = new VertexEffectRotate( new Static1D(180), new Static3D(0,0,1), center1 ); |
|
267 |
VertexEffectRotate effect5 = new VertexEffectRotate( angle, axis1, center1 ); |
|
268 |
VertexEffectRotate effect6 = new VertexEffectRotate( angle, axis2, center2 ); |
|
269 |
VertexEffectRotate effect7 = new VertexEffectRotate( angle, axis3, center2 ); |
|
273 | 270 |
|
274 | 271 |
VertexEffectDeform effect8 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
275 | 272 |
VertexEffectDeform effect9 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
... | ... | |
278 | 275 |
|
279 | 276 |
VertexEffectSink effect12= new VertexEffectSink( new Static1D(1.3f), center, region ); |
280 | 277 |
|
281 |
effect4.setMeshAssociation(-1,14); // apply to mesh[1], [2] and [3]
|
|
282 |
effect5.setMeshAssociation(-1, 2); // apply only to mesh[1]
|
|
283 |
effect6.setMeshAssociation(-1, 4); // apply only to mesh[2]
|
|
284 |
effect7.setMeshAssociation(-1, 8); // apply only to mesh[3]
|
|
278 |
effect4.setMeshAssociation(14,-1); // apply to mesh[1], [2] and [3]
|
|
279 |
effect5.setMeshAssociation( 2,-1); // apply only to mesh[1]
|
|
280 |
effect6.setMeshAssociation( 4,-1); // apply only to mesh[2]
|
|
281 |
effect7.setMeshAssociation( 8,-1); // apply only to mesh[3]
|
|
285 | 282 |
|
286 | 283 |
result.apply(effect1); |
287 | 284 |
result.apply(effect2); |
Also available in: Unified diff
Correct RubikCube for the new library.