70 |
70 |
private static final Static4D[] QUATS = new Static4D[]
|
71 |
71 |
{
|
72 |
72 |
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ),
|
|
73 |
new Static4D( 0.5f, 0.5f, 0.5f, -0.5f ),
|
73 |
74 |
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f ),
|
74 |
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f ),
|
75 |
|
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f ),
|
|
75 |
new Static4D( 0.5f, -0.5f, -0.5f, -0.5f ),
|
76 |
76 |
new Static4D( 0.5f, 0.5f, 0.5f, 0.5f ),
|
77 |
|
new Static4D( 0.5f, 0.5f, 0.5f, -0.5f ),
|
78 |
|
new Static4D( 0.5f, 0.5f, -0.5f, 0.5f ),
|
79 |
77 |
new Static4D( 0.5f, 0.5f, -0.5f, -0.5f ),
|
80 |
|
new Static4D( 0.5f, -0.5f, 0.5f, 0.5f ),
|
81 |
78 |
new Static4D( 0.5f, -0.5f, 0.5f, -0.5f ),
|
82 |
79 |
new Static4D( 0.5f, -0.5f, -0.5f, 0.5f ),
|
83 |
|
new Static4D( 0.5f, -0.5f, -0.5f, -0.5f )
|
|
80 |
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f ),
|
|
81 |
new Static4D( 0.5f, -0.5f, 0.5f, 0.5f ),
|
|
82 |
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f ),
|
|
83 |
new Static4D( 0.5f, 0.5f, -0.5f, 0.5f )
|
84 |
84 |
};
|
85 |
85 |
|
86 |
86 |
// centers of the 12 edges. Must be in the same order like QUATs above.
|
87 |
87 |
private static final Static3D[] CENTERS = new Static3D[]
|
88 |
88 |
{
|
89 |
89 |
new Static3D( 0.0f, 0.5f, 0.5f ),
|
|
90 |
new Static3D( 0.5f, 0.0f, 0.5f ),
|
90 |
91 |
new Static3D( 0.0f,-0.5f, 0.5f ),
|
91 |
|
new Static3D( 0.0f, 0.5f,-0.5f ),
|
92 |
|
new Static3D( 0.0f,-0.5f,-0.5f ),
|
|
92 |
new Static3D(-0.5f, 0.0f, 0.5f ),
|
93 |
93 |
new Static3D( 0.5f, 0.5f, 0.0f ),
|
94 |
|
new Static3D( 0.5f, 0.0f, 0.5f ),
|
95 |
|
new Static3D(-0.5f, 0.0f,-0.5f ),
|
96 |
94 |
new Static3D( 0.5f,-0.5f, 0.0f ),
|
97 |
|
new Static3D( 0.5f, 0.0f,-0.5f ),
|
98 |
95 |
new Static3D(-0.5f,-0.5f, 0.0f ),
|
99 |
96 |
new Static3D(-0.5f, 0.5f, 0.0f ),
|
100 |
|
new Static3D(-0.5f, 0.0f, 0.5f )
|
|
97 |
new Static3D( 0.0f, 0.5f,-0.5f ),
|
|
98 |
new Static3D( 0.5f, 0.0f,-0.5f ),
|
|
99 |
new Static3D( 0.0f,-0.5f,-0.5f ),
|
|
100 |
new Static3D(-0.5f, 0.0f,-0.5f )
|
101 |
101 |
};
|
102 |
102 |
|
103 |
103 |
private static MeshBase mMesh;
|
... | ... | |
121 |
121 |
int association = 1;
|
122 |
122 |
MeshBase[] meshes = new MeshTriangles[MESHES];
|
123 |
123 |
|
124 |
|
meshes[0] = new MeshTriangles(9);
|
|
124 |
meshes[0] = new MeshTriangles(11);
|
125 |
125 |
meshes[0].setEffectAssociation(0,association,0);
|
126 |
126 |
|
127 |
127 |
for(int i=1; i<MESHES; i++)
|
... | ... | |
141 |
141 |
float tetraHeight = SQ2*SQ3/3;
|
142 |
142 |
float d1 = 0.75f*tetraHeight;
|
143 |
143 |
float d2 =-0.10f*tetraHeight;
|
144 |
|
float d3 = 0.20f*tetraHeight;
|
|
144 |
float d3 =-0.05f*tetraHeight;
|
|
145 |
float d4 = 0.15f*tetraHeight;
|
145 |
146 |
|
146 |
147 |
Static3D dCen0 = new Static3D( d1*a0.get0(), d1*a0.get1(), d1*a0.get2() );
|
147 |
148 |
Static3D dCen1 = new Static3D( d1*a1.get0(), d1*a1.get1(), d1*a1.get2() );
|
148 |
149 |
Static3D dCen2 = new Static3D( d1*a2.get0(), d1*a2.get1(), d1*a2.get2() );
|
149 |
150 |
Static3D dCen3 = new Static3D( d1*a3.get0(), d1*a3.get1(), d1*a3.get2() );
|
150 |
151 |
|
151 |
|
Static3D dVec0 = new Static3D( d2*a0.get0(), d2*a0.get1(), d2*a0.get2() );
|
152 |
|
Static3D dVec1 = new Static3D( d2*a1.get0(), d2*a1.get1(), d2*a1.get2() );
|
|
152 |
Static3D dVec0 = new Static3D( d3*a0.get0(), d3*a0.get1(), d3*a0.get2() );
|
|
153 |
Static3D dVec1 = new Static3D( d3*a1.get0(), d3*a1.get1(), d3*a1.get2() );
|
153 |
154 |
Static3D dVec2 = new Static3D( d2*a2.get0(), d2*a2.get1(), d2*a2.get2() );
|
154 |
155 |
Static3D dVec3 = new Static3D( d2*a3.get0(), d2*a3.get1(), d2*a3.get2() );
|
155 |
156 |
|
156 |
|
Static4D dReg = new Static4D(0,0,0,d3);
|
|
157 |
Static4D dReg = new Static4D(0,0,0,d4);
|
157 |
158 |
Static1D dRad = new Static1D(1);
|
158 |
159 |
|
159 |
160 |
Static1D angle = new Static1D(ANGLE_FACES);
|
... | ... | |
215 |
216 |
|
216 |
217 |
MatrixEffectMove moveEffect = new MatrixEffectMove ( new Static3D(0.0f,SQ3*SQ2/12,SQ3/6) );
|
217 |
218 |
MatrixEffectRotate rot1Effect = new MatrixEffectRotate( new Static1D(180+ANGLE_FACES/2), axis, cent);
|
218 |
|
MatrixEffectScale scalEffect = new MatrixEffectScale ( new Static3D(1.0f, SQ2/2, SQ2*SQ3/6) );
|
|
219 |
MatrixEffectScale scalEffect = new MatrixEffectScale ( new Static3D(1.0f, SQ2/2, 0.5f) );
|
219 |
220 |
MatrixEffectRotate rot2Effect = new MatrixEffectRotate( new Static1D(-45), axis, cent);
|
220 |
221 |
|
221 |
|
mMesh.apply(moveEffect,0xffffffff,0);
|
222 |
|
mMesh.apply(rot1Effect,0xffffffff,0);
|
223 |
|
mMesh.apply(scalEffect,0xffffffff,0);
|
224 |
|
mMesh.apply(rot2Effect,0xffffffff,0);
|
|
222 |
mMesh.apply(moveEffect, 0xffffffff, 0);
|
|
223 |
mMesh.apply(rot1Effect, 0xffffffff, 0);
|
|
224 |
mMesh.apply(scalEffect, 0xffffffff, 0);
|
|
225 |
mMesh.apply(rot2Effect, 0xffffffff, 0);
|
225 |
226 |
}
|
226 |
227 |
|
227 |
228 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
228 |
229 |
|
229 |
230 |
float getScreenRatio()
|
230 |
231 |
{
|
231 |
|
return 1.0f;
|
|
232 |
return 1.5f;
|
232 |
233 |
}
|
233 |
234 |
|
234 |
235 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Progress with RubikDino.