Revision 61420934
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/examples/generic/GenericMeshList.java | ||
---|---|---|
74 | 74 |
return meshes[ordinal].mDimension; |
75 | 75 |
} |
76 | 76 |
|
77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
78 |
|
|
79 |
static int getRows(int ordinal, int cols, int rows, int slic) |
|
80 |
{ |
|
81 |
switch(ordinal) |
|
82 |
{ |
|
83 |
case 0: return rows; // cubes |
|
84 |
case 1: return rows; // rectangles |
|
85 |
case 2: return rows; // sphere |
|
86 |
case 3: return 1; // quad |
|
87 |
case 4: return rows; // triangles |
|
88 |
} |
|
89 |
|
|
90 |
return 0; |
|
91 |
} |
|
92 |
|
|
93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
94 |
|
|
95 |
static int getCols(int ordinal, int cols, int rows, int slic) |
|
96 |
{ |
|
97 |
switch(ordinal) |
|
98 |
{ |
|
99 |
case 0: return cols; // cubes |
|
100 |
case 1: return cols; // rectangles |
|
101 |
case 2: return rows; // sphere |
|
102 |
case 3: return 1; // quad |
|
103 |
case 4: return rows; // triangles |
|
104 |
} |
|
105 |
|
|
106 |
return 0; |
|
107 |
} |
|
108 |
|
|
109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
110 |
|
|
111 |
static int getSlic(int ordinal, int cols, int rows, int slic) |
|
112 |
{ |
|
113 |
switch(ordinal) |
|
114 |
{ |
|
115 |
case 0: return slic; // cubes |
|
116 |
case 1: return 0; // rectangles |
|
117 |
case 2: return rows; // sphere |
|
118 |
case 3: return 0; // quad |
|
119 |
case 4: return 0; // triangles |
|
120 |
} |
|
121 |
|
|
122 |
return 0; |
|
123 |
} |
|
124 |
|
|
125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
126 |
|
|
127 |
static String getString(int ordinal, int cols, int rows, boolean[] shape) |
|
128 |
{ |
|
129 |
if( ordinal==0 ) |
|
130 |
{ |
|
131 |
String str = ""; |
|
132 |
|
|
133 |
for(int i=0; i<rows*cols; i++) |
|
134 |
str += shape[i] ? "1" : "0"; |
|
135 |
|
|
136 |
return str; |
|
137 |
} |
|
138 |
|
|
139 |
return ""; |
|
140 |
} |
|
141 |
|
|
77 | 142 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
78 | 143 |
|
79 | 144 |
static MeshBase createMesh(int ordinal, int cols, int rows, int slic, int bitmapID, String str) |
80 | 145 |
{ |
81 | 146 |
MeshBase mesh; |
82 | 147 |
|
83 |
int maxsize = cols > rows ? (cols>slic ? cols:slic) : (rows>slic ? rows:slic) ;
|
|
148 |
int maxsize = cols > rows ? (Math.max(cols, slic)) : (Math.max(rows, slic)) ;
|
|
84 | 149 |
|
85 | 150 |
switch( meshes[ordinal] ) |
86 | 151 |
{ |
... | ... | |
96 | 161 |
|
97 | 162 |
mesh = new MeshCubes(cols, str, slic, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB); |
98 | 163 |
} |
99 |
mesh.setStretch(cols,rows,slic); |
|
100 | 164 |
break; |
101 | 165 |
case Rectangles: mesh = new MeshRectangles(cols,rows); |
102 |
mesh.setStretch(cols,rows,0); |
|
103 | 166 |
break; |
104 | 167 |
case Sphere : mesh = new MeshSphere(rows); |
105 |
mesh.setStretch(rows,rows,rows); |
|
106 | 168 |
break; |
107 | 169 |
case Quad : mesh = new MeshQuad(); |
108 |
mesh.setStretch(1,1,0); |
|
109 | 170 |
break; |
110 | 171 |
case Triangles : mesh = new MeshTriangles(rows); |
111 |
mesh.setStretch(rows,rows,0); |
|
112 | 172 |
break; |
113 | 173 |
default: mesh = null; |
114 | 174 |
android.util.Log.e("Meshes", "Error: unimplemented Mesh!"); |
Also available in: Unified diff
Prepare Generic for the stretchless API.