Revision 483ae94e
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/rubik/RubikCube.java | ||
---|---|---|
254 | 254 |
private void modifyCurrentPosition(int x, int y, int z, Static4D quat) |
255 | 255 |
{ |
256 | 256 |
Static3D current = mCurrentPosition[x][y][z]; |
257 |
float beforeX = current.get1(); |
|
258 |
float beforeY = current.get2(); |
|
259 |
float beforeZ = current.get3(); |
|
260 |
|
|
261 | 257 |
float diff = 0.5f*(mSize-1); |
262 |
|
|
263 |
float cubitCenterX = beforeX - diff; |
|
264 |
float cubitCenterY = beforeY - diff; |
|
265 |
float cubitCenterZ = beforeZ - diff; |
|
258 |
float cubitCenterX = current.get1() - diff; |
|
259 |
float cubitCenterY = current.get2() - diff; |
|
260 |
float cubitCenterZ = current.get3() - diff; |
|
266 | 261 |
|
267 | 262 |
Static4D cubitCenter = new Static4D(cubitCenterX, cubitCenterY, cubitCenterZ, 0); |
268 | 263 |
Static4D rotatedCenter = RubikSurfaceView.rotateVectorByQuat( cubitCenter, quat); |
... | ... | |
326 | 321 |
|
327 | 322 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
328 | 323 |
|
329 |
float getWidth() |
|
330 |
{ |
|
331 |
return mTexture.getWidth(); |
|
332 |
} |
|
333 |
|
|
334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
335 |
|
|
336 |
float getHeight() |
|
337 |
{ |
|
338 |
return mTexture.getHeight(); |
|
339 |
} |
|
340 |
|
|
341 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
342 |
|
|
343 |
float getDepth() |
|
324 |
float getTextureSize() |
|
344 | 325 |
{ |
345 |
return mTexture.getDepth(mCubes[0][0][0]);
|
|
326 |
return TEXTURE_SIZE;
|
|
346 | 327 |
} |
347 | 328 |
|
348 | 329 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
349 | 330 |
|
350 |
float getSizeInModelSpace()
|
|
331 |
float getSize() |
|
351 | 332 |
{ |
352 |
return mSize*TEXTURE_SIZE;
|
|
333 |
return mSize; |
|
353 | 334 |
} |
354 | 335 |
} |
Also available in: Unified diff
RubikApp: properly compute cameraDistance and FOV.