Revision 55fb45c2
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/objects/CubitFactory.java | ||
|---|---|---|
| 27 | 27 |
import org.distorted.library.mesh.MeshBase; |
| 28 | 28 |
import org.distorted.library.mesh.MeshJoined; |
| 29 | 29 |
import org.distorted.library.mesh.MeshPolygon; |
| 30 |
import org.distorted.library.mesh.MeshTriangle; |
|
| 31 | 30 |
import org.distorted.library.type.Static1D; |
| 32 | 31 |
import org.distorted.library.type.Static3D; |
| 33 | 32 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 82 | 81 |
} |
| 83 | 82 |
|
| 84 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 85 |
// CUBE |
|
| 86 | 84 |
|
| 87 |
MeshBase createCubeMesh(int index)
|
|
| 85 |
MeshBase createFacesCube(int index)
|
|
| 88 | 86 |
{
|
| 89 | 87 |
final int MESHES=6; |
| 90 | 88 |
MeshBase[] meshes = new MeshPolygon[MESHES]; |
| ... | ... | |
| 102 | 100 |
1.0f-D/2,-D*0.55f, |
| 103 | 101 |
1.0f-D ,-D*0.25f, |
| 104 | 102 |
1.0f-2*D, 0.0f, |
| 105 |
0.50f, 0.040f, |
|
| 106 |
0.0f, 0.048f }; |
|
| 103 |
0.50f , 0.040f,
|
|
| 104 |
0.0f , 0.048f };
|
|
| 107 | 105 |
extraI = 2; |
| 108 | 106 |
extraV = 2; |
| 109 | 107 |
break; |
| 110 |
case 1 : bands = new float[] { 1.0f ,-D,
|
|
| 108 |
case 1 : bands = new float[] { 1.0f ,-D,
|
|
| 111 | 109 |
1.0f-D*1.2f,-D*0.55f, |
| 112 |
1.0f-2*D, 0.0f, |
|
| 113 |
0.50f, 0.040f, |
|
| 114 |
0.0f, 0.048f }; |
|
| 110 |
1.0f-2*D , 0.0f,
|
|
| 111 |
0.50f , 0.040f,
|
|
| 112 |
0.0f , 0.048f };
|
|
| 115 | 113 |
extraI = 2; |
| 116 | 114 |
extraV = 2; |
| 117 | 115 |
break; |
| 118 |
case 2 : bands = new float[] { 1.0f ,-D,
|
|
| 116 |
case 2 : bands = new float[] { 1.0f ,-D,
|
|
| 119 | 117 |
1.0f-D*1.2f,-D*0.55f, |
| 120 |
1.0f-2*D, 0.0f, |
|
| 121 |
0.50f, 0.040f, |
|
| 122 |
0.0f, 0.048f }; |
|
| 118 |
1.0f-2*D , 0.0f,
|
|
| 119 |
0.50f , 0.040f,
|
|
| 120 |
0.0f , 0.048f };
|
|
| 123 | 121 |
extraI = 1; |
| 124 | 122 |
extraV = 2; |
| 125 | 123 |
break; |
| 126 | 124 |
default: bands = new float[] { 1.0f ,-D,
|
| 127 | 125 |
1.0f-2*D, 0.0f, |
| 128 |
0.50f, 0.025f, |
|
| 129 |
0.0f, 0.030f }; |
|
| 126 |
0.50f , 0.025f,
|
|
| 127 |
0.0f , 0.030f };
|
|
| 130 | 128 |
extraI = 1; |
| 131 | 129 |
extraV = 1; |
| 132 | 130 |
break; |
| ... | ... | |
| 142 | 140 |
meshes[i].setEffectAssociation(0,association,0); |
| 143 | 141 |
} |
| 144 | 142 |
|
| 145 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 146 |
|
|
| 147 |
Static3D axisY = new Static3D(0,1,0); |
|
| 148 |
Static3D axisX = new Static3D(1,0,0); |
|
| 149 |
Static3D center = new Static3D(0,0,0); |
|
| 150 |
Static1D angle90 = new Static1D(90); |
|
| 151 |
Static1D angle180= new Static1D(180); |
|
| 152 |
Static1D angle270= new Static1D(270); |
|
| 153 |
|
|
| 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 ); |
|
| 160 |
|
|
| 161 |
effect0.setMeshAssociation(63,-1); // all 6 sides |
|
| 162 |
effect1.setMeshAssociation(32,-1); // back |
|
| 163 |
effect2.setMeshAssociation( 8,-1); // bottom |
|
| 164 |
effect3.setMeshAssociation( 4,-1); // top |
|
| 165 |
effect4.setMeshAssociation( 2,-1); // left |
|
| 166 |
effect5.setMeshAssociation( 1,-1); // right |
|
| 167 |
|
|
| 168 |
mesh.apply(effect0); |
|
| 169 |
mesh.apply(effect1); |
|
| 170 |
mesh.apply(effect2); |
|
| 171 |
mesh.apply(effect3); |
|
| 172 |
mesh.apply(effect4); |
|
| 173 |
mesh.apply(effect5); |
|
| 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); |
|
| 186 |
|
|
| 187 |
mesh.mergeEffComponents(); |
|
| 188 |
|
|
| 189 |
return mesh; |
|
| 143 |
return new MeshJoined(meshes); |
|
| 190 | 144 |
} |
| 191 | 145 |
|
| 192 | 146 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 193 |
// SKEWB |
|
| 194 | 147 |
|
| 195 |
MeshBase createSkewbCornerMesh()
|
|
| 148 |
MeshBase createFacesSkewbCorner()
|
|
| 196 | 149 |
{
|
| 197 | 150 |
float D = 0.02f; |
| 198 | 151 |
float E = 0.5f; |
| ... | ... | |
| 227 | 180 |
meshes[5] = meshes[3].copy(true); |
| 228 | 181 |
meshes[5].setEffectAssociation(0,32,0); |
| 229 | 182 |
|
| 230 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 231 |
|
|
| 232 |
Static3D axisX = new Static3D(1,0,0); |
|
| 233 |
Static3D axisY = new Static3D(0,1,0); |
|
| 234 |
Static3D axis0 = new Static3D(-SQ2/2,0,SQ2/2); |
|
| 235 |
Static3D axis1 = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3); |
|
| 236 |
Static1D angle1 = new Static1D(+90); |
|
| 237 |
Static1D angle2 = new Static1D(-90); |
|
| 238 |
Static1D angle3 = new Static1D(-15); |
|
| 239 |
Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3))); |
|
| 240 |
Static1D angle5 = new Static1D(120); |
|
| 241 |
Static1D angle6 = new Static1D(240); |
|
| 242 |
Static3D center1= new Static3D(0,0,0); |
|
| 243 |
Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 244 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
|
| 245 |
Static3D move2 = new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 246 |
|
|
| 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); |
|
| 257 |
|
|
| 258 |
effect0.setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 259 |
effect1.setMeshAssociation( 6,-1); // meshes 1,2 |
|
| 260 |
effect2.setMeshAssociation( 2,-1); // mesh 1 |
|
| 261 |
effect3.setMeshAssociation( 4,-1); // mesh 2 |
|
| 262 |
effect4.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 263 |
effect5.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 264 |
effect6.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 265 |
effect7.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 266 |
effect8.setMeshAssociation(16,-1); // mesh 4 |
|
| 267 |
effect9.setMeshAssociation(32,-1); // mesh 5 |
|
| 268 |
|
|
| 269 |
mesh.apply(effect0); |
|
| 270 |
mesh.apply(effect1); |
|
| 271 |
mesh.apply(effect2); |
|
| 272 |
mesh.apply(effect3); |
|
| 273 |
mesh.apply(effect4); |
|
| 274 |
mesh.apply(effect5); |
|
| 275 |
mesh.apply(effect6); |
|
| 276 |
mesh.apply(effect7); |
|
| 277 |
mesh.apply(effect8); |
|
| 278 |
mesh.apply(effect9); |
|
| 279 |
|
|
| 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); |
|
| 291 |
|
|
| 292 |
mesh.mergeEffComponents(); |
|
| 293 |
|
|
| 294 |
return mesh; |
|
| 183 |
return new MeshJoined(meshes); |
|
| 295 | 184 |
} |
| 296 | 185 |
|
| 297 | 186 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 298 | 187 |
|
| 299 |
MeshBase createSkewbFaceMesh()
|
|
| 188 |
MeshBase createFacesSkewbFace()
|
|
| 300 | 189 |
{
|
| 301 | 190 |
float D = 0.03f; |
| 302 | 191 |
float E = SQ2/4; |
| ... | ... | |
| 326 | 215 |
meshes[4] = meshes[1].copy(true); |
| 327 | 216 |
meshes[4].setEffectAssociation(0,16,0); |
| 328 | 217 |
|
| 329 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 330 |
|
|
| 331 |
Static3D center = new Static3D(0,0,0); |
|
| 332 |
Static3D axisX = new Static3D(1,0,0); |
|
| 333 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 334 |
float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3)); |
|
| 335 |
|
|
| 336 |
VertexEffect effect0 = new VertexEffectRotate( new Static1D(angle), axisX, center); |
|
| 337 |
VertexEffect effect1 = new VertexEffectRotate( new Static1D( 135), axisZ, center); |
|
| 338 |
VertexEffect effect2 = new VertexEffectRotate( new Static1D( 45), axisZ, center); |
|
| 339 |
VertexEffect effect3 = new VertexEffectRotate( new Static1D( -45), axisZ, center); |
|
| 340 |
VertexEffect effect4 = new VertexEffectRotate( new Static1D( -135), axisZ, center); |
|
| 341 |
VertexEffect effect5 = new VertexEffectMove( new Static3D(0,0,-0.5f) ); |
|
| 342 |
|
|
| 343 |
effect0.setMeshAssociation(30,-1); // meshes 1,2,3,4 |
|
| 344 |
effect1.setMeshAssociation( 2,-1); // mesh 1 |
|
| 345 |
effect2.setMeshAssociation( 5,-1); // meshes 0,2 |
|
| 346 |
effect3.setMeshAssociation( 8,-1); // mesh 3 |
|
| 347 |
effect4.setMeshAssociation(16,-1); // mesh 4 |
|
| 348 |
effect5.setMeshAssociation(30,-1); // meshes 1,2,3,4 |
|
| 349 |
|
|
| 350 |
mesh.apply(effect0); |
|
| 351 |
mesh.apply(effect1); |
|
| 352 |
mesh.apply(effect2); |
|
| 353 |
mesh.apply(effect3); |
|
| 354 |
mesh.apply(effect4); |
|
| 355 |
mesh.apply(effect5); |
|
| 356 |
|
|
| 357 |
Static3D roundingCenter = new Static3D(0,0,-0.2f); |
|
| 358 |
|
|
| 359 |
Static3D[] vertices = new Static3D[4]; |
|
| 360 |
vertices[0] = new Static3D(-E*SQ2, 0, 0); |
|
| 361 |
vertices[1] = new Static3D(+E*SQ2, 0, 0); |
|
| 362 |
vertices[2] = new Static3D( 0, -E*SQ2, 0); |
|
| 363 |
vertices[3] = new Static3D( 0, +E*SQ2, 0); |
|
| 364 |
roundCorners(mesh,roundingCenter,vertices,0.10f,0.10f); |
|
| 365 |
|
|
| 366 |
mesh.mergeEffComponents(); |
|
| 367 |
mesh.addEmptyTexComponent(); |
|
| 368 |
|
|
| 369 |
return mesh; |
|
| 218 |
return new MeshJoined(meshes); |
|
| 370 | 219 |
} |
| 371 | 220 |
|
| 372 | 221 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 373 |
// SKEWB DIAMOND / PYRAMINX |
|
| 374 | 222 |
|
| 375 |
MeshBase createOctaMesh()
|
|
| 223 |
MeshBase createFacesOcta()
|
|
| 376 | 224 |
{
|
| 377 | 225 |
int association = 1; |
| 378 | 226 |
|
| ... | ... | |
| 401 | 249 |
meshes[i].setEffectAssociation(0,association,0); |
| 402 | 250 |
} |
| 403 | 251 |
|
| 404 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 405 |
|
|
| 406 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
|
| 407 |
Static1D angle1= new Static1D( 90); |
|
| 408 |
Static1D angle2= new Static1D(180); |
|
| 409 |
Static1D angle3= new Static1D(270); |
|
| 410 |
|
|
| 411 |
Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0); |
|
| 412 |
|
|
| 413 |
Static3D axisX = new Static3D(1,0,0); |
|
| 414 |
Static3D axisY = new Static3D(0,1,0); |
|
| 415 |
|
|
| 416 |
Static3D cent0 = new Static3D(0,0,0); |
|
| 417 |
Static3D cent1 = new Static3D(0,SQ2/2,0); |
|
| 418 |
|
|
| 419 |
Static3D flipY = new Static3D( 1,-1, 1); |
|
| 420 |
|
|
| 421 |
VertexEffect effect0 = new VertexEffectMove(move1); |
|
| 422 |
VertexEffect effect1 = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 423 |
VertexEffect effect2 = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 424 |
VertexEffect effect3 = new VertexEffectRotate(angle2, axisY, cent0); |
|
| 425 |
VertexEffect effect4 = new VertexEffectRotate(angle3, axisY, cent0); |
|
| 426 |
VertexEffect effect5 = new VertexEffectScale(flipY); |
|
| 427 |
|
|
| 428 |
effect2.setMeshAssociation ( 34,-1); // apply to meshes 1 & 5 |
|
| 429 |
effect3.setMeshAssociation ( 68,-1); // apply to meshes 2 & 6 |
|
| 430 |
effect4.setMeshAssociation (136,-1); // apply to meshes 3 & 7 |
|
| 431 |
effect5.setMeshAssociation (240,-1); // apply to meshes 4,5,6,7 |
|
| 432 |
|
|
| 433 |
mesh.apply(effect0); |
|
| 434 |
mesh.apply(effect1); |
|
| 435 |
mesh.apply(effect2); |
|
| 436 |
mesh.apply(effect3); |
|
| 437 |
mesh.apply(effect4); |
|
| 438 |
mesh.apply(effect5); |
|
| 439 |
|
|
| 440 |
Static3D[] verticesRound = new Static3D[6]; |
|
| 441 |
verticesRound[0] = new Static3D( 0, SQ2/2, 0 ); |
|
| 442 |
verticesRound[1] = new Static3D( 0.5f, 0, 0.5f ); |
|
| 443 |
verticesRound[2] = new Static3D(-0.5f, 0, 0.5f ); |
|
| 444 |
verticesRound[3] = new Static3D( 0,-SQ2/2, 0 ); |
|
| 445 |
verticesRound[4] = new Static3D(-0.5f, 0,-0.5f ); |
|
| 446 |
verticesRound[5] = new Static3D( 0.5f, 0,-0.5f ); |
|
| 447 |
|
|
| 448 |
roundCorners(mesh,cent0,verticesRound,0.06f,0.20f); |
|
| 449 |
|
|
| 450 |
mesh.mergeEffComponents(); |
|
| 451 |
|
|
| 452 |
return mesh; |
|
| 252 |
return new MeshJoined(meshes); |
|
| 453 | 253 |
} |
| 454 | 254 |
|
| 455 | 255 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 456 | 256 |
|
| 457 |
MeshBase createTetraMesh()
|
|
| 257 |
MeshBase createFacesTetra()
|
|
| 458 | 258 |
{
|
| 459 | 259 |
MeshBase[] meshes = new MeshBase[4]; |
| 460 | 260 |
int association = 1; |
| ... | ... | |
| 483 | 283 |
meshes[i].setEffectAssociation(0,association,0); |
| 484 | 284 |
} |
| 485 | 285 |
|
| 486 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 487 |
|
|
| 488 |
Static3D flipZ = new Static3D( 1, 1,-1); |
|
| 489 |
|
|
| 490 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
|
| 491 |
Static1D angle1= new Static1D( 90); |
|
| 492 |
Static1D angle2= new Static1D(180); |
|
| 493 |
Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0); |
|
| 494 |
|
|
| 495 |
Static3D axisX = new Static3D(1,0,0); |
|
| 496 |
Static3D axisY = new Static3D(0,1,0); |
|
| 497 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 498 |
|
|
| 499 |
Static3D cent0 = new Static3D(0,0,0); |
|
| 500 |
Static3D cent1 = new Static3D(0,SQ2/4,0); |
|
| 501 |
|
|
| 502 |
VertexEffect effect0 = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 503 |
VertexEffect effect1 = new VertexEffectMove(move1); |
|
| 504 |
VertexEffect effect2 = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 505 |
VertexEffect effect3 = new VertexEffectScale(flipZ); |
|
| 506 |
VertexEffect effect4 = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 507 |
VertexEffect effect5 = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 508 |
|
|
| 509 |
effect0.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 510 |
effect1.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 511 |
effect2.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 512 |
effect3.setMeshAssociation(10,-1); // meshes 1 & 3 |
|
| 513 |
effect4.setMeshAssociation(12,-1); // meshes 2 & 3 |
|
| 514 |
effect5.setMeshAssociation(12,-1); // meshes 2 & 3 |
|
| 515 |
|
|
| 516 |
mesh.apply(effect0); |
|
| 517 |
mesh.apply(effect1); |
|
| 518 |
mesh.apply(effect2); |
|
| 519 |
mesh.apply(effect3); |
|
| 520 |
mesh.apply(effect4); |
|
| 521 |
mesh.apply(effect5); |
|
| 522 |
|
|
| 523 |
Static3D[] verticesRound = new Static3D[4]; |
|
| 524 |
verticesRound[0] = new Static3D(-0.5f,+SQ2/4, 0 ); |
|
| 525 |
verticesRound[1] = new Static3D(+0.5f,+SQ2/4, 0 ); |
|
| 526 |
verticesRound[2] = new Static3D( 0,-SQ2/4,+0.5f); |
|
| 527 |
verticesRound[3] = new Static3D( 0,-SQ2/4,-0.5f); |
|
| 528 |
roundCorners(mesh,cent0,verticesRound,0.08f,0.15f); |
|
| 529 |
|
|
| 530 |
mesh.mergeEffComponents(); |
|
| 531 |
mesh.addEmptyTexComponent(); |
|
| 532 |
mesh.addEmptyTexComponent(); |
|
| 533 |
mesh.addEmptyTexComponent(); |
|
| 534 |
mesh.addEmptyTexComponent(); |
|
| 535 |
|
|
| 536 |
return mesh; |
|
| 286 |
return new MeshJoined(meshes); |
|
| 537 | 287 |
} |
| 538 | 288 |
|
| 539 | 289 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 540 |
// DINO |
|
| 541 | 290 |
|
| 542 |
MeshBase createDinoMesh()
|
|
| 291 |
MeshBase createFacesDino()
|
|
| 543 | 292 |
{
|
| 544 |
final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2))); |
|
| 545 |
|
|
| 546 | 293 |
final int MESHES=4; |
| 547 | 294 |
|
| 548 | 295 |
float D = 0.02f; |
| ... | ... | |
| 576 | 323 |
meshes[3] = meshes[2].copy(true); |
| 577 | 324 |
meshes[3].setEffectAssociation(0,8,0); |
| 578 | 325 |
|
| 579 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 580 |
|
|
| 581 |
Static1D angle1 = new Static1D(+ANGLE); |
|
| 582 |
Static1D angle2 = new Static1D(-ANGLE); |
|
| 583 |
|
|
| 584 |
Static3D axisX = new Static3D(1,0,0); |
|
| 585 |
Static3D axisY = new Static3D(0,1,0); |
|
| 586 |
Static3D axisZ = new Static3D(0,-1,1); |
|
| 587 |
|
|
| 588 |
Static3D center0= new Static3D(0,0,0); |
|
| 589 |
Static3D center1= new Static3D(0,-3*F,0); |
|
| 590 |
|
|
| 591 |
VertexEffect effect0 = new VertexEffectScale ( new Static3D(3,3,3) ); |
|
| 592 |
VertexEffect effect1 = new VertexEffectMove ( new Static3D(0,-F,0) ); |
|
| 593 |
VertexEffect effect2 = new VertexEffectRotate( new Static1D(90), axisX, center0 ); |
|
| 594 |
VertexEffect effect3 = new VertexEffectScale ( new Static3D(1,-1,1) ); |
|
| 595 |
VertexEffect effect4 = new VertexEffectMove ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) ); |
|
| 596 |
VertexEffect effect5 = new VertexEffectRotate( new Static1D(+90), axisY, center1 ); |
|
| 597 |
VertexEffect effect6 = new VertexEffectScale ( new Static3D(-1,1,1) ); |
|
| 598 |
VertexEffect effect7 = new VertexEffectRotate( new Static1D( 45), axisX, center1 ); |
|
| 599 |
VertexEffect effect8 = new VertexEffectRotate( angle1 , axisZ, center1 ); |
|
| 600 |
VertexEffect effect9 = new VertexEffectRotate( angle2 , axisZ, center1 ); |
|
| 601 |
|
|
| 602 |
effect0.setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 603 |
effect1.setMeshAssociation( 3,-1); // apply to meshes 0,1 |
|
| 604 |
effect2.setMeshAssociation( 2,-1); // apply to mesh 1 |
|
| 605 |
effect3.setMeshAssociation( 2,-1); // apply to mesh 0 |
|
| 606 |
effect4.setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 607 |
effect5.setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 608 |
effect6.setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 609 |
effect7.setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 610 |
effect8.setMeshAssociation( 4,-1); // apply to mesh 2 |
|
| 611 |
effect9.setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 612 |
|
|
| 613 |
mesh.apply(effect0); |
|
| 614 |
mesh.apply(effect1); |
|
| 615 |
mesh.apply(effect2); |
|
| 616 |
mesh.apply(effect3); |
|
| 617 |
mesh.apply(effect4); |
|
| 618 |
mesh.apply(effect5); |
|
| 619 |
mesh.apply(effect6); |
|
| 620 |
mesh.apply(effect7); |
|
| 621 |
mesh.apply(effect8); |
|
| 622 |
mesh.apply(effect9); |
|
| 623 |
|
|
| 624 |
Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F); |
|
| 625 |
|
|
| 626 |
Static3D[] verticesRound = new Static3D[4]; |
|
| 627 |
verticesRound[0] = new Static3D( 0,-3*F, 0 ); |
|
| 628 |
verticesRound[1] = new Static3D( 0, 0, -3*F ); |
|
| 629 |
verticesRound[2] = new Static3D( -3*F, 0, 0 ); |
|
| 630 |
verticesRound[3] = new Static3D( +3*F, 0, 0 ); |
|
| 631 |
roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f); |
|
| 632 |
|
|
| 633 |
mesh.mergeEffComponents(); |
|
| 634 |
|
|
| 635 |
return mesh; |
|
| 326 |
return new MeshJoined(meshes); |
|
| 636 | 327 |
} |
| 637 | 328 |
|
| 638 | 329 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 639 |
// Helicopter |
|
| 640 | 330 |
|
| 641 |
MeshBase createHelicopterCornerMesh()
|
|
| 331 |
MeshBase createFacesHelicopterCorner()
|
|
| 642 | 332 |
{
|
| 643 | 333 |
float D = 0.02f; |
| 644 | 334 |
float E = 0.5f; |
| ... | ... | |
| 673 | 363 |
meshes[5] = meshes[3].copy(true); |
| 674 | 364 |
meshes[5].setEffectAssociation(0,32,0); |
| 675 | 365 |
|
| 676 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 677 |
|
|
| 678 |
Static3D axisX = new Static3D(1,0,0); |
|
| 679 |
Static3D axisY = new Static3D(0,1,0); |
|
| 680 |
Static3D axis0 = new Static3D(-SQ2/2,0,SQ2/2); |
|
| 681 |
Static3D axis1 = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3); |
|
| 682 |
Static1D angle1 = new Static1D(+90); |
|
| 683 |
Static1D angle2 = new Static1D(-90); |
|
| 684 |
Static1D angle3 = new Static1D(-135); |
|
| 685 |
Static1D angle4 = new Static1D(90); |
|
| 686 |
Static1D angle5 = new Static1D(120); |
|
| 687 |
Static1D angle6 = new Static1D(240); |
|
| 688 |
Static3D center1= new Static3D(0,0,0); |
|
| 689 |
Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f); |
|
| 690 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
|
| 691 |
Static3D move2 = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f); |
|
| 692 |
|
|
| 693 |
VertexEffect effect0 = new VertexEffectMove(move1); |
|
| 694 |
VertexEffect effect1 = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 695 |
VertexEffect effect2 = new VertexEffectRotate(angle1,axisX,center1); |
|
| 696 |
VertexEffect effect3 = new VertexEffectRotate(angle2,axisY,center1); |
|
| 697 |
VertexEffect effect4 = new VertexEffectMove(move2); |
|
| 698 |
VertexEffect effect5 = new VertexEffectRotate(angle1,axisX,center2); |
|
| 699 |
VertexEffect effect6 = new VertexEffectRotate(angle3,axisY,center2); |
|
| 700 |
VertexEffect effect7 = new VertexEffectRotate(angle4,axis0,center2); |
|
| 701 |
VertexEffect effect8 = new VertexEffectRotate(angle5,axis1,center2); |
|
| 702 |
VertexEffect effect9 = new VertexEffectRotate(angle6,axis1,center2); |
|
| 703 |
|
|
| 704 |
effect0.setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 705 |
effect1.setMeshAssociation( 6,-1); // meshes 1,2 |
|
| 706 |
effect2.setMeshAssociation( 2,-1); // mesh 1 |
|
| 707 |
effect3.setMeshAssociation( 4,-1); // mesh 2 |
|
| 708 |
effect4.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 709 |
effect5.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 710 |
effect6.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 711 |
effect7.setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 712 |
effect8.setMeshAssociation(16,-1); // mesh 4 |
|
| 713 |
effect9.setMeshAssociation(32,-1); // mesh 5 |
|
| 714 |
|
|
| 715 |
mesh.apply(effect0); |
|
| 716 |
mesh.apply(effect1); |
|
| 717 |
mesh.apply(effect2); |
|
| 718 |
mesh.apply(effect3); |
|
| 719 |
mesh.apply(effect4); |
|
| 720 |
mesh.apply(effect5); |
|
| 721 |
mesh.apply(effect6); |
|
| 722 |
mesh.apply(effect7); |
|
| 723 |
mesh.apply(effect8); |
|
| 724 |
mesh.apply(effect9); |
|
| 725 |
|
|
| 726 |
Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2); |
|
| 727 |
|
|
| 728 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 729 |
verticesType1[0] = new Static3D(0.0f,0.0f,0.0f); |
|
| 730 |
roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f); |
|
| 731 |
|
|
| 732 |
Static3D[] verticesType2 = new Static3D[3]; |
|
| 733 |
verticesType2[0] = new Static3D(-E, 0, 0); |
|
| 734 |
verticesType2[1] = new Static3D( 0,-E, 0); |
|
| 735 |
verticesType2[2] = new Static3D( 0, 0,-E); |
|
| 736 |
roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f); |
|
| 737 |
|
|
| 738 |
mesh.mergeEffComponents(); |
|
| 739 |
|
|
| 740 |
return mesh; |
|
| 366 |
return new MeshJoined(meshes); |
|
| 741 | 367 |
} |
| 742 | 368 |
|
| 743 | 369 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 744 | 370 |
|
| 745 |
MeshBase createHelicopterFaceMesh()
|
|
| 371 |
MeshBase createFacesHelicopterFace()
|
|
| 746 | 372 |
{
|
| 747 | 373 |
MeshBase[] meshes = new MeshBase[4]; |
| 748 | 374 |
|
| ... | ... | |
| 784 | 410 |
meshes[3] = meshes[2].copy(true); |
| 785 | 411 |
meshes[3].setEffectAssociation(0,8,0); |
| 786 | 412 |
|
| 787 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 788 |
|
|
| 789 |
Static3D move0 = new Static3D(-E/4, -E/4, 0); |
|
| 790 |
Static3D move1 = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0); |
|
| 791 |
Static3D move2 = new Static3D(-E/2, F/3, 0); |
|
| 792 |
Static3D move3 = new Static3D(+E/2, F/3, 0); |
|
| 793 |
Static3D move4 = new Static3D(+E/3,+E/3, 0); |
|
| 794 |
Static1D angle1 = new Static1D(135); |
|
| 795 |
Static1D angle2 = new Static1D(90); |
|
| 796 |
Static1D angle3 = new Static1D(-90); |
|
| 797 |
Static1D angle4 = new Static1D(-135); |
|
| 798 |
Static3D axisX = new Static3D(1,0,0); |
|
| 799 |
Static3D axisY = new Static3D(0,1,0); |
|
| 800 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 801 |
Static3D axis1 = new Static3D(1,-1,0); |
|
| 802 |
Static3D center = new Static3D(0,0,0); |
|
| 803 |
Static3D center1= new Static3D(-E/2,-E/2,0); |
|
| 804 |
|
|
| 805 |
VertexEffect effect0 = new VertexEffectMove(move0); |
|
| 806 |
VertexEffect effect1 = new VertexEffectRotate(angle1, axisZ, center); |
|
| 807 |
VertexEffect effect2 = new VertexEffectMove(move1); |
|
| 808 |
VertexEffect effect3 = new VertexEffectRotate(angle2, axis1, center1); |
|
| 809 |
VertexEffect effect4 = new VertexEffectMove(move2); |
|
| 810 |
VertexEffect effect5 = new VertexEffectMove(move3); |
|
| 811 |
VertexEffect effect6 = new VertexEffectRotate(angle3, axisZ, center); |
|
| 812 |
VertexEffect effect7 = new VertexEffectRotate(angle4, axisX, center); |
|
| 813 |
VertexEffect effect8 = new VertexEffectRotate(angle1, axisY, center); |
|
| 814 |
VertexEffect effect9 = new VertexEffectMove(move4); |
|
| 815 |
|
|
| 816 |
effect0.setMeshAssociation( 1,-1); // mesh 0 |
|
| 817 |
effect1.setMeshAssociation( 2,-1); // mesh 1 |
|
| 818 |
effect2.setMeshAssociation( 2,-1); // mesh 1 |
|
| 819 |
effect3.setMeshAssociation( 2,-1); // mesh 1 |
|
| 820 |
effect4.setMeshAssociation( 4,-1); // mesh 2 |
|
| 821 |
effect5.setMeshAssociation( 8,-1); // mesh 3 |
|
| 822 |
effect6.setMeshAssociation( 8,-1); // mesh 3 |
|
| 823 |
effect7.setMeshAssociation( 4,-1); // mesh 2 |
|
| 824 |
effect8.setMeshAssociation( 8,-1); // mesh 3 |
|
| 825 |
effect9.setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 826 |
|
|
| 827 |
mesh.apply(effect0); |
|
| 828 |
mesh.apply(effect1); |
|
| 829 |
mesh.apply(effect2); |
|
| 830 |
mesh.apply(effect3); |
|
| 831 |
mesh.apply(effect4); |
|
| 832 |
mesh.apply(effect5); |
|
| 833 |
mesh.apply(effect6); |
|
| 834 |
mesh.apply(effect7); |
|
| 835 |
mesh.apply(effect8); |
|
| 836 |
mesh.apply(effect9); |
|
| 837 |
|
|
| 838 |
Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2); |
|
| 839 |
|
|
| 840 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 841 |
verticesType1[0] = new Static3D(E/3,E/3,0.0f); |
|
| 842 |
roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f); |
|
| 843 |
|
|
| 844 |
Static3D[] verticesType2 = new Static3D[2]; |
|
| 845 |
verticesType2[0] = new Static3D(-E+E/3, E/3 , 0); |
|
| 846 |
verticesType2[1] = new Static3D( E/3 ,-E+E/3, 0); |
|
| 847 |
roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f); |
|
| 848 |
|
|
| 849 |
mesh.mergeEffComponents(); |
|
| 850 |
mesh.addEmptyTexComponent(); |
|
| 851 |
mesh.addEmptyTexComponent(); |
|
| 852 |
|
|
| 853 |
return mesh; |
|
| 413 |
return new MeshJoined(meshes); |
|
| 854 | 414 |
} |
| 855 | 415 |
|
| 856 | 416 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 857 |
// Redi cube |
|
| 858 | 417 |
|
| 859 |
MeshBase createRediEdgeMesh()
|
|
| 418 |
MeshBase createFacesRediEdge()
|
|
| 860 | 419 |
{
|
| 861 | 420 |
final int MESHES=6; |
| 862 | 421 |
|
| ... | ... | |
| 905 | 464 |
meshes[5] = meshes[4].copy(true); |
| 906 | 465 |
meshes[5].setEffectAssociation(0,32,0); |
| 907 | 466 |
|
| 908 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 909 |
|
|
| 910 |
Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f); |
|
| 911 |
Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f); |
|
| 912 |
Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f); |
|
| 913 |
Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8); |
|
| 914 |
Static3D flipZ = new Static3D(1,1,-1); |
|
| 915 |
Static3D flipX = new Static3D(-1,1,1); |
|
| 916 |
Static3D scale = new Static3D(2,2,2); |
|
| 917 |
Static3D cent0 = new Static3D(0,0, 0); |
|
| 918 |
Static3D cent1 = new Static3D(0,0, -1.5f); |
|
| 919 |
Static3D axisX = new Static3D(1,0, 0); |
|
| 920 |
Static3D axisY = new Static3D(0,1, 0); |
|
| 921 |
Static3D axis = new Static3D(0,SQ2/2,-SQ2/2); |
|
| 922 |
Static1D angle1= new Static1D(90); |
|
| 923 |
Static1D angle2= new Static1D(45); |
|
| 924 |
Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) ); |
|
| 925 |
|
|
| 926 |
VertexEffect effect0 = new VertexEffectScale(scale); |
|
| 927 |
VertexEffect effect1 = new VertexEffectMove(move0); |
|
| 928 |
VertexEffect effect2 = new VertexEffectScale(flipZ); |
|
| 929 |
VertexEffect effect3 = new VertexEffectRotate(angle1,axisX,cent0); |
|
| 930 |
VertexEffect effect4 = new VertexEffectMove(move1); |
|
| 931 |
VertexEffect effect5 = new VertexEffectRotate(angle1,axisY,cent0); |
|
| 932 |
VertexEffect effect6 = new VertexEffectMove(move2); |
|
| 933 |
VertexEffect effect7 = new VertexEffectScale(flipX); |
|
| 934 |
VertexEffect effect8 = new VertexEffectRotate(angle2,axisX,cent0); |
|
| 935 |
VertexEffect effect9 = new VertexEffectMove(move3); |
|
| 936 |
VertexEffect effect10= new VertexEffectRotate(angle3,axis ,cent1); |
|
| 937 |
VertexEffect effect11= new VertexEffectScale(flipX); |
|
| 938 |
|
|
| 939 |
effect0.setMeshAssociation(63,-1); // meshes 0,1,2,3,4,5 |
|
| 940 |
effect1.setMeshAssociation( 3,-1); // meshes 0,1 |
|
| 941 |
effect2.setMeshAssociation( 2,-1); // mesh 1 |
|
| 942 |
effect3.setMeshAssociation( 2,-1); // mesh 1 |
|
| 943 |
effect4.setMeshAssociation(12,-1); // meshes 2,3 |
|
| 944 |
effect5.setMeshAssociation(60,-1); // meshes 2,3,4,5 |
|
| 945 |
effect6.setMeshAssociation(12,-1); // meshes 2,3 |
|
| 946 |
effect7.setMeshAssociation( 8,-1); // mesh 3 |
|
| 947 |
effect8.setMeshAssociation(48,-1); // meshes 4,5 |
|
| 948 |
effect9.setMeshAssociation(48,-1); // meshes 4,5 |
|
| 949 |
effect10.setMeshAssociation(48,-1); // meshes 4,5 |
|
| 950 |
effect11.setMeshAssociation(32,-1); // mesh 5 |
|
| 951 |
|
|
| 952 |
mesh.apply(effect0); |
|
| 953 |
mesh.apply(effect1); |
|
| 954 |
mesh.apply(effect2); |
|
| 955 |
mesh.apply(effect3); |
|
| 956 |
mesh.apply(effect4); |
|
| 957 |
mesh.apply(effect5); |
|
| 958 |
mesh.apply(effect6); |
|
| 959 |
mesh.apply(effect7); |
|
| 960 |
mesh.apply(effect8); |
|
| 961 |
mesh.apply(effect9); |
|
| 962 |
mesh.apply(effect10); |
|
| 963 |
mesh.apply(effect11); |
|
| 964 |
|
|
| 965 |
Static3D center = new Static3D(0.0f,-0.75f,-0.75f); |
|
| 966 |
Static3D[] vertices = new Static3D[4]; |
|
| 967 |
vertices[0] = new Static3D( 0.5f, 0.0f, 0.0f); |
|
| 968 |
vertices[1] = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 969 |
vertices[2] = new Static3D(0.0f, 0.0f,-1.5f); |
|
| 970 |
vertices[3] = new Static3D(0.0f,-1.5f, 0.0f); |
|
| 971 |
|
|
| 972 |
roundCorners(mesh,center,vertices,0.06f,0.20f); |
|
| 973 |
|
|
| 974 |
mesh.mergeEffComponents(); |
|
| 975 |
|
|
| 976 |
return mesh; |
|
| 467 |
return new MeshJoined(meshes); |
|
| 977 | 468 |
} |
| 978 | 469 |
|
| 979 | 470 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 980 | 471 |
|
| 981 |
MeshBase createRediCornerMesh()
|
|
| 472 |
MeshBase createFacesRediCorner()
|
|
| 982 | 473 |
{
|
| 983 | 474 |
final int MESHES=6; |
| 984 | 475 |
MeshBase[] meshes = new MeshBase[MESHES]; |
| ... | ... | |
| 1017 | 508 |
meshes[5] = meshes[3].copy(true); |
| 1018 | 509 |
meshes[5].setEffectAssociation(0,32,0); |
| 1019 | 510 |
|
| 1020 |
MeshBase mesh = new MeshJoined(meshes); |
|
| 511 |
return new MeshJoined(meshes); |
|
| 512 |
} |
|
| 1021 | 513 |
|
| 1022 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1023 |
Static3D axisX = new Static3D(1,0,0); |
|
| 514 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 515 |
|
|
| 516 |
VertexEffect[] createVertexEffectsCube() |
|
| 517 |
{
|
|
| 518 |
Static3D axisY = new Static3D(0,1,0); |
|
| 519 |
Static3D axisX = new Static3D(1,0,0); |
|
| 520 |
Static3D center = new Static3D(0,0,0); |
|
| 521 |
Static1D angle90 = new Static1D(90); |
|
| 522 |
Static1D angle180= new Static1D(180); |
|
| 523 |
Static1D angle270= new Static1D(270); |
|
| 524 |
|
|
| 525 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 526 |
|
|
| 527 |
effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 528 |
effect[1] = new VertexEffectRotate( angle180, axisX, center ); |
|
| 529 |
effect[2] = new VertexEffectRotate( angle90 , axisX, center ); |
|
| 530 |
effect[3] = new VertexEffectRotate( angle270, axisX, center ); |
|
| 531 |
effect[4] = new VertexEffectRotate( angle270, axisY, center ); |
|
| 532 |
effect[5] = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 533 |
|
|
| 534 |
effect[0].setMeshAssociation(63,-1); // all 6 sides |
|
| 535 |
effect[1].setMeshAssociation(32,-1); // back |
|
| 536 |
effect[2].setMeshAssociation( 8,-1); // bottom |
|
| 537 |
effect[3].setMeshAssociation( 4,-1); // top |
|
| 538 |
effect[4].setMeshAssociation( 2,-1); // left |
|
| 539 |
effect[5].setMeshAssociation( 1,-1); // right |
|
| 540 |
|
|
| 541 |
return effect; |
|
| 542 |
} |
|
| 543 |
|
|
| 544 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 545 |
|
|
| 546 |
VertexEffect[] createVertexEffectsSkewbCorner() |
|
| 547 |
{
|
|
| 548 |
float E = 0.5f; |
|
| 549 |
|
|
| 550 |
Static3D axisX = new Static3D(1,0,0); |
|
| 551 |
Static3D axisY = new Static3D(0,1,0); |
|
| 552 |
Static3D axis0 = new Static3D(-SQ2/2,0,SQ2/2); |
|
| 553 |
Static3D axis1 = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3); |
|
| 554 |
Static1D angle1 = new Static1D(+90); |
|
| 555 |
Static1D angle2 = new Static1D(-90); |
|
| 556 |
Static1D angle3 = new Static1D(-15); |
|
| 557 |
Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3))); |
|
| 558 |
Static1D angle5 = new Static1D(120); |
|
| 559 |
Static1D angle6 = new Static1D(240); |
|
| 560 |
Static3D center1= new Static3D(0,0,0); |
|
| 561 |
Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 562 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
|
| 563 |
Static3D move2 = new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 564 |
|
|
| 565 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 566 |
|
|
| 567 |
effect[0] = new VertexEffectMove(move1); |
|
| 568 |
effect[1] = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 569 |
effect[2] = new VertexEffectRotate(angle1,axisX,center1); |
|
| 570 |
effect[3] = new VertexEffectRotate(angle2,axisY,center1); |
|
| 571 |
effect[4] = new VertexEffectMove(move2); |
|
| 572 |
effect[5] = new VertexEffectRotate(angle1,axisX,center2); |
|
| 573 |
effect[6] = new VertexEffectRotate(angle3,axisY,center2); |
|
| 574 |
effect[7] = new VertexEffectRotate(angle4,axis0,center2); |
|
| 575 |
effect[8] = new VertexEffectRotate(angle5,axis1,center2); |
|
| 576 |
effect[9] = new VertexEffectRotate(angle6,axis1,center2); |
|
| 577 |
|
|
| 578 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 579 |
effect[1].setMeshAssociation( 6,-1); // meshes 1,2 |
|
| 580 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 581 |
effect[3].setMeshAssociation( 4,-1); // mesh 2 |
|
| 582 |
effect[4].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 583 |
effect[5].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 584 |
effect[6].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 585 |
effect[7].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 586 |
effect[8].setMeshAssociation(16,-1); // mesh 4 |
|
| 587 |
effect[9].setMeshAssociation(32,-1); // mesh 5 |
|
| 588 |
|
|
| 589 |
return effect; |
|
| 590 |
} |
|
| 591 |
|
|
| 592 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 593 |
|
|
| 594 |
VertexEffect[] createVertexEffectsSkewbFace() |
|
| 595 |
{
|
|
| 596 |
Static3D center = new Static3D(0,0,0); |
|
| 597 |
Static3D axisX = new Static3D(1,0,0); |
|
| 598 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 599 |
float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3)); |
|
| 600 |
|
|
| 601 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 602 |
|
|
| 603 |
effect[0] = new VertexEffectRotate( new Static1D(angle), axisX, center); |
|
| 604 |
effect[1] = new VertexEffectRotate( new Static1D( 135), axisZ, center); |
|
| 605 |
effect[2] = new VertexEffectRotate( new Static1D( 45), axisZ, center); |
|
| 606 |
effect[3] = new VertexEffectRotate( new Static1D( -45), axisZ, center); |
|
| 607 |
effect[4] = new VertexEffectRotate( new Static1D( -135), axisZ, center); |
|
| 608 |
effect[5] = new VertexEffectMove( new Static3D(0,0,-0.5f) ); |
|
| 609 |
|
|
| 610 |
effect[0].setMeshAssociation(30,-1); // meshes 1,2,3,4 |
|
| 611 |
effect[1].setMeshAssociation( 2,-1); // mesh 1 |
|
| 612 |
effect[2].setMeshAssociation( 5,-1); // meshes 0,2 |
|
| 613 |
effect[3].setMeshAssociation( 8,-1); // mesh 3 |
|
| 614 |
effect[4].setMeshAssociation(16,-1); // mesh 4 |
|
| 615 |
effect[5].setMeshAssociation(30,-1); // meshes 1,2,3,4 |
|
| 616 |
|
|
| 617 |
return effect; |
|
| 618 |
} |
|
| 619 |
|
|
| 620 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 621 |
|
|
| 622 |
VertexEffect[] createVertexEffectsOcta() |
|
| 623 |
{
|
|
| 624 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
|
| 625 |
Static1D angle1= new Static1D( 90); |
|
| 626 |
Static1D angle2= new Static1D(180); |
|
| 627 |
Static1D angle3= new Static1D(270); |
|
| 628 |
Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0); |
|
| 629 |
Static3D axisX = new Static3D(1,0,0); |
|
| 630 |
Static3D axisY = new Static3D(0,1,0); |
|
| 631 |
Static3D cent0 = new Static3D(0,0,0); |
|
| 632 |
Static3D cent1 = new Static3D(0,SQ2/2,0); |
|
| 633 |
Static3D flipY = new Static3D( 1,-1, 1); |
|
| 634 |
|
|
| 635 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 636 |
|
|
| 637 |
effect[0] = new VertexEffectMove(move1); |
|
| 638 |
effect[1] = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 639 |
effect[2] = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 640 |
effect[3] = new VertexEffectRotate(angle2, axisY, cent0); |
|
| 641 |
effect[4] = new VertexEffectRotate(angle3, axisY, cent0); |
|
| 642 |
effect[5] = new VertexEffectScale(flipY); |
|
| 643 |
|
|
| 644 |
effect[2].setMeshAssociation ( 34,-1); // apply to meshes 1 & 5 |
|
| 645 |
effect[3].setMeshAssociation ( 68,-1); // apply to meshes 2 & 6 |
|
| 646 |
effect[4].setMeshAssociation (136,-1); // apply to meshes 3 & 7 |
|
| 647 |
effect[5].setMeshAssociation (240,-1); // apply to meshes 4,5,6,7 |
|
| 648 |
|
|
| 649 |
return effect; |
|
| 650 |
} |
|
| 651 |
|
|
| 652 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 653 |
|
|
| 654 |
VertexEffect[] createVertexEffectsTetra() |
|
| 655 |
{
|
|
| 656 |
Static3D flipZ = new Static3D( 1, 1,-1); |
|
| 657 |
|
|
| 658 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
|
| 659 |
Static1D angle1= new Static1D( 90); |
|
| 660 |
Static1D angle2= new Static1D(180); |
|
| 661 |
Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0); |
|
| 662 |
|
|
| 663 |
Static3D axisX = new Static3D(1,0,0); |
|
| 664 |
Static3D axisY = new Static3D(0,1,0); |
|
| 665 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 666 |
|
|
| 667 |
Static3D cent0 = new Static3D(0,0,0); |
|
| 668 |
Static3D cent1 = new Static3D(0,SQ2/4,0); |
|
| 669 |
|
|
| 670 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 671 |
|
|
| 672 |
effect[0] = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 673 |
effect[1] = new VertexEffectMove(move1); |
|
| 674 |
effect[2] = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 675 |
effect[3] = new VertexEffectScale(flipZ); |
|
| 676 |
effect[4] = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 677 |
effect[5] = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 678 |
|
|
| 679 |
effect[0].setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 680 |
effect[1].setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 681 |
effect[2].setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 682 |
effect[3].setMeshAssociation(10,-1); // meshes 1 & 3 |
|
| 683 |
effect[4].setMeshAssociation(12,-1); // meshes 2 & 3 |
|
| 684 |
effect[5].setMeshAssociation(12,-1); // meshes 2 & 3 |
|
| 685 |
|
|
| 686 |
return effect; |
|
| 687 |
} |
|
| 688 |
|
|
| 689 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 690 |
|
|
| 691 |
VertexEffect[] createVertexEffectsDino() |
|
| 692 |
{
|
|
| 693 |
float E = 0.5f*SQ2; |
|
| 694 |
float F = 0.5f; |
|
| 695 |
final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2))); |
|
| 696 |
|
|
| 697 |
Static1D angle1 = new Static1D(+ANGLE); |
|
| 698 |
Static1D angle2 = new Static1D(-ANGLE); |
|
| 699 |
Static3D axisX = new Static3D(1,0,0); |
|
| 700 |
Static3D axisY = new Static3D(0,1,0); |
|
| 701 |
Static3D axisZ = new Static3D(0,-1,1); |
|
| 702 |
Static3D center0= new Static3D(0,0,0); |
|
| 703 |
Static3D center1= new Static3D(0,-3*F,0); |
|
| 704 |
|
|
| 705 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 706 |
|
|
| 707 |
effect[0] = new VertexEffectScale ( new Static3D(3,3,3) ); |
|
| 708 |
effect[1] = new VertexEffectMove ( new Static3D(0,-F,0) ); |
|
| 709 |
effect[2] = new VertexEffectRotate( new Static1D(90), axisX, center0 ); |
|
| 710 |
effect[3] = new VertexEffectScale ( new Static3D(1,-1,1) ); |
|
| 711 |
effect[4] = new VertexEffectMove ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) ); |
|
| 712 |
effect[5] = new VertexEffectRotate( new Static1D(+90), axisY, center1 ); |
|
| 713 |
effect[6] = new VertexEffectScale ( new Static3D(-1,1,1) ); |
|
| 714 |
effect[7] = new VertexEffectRotate( new Static1D( 45), axisX, center1 ); |
|
| 715 |
effect[8] = new VertexEffectRotate( angle1 , axisZ, center1 ); |
|
| 716 |
effect[9] = new VertexEffectRotate( angle2 , axisZ, center1 ); |
|
| 717 |
|
|
| 718 |
effect[0].setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 719 |
effect[1].setMeshAssociation( 3,-1); // apply to meshes 0,1 |
|
| 720 |
effect[2].setMeshAssociation( 2,-1); // apply to mesh 1 |
|
| 721 |
effect[3].setMeshAssociation( 2,-1); // apply to mesh 0 |
|
| 722 |
effect[4].setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 723 |
effect[5].setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 724 |
effect[6].setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 725 |
effect[7].setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 726 |
effect[8].setMeshAssociation( 4,-1); // apply to mesh 2 |
|
| 727 |
effect[9].setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 728 |
|
|
| 729 |
return effect; |
|
| 730 |
} |
|
| 731 |
|
|
| 732 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 733 |
|
|
| 734 |
VertexEffect[] createVertexEffectsHelicopterCorner() |
|
| 735 |
{
|
|
| 736 |
float E = 0.5f; |
|
| 737 |
|
|
| 738 |
Static3D axisX = new Static3D(1,0,0); |
|
| 739 |
Static3D axisY = new Static3D(0,1,0); |
|
| 740 |
Static3D axis0 = new Static3D(-SQ2/2,0,SQ2/2); |
|
| 741 |
Static3D axis1 = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3); |
|
| 742 |
Static1D angle1 = new Static1D(+90); |
|
| 743 |
Static1D angle2 = new Static1D(-90); |
|
| 744 |
Static1D angle3 = new Static1D(-135); |
|
| 745 |
Static1D angle4 = new Static1D(90); |
|
| 746 |
Static1D angle5 = new Static1D(120); |
|
| 747 |
Static1D angle6 = new Static1D(240); |
|
| 748 |
Static3D center1= new Static3D(0,0,0); |
|
| 749 |
Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f); |
|
| 750 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
|
| 751 |
Static3D move2 = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f); |
|
| 752 |
|
|
| 753 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 754 |
|
|
| 755 |
effect[0] = new VertexEffectMove(move1); |
|
| 756 |
effect[1] = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 757 |
effect[2] = new VertexEffectRotate(angle1,axisX,center1); |
|
| 758 |
effect[3] = new VertexEffectRotate(angle2,axisY,center1); |
|
| 759 |
effect[4] = new VertexEffectMove(move2); |
|
| 760 |
effect[5] = new VertexEffectRotate(angle1,axisX,center2); |
|
| 761 |
effect[6] = new VertexEffectRotate(angle3,axisY,center2); |
|
| 762 |
effect[7] = new VertexEffectRotate(angle4,axis0,center2); |
|
| 763 |
effect[8] = new VertexEffectRotate(angle5,axis1,center2); |
|
| 764 |
effect[9] = new VertexEffectRotate(angle6,axis1,center2); |
|
| 765 |
|
|
| 766 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 767 |
effect[1].setMeshAssociation( 6,-1); // meshes 1,2 |
|
| 768 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 769 |
effect[3].setMeshAssociation( 4,-1); // mesh 2 |
|
| 770 |
effect[4].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 771 |
effect[5].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 772 |
effect[6].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 773 |
effect[7].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 774 |
effect[8].setMeshAssociation(16,-1); // mesh 4 |
|
| 775 |
effect[9].setMeshAssociation(32,-1); // mesh 5 |
|
| 776 |
|
|
| 777 |
return effect; |
|
| 778 |
} |
|
| 779 |
|
|
| 780 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 781 |
|
|
| 782 |
VertexEffect[] createVertexEffectsHelicopterFace() |
|
| 783 |
{
|
|
| 784 |
float E = 0.5f; |
|
| 785 |
float F = SQ2/4; |
|
| 786 |
|
|
| 787 |
Static3D move0 = new Static3D(-E/4, -E/4, 0); |
|
| 788 |
Static3D move1 = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0); |
|
| 789 |
Static3D move2 = new Static3D(-E/2, F/3, 0); |
|
| 790 |
Static3D move3 = new Static3D(+E/2, F/3, 0); |
|
| 791 |
Static3D move4 = new Static3D(+E/3,+E/3, 0); |
|
| 792 |
Static1D angle1 = new Static1D(135); |
|
| 793 |
Static1D angle2 = new Static1D(90); |
|
| 794 |
Static1D angle3 = new Static1D(-90); |
|
| 795 |
Static1D angle4 = new Static1D(-135); |
|
| 796 |
Static3D axisX = new Static3D(1,0,0); |
|
| 797 |
Static3D axisY = new Static3D(0,1,0); |
|
| 798 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 799 |
Static3D axis1 = new Static3D(1,-1,0); |
|
| 800 |
Static3D center = new Static3D(0,0,0); |
|
| 801 |
Static3D center1= new Static3D(-E/2,-E/2,0); |
|
| 802 |
|
|
| 803 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 804 |
|
|
| 805 |
effect[0] = new VertexEffectMove(move0); |
|
| 806 |
effect[1] = new VertexEffectRotate(angle1, axisZ, center); |
|
| 807 |
effect[2] = new VertexEffectMove(move1); |
|
| 808 |
effect[3] = new VertexEffectRotate(angle2, axis1, center1); |
|
| 809 |
effect[4] = new VertexEffectMove(move2); |
|
| 810 |
effect[5] = new VertexEffectMove(move3); |
|
| 811 |
effect[6] = new VertexEffectRotate(angle3, axisZ, center); |
|
| 812 |
effect[7] = new VertexEffectRotate(angle4, axisX, center); |
|
| 813 |
effect[8] = new VertexEffectRotate(angle1, axisY, center); |
|
| 814 |
effect[9] = new VertexEffectMove(move4); |
|
| 815 |
|
|
| 816 |
effect[0].setMeshAssociation( 1,-1); // mesh 0 |
|
| 817 |
effect[1].setMeshAssociation( 2,-1); // mesh 1 |
|
| 818 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 819 |
effect[3].setMeshAssociation( 2,-1); // mesh 1 |
|
| 820 |
effect[4].setMeshAssociation( 4,-1); // mesh 2 |
|
| 821 |
effect[5].setMeshAssociation( 8,-1); // mesh 3 |
|
| 822 |
effect[6].setMeshAssociation( 8,-1); // mesh 3 |
|
| 823 |
effect[7].setMeshAssociation( 4,-1); // mesh 2 |
|
| 824 |
effect[8].setMeshAssociation( 8,-1); // mesh 3 |
|
| 825 |
effect[9].setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 826 |
|
|
| 827 |
return effect; |
|
| 828 |
} |
|
| 829 |
|
|
| 830 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 831 |
|
|
| 832 |
VertexEffect[] createVertexEffectsRediEdge() |
|
| 833 |
{
|
|
| 834 |
Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f); |
|
| 835 |
Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f); |
|
| 836 |
Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f); |
|
| 837 |
Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8); |
|
| 838 |
Static3D flipZ = new Static3D(1,1,-1); |
|
| 839 |
Static3D flipX = new Static3D(-1,1,1); |
|
| 840 |
Static3D scale = new Static3D(2,2,2); |
|
| 841 |
Static3D cent0 = new Static3D(0,0, 0); |
|
| 842 |
Static3D cent1 = new Static3D(0,0, -1.5f); |
|
| 843 |
Static3D axisX = new Static3D(1,0, 0); |
|
| 844 |
Static3D axisY = new Static3D(0,1, 0); |
|
| 845 |
Static3D axis = new Static3D(0,SQ2/2,-SQ2/2); |
|
| 846 |
Static1D angle1= new Static1D(90); |
|
| 847 |
Static1D angle2= new Static1D(45); |
|
| 848 |
Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) ); |
|
| 849 |
|
|
| 850 |
VertexEffect[] effect = new VertexEffect[12]; |
|
| 851 |
|
|
| 852 |
effect[0] = new VertexEffectScale(scale); |
|
| 853 |
effect[1] = new VertexEffectMove(move0); |
|
| 854 |
effect[2] = new VertexEffectScale(flipZ); |
|
| 855 |
effect[3] = new VertexEffectRotate(angle1,axisX,cent0); |
|
| 856 |
effect[4] = new VertexEffectMove(move1); |
|
| 857 |
effect[5] = new VertexEffectRotate(angle1,axisY,cent0); |
|
| 858 |
effect[6] = new VertexEffectMove(move2); |
|
| 859 |
effect[7] = new VertexEffectScale(flipX); |
|
| 860 |
effect[8] = new VertexEffectRotate(angle2,axisX,cent0); |
|
| 861 |
effect[9] = new VertexEffectMove(move3); |
|
| 862 |
effect[10]= new VertexEffectRotate(angle3,axis ,cent1); |
|
| 863 |
effect[11]= new VertexEffectScale(flipX); |
|
| 864 |
|
|
| 865 |
effect[0].setMeshAssociation(63,-1); // meshes 0,1,2,3,4,5 |
|
| 866 |
effect[1].setMeshAssociation( 3,-1); // meshes 0,1 |
|
| 867 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 868 |
effect[3].setMeshAssociation( 2,-1); // mesh 1 |
|
| 869 |
effect[4].setMeshAssociation(12,-1); // meshes 2,3 |
|
| 870 |
effect[5].setMeshAssociation(60,-1); // meshes 2,3,4,5 |
|
| 871 |
effect[6].setMeshAssociation(12,-1); // meshes 2,3 |
|
| 872 |
effect[7].setMeshAssociation( 8,-1); // mesh 3 |
|
| 873 |
effect[8].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 874 |
effect[9].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 875 |
effect[10].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 876 |
effect[11].setMeshAssociation(32,-1); // mesh 5 |
|
| 877 |
|
|
| 878 |
return effect; |
|
| 879 |
} |
|
| 880 |
|
|
| 881 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 882 |
|
|
| 883 |
VertexEffect[] createVertexEffectsRediCorner() |
|
| 884 |
{
|
|
| 885 |
Static3D axisY = new Static3D(0,1,0); |
|
| 886 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1024 | 887 |
Static3D axisZ = new Static3D(0,0,1); |
| 1025 | 888 |
Static3D center = new Static3D(0,0,0); |
| 1026 | 889 |
Static1D angle90 = new Static1D(90); |
| 1027 | 890 |
Static1D angle270= new Static1D(270); |
| 1028 | 891 |
Static1D angle45 = new Static1D(-45); |
| 1029 | 892 |
|
| 1030 |
VertexEffect effect0 = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 1031 |
VertexEffect effect1 = new VertexEffectRotate( angle270, axisX, center ); |
|
| 1032 |
VertexEffect effect2 = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 1033 |
VertexEffect effect3 = new VertexEffectRotate( angle45 , axisX, center ); |
|
| 1034 |
VertexEffect effect4 = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 1035 |
VertexEffect effect5 = new VertexEffectRotate( angle270, axisZ, center ); |
|
| 1036 |
|
|
| 1037 |
effect0.setMeshAssociation( 7,-1); // 0,1,2 |
|
| 1038 |
effect1.setMeshAssociation( 2,-1); // 1 |
|
| 1039 |
effect2.setMeshAssociation( 4,-1); // 2 |
|
| 1040 |
effect3.setMeshAssociation(56,-1); // 3 |
|
| 1041 |
effect4.setMeshAssociation(16,-1); // 4 |
|
| 1042 |
effect5.setMeshAssociation(32,-1); // 5 |
|
| 1043 |
|
|
| 1044 |
mesh.apply(effect0); |
|
| 1045 |
mesh.apply(effect1); |
|
| 1046 |
mesh.apply(effect2); |
|
| 1047 |
mesh.apply(effect3); |
|
| 1048 |
mesh.apply(effect4); |
|
| 1049 |
mesh.apply(effect5); |
|
| 893 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 894 |
|
|
| 895 |
effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 896 |
effect[1] = new VertexEffectRotate( angle270, axisX, center ); |
|
| 897 |
effect[2] = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 898 |
effect[3] = new VertexEffectRotate( angle45 , axisX, center ); |
|
| 899 |
effect[4] = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 900 |
effect[5] = new VertexEffectRotate( angle270, axisZ, center ); |
|
| 901 |
|
|
| 902 |
effect[0].setMeshAssociation( 7,-1); // 0,1,2 |
|
| 903 |
effect[1].setMeshAssociation( 2,-1); // 1 |
|
| 904 |
effect[2].setMeshAssociation( 4,-1); // 2 |
|
| 905 |
effect[3].setMeshAssociation(56,-1); // 3 |
|
| 906 |
effect[4].setMeshAssociation(16,-1); // 4 |
|
| 907 |
effect[5].setMeshAssociation(32,-1); // 5 |
|
| 908 |
|
|
| 909 |
return effect; |
|
| 910 |
} |
|
| 911 |
|
|
| 912 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 913 |
// OBJECTS |
|
| 914 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 915 |
// CUBE |
|
| 916 |
|
|
| 917 |
MeshBase createCubeMesh(int index) |
|
| 918 |
{
|
|
| 919 |
MeshBase mesh = createFacesCube(index); |
|
| 920 |
VertexEffect[] effects = createVertexEffectsCube(); |
|
| 921 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 922 |
|
|
| 923 |
Static3D roundingCenter = new Static3D(0,0,0); |
|
| 924 |
Static3D[] vertices = new Static3D[8]; |
|
| 925 |
vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f); |
|
| 926 |
vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f); |
|
| 927 |
vertices[2] = new Static3D(+0.5f,-0.5f,+0.5f); |
|
| 928 |
vertices[3] = new Static3D(+0.5f,-0.5f,-0.5f); |
|
| 929 |
vertices[4] = new Static3D(-0.5f,+0.5f,+0.5f); |
|
| 930 |
vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f); |
|
| 931 |
vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f); |
|
| 932 |
vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 933 |
|
|
| 934 |
roundCorners(mesh,roundingCenter,vertices,0.06f,0.12f); |
|
| 935 |
|
|
| 936 |
mesh.mergeEffComponents(); |
|
| 937 |
|
|
| 938 |
return mesh; |
|
| 939 |
} |
|
| 940 |
|
|
| 941 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 942 |
// SKEWB |
|
| 943 |
|
|
| 944 |
MeshBase createSkewbCornerMesh() |
|
| 945 |
{
|
|
| 946 |
MeshBase mesh = createFacesSkewbCorner(); |
|
| 947 |
VertexEffect[] effects = createVertexEffectsSkewbCorner(); |
|
| 948 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 949 |
|
|
| 950 |
float E = 0.5f; |
|
| 951 |
Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2); |
|
| 952 |
|
|
| 953 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 954 |
verticesType1[0] = new Static3D(0.0f,0.0f,0.0f); |
|
| 955 |
roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f); |
|
| 956 |
|
|
| 957 |
Static3D[] verticesType2 = new Static3D[3]; |
|
| 958 |
verticesType2[0] = new Static3D(-E, 0, 0); |
|
| 959 |
verticesType2[1] = new Static3D( 0,-E, 0); |
|
| 960 |
verticesType2[2] = new Static3D( 0, 0,-E); |
|
| 961 |
roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f); |
|
| 962 |
|
|
| 963 |
mesh.mergeEffComponents(); |
|
| 964 |
|
|
| 965 |
return mesh; |
|
| 966 |
} |
|
| 967 |
|
|
| 968 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 969 |
|
|
| 970 |
MeshBase createSkewbFaceMesh() |
|
| 971 |
{
|
|
| 972 |
MeshBase mesh = createFacesSkewbFace(); |
|
| 973 |
VertexEffect[] effects = createVertexEffectsSkewbFace(); |
|
| 974 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 975 |
|
|
| 976 |
Static3D roundingCenter = new Static3D(0,0,-0.2f); |
|
| 977 |
float E = SQ2/4; |
|
| 978 |
Static3D[] vertices = new Static3D[4]; |
|
| 979 |
vertices[0] = new Static3D(-E*SQ2, 0, 0); |
|
| 980 |
vertices[1] = new Static3D(+E*SQ2, 0, 0); |
|
| 981 |
vertices[2] = new Static3D( 0, -E*SQ2, 0); |
|
| 982 |
vertices[3] = new Static3D( 0, +E*SQ2, 0); |
|
| 983 |
roundCorners(mesh,roundingCenter,vertices,0.10f,0.10f); |
|
| 984 |
|
|
| 985 |
mesh.mergeEffComponents(); |
|
| 986 |
mesh.addEmptyTexComponent(); |
|
| 987 |
|
|
| 988 |
return mesh; |
|
| 989 |
} |
|
| 990 |
|
|
| 991 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 992 |
// SKEWB DIAMOND / PYRAMINX |
|
| 993 |
|
|
| 994 |
MeshBase createOctaMesh() |
|
| 995 |
{
|
|
| 996 |
MeshBase mesh = createFacesOcta(); |
|
| 997 |
VertexEffect[] effects = createVertexEffectsOcta(); |
|
| 998 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 999 |
|
|
| 1000 |
Static3D roundingCenter = new Static3D(0,0,0); |
|
| 1001 |
Static3D[] vertices = new Static3D[6]; |
|
| 1002 |
vertices[0] = new Static3D( 0, SQ2/2, 0 ); |
|
| 1003 |
vertices[1] = new Static3D( 0.5f, 0, 0.5f ); |
|
| 1004 |
vertices[2] = new Static3D(-0.5f, 0, 0.5f ); |
|
| 1005 |
vertices[3] = new Static3D( 0,-SQ2/2, 0 ); |
|
| 1006 |
vertices[4] = new Static3D(-0.5f, 0,-0.5f ); |
|
| 1007 |
vertices[5] = new Static3D( 0.5f, 0,-0.5f ); |
|
| 1008 |
|
|
| 1009 |
roundCorners(mesh,roundingCenter,vertices,0.06f,0.20f); |
|
| 1010 |
|
|
| 1011 |
mesh.mergeEffComponents(); |
|
| 1012 |
|
|
| 1013 |
return mesh; |
|
| 1014 |
} |
|
| 1015 |
|
|
| 1016 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1017 |
|
|
| 1018 |
MeshBase createTetraMesh() |
|
| 1019 |
{
|
|
| 1020 |
MeshBase mesh = createFacesTetra(); |
|
| 1021 |
VertexEffect[] effects = createVertexEffectsTetra(); |
|
| 1022 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 1023 |
|
|
| 1024 |
Static3D roundingCenter = new Static3D(0,0,0); |
|
| 1025 |
Static3D[] verticesRound = new Static3D[4]; |
|
| 1026 |
verticesRound[0] = new Static3D(-0.5f,+SQ2/4, 0 ); |
|
| 1027 |
verticesRound[1] = new Static3D(+0.5f,+SQ2/4, 0 ); |
|
| 1028 |
verticesRound[2] = new Static3D( 0,-SQ2/4,+0.5f); |
|
| 1029 |
verticesRound[3] = new Static3D( 0,-SQ2/4,-0.5f); |
|
| 1030 |
roundCorners(mesh,roundingCenter,verticesRound,0.08f,0.15f); |
|
| 1031 |
|
|
| 1032 |
mesh.mergeEffComponents(); |
|
| 1033 |
mesh.addEmptyTexComponent(); |
|
| 1034 |
mesh.addEmptyTexComponent(); |
|
| 1035 |
mesh.addEmptyTexComponent(); |
|
| 1036 |
mesh.addEmptyTexComponent(); |
|
| 1037 |
|
|
| 1038 |
return mesh; |
|
| 1039 |
} |
|
| 1050 | 1040 |
|
| 1041 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1042 |
// DINO |
|
| 1043 |
|
|
| 1044 |
MeshBase createDinoMesh() |
|
| 1045 |
{
|
|
| 1046 |
MeshBase mesh = createFacesDino(); |
|
| 1047 |
VertexEffect[] effects = createVertexEffectsDino(); |
|
| 1048 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 1049 |
|
|
| 1050 |
float F = 0.5f; |
|
| 1051 |
Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F); |
|
| 1052 |
Static3D[] verticesRound = new Static3D[4]; |
|
| 1053 |
verticesRound[0] = new Static3D( 0,-3*F, 0 ); |
|
| 1054 |
verticesRound[1] = new Static3D( 0, 0, -3*F ); |
|
| 1055 |
verticesRound[2] = new Static3D( -3*F, 0, 0 ); |
|
| 1056 |
verticesRound[3] = new Static3D( +3*F, 0, 0 ); |
|
| 1057 |
roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f); |
|
| 1058 |
|
|
| 1059 |
mesh.mergeEffComponents(); |
|
| 1060 |
|
|
| 1061 |
return mesh; |
|
| 1062 |
} |
|
| 1063 |
|
|
| 1064 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1065 |
// Helicopter |
|
| 1066 |
|
|
| 1067 |
MeshBase createHelicopterCornerMesh() |
|
| 1068 |
{
|
|
| 1069 |
MeshBase mesh = createFacesHelicopterCorner(); |
|
| 1070 |
VertexEffect[] effects = createVertexEffectsHelicopterCorner(); |
|
| 1071 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 1072 |
|
|
| 1073 |
float E = 0.5f; |
|
| 1074 |
Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2); |
|
| 1075 |
|
|
| 1076 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 1077 |
verticesType1[0] = new Static3D(0.0f,0.0f,0.0f); |
|
| 1078 |
roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f); |
|
| 1079 |
|
|
| 1080 |
Static3D[] verticesType2 = new Static3D[3]; |
|
| 1081 |
verticesType2[0] = new Static3D(-E, 0, 0); |
|
| 1082 |
verticesType2[1] = new Static3D( 0,-E, 0); |
|
| 1083 |
verticesType2[2] = new Static3D( 0, 0,-E); |
|
| 1084 |
roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f); |
|
| 1085 |
|
|
| 1086 |
mesh.mergeEffComponents(); |
|
| 1087 |
|
|
| 1088 |
return mesh; |
|
| 1089 |
} |
|
| 1090 |
|
|
| 1091 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1092 |
|
|
| 1093 |
MeshBase createHelicopterFaceMesh() |
|
| 1094 |
{
|
|
| 1095 |
MeshBase mesh = createFacesHelicopterFace(); |
|
| 1096 |
VertexEffect[] effects = createVertexEffectsHelicopterFace(); |
|
| 1097 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 1098 |
|
|
| 1099 |
float E = 0.5f; |
|
| 1100 |
Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2); |
|
| 1101 |
|
|
| 1102 |
Static3D[] verticesType1 = new Static3D[1]; |
|
| 1103 |
verticesType1[0] = new Static3D(E/3,E/3,0.0f); |
|
| 1104 |
roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f); |
|
| 1105 |
|
|
| 1106 |
Static3D[] verticesType2 = new Static3D[2]; |
|
| 1107 |
verticesType2[0] = new Static3D(-E+E/3, E/3 , 0); |
|
| 1108 |
verticesType2[1] = new Static3D( E/3 ,-E+E/3, 0); |
|
| 1109 |
roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f); |
|
| 1110 |
|
|
| 1111 |
mesh.mergeEffComponents(); |
|
| 1112 |
mesh.addEmptyTexComponent(); |
|
| 1113 |
mesh.addEmptyTexComponent(); |
|
| 1114 |
|
|
| 1115 |
return mesh; |
|
| 1116 |
} |
|
| 1117 |
|
|
| 1118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1119 |
// Redi cube |
|
| 1120 |
|
|
| 1121 |
MeshBase createRediEdgeMesh() |
|
| 1122 |
{
|
|
| 1123 |
MeshBase mesh = createFacesRediEdge(); |
|
| 1124 |
VertexEffect[] effects = createVertexEffectsRediEdge(); |
|
| 1125 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 1126 |
|
|
| 1127 |
Static3D center = new Static3D(0.0f,-0.75f,-0.75f); |
|
| 1128 |
Static3D[] vertices = new Static3D[4]; |
|
| 1129 |
vertices[0] = new Static3D( 0.5f, 0.0f, 0.0f); |
|
| 1130 |
vertices[1] = new Static3D(-0.5f, 0.0f, 0.0f); |
|
| 1131 |
vertices[2] = new Static3D(0.0f, 0.0f,-1.5f); |
|
| 1132 |
vertices[3] = new Static3D(0.0f,-1.5f, 0.0f); |
|
| 1133 |
|
|
| 1134 |
roundCorners(mesh,center,vertices,0.06f,0.20f); |
|
| 1135 |
|
|
| 1136 |
mesh.mergeEffComponents(); |
|
| 1137 |
|
|
| 1138 |
return mesh; |
|
| 1139 |
} |
|
| 1140 |
|
|
| 1141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1142 |
|
|
| 1143 |
MeshBase createRediCornerMesh() |
|
| 1144 |
{
|
|
| 1145 |
MeshBase mesh = createFacesRediCorner(); |
|
| 1146 |
VertexEffect[] effects = createVertexEffectsRediCorner(); |
|
| 1147 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
| 1148 |
|
|
| 1149 |
Static3D center = new Static3D(0,0,0); |
|
| 1051 | 1150 |
Static3D[] vertices = new Static3D[8]; |
| 1052 | 1151 |
vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f); |
| 1053 | 1152 |
vertices[1] = new Static3D(+0.5f,+0.5f,-0.5f); |
Also available in: Unified diff
More unification in CubitFactory.