Project

General

Profile

« Previous | Next » 

Revision 83e0ca5e

Added by Leszek Koltunski about 4 years ago

New Mesh 'Triangles' and updated Inflate & Generic apps to test it.

View differences:

src/main/java/org/distorted/examples/generic/GenericActivity2.java
34 34
import org.distorted.library.main.DistortedLibrary;
35 35
import org.distorted.library.main.DistortedEffects;
36 36
import org.distorted.library.main.DistortedTexture;
37
import org.distorted.library.mesh.MeshCubes;
38
import org.distorted.library.mesh.MeshRectangles;
39 37
import org.distorted.library.mesh.MeshBase;
40
import org.distorted.library.mesh.MeshQuad;
41
import org.distorted.library.mesh.MeshSphere;
42 38
import org.distorted.library.type.Static3D;
43 39
import org.distorted.library.type.Static4D;
44 40

  
......
80 76
    mShowNormal = false;
81 77
    mUseOIT     = false;
82 78

  
83
    mEffects= new DistortedEffects();
84

  
85
    int maxsize = numCols > numRows ? (numCols>numSlic ? numCols:numSlic) : (numRows>numSlic ? numRows:numSlic) ;
86

  
79
    int maxsize = numCols > numRows ? (numCols>numSlic ? numCols:numSlic) : (numRows>numSlic ? numRows:numSlic);
87 80
    createBitmap(maxsize, bitmapID);
88

  
89
    switch(objectType)
90
      {
91
      case 0: if( bitmapID!=-1 )
92
                {
93
                mMesh = new MeshCubes(numCols, str, numSlic);
94
                }
95
              else
96
                {
97
                Static4D mapFB = new Static4D(0.0f,0.0f, (float)numCols/maxsize, (float)numRows/maxsize);
98
                Static4D mapLR = new Static4D(0.0f,0.0f, (float)numSlic/maxsize, (float)numRows/maxsize);
99
                Static4D mapTB = new Static4D(0.0f,0.0f, (float)numCols/maxsize, (float)numSlic/maxsize);
100

  
101
                mMesh = new MeshCubes(numCols, str, numSlic, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
102
                }
103
              mMesh.setStretch(numCols,numRows,numSlic);
104
              break;
105
      case 1: mMesh = new MeshRectangles(numCols,numRows);
106
              mMesh.setStretch(numCols,numRows,0);
107
              break;
108
      case 2: mMesh = new MeshSphere(numRows);
109
              mMesh.setStretch(numRows,numRows,numRows);
110
              break;
111
      case 3: mMesh = new MeshQuad();
112
              mMesh.setStretch(1,1,0);
113
              break;
114
      }
81
    mMesh =  GenericMeshList.createMesh(objectType, numCols, numRows, numSlic, bitmapID, str);
115 82

  
116 83
    mMesh.setShowNormals(mShowNormal);
117 84
    mTexture= new DistortedTexture();
85
    mEffects= new DistortedEffects();
118 86

  
119 87
    final View view = getLayoutInflater().inflate(R.layout.genericlayout, null);
120 88

  

Also available in: Unified diff