Revision 2394e617
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/objects/RubikDino.java | ||
---|---|---|
31 | 31 |
import org.distorted.library.effect.VertexEffectMove; |
32 | 32 |
import org.distorted.library.effect.VertexEffectRotate; |
33 | 33 |
import org.distorted.library.effect.VertexEffectScale; |
34 |
import org.distorted.library.effect.VertexEffectSink; |
|
35 | 34 |
import org.distorted.library.main.DistortedEffects; |
36 | 35 |
import org.distorted.library.main.DistortedTexture; |
37 | 36 |
import org.distorted.library.mesh.MeshBase; |
38 | 37 |
import org.distorted.library.mesh.MeshJoined; |
38 |
import org.distorted.library.mesh.MeshPolygon; |
|
39 | 39 |
import org.distorted.library.mesh.MeshSquare; |
40 |
import org.distorted.library.mesh.MeshTriangle; |
|
41 | 40 |
import org.distorted.library.type.Static1D; |
42 | 41 |
import org.distorted.library.type.Static3D; |
43 | 42 |
import org.distorted.library.type.Static4D; |
... | ... | |
136 | 135 |
final int MESHES=4; |
137 | 136 |
|
138 | 137 |
int association = 1; |
139 |
MeshBase[] meshes = new MeshTriangle[MESHES]; |
|
140 | 138 |
|
141 |
meshes[0] = new MeshTriangle(11); |
|
139 |
float D = 0.005f; |
|
140 |
float E = 0.5f - D*SQ2; |
|
141 |
float F = 0.5f - D*SQ2*SQ3; |
|
142 |
float G = 0.005f; |
|
143 |
float[] bands = { 1.0f ,-G, |
|
144 |
1.0f-G/2,-G*0.55f, |
|
145 |
1.0f-G ,-G*0.25f, |
|
146 |
1.0f-2*G,+G*0.25f, |
|
147 |
0.50f, 0.040f, |
|
148 |
0.0f, 0.045f }; |
|
149 |
|
|
150 |
float[] vertices = { -F,-E, +F,-E, 0.0f,E-D*SQ2}; |
|
151 |
|
|
152 |
MeshBase[] meshes = new MeshPolygon[MESHES]; |
|
153 |
meshes[0] = new MeshPolygon(vertices, bands, 2, 3); |
|
142 | 154 |
meshes[0].setEffectAssociation(0,association,0); |
143 | 155 |
|
144 | 156 |
for(int i=1; i<MESHES; i++) |
... | ... | |
181 | 193 |
Static3D center1= new Static3D(0,-SQ3*SQ2/12,-SQ3/6); |
182 | 194 |
Static3D center2= new Static3D(0,-SQ3*SQ2/12,+SQ3/3); |
183 | 195 |
|
184 |
Static3D center = new Static3D(0,0,0); |
|
185 |
Static4D region = new Static4D(0,0,0,0.6f); |
|
186 |
|
|
187 | 196 |
VertexEffectScale effect1 = new VertexEffectScale ( new Static3D(1,SQ3/2,1) ); |
188 | 197 |
VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) ); |
189 | 198 |
VertexEffectMove effect3 = new VertexEffectMove ( new Static3D(0,-SQ3*SQ2/12,SQ3/12) ); |
... | ... | |
197 | 206 |
VertexEffectDeform effect10= new VertexEffectDeform(dVec2, dRad, dCen2, dReg); |
198 | 207 |
VertexEffectDeform effect11= new VertexEffectDeform(dVec3, dRad, dCen3, dReg); |
199 | 208 |
|
200 |
VertexEffectSink effect12= new VertexEffectSink( new Static1D(1.25f), center, region ); |
|
201 |
|
|
202 | 209 |
effect4.setMeshAssociation(14,-1); // apply to mesh[1], [2] and [3] |
203 | 210 |
effect5.setMeshAssociation( 2,-1); // apply only to mesh[1] |
204 | 211 |
effect6.setMeshAssociation( 4,-1); // apply only to mesh[2] |
... | ... | |
215 | 222 |
result.apply(effect9); |
216 | 223 |
result.apply(effect10); |
217 | 224 |
result.apply(effect11); |
218 |
result.apply(effect12); |
|
219 | 225 |
|
220 | 226 |
result.mergeEffComponents(); |
221 | 227 |
|
... | ... | |
306 | 312 |
|
307 | 313 |
void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top, int side) |
308 | 314 |
{ |
309 |
float STROKE = 0.06f*side;
|
|
315 |
float STROKE = 0.044f*side;
|
|
310 | 316 |
float OFF = STROKE/2 -1; |
311 | 317 |
float OFF2 = 0.5f*side + OFF; |
312 | 318 |
float HEIGHT = side - OFF; |
Also available in: Unified diff
Convert RubikDino to the new Polygon mesh.