Revision fb6a40c8
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/object/RubikObject.java | ||
---|---|---|
39 | 39 |
import org.distorted.library.type.Static3D; |
40 | 40 |
import org.distorted.library.type.Static4D; |
41 | 41 |
|
42 |
import static org.distorted.magic.RubikRenderer.NODE_FBO_SIZE; |
|
43 |
|
|
44 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 43 |
|
46 | 44 |
public abstract class RubikObject extends DistortedNode |
47 | 45 |
{ |
46 |
public static final int NODE_FBO_SIZE = 600; |
|
47 |
|
|
48 | 48 |
static final int TEXTURE_HEIGHT = 128; |
49 | 49 |
final float[] LEGAL_QUATS; |
50 | 50 |
final Static3D[] ROTATION_AXIS; |
... | ... | |
56 | 56 |
private int mRotRowBitmap; |
57 | 57 |
private int mRotAxis; |
58 | 58 |
private Static3D[] mOrigPos; |
59 |
private Static3D mScale, mNodeScale;
|
|
59 |
private Static3D mNodeScale; |
|
60 | 60 |
private Static4D mQuatAccumulated; |
61 | 61 |
private Cubit[] mCubits; |
62 | 62 |
private int mSize; |
... | ... | |
91 | 91 |
|
92 | 92 |
mSize = size; |
93 | 93 |
computeStartAndStep(mOrigPos); |
94 |
mNodeScale= new Static3D(1,1,1); |
|
95 |
mQuatAccumulated = quatAcc; |
|
96 |
mSinkEffect = getSink(mSize); |
|
94 | 97 |
|
95 | 98 |
mRotationAngleStatic = new Static1D(0); |
96 | 99 |
mRotationAngleMiddle = new Static1D(0); |
97 | 100 |
mRotationAngleFinal = new Static1D(0); |
98 | 101 |
|
99 |
mScale = new Static3D(1,1,1); |
|
100 |
mNodeScale= new Static3D(1,1,1); |
|
101 |
|
|
102 |
mQuatAccumulated = quatAcc; |
|
103 |
|
|
104 | 102 |
Static3D center = new Static3D(0,0,0); |
105 |
|
|
106 |
mSinkEffect = getSink(mSize); |
|
107 |
mScaleEffect = new MatrixEffectScale(mScale); |
|
103 |
float scale = OBJECT_SCREEN_RATIO*NODE_FBO_SIZE/mSize; |
|
104 |
mScaleEffect = new MatrixEffectScale(new Static3D(scale,scale,scale)); |
|
108 | 105 |
mQuatCEffect = new MatrixEffectQuaternion(quatCur, center); |
109 | 106 |
mQuatAEffect = new MatrixEffectQuaternion(quatAcc, center); |
110 | 107 |
|
... | ... | |
347 | 344 |
public void recomputeScaleFactor(int scrWidth, int scrHeight) |
348 | 345 |
{ |
349 | 346 |
float factor = Math.min(scrWidth,scrHeight); |
350 |
float scaleFactor = OBJECT_SCREEN_RATIO*NODE_FBO_SIZE/mSize; |
|
351 |
|
|
352 | 347 |
mNodeScale.set(factor,factor,factor); |
353 |
mScale.set(scaleFactor,scaleFactor,scaleFactor); |
|
354 | 348 |
} |
355 | 349 |
|
356 | 350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Minor.