Revision b1fca44e
Added by Leszek Koltunski over 5 years ago
| src/main/java/org/distorted/examples/generic/GenericActivity2.java | ||
|---|---|---|
| 52 | 52 |
private GenericViewPager mViewPager; |
| 53 | 53 |
|
| 54 | 54 |
private boolean mShowCenter, mShowRegion, mShowNormal, mUseOIT; |
| 55 |
private float mScaleX, mScaleY, mScaleZ; |
|
| 55 | 56 |
|
| 56 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 57 | 58 |
|
| ... | ... | |
| 76 | 77 |
mShowNormal = false; |
| 77 | 78 |
mUseOIT = false; |
| 78 | 79 |
|
| 80 |
mScaleX = numCols; |
|
| 81 |
mScaleY = numRows; |
|
| 82 |
mScaleZ = numSlic; |
|
| 83 |
|
|
| 79 | 84 |
int maxsize = numCols > numRows ? (Math.max(numCols, numSlic)) : (Math.max(numRows, numSlic)); |
| 80 | 85 |
createBitmap(maxsize, bitmapID); |
| 81 | 86 |
mMesh = GenericMeshList.createMesh(objectType, numCols, numRows, numSlic, bitmapID, str); |
| 82 |
mMesh.setStretch(numCols, numRows, numSlic); |
|
| 83 | 87 |
|
| 84 | 88 |
mMesh.setShowNormals(mShowNormal); |
| 85 | 89 |
mTexture= new DistortedTexture(); |
| ... | ... | |
| 178 | 182 |
|
| 179 | 183 |
public float getWidth() |
| 180 | 184 |
{
|
| 181 |
return mMesh==null ? 0: mMesh.getStretchX();
|
|
| 185 |
return mScaleX;
|
|
| 182 | 186 |
} |
| 183 | 187 |
|
| 184 | 188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 185 | 189 |
|
| 186 | 190 |
public float getHeight() |
| 187 | 191 |
{
|
| 188 |
return mMesh==null ? 0: mMesh.getStretchY();
|
|
| 192 |
return mScaleY;
|
|
| 189 | 193 |
} |
| 190 | 194 |
|
| 191 | 195 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 192 | 196 |
|
| 193 | 197 |
public float getDepth() |
| 194 | 198 |
{
|
| 195 |
return mMesh==null ? 0: mMesh.getStretchZ();
|
|
| 199 |
return mScaleZ;
|
|
| 196 | 200 |
} |
| 197 | 201 |
|
| 198 | 202 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/examples/generic/GenericRenderer.java | ||
|---|---|---|
| 29 | 29 |
import org.distorted.library.effect.MatrixEffectMove; |
| 30 | 30 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
| 31 | 31 |
import org.distorted.library.effect.MatrixEffectScale; |
| 32 |
import org.distorted.library.effect.VertexEffectScale; |
|
| 32 | 33 |
import org.distorted.library.main.DistortedLibrary; |
| 33 | 34 |
import org.distorted.library.main.DistortedEffects; |
| 34 | 35 |
import org.distorted.library.main.DistortedNode; |
| ... | ... | |
| 140 | 141 |
regionEffects.apply(quat1cen); |
| 141 | 142 |
|
| 142 | 143 |
resetMatrixEffects(); |
| 144 |
resetVertexEffects(); |
|
| 143 | 145 |
|
| 144 | 146 |
// quite tricky: move the background exactly to the FAR plane! (see InternalOutputSurface.setProjection() ) |
| 145 | 147 |
backgroundEffects.apply(new MatrixEffectScale(mScaleBackground) ); |
| ... | ... | |
| 164 | 166 |
mQuat2.set(0,0,0,1); |
| 165 | 167 |
} |
| 166 | 168 |
|
| 169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 170 |
|
|
| 171 |
void resetVertexEffects() |
|
| 172 |
{
|
|
| 173 |
Static3D scale = new Static3D(mObjWidth, mObjHeight, mObjDepth); |
|
| 174 |
mObjectEffects.apply( new VertexEffectScale(scale) ); |
|
| 175 |
} |
|
| 176 |
|
|
| 167 | 177 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 168 | 178 |
|
| 169 | 179 |
void showRegionAndCenter(boolean showRegion, boolean showCenter) |
| src/main/java/org/distorted/examples/generic/GenericTab.java | ||
|---|---|---|
| 240 | 240 |
GenericRenderer renderer= view.getRenderer(); |
| 241 | 241 |
renderer.resetMatrixEffects(); |
| 242 | 242 |
} |
| 243 |
if( mType==EffectType.VERTEX ) |
|
| 244 |
{
|
|
| 245 |
GenericSurfaceView view = act.findViewById(R.id.genericSurfaceView); |
|
| 246 |
GenericRenderer renderer= view.getRenderer(); |
|
| 247 |
renderer.resetVertexEffects(); |
|
| 248 |
} |
|
| 249 |
|
|
| 243 | 250 |
} |
| 244 | 251 |
|
| 245 | 252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Convert Generic to stretchless API.