Revision b424b062
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java | ||
---|---|---|
54 | 54 |
private DistortedTexture mObjectTexture, mBackgroundTexture, mCenterTexture, mRegionTexture; |
55 | 55 |
private DistortedScreen mScreen; |
56 | 56 |
private DistortedNode mCenterNode, mRegionNode; |
57 |
private int mObjWidth, mObjHeight; |
|
57 |
private int mObjWidth, mObjHeight, mObjDepth;
|
|
58 | 58 |
private Static3D mCenterPoint, mRegionPoint, mRegionScalePoint; |
59 | 59 |
private Static3D mRotateCen, mMoveObject, mScaleObject, mMoveCenter, mScaleCenter, mMoveRegion, mMoveBackground, mScaleBackground; |
60 | 60 |
private boolean mShowingCenter=false; |
... | ... | |
97 | 97 |
|
98 | 98 |
mObjWidth = mObjectTexture.getWidth(); |
99 | 99 |
mObjHeight= mObjectTexture.getHeight(); |
100 |
mObjDepth = mObjectTexture.getDepth(mesh); |
|
100 | 101 |
|
101 | 102 |
mQuat1 = new Static4D(0,0,0,1); // unity |
102 | 103 |
mQuat2 = new Static4D(0,0,0,1); // quaternions |
... | ... | |
146 | 147 |
void resetMatrixEffects() |
147 | 148 |
{ |
148 | 149 |
Effects3DActivity2 act = (Effects3DActivity2)mView.getContext(); |
149 |
|
|
150 | 150 |
DistortedEffects objectEffects= act.getEffects(); |
151 |
MeshBase mesh = act.getMesh(); |
|
152 |
|
|
153 |
int objDepth = mObjectTexture.getDepth(mesh); |
|
154 |
|
|
155 |
Static3D rotateObj = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, -(float)objDepth/2 ); |
|
151 |
Static3D rotateObj = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, (float)mObjDepth/2 ); |
|
156 | 152 |
|
157 | 153 |
MatrixEffectQuaternion quat1obj = new MatrixEffectQuaternion(mQuat1, rotateObj); |
158 | 154 |
MatrixEffectQuaternion quat2obj = new MatrixEffectQuaternion(mQuat2, rotateObj); |
Also available in: Unified diff
Make Matrix effects Rotate and Quaternion actually correct when it comes to the Z-axis. Also corresponding adjustments in apps.