Revision 687263cc
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/rubik/RubikCube.java | ||
---|---|---|
50 | 50 |
private static final int VECTZ = 2; |
51 | 51 |
|
52 | 52 |
private static final int ROTATION_MILLISEC = 1500; |
53 |
private static final int TEXTURE_SIZE = 100;
|
|
53 |
private static final int STRETCH_SIZE = 100;
|
|
54 | 54 |
|
55 | 55 |
private static final Static3D VectX = new Static3D(1,0,0); |
56 | 56 |
private static final Static3D VectY = new Static3D(0,1,0); |
... | ... | |
73 | 73 |
{ |
74 | 74 |
mSize = size; |
75 | 75 |
|
76 |
mTexture = new DistortedTexture(TEXTURE_SIZE,TEXTURE_SIZE);
|
|
76 |
mTexture = new DistortedTexture(); |
|
77 | 77 |
|
78 | 78 |
mNodes = new DistortedNode[mSize][mSize][mSize]; |
79 | 79 |
mCubes = new MeshCubes[mSize][mSize][mSize]; |
... | ... | |
84 | 84 |
|
85 | 85 |
Static3D[][][] cubeVectors = new Static3D[mSize][mSize][mSize]; |
86 | 86 |
|
87 |
Static3D center = new Static3D(TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f, TEXTURE_SIZE*0.5f);
|
|
88 |
Static4D region = new Static4D(0,0,0, TEXTURE_SIZE*0.72f);
|
|
87 |
Static3D center = new Static3D(STRETCH_SIZE*0.5f, STRETCH_SIZE*0.5f, STRETCH_SIZE*0.5f);
|
|
88 |
Static4D region = new Static4D(0,0,0, STRETCH_SIZE*0.72f);
|
|
89 | 89 |
|
90 | 90 |
VertexEffectSink sinkEffect = new VertexEffectSink( new Static1D(getSinkStrength()), center, region ); |
91 | 91 |
MatrixEffectMove moveEffect = new MatrixEffectMove(move); |
... | ... | |
130 | 130 |
tmpBottom= (y== 0 ? mapBottom:mapBlack); |
131 | 131 |
|
132 | 132 |
mCubes[x][y][z] = new MeshCubes(vertices,vertices,vertices, tmpFront, tmpBack, tmpLeft, tmpRight, tmpTop, tmpBottom); |
133 |
cubeVectors[x][y][z] = new Static3D( TEXTURE_SIZE*(x-nc), TEXTURE_SIZE*(y-nc), TEXTURE_SIZE*(z-nc) );
|
|
133 |
cubeVectors[x][y][z] = new Static3D( STRETCH_SIZE*(x-nc), STRETCH_SIZE*(y-nc), STRETCH_SIZE*(z-nc) );
|
|
134 | 134 |
mRotationAngle[x][y][z] = new Dynamic1D(); |
135 | 135 |
mRotationAxis[x][y][z] = new Static3D(1,0,0); |
136 | 136 |
|
... | ... | |
138 | 138 |
mRotationAngle[x][y][z].add(new Static1D(0.0f)); |
139 | 139 |
mRotate[x][y][z] = new MatrixEffectRotate( mRotationAngle[x][y][z], mRotationAxis[x][y][z], center); |
140 | 140 |
|
141 |
mEffects[x][y][z] = new DistortedEffects(); |
|
141 |
mEffects[x][y][z] = new DistortedEffects(STRETCH_SIZE,STRETCH_SIZE,STRETCH_SIZE);
|
|
142 | 142 |
mEffects[x][y][z].apply( new MatrixEffectMove(cubeVectors[x][y][z]) ); |
143 | 143 |
mEffects[x][y][z].apply( mRotate[x][y][z] ); |
144 | 144 |
mEffects[x][y][z].apply(quatEffect); |
... | ... | |
308 | 308 |
|
309 | 309 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
310 | 310 |
|
311 |
float getTextureSize()
|
|
311 |
float getStretchSize()
|
|
312 | 312 |
{ |
313 |
return TEXTURE_SIZE;
|
|
313 |
return STRETCH_SIZE;
|
|
314 | 314 |
} |
315 | 315 |
|
316 | 316 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)