Revision 05cc8075
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/objects/CubitFactory.java | ||
|---|---|---|
| 40 | 40 |
private static final float SQ3 = (float)Math.sqrt(3); |
| 41 | 41 |
private static final float SQ6 = (float)Math.sqrt(6); |
| 42 | 42 |
|
| 43 |
private static final Static1D RADIUS = new Static1D(1); |
|
| 44 |
|
|
| 43 | 45 |
private static CubitFactory mThis; |
| 44 | 46 |
|
| 45 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 58 | 60 |
return mThis; |
| 59 | 61 |
} |
| 60 | 62 |
|
| 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 64 |
|
|
| 65 |
private void roundCorners(MeshBase mesh, Static3D center, Static3D[] vertices, float strength, float regionRadius) |
|
| 66 |
{
|
|
| 67 |
Static4D reg= new Static4D(0,0,0,regionRadius); |
|
| 68 |
|
|
| 69 |
float centX = center.get0(); |
|
| 70 |
float centY = center.get1(); |
|
| 71 |
float centZ = center.get2(); |
|
| 72 |
|
|
| 73 |
for (Static3D vertex : vertices) |
|
| 74 |
{
|
|
| 75 |
float x = strength*(centX - vertex.get0()); |
|
| 76 |
float y = strength*(centY - vertex.get1()); |
|
| 77 |
float z = strength*(centZ - vertex.get2()); |
|
| 78 |
|
|
| 79 |
VertexEffect effect = new VertexEffectDeform(new Static3D(x,y,z), RADIUS, vertex, reg); |
|
| 80 |
mesh.apply(effect); |
|
| 81 |
} |
|
| 82 |
} |
|
| 83 |
|
|
| 61 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 62 | 85 |
// CUBE |
| 63 | 86 |
|
| 64 | 87 |
MeshBase createCubeMesh(int index) |
| 65 | 88 |
{
|
| 89 |
final int MESHES=6; |
|
| 90 |
MeshBase[] meshes = new MeshPolygon[MESHES]; |
|
| 91 |
int association = 1; |
|
| 92 |
|
|
| 66 | 93 |
float[] bands; |
| 67 | 94 |
float D = 0.027f; |
| 68 | 95 |
float E = 0.5f-D; |
| ... | ... | |
| 105 | 132 |
break; |
| 106 | 133 |
} |
| 107 | 134 |
|
| 108 |
return createCubeMesh(vertices,bands,extraI,extraV); |
|
| 109 |
} |
|
| 110 |
|
|
| 111 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 112 |
|
|
| 113 |
private MeshBase createCubeMesh(float[] vertices, float[] bands, int extraI, int extraV) |
|
| 114 |
{
|
|
| 115 |
final int MESHES=6; |
|
| 116 |
int association = 1; |
|
| 117 |
MeshBase[] meshes = new MeshPolygon[MESHES]; |
|
| 118 | 135 |
meshes[0] = new MeshPolygon(vertices,bands,extraI,extraV); |
| 119 | 136 |
meshes[0].setEffectAssociation(0,association,0); |
| 120 | 137 |
|
| ... | ... | |
| 134 | 151 |
Static1D angle180= new Static1D(180); |
| 135 | 152 |
Static1D angle270= new Static1D(270); |
| 136 | 153 |
|
| 137 |
float d1 = 1.0f; |
|
| 138 |
float d2 =-0.05f; |
|
| 139 |
float d3 = 0.12f; |
|
| 140 |
|
|
| 141 |
Static3D dCen0 = new Static3D( d1*(+0.5f), d1*(+0.5f), d1*(+0.5f) ); |
|
| 142 |
Static3D dCen1 = new Static3D( d1*(+0.5f), d1*(+0.5f), d1*(-0.5f) ); |
|
| 143 |
Static3D dCen2 = new Static3D( d1*(+0.5f), d1*(-0.5f), d1*(+0.5f) ); |
|
| 144 |
Static3D dCen3 = new Static3D( d1*(+0.5f), d1*(-0.5f), d1*(-0.5f) ); |
|
| 145 |
Static3D dCen4 = new Static3D( d1*(-0.5f), d1*(+0.5f), d1*(+0.5f) ); |
|
| 146 |
Static3D dCen5 = new Static3D( d1*(-0.5f), d1*(+0.5f), d1*(-0.5f) ); |
|
| 147 |
Static3D dCen6 = new Static3D( d1*(-0.5f), d1*(-0.5f), d1*(+0.5f) ); |
|
| 148 |
Static3D dCen7 = new Static3D( d1*(-0.5f), d1*(-0.5f), d1*(-0.5f) ); |
|
| 149 |
|
|
| 150 |
Static3D dVec0 = new Static3D( d2*(+0.5f), d2*(+0.5f), d2*(+0.5f) ); |
|
| 151 |
Static3D dVec1 = new Static3D( d2*(+0.5f), d2*(+0.5f), d2*(-0.5f) ); |
|
| 152 |
Static3D dVec2 = new Static3D( d2*(+0.5f), d2*(-0.5f), d2*(+0.5f) ); |
|
| 153 |
Static3D dVec3 = new Static3D( d2*(+0.5f), d2*(-0.5f), d2*(-0.5f) ); |
|
| 154 |
Static3D dVec4 = new Static3D( d2*(-0.5f), d2*(+0.5f), d2*(+0.5f) ); |
|
| 155 |
Static3D dVec5 = new Static3D( d2*(-0.5f), d2*(+0.5f), d2*(-0.5f) ); |
|
| 156 |
Static3D dVec6 = new Static3D( d2*(-0.5f), d2*(-0.5f), d2*(+0.5f) ); |
|
| 157 |
Static3D dVec7 = new Static3D( d2*(-0.5f), d2*(-0.5f), d2*(-0.5f) ); |
|
| 158 |
|
|
| 159 |
Static4D dReg = new Static4D(0,0,0,d3); |
|
| 160 |
Static1D dRad = new Static1D(1); |
|
| 161 |
|
|
| 162 |
VertexEffectMove effect0 = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 163 |
VertexEffectRotate effect1 = new VertexEffectRotate( angle180, axisX, center ); |
|
| 164 |
VertexEffectRotate effect2 = new VertexEffectRotate( angle90 , axisX, center ); |
|
| 165 |
VertexEffectRotate effect3 = new VertexEffectRotate( angle270, axisX, center ); |
|
| 166 |
VertexEffectRotate effect4 = new VertexEffectRotate( angle270, axisY, center ); |
|
| 167 |
VertexEffectRotate effect5 = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 168 |
|
|
| 169 |
VertexEffectDeform effect6 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
|
| 170 |
VertexEffectDeform effect7 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
|
| 171 |
VertexEffectDeform effect8 = new VertexEffectDeform(dVec2, dRad, dCen2, dReg); |
|
| 172 |
VertexEffectDeform effect9 = new VertexEffectDeform(dVec3, dRad, dCen3, dReg); |
|
| 173 |
VertexEffectDeform effect10= new VertexEffectDeform(dVec4, dRad, dCen4, dReg); |
|
| 174 |
VertexEffectDeform effect11= new VertexEffectDeform(dVec5, dRad, dCen5, dReg); |
|
| 175 |
VertexEffectDeform effect12= new VertexEffectDeform(dVec6, dRad, dCen6, dReg); |
|
| 176 |
VertexEffectDeform effect13= new VertexEffectDeform(dVec7, dRad, dCen7, dReg); |
|
| 154 |
VertexEffect effect0 = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 155 |
VertexEffect effect1 = new VertexEffectRotate( angle180, axisX, center ); |
|
| 156 |
VertexEffect effect2 = new VertexEffectRotate( angle90 , axisX, center ); |
|
| 157 |
VertexEffect effect3 = new VertexEffectRotate( angle270, axisX, center ); |
|
| 158 |
VertexEffect effect4 = new VertexEffectRotate( angle270, axisY, center ); |
|
| 159 |
VertexEffect effect5 = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 177 | 160 |
|
| 178 | 161 |
effect0.setMeshAssociation(63,-1); // all 6 sides |
| 179 | 162 |
effect1.setMeshAssociation(32,-1); // back |
| ... | ... | |
| 188 | 171 |
mesh.apply(effect3); |
| 189 | 172 |
mesh.apply(effect4); |
| 190 | 173 |
mesh.apply(effect5); |
| 191 |
mesh.apply(effect6); |
|
| 192 |
mesh.apply(effect7); |
|
| 193 |
mesh.apply(effect8); |
|
| 194 |
mesh.apply(effect9); |
|
| 195 |
mesh.apply(effect10); |
|
| 196 |
mesh.apply(effect11); |
|
| 197 |
mesh.apply(effect12); |
|
| 198 |
mesh.apply(effect13); |
|
| 174 |
|
|
| 175 |
Static3D[] verticesCubit = new Static3D[8]; |
|
| 176 |
verticesCubit[0] = new Static3D(+0.5f,+0.5f,+0.5f); |
|
| 177 |
verticesCubit[1] = new Static3D(+0.5f,+0.5f,-0.5f); |
|
| 178 |
verticesCubit[2] = new Static3D(+0.5f,-0.5f,+0.5f); |
|
| 179 |
verticesCubit[3] = new Static3D(+0.5f,-0.5f,-0.5f); |
|
| 180 |
verticesCubit[4] = new Static3D(-0.5f,+0.5f,+0.5f); |
|
| 181 |
verticesCubit[5] = new Static3D(-0.5f,+0.5f,-0.5f); |
|
| 182 |
verticesCubit[6] = new Static3D(-0.5f,-0.5f,+0.5f); |
|
| 183 |
verticesCubit[7] = new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 184 |
|
|
| 185 |
roundCorners(mesh,center,verticesCubit,0.06f,0.12f); |
|
| 199 | 186 |
|
| 200 | 187 |
mesh.mergeEffComponents(); |
| 201 | 188 |
|
| ... | ... | |
| 257 | 244 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
| 258 | 245 |
Static3D move2 = new Static3D(-0.5f,-0.5f,-0.5f); |
| 259 | 246 |
|
| 260 |
float d0 =-0.04f; |
|
| 261 |
float d1 = 0.04f; |
|
| 262 |
float r0 = 0.15f; |
|
| 263 |
float r1 = 0.10f; |
|
| 264 |
|
|
| 265 |
Static3D vec0 = new Static3D(d0*(+SQ3/3),d0*(+SQ3/3),d0*(+SQ3/3)); |
|
| 266 |
Static3D vec1 = new Static3D(d1*(+SQ3/3),d1*(-SQ3/3),d1*(-SQ3/3)); |
|
| 267 |
Static3D vec2 = new Static3D(d1*(-SQ3/3),d1*(+SQ3/3),d1*(-SQ3/3)); |
|
| 268 |
Static3D vec3 = new Static3D(d1*(-SQ3/3),d1*(-SQ3/3),d1*(+SQ3/3)); |
|
| 269 |
|
|
| 270 |
Static1D radius = new Static1D(0.5f); |
|
| 271 |
|
|
| 272 |
Static3D cent0 = new Static3D( 0.0f, 0.0f, 0.0f); |
|
| 273 |
Static3D cent1 = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 274 |
Static3D cent2 = new Static3D( 0.0f,-0.5f, 0.0f); |
|
| 275 |
Static3D cent3 = new Static3D( 0.0f, 0.0f,-0.5f); |
|
| 276 |
|
|
| 277 |
Static4D reg0 = new Static4D(0,0,0,r0); |
|
| 278 |
Static4D reg1 = new Static4D(0,0,0,r1); |
|
| 279 |
|
|
| 280 |
VertexEffectMove effect0 = new VertexEffectMove(move1); |
|
| 281 |
VertexEffectScale effect1 = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 282 |
VertexEffectRotate effect2 = new VertexEffectRotate(angle1,axisX,center1); |
|
| 283 |
VertexEffectRotate effect3 = new VertexEffectRotate(angle2,axisY,center1); |
|
| 284 |
VertexEffectMove effect4 = new VertexEffectMove(move2); |
|
| 285 |
VertexEffectRotate effect5 = new VertexEffectRotate(angle1,axisX,center2); |
|
| 286 |
VertexEffectRotate effect6 = new VertexEffectRotate(angle3,axisY,center2); |
|
| 287 |
VertexEffectRotate effect7 = new VertexEffectRotate(angle4,axis0,center2); |
|
| 288 |
VertexEffectRotate effect8 = new VertexEffectRotate(angle5,axis1,center2); |
|
| 289 |
VertexEffectRotate effect9 = new VertexEffectRotate(angle6,axis1,center2); |
|
| 290 |
|
|
| 291 |
VertexEffectDeform effect10= new VertexEffectDeform(vec0,radius,cent0,reg0); |
|
| 292 |
VertexEffectDeform effect11= new VertexEffectDeform(vec1,radius,cent1,reg1); |
|
| 293 |
VertexEffectDeform effect12= new VertexEffectDeform(vec2,radius,cent2,reg1); |
|
| 294 |
VertexEffectDeform effect13= new VertexEffectDeform(vec3,radius,cent3,reg1); |
|
| 247 |
VertexEffect effect0 = new VertexEffectMove(move1); |
|
| 248 |
VertexEffect effect1 = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 249 |
VertexEffect effect2 = new VertexEffectRotate(angle1,axisX,center1); |
|
| 250 |
VertexEffect effect3 = new VertexEffectRotate(angle2,axisY,center1); |
|
| 251 |
VertexEffect effect4 = new VertexEffectMove(move2); |
|
| 252 |
VertexEffect effect5 = new VertexEffectRotate(angle1,axisX,center2); |
|
| 253 |
VertexEffect effect6 = new VertexEffectRotate(angle3,axisY,center2); |
|
| 254 |
VertexEffect effect7 = new VertexEffectRotate(angle4,axis0,center2); |
|
| 255 |
VertexEffect effect8 = new VertexEffectRotate(angle5,axis1,center2); |
|
| 256 |
VertexEffect effect9 = new VertexEffectRotate(angle6,axis1,center2); |
|
| 295 | 257 |
|
| 296 | 258 |
effect0.setMeshAssociation( 7,-1); // meshes 0,1,2 |
| 297 | 259 |
effect1.setMeshAssociation( 6,-1); // meshes 1,2 |
| ... | ... | |
| 304 | 266 |
effect8.setMeshAssociation(16,-1); // mesh 4 |
| 305 | 267 |
effect9.setMeshAssociation(32,-1); // mesh 5 |
| 306 | 268 |
|
| 307 |
effect10.setMeshAssociation(63,-1); // all meshes |
|
| 308 |
effect11.setMeshAssociation(63,-1); // all meshes |
|
| 309 |
effect12.setMeshAssociation(63,-1); // all meshes |
|
| 310 |
effect13.setMeshAssociation(63,-1); // all meshes |
|
| 311 |
|
|
| 312 | 269 |
mesh.apply(effect0); |
| 313 | 270 |
mesh.apply(effect1); |
| 314 | 271 |
mesh.apply(effect2); |
| ... | ... | |
| 320 | 277 |
mesh.apply(effect8); |
| 321 | 278 |
mesh.apply(effect9); |
| 322 | 279 |
|
| 323 |
mesh.apply(effect10); |
|
| 324 |
mesh.apply(effect11); |
|
| 325 |
mesh.apply(effect12); |
|
| 326 |
mesh.apply(effect13); |
|
| 280 |
Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2); |
|
| 281 |
|
|
| 282 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 283 |
verticesType1[0] = new Static3D(0.0f,0.0f,0.0f); |
|
| 284 |
roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f); |
|
| 285 |
|
|
| 286 |
Static3D[] verticesType2 = new Static3D[3]; |
|
| 287 |
verticesType2[0] = new Static3D(-E, 0, 0); |
|
| 288 |
verticesType2[1] = new Static3D( 0,-E, 0); |
|
| 289 |
verticesType2[2] = new Static3D( 0, 0,-E); |
|
| 290 |
roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f); |
|
| 327 | 291 |
|
| 328 | 292 |
mesh.mergeEffComponents(); |
| 329 | 293 |
|
| ... | ... | |
| 374 | 338 |
MeshBase mesh = new MeshJoined(meshes); |
| 375 | 339 |
|
| 376 | 340 |
Static3D center = new Static3D(0,0,0); |
| 377 |
Static3D axis1 = new Static3D(1,0,0);
|
|
| 378 |
Static3D axis2 = new Static3D(0,0,1);
|
|
| 341 |
Static3D axisX = new Static3D(1,0,0);
|
|
| 342 |
Static3D axisZ = new Static3D(0,0,1);
|
|
| 379 | 343 |
float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3)); |
| 380 | 344 |
|
| 381 |
float f = 0.05f; |
|
| 382 |
float r = 0.10f; |
|
| 383 |
float d = 0.5f; |
|
| 384 |
float e = +D*0.6f; |
|
| 385 |
Static3D vector0 = new Static3D(-f, 0, 0); |
|
| 386 |
Static3D vector1 = new Static3D( 0,+f, 0); |
|
| 387 |
Static3D vector2 = new Static3D(+f, 0, 0); |
|
| 388 |
Static3D vector3 = new Static3D( 0,-f, 0); |
|
| 389 |
Static1D radius = new Static1D(1.0f); |
|
| 390 |
Static4D region = new Static4D(0,0,0,r); |
|
| 391 |
Static3D center0 = new Static3D(+d, 0, e); |
|
| 392 |
Static3D center1 = new Static3D( 0,-d, e); |
|
| 393 |
Static3D center2 = new Static3D(-d, 0, e); |
|
| 394 |
Static3D center3 = new Static3D( 0,+d, e); |
|
| 395 |
|
|
| 396 |
VertexEffectRotate effect0 = new VertexEffectRotate( new Static1D(angle), axis1, center); |
|
| 397 |
VertexEffectRotate effect1 = new VertexEffectRotate( new Static1D( 135), axis2, center); |
|
| 398 |
VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D( 45), axis2, center); |
|
| 399 |
VertexEffectRotate effect3 = new VertexEffectRotate( new Static1D( -45), axis2, center); |
|
| 400 |
VertexEffectRotate effect4 = new VertexEffectRotate( new Static1D( -135), axis2, center); |
|
| 401 |
VertexEffectMove effect5 = new VertexEffectMove( new Static3D(0,0,-0.5f) ); |
|
| 402 |
VertexEffectDeform effect6 = new VertexEffectDeform(vector0,radius,center0,region); |
|
| 403 |
VertexEffectDeform effect7 = new VertexEffectDeform(vector1,radius,center1,region); |
|
| 404 |
VertexEffectDeform effect8 = new VertexEffectDeform(vector2,radius,center2,region); |
|
| 405 |
VertexEffectDeform effect9 = new VertexEffectDeform(vector3,radius,center3,region); |
|
| 406 |
VertexEffectScale effect10= new VertexEffectScale(0.01f); |
|
| 345 |
VertexEffect effect0 = new VertexEffectRotate( new Static1D(angle), axisX, center); |
|
| 346 |
VertexEffect effect1 = new VertexEffectRotate( new Static1D( 135), axisZ, center); |
|
| 347 |
VertexEffect effect2 = new VertexEffectRotate( new Static1D( 45), axisZ, center); |
|
| 348 |
VertexEffect effect3 = new VertexEffectRotate( new Static1D( -45), axisZ, center); |
|
| 349 |
VertexEffect effect4 = new VertexEffectRotate( new Static1D( -135), axisZ, center); |
|
| 350 |
VertexEffect effect5 = new VertexEffectMove( new Static3D(0,0,-0.5f) ); |
|
| 351 |
VertexEffect effect6 = new VertexEffectScale(0); |
|
| 407 | 352 |
|
| 408 | 353 |
effect0.setMeshAssociation(30,-1); // meshes 1,2,3,4 |
| 409 | 354 |
effect1.setMeshAssociation( 2,-1); // mesh 1 |
| ... | ... | |
| 411 | 356 |
effect3.setMeshAssociation( 8,-1); // mesh 3 |
| 412 | 357 |
effect4.setMeshAssociation(16,-1); // mesh 4 |
| 413 | 358 |
effect5.setMeshAssociation(30,-1); // meshes 1,2,3,4 |
| 414 |
effect6.setMeshAssociation(31,-1); // meshes 0,1,2,3,4 |
|
| 415 |
effect7.setMeshAssociation(31,-1); // meshes 0,1,2,3,4 |
|
| 416 |
effect8.setMeshAssociation(31,-1); // meshes 0,1,2,3,4 |
|
| 417 |
effect9.setMeshAssociation(31,-1); // meshes 0,1,2,3,4 |
|
| 418 |
effect10.setMeshAssociation(32,-1); // mesh 5 |
|
| 359 |
effect6.setMeshAssociation(32,-1); // mesh 5 |
|
| 419 | 360 |
|
| 420 | 361 |
mesh.apply(effect0); |
| 421 | 362 |
mesh.apply(effect1); |
| ... | ... | |
| 424 | 365 |
mesh.apply(effect4); |
| 425 | 366 |
mesh.apply(effect5); |
| 426 | 367 |
mesh.apply(effect6); |
| 427 |
mesh.apply(effect7); |
|
| 428 |
mesh.apply(effect8); |
|
| 429 |
mesh.apply(effect9); |
|
| 430 |
mesh.apply(effect10); |
|
| 368 |
|
|
| 369 |
Static3D roundingCenter = new Static3D(0,0,-0.2f); |
|
| 370 |
|
|
| 371 |
Static3D[] vertices = new Static3D[4]; |
|
| 372 |
vertices[0] = new Static3D(-E*SQ2, 0, 0); |
|
| 373 |
vertices[1] = new Static3D(+E*SQ2, 0, 0); |
|
| 374 |
vertices[2] = new Static3D( 0, -E*SQ2, 0); |
|
| 375 |
vertices[3] = new Static3D( 0, +E*SQ2, 0); |
|
| 376 |
roundCorners(mesh,roundingCenter,vertices,0.10f,0.10f); |
|
| 431 | 377 |
|
| 432 | 378 |
mesh.mergeEffComponents(); |
| 433 | 379 |
|
| ... | ... | |
| 468 | 414 |
|
| 469 | 415 |
MeshBase mesh = new MeshJoined(meshes); |
| 470 | 416 |
|
| 471 |
float d1 = SQ2/2; |
|
| 472 |
float d2 =-0.06f; |
|
| 473 |
float d3 = 0.20f; |
|
| 474 |
|
|
| 475 |
Static3D a0 = new Static3D( 0, 1, 0 ); |
|
| 476 |
Static3D a1 = new Static3D( SQ2/2, 0, SQ2/2 ); |
|
| 477 |
Static3D a2 = new Static3D(-SQ2/2, 0, SQ2/2 ); |
|
| 478 |
|
|
| 479 | 417 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
| 480 | 418 |
Static1D angle1= new Static1D( 90); |
| 481 | 419 |
Static1D angle2= new Static1D(180); |
| ... | ... | |
| 491 | 429 |
|
| 492 | 430 |
Static3D flipY = new Static3D( 1,-1, 1); |
| 493 | 431 |
|
| 494 |
Static3D dCen0 = new Static3D( d1*a0.get0(), d1*a0.get1(), d1*a0.get2() ); |
|
| 495 |
Static3D dCen1 = new Static3D( d1*a1.get0(), d1*a1.get1(), d1*a1.get2() ); |
|
| 496 |
Static3D dCen2 = new Static3D( d1*a2.get0(), d1*a2.get1(), d1*a2.get2() ); |
|
| 497 |
Static3D dCen3 = new Static3D(-d1*a0.get0(),-d1*a0.get1(),-d1*a0.get2() ); |
|
| 498 |
Static3D dCen4 = new Static3D(-d1*a1.get0(),-d1*a2.get1(),-d1*a2.get2() ); |
|
| 499 |
Static3D dCen5 = new Static3D(-d1*a2.get0(),-d1*a1.get1(),-d1*a1.get2() ); |
|
| 500 |
|
|
| 501 |
Static3D dVec0 = new Static3D( d2*a0.get0(), d2*a0.get1(), d2*a0.get2() ); |
|
| 502 |
Static3D dVec1 = new Static3D( d2*a1.get0(), d2*a1.get1(), d2*a1.get2() ); |
|
| 503 |
Static3D dVec2 = new Static3D( d2*a2.get0(), d2*a2.get1(), d2*a2.get2() ); |
|
| 504 |
Static3D dVec3 = new Static3D(-d2*a0.get0(),-d2*a0.get1(),-d2*a0.get2() ); |
|
| 505 |
Static3D dVec4 = new Static3D(-d2*a1.get0(),-d2*a1.get1(),-d2*a1.get2() ); |
|
| 506 |
Static3D dVec5 = new Static3D(-d2*a2.get0(),-d2*a2.get1(),-d2*a2.get2() ); |
|
| 507 |
|
|
| 508 |
Static4D dReg = new Static4D(0,0,0,d3); |
|
| 509 |
Static1D dRad = new Static1D(1); |
|
| 510 |
|
|
| 511 |
VertexEffectMove effect0 = new VertexEffectMove(move1); |
|
| 512 |
VertexEffectRotate effect1 = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 513 |
VertexEffectRotate effect2 = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 514 |
VertexEffectRotate effect3 = new VertexEffectRotate(angle2, axisY, cent0); |
|
| 515 |
VertexEffectRotate effect4 = new VertexEffectRotate(angle3, axisY, cent0); |
|
| 516 |
VertexEffectScale effect5 = new VertexEffectScale(flipY); |
|
| 517 |
|
|
| 518 |
VertexEffectDeform effect6 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
|
| 519 |
VertexEffectDeform effect7 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
|
| 520 |
VertexEffectDeform effect8 = new VertexEffectDeform(dVec2, dRad, dCen2, dReg); |
|
| 521 |
VertexEffectDeform effect9 = new VertexEffectDeform(dVec3, dRad, dCen3, dReg); |
|
| 522 |
VertexEffectDeform effect10= new VertexEffectDeform(dVec4, dRad, dCen4, dReg); |
|
| 523 |
VertexEffectDeform effect11= new VertexEffectDeform(dVec5, dRad, dCen5, dReg); |
|
| 524 |
|
|
| 525 |
effect0.setMeshAssociation (255,-1); // apply to all meshes |
|
| 526 |
effect1.setMeshAssociation (255,-1); // apply to all meshes |
|
| 432 |
VertexEffect effect0 = new VertexEffectMove(move1); |
|
| 433 |
VertexEffect effect1 = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 434 |
VertexEffect effect2 = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 435 |
VertexEffect effect3 = new VertexEffectRotate(angle2, axisY, cent0); |
|
| 436 |
VertexEffect effect4 = new VertexEffectRotate(angle3, axisY, cent0); |
|
| 437 |
VertexEffect effect5 = new VertexEffectScale(flipY); |
|
| 438 |
|
|
| 527 | 439 |
effect2.setMeshAssociation ( 34,-1); // apply to meshes 1 & 5 |
| 528 | 440 |
effect3.setMeshAssociation ( 68,-1); // apply to meshes 2 & 6 |
| 529 | 441 |
effect4.setMeshAssociation (136,-1); // apply to meshes 3 & 7 |
| 530 | 442 |
effect5.setMeshAssociation (240,-1); // apply to meshes 4,5,6,7 |
| 531 |
effect6.setMeshAssociation (255,-1); // apply to all meshes |
|
| 532 |
effect7.setMeshAssociation (255,-1); // apply to all meshes |
|
| 533 |
effect8.setMeshAssociation (255,-1); // apply to all meshes |
|
| 534 |
effect9.setMeshAssociation (255,-1); // apply to all meshes |
|
| 535 |
effect10.setMeshAssociation(255,-1); // apply to all meshes |
|
| 536 |
effect11.setMeshAssociation(255,-1); // apply to all meshes |
|
| 537 | 443 |
|
| 538 | 444 |
mesh.apply(effect0); |
| 539 | 445 |
mesh.apply(effect1); |
| ... | ... | |
| 541 | 447 |
mesh.apply(effect3); |
| 542 | 448 |
mesh.apply(effect4); |
| 543 | 449 |
mesh.apply(effect5); |
| 544 |
mesh.apply(effect6); |
|
| 545 |
mesh.apply(effect7); |
|
| 546 |
mesh.apply(effect8); |
|
| 547 |
mesh.apply(effect9); |
|
| 548 |
mesh.apply(effect10); |
|
| 549 |
mesh.apply(effect11); |
|
| 450 |
|
|
| 451 |
Static3D[] verticesRound = new Static3D[6]; |
|
| 452 |
verticesRound[0] = new Static3D( 0, SQ2/2, 0 ); |
|
| 453 |
verticesRound[1] = new Static3D( 0.5f, 0, 0.5f ); |
|
| 454 |
verticesRound[2] = new Static3D(-0.5f, 0, 0.5f ); |
|
| 455 |
verticesRound[3] = new Static3D( 0,-SQ2/2, 0 ); |
|
| 456 |
verticesRound[4] = new Static3D(-0.5f, 0,-0.5f ); |
|
| 457 |
verticesRound[5] = new Static3D( 0.5f, 0,-0.5f ); |
|
| 458 |
|
|
| 459 |
roundCorners(mesh,cent0,verticesRound,0.06f,0.20f); |
|
| 550 | 460 |
|
| 551 | 461 |
mesh.mergeEffComponents(); |
| 552 | 462 |
|
| ... | ... | |
| 557 | 467 |
|
| 558 | 468 |
MeshBase createTetraMesh() |
| 559 | 469 |
{
|
| 470 |
MeshBase[] meshes = new MeshBase[8]; |
|
| 560 | 471 |
int association = 1; |
| 561 | 472 |
|
| 562 | 473 |
float C = 0.06f; |
| ... | ... | |
| 573 | 484 |
0.5f , D*1.30f, |
| 574 | 485 |
0.0f , D*1.35f }; |
| 575 | 486 |
|
| 576 |
MeshBase[] meshes = new MeshBase[8]; |
|
| 577 | 487 |
meshes[0] = new MeshPolygon(vertices, bands, 2,2); |
| 578 | 488 |
meshes[0].setEffectAssociation(0,association,0); |
| 579 | 489 |
|
| ... | ... | |
| 607 | 517 |
Static3D cent0 = new Static3D(0,0,0); |
| 608 | 518 |
Static3D cent1 = new Static3D(0,SQ2/4,0); |
| 609 | 519 |
|
| 610 |
float d1 =-1.00f; |
|
| 611 |
float d2 = 0.10f; |
|
| 612 |
float d3 = 0.15f; |
|
| 613 |
|
|
| 614 |
float vx = 0.5f ; |
|
| 615 |
float vy = (SQ2/4); |
|
| 616 |
|
|
| 617 |
Static3D a0 = new Static3D(+vx,-vy, 0 ); |
|
| 618 |
Static3D a1 = new Static3D(-vx,-vy, 0 ); |
|
| 619 |
Static3D a2 = new Static3D( 0, vy,-vx); |
|
| 620 |
Static3D a3 = new Static3D( 0, vy,+vx); |
|
| 621 |
|
|
| 622 |
Static4D dReg = new Static4D(0,0,0,d3); |
|
| 623 |
Static1D dRad = new Static1D(1); |
|
| 624 |
|
|
| 625 |
Static3D dCen0 = new Static3D( d1*a0.get0(), d1*a0.get1(), d1*a0.get2() ); |
|
| 626 |
Static3D dCen1 = new Static3D( d1*a1.get0(), d1*a1.get1(), d1*a1.get2() ); |
|
| 627 |
Static3D dCen2 = new Static3D( d1*a2.get0(), d1*a2.get1(), d1*a2.get2() ); |
|
| 628 |
Static3D dCen3 = new Static3D( d1*a3.get0(), d1*a3.get1(), d1*a3.get2() ); |
|
| 629 |
|
|
| 630 |
Static3D dVec0 = new Static3D( d2*a0.get0(), d2*a0.get1(), d2*a0.get2() ); |
|
| 631 |
Static3D dVec1 = new Static3D( d2*a1.get0(), d2*a1.get1(), d2*a1.get2() ); |
|
| 632 |
Static3D dVec2 = new Static3D( d2*a2.get0(), d2*a2.get1(), d2*a2.get2() ); |
|
| 633 |
Static3D dVec3 = new Static3D( d2*a3.get0(), d2*a3.get1(), d2*a3.get2() ); |
|
| 634 |
|
|
| 635 |
VertexEffectRotate effect0 = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 636 |
VertexEffectMove effect1 = new VertexEffectMove(move1); |
|
| 637 |
VertexEffectRotate effect2 = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 638 |
VertexEffectScale effect3 = new VertexEffectScale(flipZ); |
|
| 639 |
VertexEffectRotate effect4 = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 640 |
VertexEffectRotate effect5 = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 641 |
|
|
| 642 |
VertexEffectDeform effect6 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
|
| 643 |
VertexEffectDeform effect7 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
|
| 644 |
VertexEffectDeform effect8 = new VertexEffectDeform(dVec2, dRad, dCen2, dReg); |
|
| 645 |
VertexEffectDeform effect9 = new VertexEffectDeform(dVec3, dRad, dCen3, dReg); |
|
| 646 |
|
|
| 647 |
VertexEffectScale effect10 = new VertexEffectScale(0.1f); |
|
| 520 |
VertexEffect effect0 = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 521 |
VertexEffect effect1 = new VertexEffectMove(move1); |
|
| 522 |
VertexEffect effect2 = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 523 |
VertexEffect effect3 = new VertexEffectScale(flipZ); |
|
| 524 |
VertexEffect effect4 = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 525 |
VertexEffect effect5 = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 526 |
VertexEffect effect6 = new VertexEffectScale(0); |
|
| 648 | 527 |
|
| 649 | 528 |
effect0.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
| 650 | 529 |
effect1.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
| ... | ... | |
| 652 | 531 |
effect3.setMeshAssociation(10,-1); // meshes 1 & 3 |
| 653 | 532 |
effect4.setMeshAssociation(12,-1); // meshes 2 & 3 |
| 654 | 533 |
effect5.setMeshAssociation(12,-1); // meshes 2 & 3 |
| 655 |
effect6.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 656 |
effect7.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 657 |
effect8.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 658 |
effect9.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 659 |
effect10.setMeshAssociation(240,-1); // meshes 4,5,6,7 |
|
| 534 |
effect6.setMeshAssociation(240,-1);// meshes 4,5,6,7 |
|
| 660 | 535 |
|
| 661 | 536 |
mesh.apply(effect0); |
| 662 | 537 |
mesh.apply(effect1); |
| ... | ... | |
| 665 | 540 |
mesh.apply(effect4); |
| 666 | 541 |
mesh.apply(effect5); |
| 667 | 542 |
mesh.apply(effect6); |
| 668 |
mesh.apply(effect7); |
|
| 669 |
mesh.apply(effect8); |
|
| 670 |
mesh.apply(effect9); |
|
| 671 |
mesh.apply(effect10); |
|
| 543 |
|
|
| 544 |
Static3D[] verticesRound = new Static3D[4]; |
|
| 545 |
verticesRound[0] = new Static3D(-0.5f,+SQ2/4, 0 ); |
|
| 546 |
verticesRound[1] = new Static3D(+0.5f,+SQ2/4, 0 ); |
|
| 547 |
verticesRound[2] = new Static3D( 0,-SQ2/4,+0.5f); |
|
| 548 |
verticesRound[3] = new Static3D( 0,-SQ2/4,-0.5f); |
|
| 549 |
roundCorners(mesh,cent0,verticesRound,0.08f,0.15f); |
|
| 672 | 550 |
|
| 673 | 551 |
mesh.mergeEffComponents(); |
| 674 | 552 |
|
| ... | ... | |
| 717 | 595 |
|
| 718 | 596 |
MeshBase mesh = new MeshJoined(meshes); |
| 719 | 597 |
|
| 720 |
Static3D a0 = new Static3D( 0,-3*F, 0 ); |
|
| 721 |
Static3D a1 = new Static3D( 0, 0, -3*F ); |
|
| 722 |
Static3D a2 = new Static3D( -3*F, 0, 0 ); |
|
| 723 |
Static3D a3 = new Static3D( +3*F, 0, 0 ); |
|
| 724 |
|
|
| 725 |
Static3D v0 = new Static3D( 0,-3*F/2, 3*F/2 ); |
|
| 726 |
Static3D v1 = new Static3D( 0, 3*F/2,-3*F/2 ); |
|
| 727 |
Static3D v2 = new Static3D( -3*F, 3*F/2, 3*F/2 ); |
|
| 728 |
Static3D v3 = new Static3D( +3*F, 3*F/2, 3*F/2 ); |
|
| 729 |
|
|
| 730 |
float d1 = 1.0f; |
|
| 731 |
float d2 =-0.10f; |
|
| 732 |
float d3 =-0.10f; |
|
| 733 |
float d4 = 0.40f; |
|
| 734 |
|
|
| 735 |
Static3D dCen0 = new Static3D( d1*a0.get0(), d1*a0.get1(), d1*a0.get2() ); |
|
| 736 |
Static3D dCen1 = new Static3D( d1*a1.get0(), d1*a1.get1(), d1*a1.get2() ); |
|
| 737 |
Static3D dCen2 = new Static3D( d1*a2.get0(), d1*a2.get1(), d1*a2.get2() ); |
|
| 738 |
Static3D dCen3 = new Static3D( d1*a3.get0(), d1*a3.get1(), d1*a3.get2() ); |
|
| 739 |
|
|
| 740 |
Static3D dVec0 = new Static3D( d3*v0.get0(), d3*v0.get1(), d3*v0.get2() ); |
|
| 741 |
Static3D dVec1 = new Static3D( d3*v1.get0(), d3*v1.get1(), d3*v1.get2() ); |
|
| 742 |
Static3D dVec2 = new Static3D( d2*v2.get0(), d2*v2.get1(), d2*v2.get2() ); |
|
| 743 |
Static3D dVec3 = new Static3D( d2*v3.get0(), d2*v3.get1(), d2*v3.get2() ); |
|
| 744 |
|
|
| 745 |
Static4D dReg = new Static4D(0,0,0,d4); |
|
| 746 |
Static1D dRad = new Static1D(1); |
|
| 747 |
|
|
| 748 | 598 |
Static1D angle1 = new Static1D(+ANGLE); |
| 749 | 599 |
Static1D angle2 = new Static1D(-ANGLE); |
| 750 | 600 |
|
| ... | ... | |
| 755 | 605 |
Static3D center0= new Static3D(0,0,0); |
| 756 | 606 |
Static3D center1= new Static3D(0,-3*F,0); |
| 757 | 607 |
|
| 758 |
VertexEffectScale effect0 = new VertexEffectScale ( new Static3D(3,3,3) ); |
|
| 759 |
VertexEffectMove effect1 = new VertexEffectMove ( new Static3D(0,-F,0) ); |
|
| 760 |
VertexEffectRotate effect2 = new VertexEffectRotate( new Static1D(90), axisX, center0 ); |
|
| 761 |
VertexEffectScale effect3 = new VertexEffectScale ( new Static3D(1,-1,1) ); |
|
| 762 |
VertexEffectMove effect4 = new VertexEffectMove ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) ); |
|
| 763 |
VertexEffectRotate effect5 = new VertexEffectRotate( new Static1D(+90), axisY, center1 ); |
|
| 764 |
VertexEffectScale effect6 = new VertexEffectScale ( new Static3D(-1,1,1) ); |
|
| 765 |
VertexEffectRotate effect7 = new VertexEffectRotate( new Static1D( 45), axisX, center1 ); |
|
| 766 |
VertexEffectRotate effect8 = new VertexEffectRotate( angle1 , axisZ, center1 ); |
|
| 767 |
VertexEffectRotate effect9 = new VertexEffectRotate( angle2 , axisZ, center1 ); |
|
| 768 |
|
|
| 769 |
VertexEffectDeform effect10= new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
|
| 770 |
VertexEffectDeform effect11= new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
|
| 771 |
VertexEffectDeform effect12= new VertexEffectDeform(dVec2, dRad, dCen2, dReg); |
|
| 772 |
VertexEffectDeform effect13= new VertexEffectDeform(dVec3, dRad, dCen3, dReg); |
|
| 608 |
VertexEffect effect0 = new VertexEffectScale ( new Static3D(3,3,3) ); |
|
| 609 |
VertexEffect effect1 = new VertexEffectMove ( new Static3D(0,-F,0) ); |
|
| 610 |
VertexEffect effect2 = new VertexEffectRotate( new Static1D(90), axisX, center0 ); |
|
| 611 |
VertexEffect effect3 = new VertexEffectScale ( new Static3D(1,-1,1) ); |
|
| 612 |
VertexEffect effect4 = new VertexEffectMove ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) ); |
|
| 613 |
VertexEffect effect5 = new VertexEffectRotate( new Static1D(+90), axisY, center1 ); |
|
| 614 |
VertexEffect effect6 = new VertexEffectScale ( new Static3D(-1,1,1) ); |
|
| 615 |
VertexEffect effect7 = new VertexEffectRotate( new Static1D( 45), axisX, center1 ); |
|
| 616 |
VertexEffect effect8 = new VertexEffectRotate( angle1 , axisZ, center1 ); |
|
| 617 |
VertexEffect effect9 = new VertexEffectRotate( angle2 , axisZ, center1 ); |
|
| 773 | 618 |
|
| 774 | 619 |
effect0.setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
| 775 | 620 |
effect1.setMeshAssociation( 3,-1); // apply to meshes 0,1 |
| ... | ... | |
| 781 | 626 |
effect7.setMeshAssociation(12,-1); // apply to meshes 2,3 |
| 782 | 627 |
effect8.setMeshAssociation( 4,-1); // apply to mesh 2 |
| 783 | 628 |
effect9.setMeshAssociation( 8,-1); // apply to mesh 3 |
| 784 |
effect10.setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 785 |
effect11.setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 786 |
effect12.setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 787 |
effect13.setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 788 | 629 |
|
| 789 | 630 |
mesh.apply(effect0); |
| 790 | 631 |
mesh.apply(effect1); |
| ... | ... | |
| 796 | 637 |
mesh.apply(effect7); |
| 797 | 638 |
mesh.apply(effect8); |
| 798 | 639 |
mesh.apply(effect9); |
| 799 |
mesh.apply(effect10); |
|
| 800 |
mesh.apply(effect11); |
|
| 801 |
mesh.apply(effect12); |
|
| 802 |
mesh.apply(effect13); |
|
| 640 |
|
|
| 641 |
Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F); |
|
| 642 |
|
|
| 643 |
Static3D[] verticesRound = new Static3D[4]; |
|
| 644 |
verticesRound[0] = new Static3D( 0,-3*F, 0 ); |
|
| 645 |
verticesRound[1] = new Static3D( 0, 0, -3*F ); |
|
| 646 |
verticesRound[2] = new Static3D( -3*F, 0, 0 ); |
|
| 647 |
verticesRound[3] = new Static3D( +3*F, 0, 0 ); |
|
| 648 |
roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f); |
|
| 803 | 649 |
|
| 804 | 650 |
mesh.mergeEffComponents(); |
| 805 | 651 |
|
| ... | ... | |
| 861 | 707 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
| 862 | 708 |
Static3D move2 = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f); |
| 863 | 709 |
|
| 864 |
float d0 =-0.04f; |
|
| 865 |
float d1 = 0.04f; |
|
| 866 |
float r0 = 0.15f; |
|
| 867 |
float r1 = 0.10f; |
|
| 868 |
|
|
| 869 |
Static3D vec0 = new Static3D(d0*(+SQ3/3),d0*(+SQ3/3),d0*(+SQ3/3)); |
|
| 870 |
Static3D vec1 = new Static3D(d1*(+SQ3/3),d1*(-SQ3/3),d1*(-SQ3/3)); |
|
| 871 |
Static3D vec2 = new Static3D(d1*(-SQ3/3),d1*(+SQ3/3),d1*(-SQ3/3)); |
|
| 872 |
Static3D vec3 = new Static3D(d1*(-SQ3/3),d1*(-SQ3/3),d1*(+SQ3/3)); |
|
| 873 |
|
|
| 874 |
Static1D radius = new Static1D(0.5f); |
|
| 875 |
|
|
| 876 |
Static3D cent0 = new Static3D( 0.0f, 0.0f, 0.0f); |
|
| 877 |
Static3D cent1 = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 878 |
Static3D cent2 = new Static3D( 0.0f,-0.5f, 0.0f); |
|
| 879 |
Static3D cent3 = new Static3D( 0.0f, 0.0f,-0.5f); |
|
| 880 |
|
|
| 881 |
Static4D reg0 = new Static4D(0,0,0,r0); |
|
| 882 |
Static4D reg1 = new Static4D(0,0,0,r1); |
|
| 883 |
|
|
| 884 |
VertexEffectMove effect0 = new VertexEffectMove(move1); |
|
| 885 |
VertexEffectScale effect1 = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 886 |
VertexEffectRotate effect2 = new VertexEffectRotate(angle1,axisX,center1); |
|
| 887 |
VertexEffectRotate effect3 = new VertexEffectRotate(angle2,axisY,center1); |
|
| 888 |
VertexEffectMove effect4 = new VertexEffectMove(move2); |
|
| 889 |
VertexEffectRotate effect5 = new VertexEffectRotate(angle1,axisX,center2); |
|
| 890 |
VertexEffectRotate effect6 = new VertexEffectRotate(angle3,axisY,center2); |
|
| 891 |
VertexEffectRotate effect7 = new VertexEffectRotate(angle4,axis0,center2); |
|
| 892 |
VertexEffectRotate effect8 = new VertexEffectRotate(angle5,axis1,center2); |
|
| 893 |
VertexEffectRotate effect9 = new VertexEffectRotate(angle6,axis1,center2); |
|
| 894 |
|
|
| 895 |
VertexEffectDeform effect10= new VertexEffectDeform(vec0,radius,cent0,reg0); |
|
| 896 |
VertexEffectDeform effect11= new VertexEffectDeform(vec1,radius,cent1,reg1); |
|
| 897 |
VertexEffectDeform effect12= new VertexEffectDeform(vec2,radius,cent2,reg1); |
|
| 898 |
VertexEffectDeform effect13= new VertexEffectDeform(vec3,radius,cent3,reg1); |
|
| 710 |
VertexEffect effect0 = new VertexEffectMove(move1); |
|
| 711 |
VertexEffect effect1 = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 712 |
VertexEffect effect2 = new VertexEffectRotate(angle1,axisX,center1); |
|
| 713 |
VertexEffect effect3 = new VertexEffectRotate(angle2,axisY,center1); |
|
| 714 |
VertexEffect effect4 = new VertexEffectMove(move2); |
|
| 715 |
VertexEffect effect5 = new VertexEffectRotate(angle1,axisX,center2); |
|
| 716 |
VertexEffect effect6 = new VertexEffectRotate(angle3,axisY,center2); |
|
| 717 |
VertexEffect effect7 = new VertexEffectRotate(angle4,axis0,center2); |
|
| 718 |
VertexEffect effect8 = new VertexEffectRotate(angle5,axis1,center2); |
|
| 719 |
VertexEffect effect9 = new VertexEffectRotate(angle6,axis1,center2); |
|
| 899 | 720 |
|
| 900 | 721 |
effect0.setMeshAssociation( 7,-1); // meshes 0,1,2 |
| 901 | 722 |
effect1.setMeshAssociation( 6,-1); // meshes 1,2 |
| ... | ... | |
| 908 | 729 |
effect8.setMeshAssociation(16,-1); // mesh 4 |
| 909 | 730 |
effect9.setMeshAssociation(32,-1); // mesh 5 |
| 910 | 731 |
|
| 911 |
effect10.setMeshAssociation(63,-1); // all meshes |
|
| 912 |
effect11.setMeshAssociation(63,-1); // all meshes |
|
| 913 |
effect12.setMeshAssociation(63,-1); // all meshes |
|
| 914 |
effect13.setMeshAssociation(63,-1); // all meshes |
|
| 915 |
|
|
| 916 | 732 |
mesh.apply(effect0); |
| 917 | 733 |
mesh.apply(effect1); |
| 918 | 734 |
mesh.apply(effect2); |
| ... | ... | |
| 924 | 740 |
mesh.apply(effect8); |
| 925 | 741 |
mesh.apply(effect9); |
| 926 | 742 |
|
| 927 |
mesh.apply(effect10); |
|
| 928 |
mesh.apply(effect11); |
|
| 929 |
mesh.apply(effect12); |
|
| 930 |
mesh.apply(effect13); |
|
| 743 |
Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2); |
|
| 744 |
|
|
| 745 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 746 |
verticesType1[0] = new Static3D(0.0f,0.0f,0.0f); |
|
| 747 |
roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f); |
|
| 748 |
|
|
| 749 |
Static3D[] verticesType2 = new Static3D[3]; |
|
| 750 |
verticesType2[0] = new Static3D(-E, 0, 0); |
|
| 751 |
verticesType2[1] = new Static3D( 0,-E, 0); |
|
| 752 |
verticesType2[2] = new Static3D( 0, 0,-E); |
|
| 753 |
roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f); |
|
| 931 | 754 |
|
| 932 | 755 |
mesh.mergeEffComponents(); |
| 933 | 756 |
|
| ... | ... | |
| 984 | 807 |
|
| 985 | 808 |
MeshBase mesh = new MeshJoined(meshes); |
| 986 | 809 |
|
| 987 |
Static3D move0 = new Static3D(-1.0f/8, -1.0f/8, 0);
|
|
| 988 |
Static3D move1 = new Static3D(-(SQ2/24)-1.0f/4, -(SQ2/24)-1.0f/4, 0);
|
|
| 810 |
Static3D move0 = new Static3D(-E/4, -E/4, 0);
|
|
| 811 |
Static3D move1 = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0);
|
|
| 989 | 812 |
Static3D move2 = new Static3D(-E/2, F/3, 0); |
| 990 | 813 |
Static3D move3 = new Static3D(+E/2, F/3, 0); |
| 991 | 814 |
Static3D move4 = new Static3D(+E/3,+E/3, 0); |
| ... | ... | |
| 998 | 821 |
Static3D axisZ = new Static3D(0,0,1); |
| 999 | 822 |
Static3D axis1 = new Static3D(1,-1,0); |
| 1000 | 823 |
Static3D center = new Static3D(0,0,0); |
| 1001 |
Static3D center1= new Static3D(-0.25f,-0.25f,0); |
|
| 1002 |
|
|
| 1003 |
float d0 =-0.03f; |
|
| 1004 |
float d1 =-0.04f; |
|
| 1005 |
float r0 = 0.15f; |
|
| 1006 |
float r1 = 0.10f; |
|
| 1007 |
|
|
| 1008 |
Static3D vec0 = new Static3D(d0*(+SQ3/3),d0*(+SQ3/3),d0*(+SQ3/3)); |
|
| 1009 |
Static3D vec1 = new Static3D(d1*(-SQ3/3),d1*(+SQ3/3),d1*(+SQ3/3)); |
|
| 1010 |
Static3D vec2 = new Static3D(d1*(+SQ3/3),d1*(-SQ3/3),d1*(+SQ3/3)); |
|
| 1011 |
|
|
| 1012 |
Static1D radius = new Static1D(0.5f); |
|
| 1013 |
|
|
| 1014 |
Static3D cent0 = new Static3D( 0.0f, 0.0f, 0.0f); |
|
| 1015 |
Static3D cent1 = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 1016 |
Static3D cent2 = new Static3D( 0.0f,-0.5f, 0.0f); |
|
| 1017 |
|
|
| 1018 |
Static4D reg0 = new Static4D(0,0,0,r0); |
|
| 1019 |
Static4D reg1 = new Static4D(0,0,0,r1); |
|
| 1020 |
|
|
| 1021 |
VertexEffectMove effect0 = new VertexEffectMove(move0); |
|
| 1022 |
VertexEffectRotate effect1 = new VertexEffectRotate(angle1, axisZ, center); |
|
| 1023 |
VertexEffectMove effect2 = new VertexEffectMove(move1); |
|
| 1024 |
VertexEffectRotate effect3 = new VertexEffectRotate(angle2, axis1, center1); |
|
| 1025 |
VertexEffectMove effect4 = new VertexEffectMove(move2); |
|
| 1026 |
VertexEffectMove effect5 = new VertexEffectMove(move3); |
|
| 1027 |
VertexEffectRotate effect6 = new VertexEffectRotate(angle3, axisZ, center); |
|
| 1028 |
VertexEffectRotate effect7 = new VertexEffectRotate(angle4, axisX, center); |
|
| 1029 |
VertexEffectRotate effect8 = new VertexEffectRotate(angle1, axisY, center); |
|
| 1030 |
VertexEffectScale effect9 = new VertexEffectScale(0); |
|
| 1031 |
VertexEffectDeform effect10= new VertexEffectDeform(vec0,radius,cent0,reg0); |
|
| 1032 |
VertexEffectDeform effect11= new VertexEffectDeform(vec1,radius,cent1,reg1); |
|
| 1033 |
VertexEffectDeform effect12= new VertexEffectDeform(vec2,radius,cent2,reg1); |
|
| 1034 |
VertexEffectMove effect13= new VertexEffectMove(move4); |
|
| 824 |
Static3D center1= new Static3D(-E/2,-E/2,0); |
|
| 825 |
|
|
| 826 |
VertexEffect effect0 = new VertexEffectMove(move0); |
|
| 827 |
VertexEffect effect1 = new VertexEffectRotate(angle1, axisZ, center); |
|
| 828 |
VertexEffect effect2 = new VertexEffectMove(move1); |
|
| 829 |
VertexEffect effect3 = new VertexEffectRotate(angle2, axis1, center1); |
|
| 830 |
VertexEffect effect4 = new VertexEffectMove(move2); |
|
| 831 |
VertexEffect effect5 = new VertexEffectMove(move3); |
|
| 832 |
VertexEffect effect6 = new VertexEffectRotate(angle3, axisZ, center); |
|
| 833 |
VertexEffect effect7 = new VertexEffectRotate(angle4, axisX, center); |
|
| 834 |
VertexEffect effect8 = new VertexEffectRotate(angle1, axisY, center); |
|
| 835 |
VertexEffect effect9 = new VertexEffectMove(move4); |
|
| 836 |
VertexEffect effect10= new VertexEffectScale(0); |
|
| 1035 | 837 |
|
| 1036 | 838 |
effect0.setMeshAssociation( 1,-1); // mesh 0 |
| 1037 | 839 |
effect1.setMeshAssociation( 2,-1); // mesh 1 |
| ... | ... | |
| 1042 | 844 |
effect6.setMeshAssociation( 8,-1); // mesh 3 |
| 1043 | 845 |
effect7.setMeshAssociation( 4,-1); // mesh 2 |
| 1044 | 846 |
effect8.setMeshAssociation( 8,-1); // mesh 3 |
| 1045 |
effect9.setMeshAssociation(48,-1); // meshes 4,5 |
|
| 1046 |
effect10.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 1047 |
effect11.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 1048 |
effect12.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 1049 |
effect13.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 847 |
effect9.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 848 |
effect10.setMeshAssociation(48,-1); // meshes 4,5 |
|
| 1050 | 849 |
|
| 1051 | 850 |
mesh.apply(effect0); |
| 1052 | 851 |
mesh.apply(effect1); |
| ... | ... | |
| 1059 | 858 |
mesh.apply(effect8); |
| 1060 | 859 |
mesh.apply(effect9); |
| 1061 | 860 |
mesh.apply(effect10); |
| 1062 |
mesh.apply(effect11); |
|
| 1063 |
mesh.apply(effect12); |
|
| 1064 |
mesh.apply(effect13); |
|
| 1065 | 861 |
|
| 1066 |
mesh.mergeEffComponents();
|
|
| 862 |
Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2);
|
|
| 1067 | 863 |
|
| 1068 |
return mesh; |
|
| 1069 |
} |
|
| 864 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 865 |
verticesType1[0] = new Static3D(E/3,E/3,0.0f); |
|
| 866 |
roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f); |
|
| 1070 | 867 |
|
| 1071 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1072 |
// Redi cube |
|
| 868 |
Static3D[] verticesType2 = new Static3D[2]; |
|
| 869 |
verticesType2[0] = new Static3D(-E+E/3, E/3 , 0); |
|
| 870 |
verticesType2[1] = new Static3D( E/3 ,-E+E/3, 0); |
|
| 871 |
roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f); |
|
| 1073 | 872 |
|
| 1074 |
private void roundCorners(MeshBase mesh) |
|
| 1075 |
{
|
|
| 1076 |
float cX = 0.0f; |
|
| 1077 |
float cY = -0.75f; |
|
| 1078 |
float cZ = -0.75f; |
|
| 1079 |
|
|
| 1080 |
float d1=-0.05f; |
|
| 1081 |
float d2=-0.05f; |
|
| 1082 |
float r0= 0.20f; |
|
| 1083 |
float r1= 0.20f; |
|
| 1084 |
|
|
| 1085 |
Static3D vert0 = new Static3D( 0.5f, 0.0f, 0.0f); |
|
| 1086 |
Static3D vert1 = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 1087 |
Static3D vert2 = new Static3D( 0.0f, 0.0f,-1.5f); |
|
| 1088 |
Static3D vert3 = new Static3D( 0.0f,-1.5f, 0.0f); |
|
| 1089 |
|
|
| 1090 |
Static3D vec0 = new Static3D( d1*(+0.5f-cX), d1*(+0.0f-cY), d1*(+0.0f-cZ)); |
|
| 1091 |
Static3D vec1 = new Static3D( d1*(-0.5f-cX), d1*(+0.0f-cY), d1*(+0.0f-cZ)); |
|
| 1092 |
Static3D vec2 = new Static3D( d2*(+0.0f-cX), d2*(+0.0f-cY), d2*(-1.5f-cZ)); |
|
| 1093 |
Static3D vec3 = new Static3D( d2*(+0.0f-cX), d2*(-1.5f-cY), d2*(+0.0f-cZ)); |
|
| 1094 |
|
|
| 1095 |
Static1D radius = new Static1D(0.5f); |
|
| 1096 |
Static4D reg0 = new Static4D(0,0,0,r0); |
|
| 1097 |
Static4D reg1 = new Static4D(0,0,0,r1); |
|
| 1098 |
|
|
| 1099 |
VertexEffect effect0= new VertexEffectDeform(vec0,radius,vert0,reg0); |
|
| 1100 |
VertexEffect effect1= new VertexEffectDeform(vec1,radius,vert1,reg0); |
|
| 1101 |
VertexEffect effect2= new VertexEffectDeform(vec2,radius,vert2,reg1); |
|
| 1102 |
VertexEffect effect3= new VertexEffectDeform(vec3,radius,vert3,reg1); |
|
| 873 |
mesh.mergeEffComponents(); |
|
| 1103 | 874 |
|
| 1104 |
mesh.apply(effect0); |
|
| 1105 |
mesh.apply(effect1); |
|
| 1106 |
mesh.apply(effect2); |
|
| 1107 |
mesh.apply(effect3); |
|
| 875 |
return mesh; |
|
| 1108 | 876 |
} |
| 1109 | 877 |
|
| 1110 | 878 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 879 |
// Redi cube |
|
| 1111 | 880 |
|
| 1112 | 881 |
MeshBase createRediEdgeMesh() |
| 1113 | 882 |
{
|
| ... | ... | |
| 1215 | 984 |
mesh.apply(effect10); |
| 1216 | 985 |
mesh.apply(effect11); |
| 1217 | 986 |
|
| 1218 |
roundCorners(mesh); |
|
| 987 |
Static3D center = new Static3D(0.0f,-0.75f,-0.75f); |
|
| 988 |
Static3D[] vertices = new Static3D[4]; |
|
| 989 |
vertices[0] = new Static3D( 0.5f, 0.0f, 0.0f); |
|
| 990 |
vertices[1] = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 991 |
vertices[2] = new Static3D(0.0f, 0.0f,-1.5f); |
|
| 992 |
vertices[3] = new Static3D(0.0f,-1.5f, 0.0f); |
|
| 993 |
|
|
| 994 |
roundCorners(mesh,center,vertices,0.06f,0.20f); |
|
| 1219 | 995 |
|
| 1220 | 996 |
mesh.mergeEffComponents(); |
| 1221 | 997 |
|
| ... | ... | |
| 1227 | 1003 |
MeshBase createRediCornerMesh() |
| 1228 | 1004 |
{
|
| 1229 | 1005 |
final int MESHES=6; |
| 1006 |
MeshBase[] meshes = new MeshBase[MESHES]; |
|
| 1230 | 1007 |
|
| 1231 | 1008 |
float C = 0.027f; |
| 1232 | 1009 |
float D = 0.027f; |
| ... | ... | |
| 1240 | 1017 |
0.50f , D*1.5f, |
| 1241 | 1018 |
0.0f , D*1.75f }; |
| 1242 | 1019 |
|
| 1243 |
MeshBase[] meshes = new MeshBase[MESHES]; |
|
| 1244 | 1020 |
meshes[0] = new MeshPolygon(vertices1,bands1,2,2); |
| 1245 | 1021 |
meshes[0].setEffectAssociation(0,1,0); |
| 1246 | 1022 |
meshes[1] = meshes[0].copy(true); |
| ... | ... | |
| 1273 | 1049 |
Static1D angle270= new Static1D(270); |
| 1274 | 1050 |
Static1D angle45 = new Static1D(-45); |
| 1275 | 1051 |
|
| 1276 |
float d1 = 1.0f; |
|
| 1277 |
float d2 =-0.05f; |
|
| 1278 |
float d3 = 0.12f; |
|
| 1279 |
|
|
| 1280 |
Static3D dCen0 = new Static3D( d1*(+0.5f), d1*(+0.5f), d1*(+0.5f) ); |
|
| 1281 |
Static3D dCen1 = new Static3D( d1*(+0.5f), d1*(+0.5f), d1*(-0.5f) ); |
|
| 1282 |
Static3D dCen2 = new Static3D( d1*(+0.5f), d1*(-0.5f), d1*(+0.5f) ); |
|
| 1283 |
Static3D dCen3 = new Static3D( d1*(+0.5f), d1*(-0.5f), d1*(-0.5f) ); |
|
| 1284 |
Static3D dCen4 = new Static3D( d1*(-0.5f), d1*(+0.5f), d1*(+0.5f) ); |
|
| 1285 |
Static3D dCen5 = new Static3D( d1*(-0.5f), d1*(+0.5f), d1*(-0.5f) ); |
|
| 1286 |
Static3D dCen6 = new Static3D( d1*(-0.5f), d1*(-0.5f), d1*(+0.5f) ); |
|
| 1287 |
Static3D dCen7 = new Static3D( d1*(-0.5f), d1*(-0.5f), d1*(-0.5f) ); |
|
| 1288 |
|
|
| 1289 |
Static3D dVec0 = new Static3D( d2*(+0.5f), d2*(+0.5f), d2*(+0.5f) ); |
|
| 1290 |
Static3D dVec1 = new Static3D( d2*(+0.5f), d2*(+0.5f), d2*(-0.5f) ); |
|
| 1291 |
Static3D dVec2 = new Static3D( d2*(+0.5f), d2*(-0.5f), d2*(+0.5f) ); |
|
| 1292 |
Static3D dVec3 = new Static3D( d2*(+0.5f), d2*(-0.5f), d2*(-0.5f) ); |
|
| 1293 |
Static3D dVec4 = new Static3D( d2*(-0.5f), d2*(+0.5f), d2*(+0.5f) ); |
|
| 1294 |
Static3D dVec5 = new Static3D( d2*(-0.5f), d2*(+0.5f), d2*(-0.5f) ); |
|
| 1295 |
Static3D dVec6 = new Static3D( d2*(-0.5f), d2*(-0.5f), d2*(+0.5f) ); |
|
| 1296 |
Static3D dVec7 = new Static3D( d2*(-0.5f), d2*(-0.5f), d2*(-0.5f) ); |
|
| 1297 |
|
|
| 1298 |
Static4D dReg = new Static4D(0,0,0,d3); |
|
| 1299 |
Static1D dRad = new Static1D(1); |
|
| 1300 |
|
|
| 1301 | 1052 |
VertexEffect effect0 = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
| 1302 | 1053 |
VertexEffect effect1 = new VertexEffectRotate( angle270, axisX, center ); |
| 1303 | 1054 |
VertexEffect effect2 = new VertexEffectRotate( angle90 , axisY, center ); |
| ... | ... | |
| 1305 | 1056 |
VertexEffect effect4 = new VertexEffectRotate( angle90 , axisY, center ); |
| 1306 | 1057 |
VertexEffect effect5 = new VertexEffectRotate( angle270, axisZ, center ); |
| 1307 | 1058 |
|
| 1308 |
VertexEffect effect6 = new VertexEffectDeform(dVec0, dRad, dCen0, dReg); |
|
| 1309 |
VertexEffect effect7 = new VertexEffectDeform(dVec1, dRad, dCen1, dReg); |
|
| 1310 |
VertexEffect effect8 = new VertexEffectDeform(dVec2, dRad, dCen2, dReg); |
|
| 1311 |
VertexEffect effect9 = new VertexEffectDeform(dVec3, dRad, dCen3, dReg); |
|
| 1312 |
VertexEffect effect10= new VertexEffectDeform(dVec4, dRad, dCen4, dReg); |
|
| 1313 |
VertexEffect effect11= new VertexEffectDeform(dVec5, dRad, dCen5, dReg); |
|
| 1314 |
VertexEffect effect12= new VertexEffectDeform(dVec6, dRad, dCen6, dReg); |
|
| 1315 |
VertexEffect effect13= new VertexEffectDeform(dVec7, dRad, dCen7, dReg); |
|
| 1316 |
|
|
| 1317 | 1059 |
effect0.setMeshAssociation( 7,-1); // 0,1,2 |
| 1318 | 1060 |
effect1.setMeshAssociation( 2,-1); // 1 |
| 1319 | 1061 |
effect2.setMeshAssociation( 4,-1); // 2 |
| ... | ... | |
| 1328 | 1070 |
mesh.apply(effect4); |
| 1329 | 1071 |
mesh.apply(effect5); |
| 1330 | 1072 |
|
| 1331 |
mesh.apply(effect6); |
|
| 1332 |
mesh.apply(effect7); |
|
| 1333 |
mesh.apply(effect8); |
|
| 1334 |
mesh.apply(effect9); |
|
| 1335 |
mesh.apply(effect10); |
|
| 1336 |
mesh.apply(effect11); |
|
| 1337 |
mesh.apply(effect12); |
|
| 1338 |
mesh.apply(effect13); |
|
| 1073 |
Static3D[] vertices = new Static3D[8]; |
|
| 1074 |
vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f); |
|
| 1075 |
vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f); |
|
| 1076 |
vertices[2] = new Static3D(+0.5f,-0.5f,+0.5f); |
|
| 1077 |
vertices[3] = new Static3D(+0.5f,-0.5f,-0.5f); |
|
| 1078 |
vertices[4] = new Static3D(-0.5f,+0.5f,+0.5f); |
|
| 1079 |
vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f); |
|
| 1080 |
vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f); |
|
| 1081 |
vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 1082 |
|
|
| 1083 |
roundCorners(mesh,center,vertices,0.06f,0.12f); |
|
| 1339 | 1084 |
|
| 1340 | 1085 |
mesh.mergeEffComponents(); |
| 1341 | 1086 |
|
Also available in: Unified diff
Unification of the way we round the corners of various cubits.