Revision 1535f677
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/examples/generic/GenericMeshList.java | ||
---|---|---|
31 | 31 |
|
32 | 32 |
public enum GenericMeshList |
33 | 33 |
{ |
34 |
CUBES ( "Cubes" , 3 ),
|
|
35 |
RECTANGLES ( "Rectangles" , 2 ),
|
|
36 |
SPHERE ( "Sphere" , 1 ),
|
|
37 |
QUAD ( "Quad" , 0 ),
|
|
38 |
TRIANGLES ( "Triangles" , 1 ),
|
|
34 |
Cubes ( 3 ),
|
|
35 |
Rectangles ( 2 ),
|
|
36 |
Sphere ( 1 ),
|
|
37 |
Quad ( 0 ),
|
|
38 |
Triangles ( 1 ),
|
|
39 | 39 |
; |
40 | 40 |
|
41 | 41 |
static final int LENGTH = values().length; |
42 | 42 |
private static final GenericMeshList[] meshes; |
43 |
private String mName; |
|
44 | 43 |
private int mDimension; |
45 | 44 |
|
46 | 45 |
static |
... | ... | |
56 | 55 |
|
57 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
58 | 57 |
|
59 |
GenericMeshList(String name, int dim )
|
|
58 |
GenericMeshList( int dim ) |
|
60 | 59 |
{ |
61 |
mName = name; |
|
62 | 60 |
mDimension = dim; |
63 | 61 |
} |
64 | 62 |
|
... | ... | |
66 | 64 |
|
67 | 65 |
static String getName(int ordinal) |
68 | 66 |
{ |
69 |
return meshes[ordinal].mName;
|
|
67 |
return meshes[ordinal].name();
|
|
70 | 68 |
} |
71 | 69 |
|
72 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
86 | 84 |
|
87 | 85 |
switch( meshes[ordinal] ) |
88 | 86 |
{ |
89 |
case CUBES : if( bitmapID!=-1 )
|
|
87 |
case Cubes : if( bitmapID!=-1 )
|
|
90 | 88 |
{ |
91 | 89 |
mesh = new MeshCubes(cols, str, slic); |
92 | 90 |
} |
... | ... | |
100 | 98 |
} |
101 | 99 |
mesh.setStretch(cols,rows,slic); |
102 | 100 |
break; |
103 |
case RECTANGLES: mesh = new MeshRectangles(cols,rows);
|
|
101 |
case Rectangles: mesh = new MeshRectangles(cols,rows);
|
|
104 | 102 |
mesh.setStretch(cols,rows,0); |
105 | 103 |
break; |
106 |
case SPHERE : mesh = new MeshSphere(rows);
|
|
104 |
case Sphere : mesh = new MeshSphere(rows);
|
|
107 | 105 |
mesh.setStretch(rows,rows,rows); |
108 | 106 |
break; |
109 |
case QUAD : mesh = new MeshQuad();
|
|
107 |
case Quad : mesh = new MeshQuad();
|
|
110 | 108 |
mesh.setStretch(1,1,0); |
111 | 109 |
break; |
112 |
case TRIANGLES : mesh = new MeshTriangles(rows);
|
|
110 |
case Triangles : mesh = new MeshTriangles(rows);
|
|
113 | 111 |
mesh.setStretch(rows,rows,0); |
114 | 112 |
break; |
115 | 113 |
default: mesh = null; |
src/main/java/org/distorted/examples/generic/GenericRenderer.java | ||
---|---|---|
158 | 158 |
|
159 | 159 |
void resetMatrixEffects() |
160 | 160 |
{ |
161 |
Static3D rotateObj = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, (float)mObjDepth/2 );
|
|
161 |
Static3D rotateObj = new Static3D( mObjWidth/2, mObjHeight/2, mObjDepth/2 );
|
|
162 | 162 |
|
163 | 163 |
MatrixEffectQuaternion quat1obj = new MatrixEffectQuaternion(mQuat1, rotateObj); |
164 | 164 |
MatrixEffectQuaternion quat2obj = new MatrixEffectQuaternion(mQuat2, rotateObj); |
src/main/java/org/distorted/examples/inflate/InflateMeshList.java | ||
---|---|---|
31 | 31 |
|
32 | 32 |
public enum InflateMeshList |
33 | 33 |
{ |
34 |
CUBES ( "Cubes" , 3 ),
|
|
35 |
RECTANGLES ( "Rectangles" , 2 ),
|
|
36 |
SPHERE ( "Sphere" , 1 ),
|
|
37 |
QUAD ( "Quad" , 0 ),
|
|
38 |
TRIANGLES ( "Triangles" , 1 ),
|
|
34 |
Cubes ( 3 ),
|
|
35 |
Rectangles ( 2 ),
|
|
36 |
Sphere ( 1 ),
|
|
37 |
Quad ( 0 ),
|
|
38 |
Triangles ( 1 ),
|
|
39 | 39 |
; |
40 | 40 |
|
41 | 41 |
static final int LENGTH = values().length; |
42 | 42 |
private static final InflateMeshList[] meshes; |
43 |
private String mName; |
|
44 | 43 |
private int mDimension; |
45 | 44 |
|
46 | 45 |
static |
... | ... | |
56 | 55 |
|
57 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
58 | 57 |
|
59 |
InflateMeshList(String name, int dim )
|
|
58 |
InflateMeshList( int dim ) |
|
60 | 59 |
{ |
61 |
mName = name; |
|
62 | 60 |
mDimension = dim; |
63 | 61 |
} |
64 | 62 |
|
... | ... | |
66 | 64 |
|
67 | 65 |
static String getName(int ordinal) |
68 | 66 |
{ |
69 |
return meshes[ordinal].mName;
|
|
67 |
return meshes[ordinal].name();
|
|
70 | 68 |
} |
71 | 69 |
|
72 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
86 | 84 |
|
87 | 85 |
switch( meshes[ordinal] ) |
88 | 86 |
{ |
89 |
case CUBES : if( bitmapID!=-1 )
|
|
87 |
case Cubes : if( bitmapID!=-1 )
|
|
90 | 88 |
{ |
91 | 89 |
mesh = new MeshCubes(cols, str, slic); |
92 | 90 |
} |
... | ... | |
100 | 98 |
} |
101 | 99 |
mesh.setStretch(cols,rows,slic); |
102 | 100 |
break; |
103 |
case RECTANGLES: mesh = new MeshRectangles(cols,rows);
|
|
101 |
case Rectangles: mesh = new MeshRectangles(cols,rows);
|
|
104 | 102 |
mesh.setStretch(cols,rows,0); |
105 | 103 |
break; |
106 |
case SPHERE : mesh = new MeshSphere(rows);
|
|
104 |
case Sphere : mesh = new MeshSphere(rows);
|
|
107 | 105 |
mesh.setStretch(rows,rows,rows); |
108 | 106 |
break; |
109 |
case QUAD : mesh = new MeshQuad();
|
|
107 |
case Quad : mesh = new MeshQuad();
|
|
110 | 108 |
mesh.setStretch(1,1,0); |
111 | 109 |
break; |
112 |
case TRIANGLES : mesh = new MeshTriangles(rows);
|
|
110 |
case Triangles : mesh = new MeshTriangles(rows);
|
|
113 | 111 |
mesh.setStretch(rows,rows,0); |
114 | 112 |
break; |
115 | 113 |
default: mesh = null; |
src/main/java/org/distorted/examples/inflate/InflateRenderer.java | ||
---|---|---|
116 | 116 |
float factor = ( width*mObjHeight > height*mObjWidth ) ? (SCALE*height)/mObjHeight : (SCALE*width)/mObjWidth; |
117 | 117 |
mMove.set( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , -factor*mObjDepth/2 ); |
118 | 118 |
mScale.set(factor,factor,factor); |
119 |
mCenter.set( (float)mObjWidth/2, (float)mObjHeight/2, (float)mObjDepth/2 );
|
|
119 |
mCenter.set( mObjWidth/2, mObjHeight/2, mObjDepth/2 );
|
|
120 | 120 |
mScreen.resize(width, height); |
121 | 121 |
} |
122 | 122 |
|
Also available in: Unified diff
Minor.