Revision e32d318a
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/main/TwistyObjectNode.java | ||
---|---|---|
31 | 31 |
public class TwistyObjectNode extends DistortedNode |
32 | 32 |
{ |
33 | 33 |
private final Static3D mScale; |
34 |
private int mWidth, mHeight, mMinSize;
|
|
34 |
private int mWidth, mHeight, mScaleFactor;
|
|
35 | 35 |
private float mCameraDist; |
36 |
private float mObjectScale; |
|
36 | 37 |
|
37 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 39 |
|
... | ... | |
40 | 41 |
{ |
41 | 42 |
super(new DistortedTexture(),new DistortedEffects(),new MeshSquare(20,20)); |
42 | 43 |
|
44 |
mObjectScale = 1.0f; |
|
43 | 45 |
mScale= new Static3D(1,1,1); |
44 | 46 |
setSize(surfaceW,surfaceH); |
45 | 47 |
MatrixEffectScale scaleEffect = new MatrixEffectScale(mScale); |
... | ... | |
52 | 54 |
|
53 | 55 |
void setSize(int surfaceW, int surfaceH) |
54 | 56 |
{ |
55 |
mWidth = surfaceW; |
|
56 |
mHeight = surfaceH; |
|
57 |
mMinSize= Math.min(mWidth,mHeight);
|
|
57 |
mWidth = surfaceW;
|
|
58 |
mHeight = surfaceH;
|
|
59 |
mScaleFactor= (int)(Math.min(mWidth,mHeight)*mObjectScale);
|
|
58 | 60 |
|
59 | 61 |
resizeFBO(mWidth,mHeight); |
60 | 62 |
|
... | ... | |
70 | 72 |
|
71 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 74 |
|
73 |
int getMinSize()
|
|
75 |
int getScaleFactor()
|
|
74 | 76 |
{ |
75 |
return mMinSize;
|
|
77 |
return mScaleFactor;
|
|
76 | 78 |
} |
77 | 79 |
|
78 | 80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
86 | 88 |
setProjection( fov, 0.1f); |
87 | 89 |
} |
88 | 90 |
|
91 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
92 |
|
|
93 |
public void setScaleFactor(float scale) |
|
94 |
{ |
|
95 |
mObjectScale = scale; |
|
96 |
mScaleFactor = (int)(Math.min(mWidth,mHeight)*mObjectScale); |
|
97 |
} |
|
98 |
|
|
89 | 99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
90 | 100 |
|
91 | 101 |
public int getWidth() |
Also available in: Unified diff
new API to make is possible to adjust default scale factor in each TwistyObjectNode.
(and use it in Tutorials, where the object needs to be smaller)