Revision ba9ae2c8
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java | ||
---|---|---|
52 | 52 |
private DistortedTexture mTexture; |
53 | 53 |
private DistortedScreen mScreen; |
54 | 54 |
private DistortedEffects mEffects; |
55 |
private Static3D mMove, mScale, mCenter;
|
|
55 |
private Static3D mScale;
|
|
56 | 56 |
private MeshBase mMesh; |
57 | 57 |
private float mObjHeight, mObjWidth, mObjDepth; |
58 | 58 |
|
... | ... | |
65 | 65 |
{ |
66 | 66 |
mView = v; |
67 | 67 |
mScreen = new DistortedScreen(); |
68 |
mMove = new Static3D(0,0,0); |
|
69 | 68 |
mScale= new Static3D(1,1,1); |
70 |
mCenter=new Static3D(0,0,0);
|
|
69 |
Static3D center=new Static3D(0,0,0);
|
|
71 | 70 |
|
72 | 71 |
mQuat1 = new Static4D(0,0,0,1); // unity |
73 | 72 |
mQuat2 = new Static4D(0,0,0,1); // quaternions |
... | ... | |
79 | 78 |
quatInt2.add(mQuat2); |
80 | 79 |
|
81 | 80 |
mEffects = new DistortedEffects(); |
82 |
mEffects.apply( new MatrixEffectQuaternion(quatInt2, mCenter) );
|
|
83 |
mEffects.apply( new MatrixEffectQuaternion(quatInt1, mCenter) );
|
|
81 |
mEffects.apply( new MatrixEffectQuaternion(quatInt2, center) );
|
|
82 |
mEffects.apply( new MatrixEffectQuaternion(quatInt1, center) );
|
|
84 | 83 |
mEffects.apply( new MatrixEffectScale(mScale)); |
85 |
mEffects.apply( new MatrixEffectMove(mMove) ); |
|
86 | 84 |
} |
87 | 85 |
|
88 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
100 | 98 |
|
101 | 99 |
mScreenMin = width<height ? width:height; |
102 | 100 |
float factor = ( width*mObjHeight > height*mObjWidth ) ? (SCALE*height)/mObjHeight : (SCALE*width)/mObjWidth; |
103 |
mMove.set( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , -factor*mObjDepth/2 ); |
|
104 | 101 |
mScale.set(factor,factor,factor); |
105 |
mCenter.set( mObjWidth/2, mObjHeight/2, mObjDepth/2 ); |
|
106 | 102 |
mScreen.resize(width, height); |
107 | 103 |
} |
108 | 104 |
|
Also available in: Unified diff
Fixes for the merge.