Revision 33647db9
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/examples/meshfile/FactoryCubit.java | ||
|---|---|---|
| 22 | 22 |
import org.distorted.library.effect.VertexEffect; |
| 23 | 23 |
import org.distorted.library.effect.VertexEffectDeform; |
| 24 | 24 |
import org.distorted.library.effect.VertexEffectMove; |
| 25 |
import org.distorted.library.effect.VertexEffectRotate;
|
|
| 25 |
import org.distorted.library.effect.VertexEffectQuaternion;
|
|
| 26 | 26 |
import org.distorted.library.effect.VertexEffectScale; |
| 27 | 27 |
import org.distorted.library.mesh.MeshBase; |
| 28 | 28 |
import org.distorted.library.mesh.MeshJoined; |
| ... | ... | |
| 31 | 31 |
import org.distorted.library.type.Static3D; |
| 32 | 32 |
import org.distorted.library.type.Static4D; |
| 33 | 33 |
|
| 34 |
import java.util.ArrayList; |
|
| 35 |
|
|
| 34 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 35 | 37 |
|
| 36 | 38 |
class FactoryCubit |
| 37 | 39 |
{
|
| 38 |
private static final float SQ2 = (float)Math.sqrt(2); |
|
| 39 |
private static final float SQ3 = (float)Math.sqrt(3); |
|
| 40 |
private static final float SQ5 = (float)Math.sqrt(5); |
|
| 41 |
private static final float SQ6 = (float)Math.sqrt(6); |
|
| 42 |
|
|
| 43 |
private static final float IVY_D = 0.003f; |
|
| 44 |
private static final int IVY_N = 8; |
|
| 45 |
private static final float IVY_C = 0.59f; |
|
| 46 |
private static final float IVY_M = 0.35f; |
|
| 47 |
private static final float REX_D = 0.2f; |
|
| 48 |
private static final int REX_N = 5; |
|
| 49 |
private static final float MEGA_D = 0.04f; |
|
| 50 |
|
|
| 51 |
static final float SIN18 = (SQ5-1)/4; |
|
| 52 |
static final float COS18 = (float)(0.25f*Math.sqrt(10.0f+2.0f*SQ5)); |
|
| 53 |
static final float SIN54 = (SQ5+1)/4; |
|
| 54 |
static final float COS54 = (float)(Math.sqrt(10-2*SQ5)/4); |
|
| 55 |
static final float COS_HALFD= (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle) |
|
| 56 |
static final float SIN_HALFD= (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle) |
|
| 57 |
|
|
| 58 |
static final float DIHEDRAL1= (float)(Math.acos(-SQ5/5)*180/Math.PI); |
|
| 59 |
static final float DIHEDRAL2= (float)((180/Math.PI)*Math.asin((2*SIN54*SIN54-1)/COS54) - 90); |
|
| 40 |
static final float SQ5 = (float)Math.sqrt(5); |
|
| 41 |
static final float SIN18 = (SQ5-1)/4; |
|
| 42 |
static final float COS18 = (float)(0.25f*Math.sqrt(10.0f+2.0f*SQ5)); |
|
| 43 |
|
|
| 44 |
private static final float[] mBuffer = new float[3]; |
|
| 45 |
private static final float[] mQuat1 = new float[4]; |
|
| 46 |
private static final float[] mQuat2 = new float[4]; |
|
| 47 |
private static final float[] mQuat3 = new float[4]; |
|
| 60 | 48 |
|
| 61 | 49 |
private static final Static1D RADIUS = new Static1D(1); |
| 62 | 50 |
|
| 63 | 51 |
private static FactoryCubit mThis; |
| 64 | 52 |
|
| 53 |
private static class FaceInfo |
|
| 54 |
{
|
|
| 55 |
float[] vertices; |
|
| 56 |
float vx,vy,vz; |
|
| 57 |
float scale; |
|
| 58 |
float qx,qy,qz,qw; |
|
| 59 |
boolean flip; |
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
private static final ArrayList<FaceInfo> mFaceInfo = new ArrayList<>(); |
|
| 63 |
|
|
| 65 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 66 | 65 |
|
| 67 | 66 |
private FactoryCubit() |
| ... | ... | |
| 207 | 206 |
} |
| 208 | 207 |
} |
| 209 | 208 |
|
| 210 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 211 |
// Compute (rx,ry) - coords of a point which is the result of rotation by angle 'radians' of the point |
|
| 212 |
// (px,py) along axis Z. Center of rotation: (cx,cy). Rotation is counterclockwise! |
|
| 213 |
// Write (rx,ry) to array[index] and array[index+1]. |
|
| 214 |
|
|
| 215 |
private void writeVertex( float cx, float cy, float px, float py, float radians, float[] array, int index) |
|
| 216 |
{
|
|
| 217 |
float vx = px-cx; |
|
| 218 |
float vy = py-cy; |
|
| 219 |
|
|
| 220 |
float sinA = (float)Math.sin(radians); |
|
| 221 |
float cosA = (float)Math.cos(radians); |
|
| 222 |
|
|
| 223 |
float rvx = vx*cosA - vy*sinA; |
|
| 224 |
float rvy = vx*sinA + vy*cosA; |
|
| 225 |
|
|
| 226 |
array[index ] = rvx + cx; |
|
| 227 |
array[index+1] = rvy + cy; |
|
| 228 |
} |
|
| 229 |
|
|
| 230 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 231 |
|
|
| 232 |
MeshBase createFacesCube(int sizeIndex) |
|
| 233 |
{
|
|
| 234 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 235 |
|
|
| 236 |
float E = 0.5f; |
|
| 237 |
int extraI, extraV, num; |
|
| 238 |
|
|
| 239 |
switch(sizeIndex) |
|
| 240 |
{
|
|
| 241 |
case 0 : num = 6; extraI = 2; extraV = 2; break; |
|
| 242 |
case 1 : num = 5; extraI = 2; extraV = 2; break; |
|
| 243 |
case 2 : num = 5; extraI = 1; extraV = 2; break; |
|
| 244 |
default: num = 4; extraI = 1; extraV = 1; break; |
|
| 245 |
} |
|
| 246 |
|
|
| 247 |
float[] vertices = { -E,-E, +E,-E, +E,+E, -E,+E };
|
|
| 248 |
float[] bands = computeBands(0.048f,35,E,0.7f,num); |
|
| 249 |
|
|
| 250 |
meshes[0] = new MeshPolygon(vertices,bands,extraI,extraV); |
|
| 251 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 252 |
meshes[1] = meshes[0].copy(true); |
|
| 253 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 254 |
meshes[2] = meshes[0].copy(true); |
|
| 255 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 256 |
meshes[3] = meshes[0].copy(true); |
|
| 257 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 258 |
meshes[4] = meshes[0].copy(true); |
|
| 259 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 260 |
meshes[5] = meshes[0].copy(true); |
|
| 261 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 262 |
|
|
| 263 |
return new MeshJoined(meshes); |
|
| 264 |
} |
|
| 265 |
|
|
| 266 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 267 |
|
|
| 268 |
MeshBase createFacesSkewbCorner() |
|
| 269 |
{
|
|
| 270 |
MeshBase[] meshes = new MeshBase[6]; |
|
| 271 |
|
|
| 272 |
float E = 0.5f; |
|
| 273 |
float F = SQ2/2; |
|
| 274 |
float G = SQ6/16; |
|
| 275 |
float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
|
|
| 276 |
float[] bands0 = computeBands(0.028f,35,E/3,0.7f,7); |
|
| 277 |
|
|
| 278 |
meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3); |
|
| 279 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 280 |
meshes[1] = meshes[0].copy(true); |
|
| 281 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 282 |
meshes[2] = meshes[0].copy(true); |
|
| 283 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 284 |
|
|
| 285 |
float[] vertices1 = { -F/2,-2*G, F/2,-2*G, 3*F/8,-G, 1*F/8,G, 0,2*G };
|
|
| 286 |
float[] bands1 = computeBands(0,0,1,0,3); |
|
| 287 |
|
|
| 288 |
meshes[3] = new MeshPolygon(vertices1,bands1,1,5); |
|
| 289 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 290 |
meshes[4] = meshes[3].copy(true); |
|
| 291 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 292 |
meshes[5] = meshes[3].copy(true); |
|
| 293 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 294 |
|
|
| 295 |
return new MeshJoined(meshes); |
|
| 296 |
} |
|
| 297 |
|
|
| 298 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 299 |
|
|
| 300 |
MeshBase createFacesSkewbFace() |
|
| 301 |
{
|
|
| 302 |
MeshBase[] meshes = new MeshBase[5]; |
|
| 303 |
|
|
| 304 |
float E = SQ2/4; |
|
| 305 |
float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
|
|
| 306 |
float[] bands0 = computeBands(0.051f,35,E/2,0.9f,7); |
|
| 307 |
|
|
| 308 |
meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3); |
|
| 309 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 310 |
|
|
| 311 |
float[] vertices1 = { -E,-SQ3*E, -E*0.7f,-SQ3*E, +E*0.7f,-SQ3*E, +E,-SQ3*E, 0,0 };
|
|
| 312 |
float[] bands1 = computeBands(0,0,1,0,3); |
|
| 313 |
|
|
| 314 |
meshes[1] = new MeshPolygon(vertices1,bands1,0,0); |
|
| 315 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 316 |
meshes[2] = meshes[1].copy(true); |
|
| 317 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 318 |
meshes[3] = meshes[1].copy(true); |
|
| 319 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 320 |
meshes[4] = meshes[1].copy(true); |
|
| 321 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 322 |
|
|
| 323 |
return new MeshJoined(meshes); |
|
| 324 |
} |
|
| 325 |
|
|
| 326 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 327 |
|
|
| 328 |
MeshBase createFacesOcta() |
|
| 329 |
{
|
|
| 330 |
MeshBase[] meshes = new MeshPolygon[8]; |
|
| 331 |
|
|
| 332 |
float E = 0.75f; |
|
| 333 |
float F = 0.5f; |
|
| 334 |
float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
|
|
| 335 |
float[] bands = computeBands(0.05f,35,F,0.8f,6); |
|
| 336 |
|
|
| 337 |
meshes[0] = new MeshPolygon(vertices, bands, 2,2); |
|
| 338 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 339 |
meshes[1] = meshes[0].copy(true); |
|
| 340 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 341 |
meshes[2] = meshes[0].copy(true); |
|
| 342 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 343 |
meshes[3] = meshes[0].copy(true); |
|
| 344 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 345 |
meshes[4] = meshes[0].copy(true); |
|
| 346 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 347 |
meshes[5] = meshes[0].copy(true); |
|
| 348 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 349 |
meshes[6] = meshes[0].copy(true); |
|
| 350 |
meshes[6].setEffectAssociation(0,64,0); |
|
| 351 |
meshes[7] = meshes[0].copy(true); |
|
| 352 |
meshes[7].setEffectAssociation(0,128,0); |
|
| 353 |
|
|
| 354 |
return new MeshJoined(meshes); |
|
| 355 |
} |
|
| 356 |
|
|
| 357 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 358 |
|
|
| 359 |
MeshBase createFacesTetra() |
|
| 360 |
{
|
|
| 361 |
MeshBase[] meshes = new MeshBase[4]; |
|
| 362 |
|
|
| 363 |
float E = 0.75f; |
|
| 364 |
float F = 0.5f; |
|
| 365 |
float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
|
|
| 366 |
float[] bands = computeBands(0.05f,35,F,0.8f,6); |
|
| 367 |
|
|
| 368 |
meshes[0] = new MeshPolygon(vertices, bands, 2,2); |
|
| 369 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 370 |
meshes[1] = meshes[0].copy(true); |
|
| 371 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 372 |
meshes[2] = meshes[0].copy(true); |
|
| 373 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 374 |
meshes[3] = meshes[0].copy(true); |
|
| 375 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 376 |
|
|
| 377 |
return new MeshJoined(meshes); |
|
| 378 |
} |
|
| 379 |
|
|
| 380 | 209 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 381 | 210 |
|
| 382 |
MeshBase createFacesDino()
|
|
| 211 |
private boolean areColinear(float[][] vertices, int index1, int index2, int index3)
|
|
| 383 | 212 |
{
|
| 384 |
MeshBase[] meshes = new MeshPolygon[4]; |
|
| 213 |
float x1 = vertices[index1][0]; |
|
| 214 |
float y1 = vertices[index1][1]; |
|
| 215 |
float z1 = vertices[index1][2]; |
|
| 216 |
float x2 = vertices[index2][0]; |
|
| 217 |
float y2 = vertices[index2][1]; |
|
| 218 |
float z2 = vertices[index2][2]; |
|
| 219 |
float x3 = vertices[index3][0]; |
|
| 220 |
float y3 = vertices[index3][1]; |
|
| 221 |
float z3 = vertices[index3][2]; |
|
| 385 | 222 |
|
| 386 |
float E = 0.5f*SQ2; |
|
| 387 |
float F = 0.5f; |
|
| 388 |
float[] vertices0 = { -F,F/3, 0,-2*F/3, +F,F/3 };
|
|
| 389 |
float[] bands0 = computeBands(0.028f,30,F/3,0.8f,7); |
|
| 223 |
float v1x = x2-x1; |
|
| 224 |
float v1y = y2-y1; |
|
| 225 |
float v1z = z2-z1; |
|
| 226 |
float v2x = x3-x1; |
|
| 227 |
float v2y = y3-y1; |
|
| 228 |
float v2z = z3-z1; |
|
| 390 | 229 |
|
| 391 |
meshes[0] = new MeshPolygon(vertices0, bands0, 2, 5); |
|
| 392 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 393 |
meshes[1] = meshes[0].copy(true); |
|
| 394 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 230 |
float A = (float)Math.sqrt( (v1x*v1x+v1y*v1y+v1z*v1z) / (v2x*v2x+v2y*v2y+v2z*v2z) ); |
|
| 395 | 231 |
|
| 396 |
float[] vertices1 = { -E/2,-E*(SQ3/6), E/2,-E*(SQ3/6), 0,E*(SQ3/3) };
|
|
| 397 |
float[] bands1 = computeBands(0.02f,45,F/3,0.2f,3); |
|
| 232 |
//android.util.Log.e("D", "("+x1+","+y1+","+z1+") , ("+x2+","+y2+","+z2+") , ("+x3+","+y3+","+z3+")" );
|
|
| 398 | 233 |
|
| 399 |
meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2); |
|
| 400 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 401 |
meshes[3] = meshes[2].copy(true); |
|
| 402 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 234 |
//boolean result = (v1x==A*v2x && v1y==A*v2y && v1z==A*v2z); |
|
| 403 | 235 |
|
| 404 |
return new MeshJoined(meshes); |
|
| 405 |
} |
|
| 406 |
|
|
| 407 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 236 |
//android.util.Log.e("D", "are those colinear? : "+result);
|
|
| 408 | 237 |
|
| 409 |
MeshBase createFacesHelicopterCorner() |
|
| 410 |
{
|
|
| 411 |
MeshBase[] meshes = new MeshBase[6]; |
|
| 412 |
|
|
| 413 |
float E = 0.5f; |
|
| 414 |
float F = SQ2/4; |
|
| 415 |
float G = 1.0f/12; |
|
| 416 |
float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
|
|
| 417 |
float[] bands0 = computeBands(0.028f,35,E/4,0.7f,7); |
|
| 418 |
|
|
| 419 |
meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3); |
|
| 420 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 421 |
meshes[1] = meshes[0].copy(true); |
|
| 422 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 423 |
meshes[2] = meshes[0].copy(true); |
|
| 424 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 425 |
|
|
| 426 |
float[] vertices1 = { -F,-G, 0,-G, +F,-G, 0,2*G };
|
|
| 427 |
float[] bands1 = computeBands(0.00f,0,0,0.0f,3); |
|
| 428 |
meshes[3] = new MeshPolygon(vertices1,bands1,1,5); |
|
| 429 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 430 |
meshes[4] = meshes[3].copy(true); |
|
| 431 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 432 |
meshes[5] = meshes[3].copy(true); |
|
| 433 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 434 |
|
|
| 435 |
return new MeshJoined(meshes); |
|
| 238 |
return (v1x==A*v2x && v1y==A*v2y && v1z==A*v2z); |
|
| 436 | 239 |
} |
| 437 | 240 |
|
| 438 | 241 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 439 | 242 |
|
| 440 |
MeshBase createFacesHelicopterFace()
|
|
| 243 |
private void computeNormalVector(float[][] vertices, int index1, int index2, int index3)
|
|
| 441 | 244 |
{
|
| 442 |
MeshBase[] meshes = new MeshBase[4]; |
|
| 443 |
|
|
| 444 |
float E = 0.5f; |
|
| 445 |
float F = SQ2/4; |
|
| 446 |
float G = 1.0f/12; |
|
| 447 |
float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
|
|
| 448 |
float[] bands0 = computeBands(0.028f,35,E/4,0.7f,7); |
|
| 449 |
|
|
| 450 |
meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3); |
|
| 451 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 452 |
|
|
| 453 |
float[] vertices1 = { -F,-G, +F,-G, 0,2*G};
|
|
| 454 |
float[] bands1 = computeBands(0.01f,45,F,0.0f,3); |
|
| 245 |
float x1 = vertices[index1][0]; |
|
| 246 |
float y1 = vertices[index1][1]; |
|
| 247 |
float z1 = vertices[index1][2]; |
|
| 248 |
float x2 = vertices[index2][0]; |
|
| 249 |
float y2 = vertices[index2][1]; |
|
| 250 |
float z2 = vertices[index2][2]; |
|
| 251 |
float x3 = vertices[index3][0]; |
|
| 252 |
float y3 = vertices[index3][1]; |
|
| 253 |
float z3 = vertices[index3][2]; |
|
| 455 | 254 |
|
| 456 |
meshes[1] = new MeshPolygon(vertices1, bands1, 1, 3); |
|
| 457 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 255 |
float v1x = x2-x1; |
|
| 256 |
float v1y = y2-y1; |
|
| 257 |
float v1z = z2-z1; |
|
| 258 |
float v2x = x3-x1; |
|
| 259 |
float v2y = y3-y1; |
|
| 260 |
float v2z = z3-z1; |
|
| 458 | 261 |
|
| 459 |
float[] vertices2 = { -E/2,-F/3, +E/2,-F/3, 0,2*F/3};
|
|
| 460 |
|
|
| 461 |
meshes[2] = new MeshPolygon(vertices2, bands1, 1, 3); |
|
| 462 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 463 |
meshes[3] = meshes[2].copy(true); |
|
| 464 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 465 |
|
|
| 466 |
return new MeshJoined(meshes); |
|
| 262 |
mBuffer[0] = v1y*v2z - v2y*v1z; |
|
| 263 |
mBuffer[1] = v1z*v2x - v2z*v1x; |
|
| 264 |
mBuffer[2] = v1x*v2y - v2x*v1y; |
|
| 467 | 265 |
} |
| 468 | 266 |
|
| 469 | 267 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 268 |
// return quat1*quat2 |
|
| 470 | 269 |
|
| 471 |
MeshBase createFacesRediEdge()
|
|
| 270 |
private static void quatMultiply( float[] quat1, float[] quat2, float[] result )
|
|
| 472 | 271 |
{
|
| 473 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 474 |
|
|
| 475 |
float F = 0.25f; |
|
| 476 |
float[] vertices0 = { -F,+F, -F,-F, 0, -2*F, +F,-F, +F,+F };
|
|
| 477 |
float[] bands0 = computeBands(0.038f,35,F,0.7f,7); |
|
| 478 |
|
|
| 479 |
meshes[0] = new MeshPolygon(vertices0, bands0, 2, 2); |
|
| 480 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 481 |
meshes[1] = meshes[0].copy(true); |
|
| 482 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 483 |
|
|
| 484 |
float[] bands1 = computeBands(0.02f,35,F/2,0.2f,3); |
|
| 485 |
float[] vertices1 = { -F/2, +F/2, -F/2, -1.5f*F, 1.5f*F, +F/2 };
|
|
| 486 |
|
|
| 487 |
meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2); |
|
| 488 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 489 |
meshes[3] = meshes[2].copy(true); |
|
| 490 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 272 |
float qx = quat1[0]; |
|
| 273 |
float qy = quat1[1]; |
|
| 274 |
float qz = quat1[2]; |
|
| 275 |
float qw = quat1[3]; |
|
| 491 | 276 |
|
| 492 |
float X = 0.25f*SQ2; |
|
| 493 |
float Y = SQ6/16; |
|
| 494 |
float[] vertices2 = { -X, Y, -1.5f*X, -Y, +1.5f*X, -Y, +X, Y };
|
|
| 277 |
float rx = quat2[0]; |
|
| 278 |
float ry = quat2[1]; |
|
| 279 |
float rz = quat2[2]; |
|
| 280 |
float rw = quat2[3]; |
|
| 495 | 281 |
|
| 496 |
meshes[4] = new MeshPolygon(vertices2, bands1, 1, 1); |
|
| 497 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 498 |
meshes[5] = meshes[4].copy(true); |
|
| 499 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 500 |
|
|
| 501 |
return new MeshJoined(meshes); |
|
| 282 |
result[0] = rw*qx - rz*qy + ry*qz + rx*qw; |
|
| 283 |
result[1] = rw*qy + rz*qx + ry*qw - rx*qz; |
|
| 284 |
result[2] = rw*qz + rz*qw - ry*qx + rx*qy; |
|
| 285 |
result[3] = rw*qw - rz*qz - ry*qy - rx*qx; |
|
| 502 | 286 |
} |
| 503 | 287 |
|
| 504 | 288 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 505 | 289 |
|
| 506 |
MeshBase createFacesRediCorner()
|
|
| 290 |
private void fitInSquare(FaceInfo info, float[][] vert3D)
|
|
| 507 | 291 |
{
|
| 508 |
MeshBase[] meshes = new MeshBase[6]; |
|
| 509 |
|
|
| 510 |
float E = 0.5f; |
|
| 511 |
float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
|
|
| 512 |
float[] bands0 = computeBands(0.06f,35,E,0.7f,6); |
|
| 513 |
|
|
| 514 |
meshes[0] = new MeshPolygon(vertices0,bands0,2,2); |
|
| 515 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 516 |
meshes[1] = meshes[0].copy(true); |
|
| 517 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 518 |
meshes[2] = meshes[0].copy(true); |
|
| 519 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 520 |
|
|
| 521 |
float F = 0.5f; |
|
| 522 |
float X = 0.5f; |
|
| 523 |
float G = 0.72f; |
|
| 524 |
float[] vertices1 = { -E,+F, -E+X,0, -E,-F, -E*G,-F, +E*G,-F, +E,-F, +E-X,0, +E,+F, +E*G,+F, -E*G,+F };
|
|
| 525 |
float[] bands1 = computeBands(0.0f,0,1.0f,0.0f,2); |
|
| 526 |
|
|
| 527 |
meshes[3] = new MeshPolygon(vertices1,bands1,0,0); |
|
| 528 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 529 |
meshes[4] = meshes[3].copy(true); |
|
| 530 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 531 |
meshes[5] = meshes[3].copy(true); |
|
| 532 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 533 |
|
|
| 534 |
return new MeshJoined(meshes); |
|
| 535 |
} |
|
| 536 |
|
|
| 537 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 292 |
float minX = Float.MAX_VALUE; |
|
| 293 |
float maxX =-Float.MAX_VALUE; |
|
| 294 |
float minY = Float.MAX_VALUE; |
|
| 295 |
float maxY =-Float.MAX_VALUE; |
|
| 538 | 296 |
|
| 539 |
MeshBase createFacesIvyCorner() |
|
| 540 |
{
|
|
| 541 |
MeshBase[] meshes = new MeshBase[6]; |
|
| 297 |
for (float[] vert : vert3D) |
|
| 298 |
{
|
|
| 299 |
float x = vert[0]; |
|
| 300 |
float y = vert[1]; |
|
| 542 | 301 |
|
| 543 |
final float angle = (float)Math.PI/(2*IVY_N); |
|
| 544 |
final float CORR = 1.0f - 2*IVY_D; |
|
| 545 |
final float DIST = -0.5f*CORR + IVY_D; |
|
| 546 |
float[] vertices = new float[2*(IVY_N+1)+6]; |
|
| 302 |
if (x > maxX) maxX = x; |
|
| 303 |
if (x < minX) minX = x; |
|
| 304 |
if (y > maxY) maxY = y; |
|
| 305 |
if (y < minY) minY = y; |
|
| 306 |
} |
|
| 547 | 307 |
|
| 548 |
vertices[0] = (0.5f-IVY_M) * IVY_C; |
|
| 549 |
vertices[1] = (DIST-IVY_M) * IVY_C; |
|
| 550 |
vertices[2] = (0.5f-IVY_M) * IVY_C; |
|
| 551 |
vertices[3] = (0.5f-IVY_M) * IVY_C; |
|
| 552 |
vertices[4] = (DIST-IVY_M) * IVY_C; |
|
| 553 |
vertices[5] = (0.5f-IVY_M) * IVY_C; |
|
| 308 |
info.scale = Math.max(maxX-minX,maxY-minY); |
|
| 309 |
int len = vert3D.length; |
|
| 310 |
info.vertices = new float[2*len]; |
|
| 554 | 311 |
|
| 555 |
for(int i=0; i<=IVY_N; i++)
|
|
| 312 |
for( int vertex=0; vertex<len; vertex++ )
|
|
| 556 | 313 |
{
|
| 557 |
float ang = (IVY_N-i)*angle; |
|
| 558 |
float sin = (float)Math.sin(ang); |
|
| 559 |
float cos = (float)Math.cos(ang); |
|
| 560 |
|
|
| 561 |
vertices[2*i+6] = (CORR*(cos-0.5f)-IVY_M)*IVY_C; |
|
| 562 |
vertices[2*i+7] = (CORR*(sin-0.5f)-IVY_M)*IVY_C; |
|
| 314 |
info.vertices[2*vertex ] = vert3D[vertex][0] / info.scale; |
|
| 315 |
info.vertices[2*vertex+1] = vert3D[vertex][1] / info.scale; |
|
| 563 | 316 |
} |
| 564 | 317 |
|
| 565 |
float[] bands0 = computeBands(+0.012f,20,0.2f,0.5f,7); |
|
| 566 |
float[] bands1 = computeBands(-0.100f,20,0.2f,0.0f,2); |
|
| 567 |
|
|
| 568 |
meshes[0] = new MeshPolygon(vertices,bands0,1,2); |
|
| 569 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 570 |
meshes[1] = meshes[0].copy(true); |
|
| 571 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 572 |
meshes[2] = meshes[0].copy(true); |
|
| 573 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 574 |
meshes[3] = new MeshPolygon(vertices,bands1,1,2); |
|
| 575 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 576 |
meshes[4] = meshes[3].copy(true); |
|
| 577 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 578 |
meshes[5] = meshes[3].copy(true); |
|
| 579 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 580 |
|
|
| 581 |
return new MeshJoined(meshes); |
|
| 318 |
info.flip = false; |
|
| 582 | 319 |
} |
| 583 | 320 |
|
| 584 | 321 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 585 | 322 |
|
| 586 |
MeshBase createFacesIvyFace()
|
|
| 323 |
private void constructNew(FaceInfo info, final float[][] vert3D)
|
|
| 587 | 324 |
{
|
| 588 |
MeshBase[] meshes = new MeshBase[2];
|
|
| 589 |
|
|
| 590 |
final float angle = (float)Math.PI/(2*IVY_N);
|
|
| 591 |
final float CORR = 1.0f - IVY_D*SQ2;
|
|
| 592 |
float[] vertices = new float[4*IVY_N];
|
|
| 325 |
// compute center of gravity
|
|
| 326 |
info.vx = 0.0f; |
|
| 327 |
info.vy = 0.0f;
|
|
| 328 |
info.vz = 0.0f;
|
|
| 329 |
int len = vert3D.length;
|
|
| 593 | 330 |
|
| 594 |
for(int i=0; i<IVY_N; i++)
|
|
| 331 |
for (float[] vert : vert3D)
|
|
| 595 | 332 |
{
|
| 596 |
float sin = (float)Math.sin(i*angle); |
|
| 597 |
float cos = (float)Math.cos(i*angle); |
|
| 598 |
|
|
| 599 |
vertices[2*i ] = CORR*(0.5f-cos); |
|
| 600 |
vertices[2*i+1 ] = CORR*(0.5f-sin); |
|
| 601 |
vertices[2*i +2*IVY_N] = CORR*(cos-0.5f); |
|
| 602 |
vertices[2*i+1+2*IVY_N] = CORR*(sin-0.5f); |
|
| 333 |
info.vx += vert[0]; |
|
| 334 |
info.vy += vert[1]; |
|
| 335 |
info.vz += vert[2]; |
|
| 603 | 336 |
} |
| 604 | 337 |
|
| 605 |
float[] bands0 = computeBands(+0.05f,35,0.5f,0.5f,5); |
|
| 606 |
float[] bands1 = computeBands(-0.10f,45,0.5f,0.0f,2); |
|
| 607 |
|
|
| 608 |
meshes[0] = new MeshPolygon(vertices,bands0,0,0); |
|
| 609 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 610 |
meshes[1] = new MeshPolygon(vertices,bands1,0,0); |
|
| 611 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 338 |
info.vx /= len; |
|
| 339 |
info.vy /= len; |
|
| 340 |
info.vz /= len; |
|
| 612 | 341 |
|
| 613 |
return new MeshJoined(meshes); |
|
| 614 |
} |
|
| 615 |
|
|
| 616 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 617 |
|
|
| 618 |
MeshBase createFacesRexCorner() |
|
| 619 |
{
|
|
| 620 |
MeshBase[] meshes = new MeshBase[2]; |
|
| 621 |
|
|
| 622 |
final float angle = (float)Math.PI/(6*REX_N); |
|
| 623 |
float[] vertices = new float[6*REX_N]; |
|
| 624 |
final float D = 0.5f - REX_D; |
|
| 625 |
final float F = D*SQ2*(SQ3-1); |
|
| 626 |
final float B = 2.5f; |
|
| 627 |
|
|
| 628 |
final float V1x = -F*0.5f; |
|
| 629 |
final float V1y = -F*SQ3/6; |
|
| 630 |
final float V2x = -V1x; |
|
| 631 |
final float V2y = V1y; |
|
| 632 |
final float V3x = 0.0f; |
|
| 633 |
final float V3y = -2*V1y; |
|
| 634 |
|
|
| 635 |
final float C1x = 0.0f; |
|
| 636 |
final float C1y = -F*(1+2*SQ3/3); |
|
| 637 |
final float C2x = B*V1x; |
|
| 638 |
final float C2y = B*V1y; |
|
| 639 |
final float C3x = B*V2x; |
|
| 640 |
final float C3y = B*V2y; |
|
| 641 |
|
|
| 642 |
for(int i=0; i<REX_N; i++) |
|
| 342 |
// move all vertices so that their center of gravity is at (0,0,0) |
|
| 343 |
for (int i=0; i<len; i++) |
|
| 643 | 344 |
{
|
| 644 |
writeVertex(C1x,C1y,V1x,V1y,-i*angle, vertices, 2*i );
|
|
| 645 |
writeVertex(C2x,C2y,V2x,V2y, i*angle, vertices, 2*i + 2*REX_N);
|
|
| 646 |
writeVertex(C3x,C3y,V3x,V3y, i*angle, vertices, 2*i + 4*REX_N);
|
|
| 345 |
vert3D[i][0] -= info.vx;
|
|
| 346 |
vert3D[i][1] -= info.vy;
|
|
| 347 |
vert3D[i][2] -= info.vz;
|
|
| 647 | 348 |
} |
| 648 | 349 |
|
| 649 |
float[] bands0 = computeBands(+0.02f,10,0.5f,0.5f,5); |
|
| 650 |
float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2); |
|
| 651 |
|
|
| 652 |
meshes[0] = new MeshPolygon(vertices,bands0,1,1); |
|
| 653 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 654 |
meshes[1] = new MeshPolygon(vertices,bands1,0,0); |
|
| 655 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 656 |
|
|
| 657 |
return new MeshJoined(meshes); |
|
| 658 |
} |
|
| 659 |
|
|
| 660 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 350 |
// find 3 non-colinear vertices |
|
| 351 |
int foundIndex = -1; |
|
| 661 | 352 |
|
| 662 |
MeshBase createFacesRexFace() |
|
| 663 |
{
|
|
| 664 |
MeshBase[] meshes = new MeshBase[2]; |
|
| 665 |
|
|
| 666 |
final float angle = (float)Math.PI/(6*REX_N); |
|
| 667 |
float[] vertices = new float[8*REX_N]; |
|
| 668 |
final float D = 0.5f - REX_D; |
|
| 669 |
final float F = D*(SQ3-1); |
|
| 670 |
|
|
| 671 |
final float V1x = 0.0f; |
|
| 672 |
final float V1y = +F; |
|
| 673 |
final float V2x = -F; |
|
| 674 |
final float V2y = 0.0f; |
|
| 675 |
final float V3x = 0.0f; |
|
| 676 |
final float V3y = -F; |
|
| 677 |
final float V4x = +F; |
|
| 678 |
final float V4y = 0.0f; |
|
| 679 |
|
|
| 680 |
final float C1x = +D; |
|
| 681 |
final float C1y = -D; |
|
| 682 |
final float C2x = +D; |
|
| 683 |
final float C2y = +D; |
|
| 684 |
final float C3x = -D; |
|
| 685 |
final float C3y = +D; |
|
| 686 |
final float C4x = -D; |
|
| 687 |
final float C4y = -D; |
|
| 688 |
|
|
| 689 |
for(int i=0; i<REX_N; i++) |
|
| 353 |
for(int vertex=2; vertex<len; vertex++) |
|
| 690 | 354 |
{
|
| 691 |
writeVertex(C1x,C1y,V1x,V1y, i*angle, vertices, 2*i ); |
|
| 692 |
writeVertex(C2x,C2y,V2x,V2y, i*angle, vertices, 2*i + 2*REX_N); |
|
| 693 |
writeVertex(C3x,C3y,V3x,V3y, i*angle, vertices, 2*i + 4*REX_N); |
|
| 694 |
writeVertex(C4x,C4y,V4x,V4y, i*angle, vertices, 2*i + 6*REX_N); |
|
| 355 |
if( !areColinear(vert3D,0,1,vertex) ) |
|
| 356 |
{
|
|
| 357 |
foundIndex = vertex; |
|
| 358 |
break; |
|
| 359 |
} |
|
| 695 | 360 |
} |
| 696 | 361 |
|
| 697 |
float[] bands0 = computeBands(+0.02f,10,0.5f,0.5f,5); |
|
| 698 |
float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2); |
|
| 699 |
|
|
| 700 |
meshes[0] = new MeshPolygon(vertices,bands0,0,0); |
|
| 701 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 702 |
meshes[1] = new MeshPolygon(vertices,bands1,0,0); |
|
| 703 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 704 |
|
|
| 705 |
return new MeshJoined(meshes); |
|
| 706 |
} |
|
| 707 |
|
|
| 708 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 709 |
|
|
| 710 |
MeshBase createFacesRexEdge() |
|
| 711 |
{
|
|
| 712 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 713 |
|
|
| 714 |
float E = 0.5f - REX_D; |
|
| 715 |
float F = 0.5f; |
|
| 716 |
float[] vertices0 = { -F,E/3, 0,-2*E/3, +F,E/3 };
|
|
| 717 |
float[] bands0 = computeBands(0.03f,27,F/3,0.8f,5); |
|
| 718 |
|
|
| 719 |
meshes[0] = new MeshPolygon(vertices0, bands0, 2, 3); |
|
| 720 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 721 |
meshes[1] = meshes[0].copy(true); |
|
| 722 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 723 |
|
|
| 724 |
float G = (float)Math.sqrt(E*E+F*F); |
|
| 725 |
float[] vertices1 = { -2*G/3, -E/3, G/3, -E/3, G/3, 2*E/3 };
|
|
| 726 |
float[] bands1 = computeBands(0.00f,45,G/3,0.2f,3); |
|
| 727 |
|
|
| 728 |
meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2); |
|
| 729 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 730 |
meshes[3] = meshes[2].copy(true); |
|
| 731 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 732 |
meshes[4] = meshes[2].copy(true); |
|
| 733 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 734 |
meshes[5] = meshes[2].copy(true); |
|
| 735 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 736 |
|
|
| 737 |
return new MeshJoined(meshes); |
|
| 738 |
} |
|
| 739 |
|
|
| 740 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 741 |
|
|
| 742 |
MeshBase createFacesKilominxCorner() |
|
| 743 |
{
|
|
| 744 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 745 |
|
|
| 746 |
float X1= (SQ5+1)/8; |
|
| 747 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
|
| 748 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8); |
|
| 749 |
float H = 0.5f* SIN54 / COS54; |
|
| 750 |
float X2= H*SIN_HALFD; |
|
| 751 |
float Y3= H/(2*COS_HALFD); |
|
| 752 |
float Y4= H*(1/(2*COS_HALFD) - COS_HALFD); |
|
| 753 |
|
|
| 754 |
float[] vertices0 = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 };
|
|
| 755 |
float[] bands0 = computeBands(0.03f,39,0.3f,0.2f,5); |
|
| 756 |
float[] vertices1 = { -X2, Y4, 0, -Y3, X2, Y4, 0, Y3 };
|
|
| 757 |
float[] bands1 = computeBands(0.00f,27,0.25f,0.5f,5); |
|
| 758 |
|
|
| 759 |
meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1); |
|
| 760 |
meshes[0].setEffectAssociation(0, 1,0); |
|
| 761 |
meshes[1] = meshes[0].copy(true); |
|
| 762 |
meshes[1].setEffectAssociation(0, 2,0); |
|
| 763 |
meshes[2] = meshes[0].copy(true); |
|
| 764 |
meshes[2].setEffectAssociation(0, 4,0); |
|
| 765 |
meshes[3] = new MeshPolygon(vertices1, bands1, 1, 1); |
|
| 766 |
meshes[3].setEffectAssociation(0, 8,0); |
|
| 767 |
meshes[4] = meshes[3].copy(true); |
|
| 768 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 769 |
meshes[5] = meshes[3].copy(true); |
|
| 770 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 771 |
|
|
| 772 |
return new MeshJoined(meshes); |
|
| 773 |
} |
|
| 774 |
|
|
| 775 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 776 |
|
|
| 777 |
MeshBase createFacesMinxCorner(int numLayers) |
|
| 778 |
{
|
|
| 779 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 780 |
|
|
| 781 |
float Y = COS54/(2*SIN54); |
|
| 782 |
|
|
| 783 |
float[] vertices0 = { -0.5f, 0.0f, 0.0f, -Y, 0.5f, 0.0f, 0.0f, Y };
|
|
| 784 |
|
|
| 785 |
int numBands0 = numLayers==3 ? 5 : 3; |
|
| 786 |
int numBands1 = numLayers==3 ? 2 : 2; |
|
| 787 |
float h = numLayers==3 ? 0.04f : 0.03f; |
|
| 788 |
int e = numLayers==3 ? 4 : 1; |
|
| 789 |
|
|
| 790 |
float[] bands0 = computeBands(h ,34,0.3f,0.2f, numBands0); |
|
| 791 |
float[] bands1 = computeBands(0.00f,34,0.3f,0.2f, numBands1); |
|
| 792 |
|
|
| 793 |
meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1); |
|
| 794 |
meshes[0].setEffectAssociation(0, 1,0); |
|
| 795 |
meshes[1] = meshes[0].copy(true); |
|
| 796 |
meshes[1].setEffectAssociation(0, 2,0); |
|
| 797 |
meshes[2] = meshes[0].copy(true); |
|
| 798 |
meshes[2].setEffectAssociation(0, 4,0); |
|
| 799 |
meshes[3] = new MeshPolygon(vertices0, bands1, 1, e); |
|
| 800 |
meshes[3].setEffectAssociation(0, 8,0); |
|
| 801 |
meshes[4] = meshes[3].copy(true); |
|
| 802 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 803 |
meshes[5] = meshes[3].copy(true); |
|
| 804 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 805 |
|
|
| 806 |
return new MeshJoined(meshes); |
|
| 807 |
} |
|
| 808 |
|
|
| 809 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 810 |
|
|
| 811 |
MeshBase createFacesKilominxEdge(int numLayers, float width, float height) |
|
| 812 |
{
|
|
| 813 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 814 |
|
|
| 815 |
float D = height/COS18; |
|
| 816 |
float W = D*SIN18; |
|
| 817 |
float X1 = height/2; |
|
| 818 |
float Y1 = width/2; |
|
| 819 |
float Y2 = (width+W)/2; |
|
| 820 |
float X3 = D*SIN54; |
|
| 821 |
float Y3 = D*COS54; |
|
| 822 |
float X4 = height*SIN_HALFD; |
|
| 823 |
float Y4 = height*COS_HALFD; |
|
| 824 |
|
|
| 825 |
float[] vertices0 = { -X1,-Y1, X1, -Y1, X1, Y1+W,-X1, Y1 };
|
|
| 826 |
float[] vertices1 = { -X1,-Y2, X1, -Y2, X1, Y2+W,-X1, Y2 };
|
|
| 827 |
float[] vertices2 = { -X3, 0.0f, 0.0f, -Y3, X3, 0.0f, 0.0f, Y3 };
|
|
| 828 |
float[] vertices3 = { -X4, 0.0f, 0.0f, -Y4, X4, 0.0f, 0.0f, Y4 };
|
|
| 829 |
|
|
| 830 |
int numBands0 = numLayers<=5 ? 5 : 3; |
|
| 831 |
int numBands1 = numLayers<=5 ? 3 : 2; |
|
| 832 |
float h = numLayers<=5 ? 0.03f : 0.03f; |
|
| 833 |
|
|
| 834 |
float[] bands0 = computeBands(h ,34,0.2f,0.2f,numBands0); |
|
| 835 |
float[] bands1 = computeBands(0.01f,34,0.3f,0.2f,numBands1); |
|
| 836 |
|
|
| 837 |
meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1); |
|
| 838 |
meshes[0].setEffectAssociation(0, 1,0); |
|
| 839 |
meshes[1] = meshes[0].copy(true); |
|
| 840 |
meshes[1].setEffectAssociation(0, 2,0); |
|
| 841 |
meshes[2] = new MeshPolygon(vertices1, bands1, 0, 0); |
|
| 842 |
meshes[2].setEffectAssociation(0, 4,0); |
|
| 843 |
meshes[3] = meshes[2].copy(true); |
|
| 844 |
meshes[3].setEffectAssociation(0, 8,0); |
|
| 845 |
meshes[4] = new MeshPolygon(vertices2, bands1, 1, 2); |
|
| 846 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 847 |
meshes[5] = new MeshPolygon(vertices3, bands1, 1, 2); |
|
| 848 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 849 |
|
|
| 850 |
return new MeshJoined(meshes); |
|
| 851 |
} |
|
| 852 |
|
|
| 853 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 854 |
|
|
| 855 |
MeshBase createFacesMegaminxEdge(float width, float height) |
|
| 856 |
{
|
|
| 857 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 858 |
|
|
| 859 |
float D = height/COS18; |
|
| 860 |
float W = D*SIN18; |
|
| 861 |
|
|
| 862 |
float Y1 = 0.5f*width; |
|
| 863 |
float Y2 = 0.5f*width + W; |
|
| 864 |
float Y3 = 0.5f*width + 2*W; |
|
| 865 |
float X2 = D*SIN54; |
|
| 866 |
float X1 = 0.5f*height; |
|
| 867 |
float Y4 = D*COS54; |
|
| 868 |
|
|
| 869 |
float[] vertices0 = { -X1, Y1, -X1, -Y1, X1, -Y2, X1, Y2 };
|
|
| 870 |
float[] vertices1 = { -X1, Y3, -X1, -Y3, X1, -Y2, X1, Y2 };
|
|
| 871 |
float[] vertices2 = { -X2, 0.0f, 0.0f, -Y4, X2, 0.0f, 0.0f, Y4 };
|
|
| 872 |
|
|
| 873 |
float[] bands0 = computeBands(0.04f,34, X1,0.2f,5); |
|
| 874 |
float[] bands1 = computeBands(0.00f,34,0.3f,0.2f,2); |
|
| 875 |
|
|
| 876 |
meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1); |
|
| 877 |
meshes[0].setEffectAssociation(0, 1,0); |
|
| 878 |
meshes[1] = meshes[0].copy(true); |
|
| 879 |
meshes[1].setEffectAssociation(0, 2,0); |
|
| 880 |
meshes[2] = new MeshPolygon(vertices1, bands1, 1, 4); |
|
| 881 |
meshes[2].setEffectAssociation(0, 4,0); |
|
| 882 |
meshes[3] = meshes[2].copy(true); |
|
| 883 |
meshes[3].setEffectAssociation(0, 8,0); |
|
| 884 |
meshes[4] = new MeshPolygon(vertices2, bands1, 1, 4); |
|
| 885 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 886 |
meshes[5] = meshes[4].copy(true); |
|
| 887 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 888 |
|
|
| 889 |
return new MeshJoined(meshes); |
|
| 890 |
} |
|
| 891 |
|
|
| 892 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 893 |
|
|
| 894 |
private float[] createVertices(int A, int B) |
|
| 895 |
{
|
|
| 896 |
float E = 0.5f / Math.max(A,B); |
|
| 897 |
return new float[] { -A*E,-B*E, +A*E,-B*E, +A*E,+B*E, -A*E,+B*E };
|
|
| 898 |
} |
|
| 899 |
|
|
| 900 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 901 |
|
|
| 902 |
MeshBase createCuboid(int[] dimensions) |
|
| 903 |
{
|
|
| 904 |
int X = dimensions[0]; |
|
| 905 |
int Y = dimensions[1]; |
|
| 906 |
int Z = dimensions[2]; |
|
| 907 |
|
|
| 908 |
float[] verticesXY = createVertices(X,Y); |
|
| 909 |
float[] verticesXZ = createVertices(X,Z); |
|
| 910 |
float[] verticesYZ = createVertices(Z,Y); |
|
| 911 |
|
|
| 912 |
float defHeight = 0.048f; |
|
| 913 |
|
|
| 914 |
float[] bandsX = computeBands( defHeight/X,65,0.25f,0.5f,5); |
|
| 915 |
float[] bandsY = computeBands( defHeight/Y,65,0.25f,0.5f,5); |
|
| 916 |
float[] bandsZ = computeBands( defHeight/Z,65,0.25f,0.5f,5); |
|
| 917 |
|
|
| 918 |
MeshBase[] meshes = new MeshPolygon[6]; |
|
| 919 |
|
|
| 920 |
meshes[0] = new MeshPolygon(verticesYZ,bandsX,1,2); |
|
| 921 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 922 |
meshes[1] = meshes[0].copy(true); |
|
| 923 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 924 |
meshes[2] = new MeshPolygon(verticesXZ,bandsY,1,2); |
|
| 925 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 926 |
meshes[3] = meshes[2].copy(true); |
|
| 927 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 928 |
meshes[4] = new MeshPolygon(verticesXY,bandsZ,1,2); |
|
| 929 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 930 |
meshes[5] = meshes[4].copy(true); |
|
| 931 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 932 |
|
|
| 933 |
|
|
| 934 |
return new MeshJoined(meshes); |
|
| 935 |
} |
|
| 936 |
|
|
| 937 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 938 |
// EFFECTS |
|
| 939 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 940 |
|
|
| 941 |
VertexEffect[] createVertexEffectsCube() |
|
| 942 |
{
|
|
| 943 |
Static3D axisY = new Static3D(0,1,0); |
|
| 944 |
Static3D axisX = new Static3D(1,0,0); |
|
| 945 |
Static3D center = new Static3D(0,0,0); |
|
| 946 |
Static1D angle90 = new Static1D(90); |
|
| 947 |
Static1D angle180= new Static1D(180); |
|
| 948 |
Static1D angle270= new Static1D(270); |
|
| 949 |
|
|
| 950 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 951 |
|
|
| 952 |
effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 953 |
effect[1] = new VertexEffectRotate( angle180, axisX, center ); |
|
| 954 |
effect[2] = new VertexEffectRotate( angle90 , axisX, center ); |
|
| 955 |
effect[3] = new VertexEffectRotate( angle270, axisX, center ); |
|
| 956 |
effect[4] = new VertexEffectRotate( angle270, axisY, center ); |
|
| 957 |
effect[5] = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 958 |
|
|
| 959 |
effect[0].setMeshAssociation(63,-1); // all 6 sides |
|
| 960 |
effect[1].setMeshAssociation(32,-1); // back |
|
| 961 |
effect[2].setMeshAssociation( 8,-1); // bottom |
|
| 962 |
effect[3].setMeshAssociation( 4,-1); // top |
|
| 963 |
effect[4].setMeshAssociation( 2,-1); // left |
|
| 964 |
effect[5].setMeshAssociation( 1,-1); // right |
|
| 965 |
|
|
| 966 |
return effect; |
|
| 967 |
} |
|
| 968 |
|
|
| 969 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 970 |
|
|
| 971 |
VertexEffect[] createVertexEffectsSkewbCorner() |
|
| 972 |
{
|
|
| 973 |
float E = 0.5f; |
|
| 974 |
|
|
| 975 |
Static3D axisX = new Static3D(1,0,0); |
|
| 976 |
Static3D axisY = new Static3D(0,1,0); |
|
| 977 |
Static3D axis0 = new Static3D(-SQ2/2,0,SQ2/2); |
|
| 978 |
Static3D axis1 = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3); |
|
| 979 |
Static1D angle1 = new Static1D(+90); |
|
| 980 |
Static1D angle2 = new Static1D(-90); |
|
| 981 |
Static1D angle3 = new Static1D(-15); |
|
| 982 |
Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3))); |
|
| 983 |
Static1D angle5 = new Static1D(120); |
|
| 984 |
Static1D angle6 = new Static1D(240); |
|
| 985 |
Static3D center1= new Static3D(0,0,0); |
|
| 986 |
Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f); |
|
| 987 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
|
| 988 |
Static3D move2 = new Static3D(-0.5f+SQ2/4,-0.5f+SQ6/8,-0.5f); |
|
| 989 |
|
|
| 990 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 991 |
|
|
| 992 |
effect[0] = new VertexEffectMove(move1); |
|
| 993 |
effect[1] = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 994 |
effect[2] = new VertexEffectRotate(angle1,axisX,center1); |
|
| 995 |
effect[3] = new VertexEffectRotate(angle2,axisY,center1); |
|
| 996 |
effect[4] = new VertexEffectMove(move2); |
|
| 997 |
effect[5] = new VertexEffectRotate(angle1,axisX,center2); |
|
| 998 |
effect[6] = new VertexEffectRotate(angle3,axisY,center2); |
|
| 999 |
effect[7] = new VertexEffectRotate(angle4,axis0,center2); |
|
| 1000 |
effect[8] = new VertexEffectRotate(angle5,axis1,center2); |
|
| 1001 |
effect[9] = new VertexEffectRotate(angle6,axis1,center2); |
|
| 1002 |
|
|
| 1003 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 1004 |
effect[1].setMeshAssociation( 6,-1); // meshes 1,2 |
|
| 1005 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1006 |
effect[3].setMeshAssociation( 4,-1); // mesh 2 |
|
| 1007 |
effect[4].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1008 |
effect[5].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1009 |
effect[6].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1010 |
effect[7].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1011 |
effect[8].setMeshAssociation(16,-1); // mesh 4 |
|
| 1012 |
effect[9].setMeshAssociation(32,-1); // mesh 5 |
|
| 1013 |
|
|
| 1014 |
return effect; |
|
| 1015 |
} |
|
| 1016 |
|
|
| 1017 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1018 |
|
|
| 1019 |
VertexEffect[] createVertexEffectsSkewbFace() |
|
| 1020 |
{
|
|
| 1021 |
Static3D center = new Static3D(0,0,0); |
|
| 1022 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1023 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 1024 |
float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3)); |
|
| 1025 |
|
|
| 1026 |
VertexEffect[] effect = new VertexEffect[6]; |
|
| 1027 |
|
|
| 1028 |
effect[0] = new VertexEffectRotate( new Static1D(angle), axisX, center); |
|
| 1029 |
effect[1] = new VertexEffectRotate( new Static1D( 135), axisZ, center); |
|
| 1030 |
effect[2] = new VertexEffectRotate( new Static1D( 45), axisZ, center); |
|
| 1031 |
effect[3] = new VertexEffectRotate( new Static1D( -45), axisZ, center); |
|
| 1032 |
effect[4] = new VertexEffectRotate( new Static1D( -135), axisZ, center); |
|
| 1033 |
effect[5] = new VertexEffectMove( new Static3D(0,0,-0.5f) ); |
|
| 1034 |
|
|
| 1035 |
effect[0].setMeshAssociation(30,-1); // meshes 1,2,3,4 |
|
| 1036 |
effect[1].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1037 |
effect[2].setMeshAssociation( 5,-1); // meshes 0,2 |
|
| 1038 |
effect[3].setMeshAssociation( 8,-1); // mesh 3 |
|
| 1039 |
effect[4].setMeshAssociation(16,-1); // mesh 4 |
|
| 1040 |
effect[5].setMeshAssociation(30,-1); // meshes 1,2,3,4 |
|
| 1041 |
|
|
| 1042 |
return effect; |
|
| 1043 |
} |
|
| 1044 |
|
|
| 1045 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1046 |
|
|
| 1047 |
VertexEffect[] createVertexEffectsOcta() |
|
| 1048 |
{
|
|
| 1049 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
|
| 1050 |
Static1D angle1= new Static1D( 90); |
|
| 1051 |
Static1D angle2= new Static1D(180); |
|
| 1052 |
Static1D angle3= new Static1D(270); |
|
| 1053 |
Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0); |
|
| 1054 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1055 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1056 |
Static3D cent0 = new Static3D(0,0,0); |
|
| 1057 |
Static3D cent1 = new Static3D(0,SQ2/2,0); |
|
| 1058 |
Static3D flipY = new Static3D( 1,-1, 1); |
|
| 1059 |
Static3D scale = new Static3D( 1, 2*SQ3/3, 1); |
|
| 1060 |
|
|
| 1061 |
VertexEffect[] effect = new VertexEffect[7]; |
|
| 1062 |
|
|
| 1063 |
effect[0] = new VertexEffectScale(scale); |
|
| 1064 |
effect[1] = new VertexEffectMove(move1); |
|
| 1065 |
effect[2] = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 1066 |
effect[3] = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 1067 |
effect[4] = new VertexEffectRotate(angle2, axisY, cent0); |
|
| 1068 |
effect[5] = new VertexEffectRotate(angle3, axisY, cent0); |
|
| 1069 |
effect[6] = new VertexEffectScale(flipY); |
|
| 1070 |
|
|
| 1071 |
effect[3].setMeshAssociation ( 34,-1); // apply to meshes 1 & 5 |
|
| 1072 |
effect[4].setMeshAssociation ( 68,-1); // apply to meshes 2 & 6 |
|
| 1073 |
effect[5].setMeshAssociation (136,-1); // apply to meshes 3 & 7 |
|
| 1074 |
effect[6].setMeshAssociation (240,-1); // apply to meshes 4,5,6,7 |
|
| 1075 |
|
|
| 1076 |
return effect; |
|
| 1077 |
} |
|
| 1078 |
|
|
| 1079 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1080 |
|
|
| 1081 |
VertexEffect[] createVertexEffectsTetra() |
|
| 1082 |
{
|
|
| 1083 |
Static3D flipZ = new Static3D( 1, 1,-1); |
|
| 1084 |
Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3))); |
|
| 1085 |
Static1D angle1= new Static1D( 90); |
|
| 1086 |
Static1D angle2= new Static1D(180); |
|
| 1087 |
Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0); |
|
| 1088 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1089 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1090 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 1091 |
Static3D cent0 = new Static3D(0,0,0); |
|
| 1092 |
Static3D cent1 = new Static3D(0,SQ2/4,0); |
|
| 1093 |
Static3D scale = new Static3D( 1, 2*SQ3/3, 1); |
|
| 1094 |
|
|
| 1095 |
VertexEffect[] effect = new VertexEffect[7]; |
|
| 1096 |
|
|
| 1097 |
effect[0] = new VertexEffectScale(scale); |
|
| 1098 |
effect[1] = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 1099 |
effect[2] = new VertexEffectMove(move1); |
|
| 1100 |
effect[3] = new VertexEffectRotate(alpha , axisX, cent1); |
|
| 1101 |
effect[4] = new VertexEffectScale(flipZ); |
|
| 1102 |
effect[5] = new VertexEffectRotate(angle1, axisY, cent0); |
|
| 1103 |
effect[6] = new VertexEffectRotate(angle2, axisZ, cent0); |
|
| 1104 |
|
|
| 1105 |
effect[4].setMeshAssociation(10,-1); // meshes 1 & 3 |
|
| 1106 |
effect[5].setMeshAssociation(12,-1); // meshes 2 & 3 |
|
| 1107 |
effect[6].setMeshAssociation(12,-1); // meshes 2 & 3 |
|
| 1108 |
|
|
| 1109 |
return effect; |
|
| 1110 |
} |
|
| 1111 |
|
|
| 1112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1113 |
|
|
| 1114 |
VertexEffect[] createVertexEffectsDino() |
|
| 1115 |
{
|
|
| 1116 |
float E = 0.5f*SQ2; |
|
| 1117 |
float F = 0.5f; |
|
| 1118 |
final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2))); |
|
| 1119 |
|
|
| 1120 |
Static1D angle1 = new Static1D(-ANGLE); |
|
| 1121 |
Static1D angle2 = new Static1D(+ANGLE); |
|
| 1122 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1123 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1124 |
Static3D axisZ = new Static3D(0,-1,1); |
|
| 1125 |
Static3D center0= new Static3D(0,0,0); |
|
| 1126 |
Static3D center1= new Static3D(0,-3*F,0); |
|
| 1127 |
|
|
| 1128 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 1129 |
|
|
| 1130 |
effect[0] = new VertexEffectScale ( new Static3D(3,3,3) ); |
|
| 1131 |
effect[1] = new VertexEffectMove ( new Static3D(0,-F,0) ); |
|
| 1132 |
effect[2] = new VertexEffectRotate( new Static1D(90), axisX, center0 ); |
|
| 1133 |
effect[3] = new VertexEffectScale ( new Static3D(1,-1,1) ); |
|
| 1134 |
effect[4] = new VertexEffectMove ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) ); |
|
| 1135 |
effect[5] = new VertexEffectRotate( new Static1D(+90), axisY, center1 ); |
|
| 1136 |
effect[6] = new VertexEffectScale ( new Static3D(-1,1,1) ); |
|
| 1137 |
effect[7] = new VertexEffectRotate( new Static1D( 45), axisX, center1 ); |
|
| 1138 |
effect[8] = new VertexEffectRotate( angle1 , axisZ, center1 ); |
|
| 1139 |
effect[9] = new VertexEffectRotate( angle2 , axisZ, center1 ); |
|
| 1140 |
|
|
| 1141 |
effect[0].setMeshAssociation(15,-1); // apply to meshes 0,1,2,3 |
|
| 1142 |
effect[1].setMeshAssociation( 3,-1); // apply to meshes 0,1 |
|
| 1143 |
effect[2].setMeshAssociation( 2,-1); // apply to mesh 1 |
|
| 1144 |
effect[3].setMeshAssociation( 2,-1); // apply to mesh 0 |
|
| 1145 |
effect[4].setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 1146 |
effect[5].setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 1147 |
effect[6].setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 1148 |
effect[7].setMeshAssociation(12,-1); // apply to meshes 2,3 |
|
| 1149 |
effect[8].setMeshAssociation( 4,-1); // apply to mesh 2 |
|
| 1150 |
effect[9].setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 1151 |
|
|
| 1152 |
return effect; |
|
| 1153 |
} |
|
| 1154 |
|
|
| 1155 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1156 |
|
|
| 1157 |
VertexEffect[] createVertexEffectsHelicopterCorner() |
|
| 1158 |
{
|
|
| 1159 |
float E = 0.5f; |
|
| 1160 |
|
|
| 1161 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1162 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1163 |
Static3D axis0 = new Static3D(-SQ2/2,0,SQ2/2); |
|
| 1164 |
Static3D axis1 = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3); |
|
| 1165 |
Static1D angle1 = new Static1D(+90); |
|
| 1166 |
Static1D angle2 = new Static1D(-90); |
|
| 1167 |
Static1D angle3 = new Static1D(-135); |
|
| 1168 |
Static1D angle4 = new Static1D(90); |
|
| 1169 |
Static1D angle5 = new Static1D(120); |
|
| 1170 |
Static1D angle6 = new Static1D(240); |
|
| 1171 |
Static3D center1= new Static3D(0,0,0); |
|
| 1172 |
Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f); |
|
| 1173 |
Static3D move1 = new Static3D(-E/4,-E/4,0); |
|
| 1174 |
Static3D move2 = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f); |
|
| 1175 |
|
|
| 1176 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 1177 |
|
|
| 1178 |
effect[0] = new VertexEffectMove(move1); |
|
| 1179 |
effect[1] = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 1180 |
effect[2] = new VertexEffectRotate(angle1,axisX,center1); |
|
| 1181 |
effect[3] = new VertexEffectRotate(angle2,axisY,center1); |
|
| 1182 |
effect[4] = new VertexEffectMove(move2); |
|
| 1183 |
effect[5] = new VertexEffectRotate(angle1,axisX,center2); |
|
| 1184 |
effect[6] = new VertexEffectRotate(angle3,axisY,center2); |
|
| 1185 |
effect[7] = new VertexEffectRotate(angle4,axis0,center2); |
|
| 1186 |
effect[8] = new VertexEffectRotate(angle5,axis1,center2); |
|
| 1187 |
effect[9] = new VertexEffectRotate(angle6,axis1,center2); |
|
| 1188 |
|
|
| 1189 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 1190 |
effect[1].setMeshAssociation( 6,-1); // meshes 1,2 |
|
| 1191 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1192 |
effect[3].setMeshAssociation( 4,-1); // mesh 2 |
|
| 1193 |
effect[4].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1194 |
effect[5].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1195 |
effect[6].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1196 |
effect[7].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1197 |
effect[8].setMeshAssociation(16,-1); // mesh 4 |
|
| 1198 |
effect[9].setMeshAssociation(32,-1); // mesh 5 |
|
| 1199 |
|
|
| 1200 |
return effect; |
|
| 1201 |
} |
|
| 1202 |
|
|
| 1203 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1204 |
|
|
| 1205 |
VertexEffect[] createVertexEffectsHelicopterFace() |
|
| 1206 |
{
|
|
| 1207 |
float E = 0.5f; |
|
| 1208 |
float F = SQ2/4; |
|
| 1209 |
|
|
| 1210 |
Static3D move0 = new Static3D(-E/4, -E/4, 0); |
|
| 1211 |
Static3D move1 = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0); |
|
| 1212 |
Static3D move2 = new Static3D(-E/2, F/3, 0); |
|
| 1213 |
Static3D move3 = new Static3D(+E/2, F/3, 0); |
|
| 1214 |
Static3D move4 = new Static3D(+E/3,+E/3, 0); |
|
| 1215 |
Static1D angle1 = new Static1D(135); |
|
| 1216 |
Static1D angle2 = new Static1D(90); |
|
| 1217 |
Static1D angle3 = new Static1D(-90); |
|
| 1218 |
Static1D angle4 = new Static1D(-135); |
|
| 1219 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1220 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1221 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 1222 |
Static3D axis1 = new Static3D(1,-1,0); |
|
| 1223 |
Static3D center = new Static3D(0,0,0); |
|
| 1224 |
Static3D center1= new Static3D(-E/2,-E/2,0); |
|
| 1225 |
|
|
| 1226 |
VertexEffect[] effect = new VertexEffect[10]; |
|
| 1227 |
|
|
| 1228 |
effect[0] = new VertexEffectMove(move0); |
|
| 1229 |
effect[1] = new VertexEffectRotate(angle1, axisZ, center); |
|
| 1230 |
effect[2] = new VertexEffectMove(move1); |
|
| 1231 |
effect[3] = new VertexEffectRotate(angle2, axis1, center1); |
|
| 1232 |
effect[4] = new VertexEffectMove(move2); |
|
| 1233 |
effect[5] = new VertexEffectMove(move3); |
|
| 1234 |
effect[6] = new VertexEffectRotate(angle3, axisZ, center); |
|
| 1235 |
effect[7] = new VertexEffectRotate(angle4, axisX, center); |
|
| 1236 |
effect[8] = new VertexEffectRotate(angle1, axisY, center); |
|
| 1237 |
effect[9] = new VertexEffectMove(move4); |
|
| 1238 |
|
|
| 1239 |
effect[0].setMeshAssociation( 1,-1); // mesh 0 |
|
| 1240 |
effect[1].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1241 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1242 |
effect[3].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1243 |
effect[4].setMeshAssociation( 4,-1); // mesh 2 |
|
| 1244 |
effect[5].setMeshAssociation( 8,-1); // mesh 3 |
|
| 1245 |
effect[6].setMeshAssociation( 8,-1); // mesh 3 |
|
| 1246 |
effect[7].setMeshAssociation( 4,-1); // mesh 2 |
|
| 1247 |
effect[8].setMeshAssociation( 8,-1); // mesh 3 |
|
| 1248 |
effect[9].setMeshAssociation(15,-1); // meshes 0,1,2,3 |
|
| 1249 |
|
|
| 1250 |
return effect; |
|
| 1251 |
} |
|
| 1252 |
|
|
| 1253 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1254 |
|
|
| 1255 |
VertexEffect[] createVertexEffectsRediEdge() |
|
| 1256 |
{
|
|
| 1257 |
Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f); |
|
| 1258 |
Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f); |
|
| 1259 |
Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f); |
|
| 1260 |
Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8); |
|
| 1261 |
Static3D flipZ = new Static3D(1,1,-1); |
|
| 1262 |
Static3D flipX = new Static3D(-1,1,1); |
|
| 1263 |
Static3D scale = new Static3D(2,2,2); |
|
| 1264 |
Static3D cent0 = new Static3D(0,0, 0); |
|
| 1265 |
Static3D cent1 = new Static3D(0,0, -1.5f); |
|
| 1266 |
Static3D axisX = new Static3D(1,0, 0); |
|
| 1267 |
Static3D axisY = new Static3D(0,1, 0); |
|
| 1268 |
Static3D axis = new Static3D(0,SQ2/2,-SQ2/2); |
|
| 1269 |
Static1D angle1= new Static1D(90); |
|
| 1270 |
Static1D angle2= new Static1D(45); |
|
| 1271 |
Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) ); |
|
| 1272 |
|
|
| 1273 |
VertexEffect[] effect = new VertexEffect[12]; |
|
| 1274 |
|
|
| 1275 |
effect[0] = new VertexEffectScale(scale); |
|
| 1276 |
effect[1] = new VertexEffectMove(move0); |
|
| 1277 |
effect[2] = new VertexEffectScale(flipZ); |
|
| 1278 |
effect[3] = new VertexEffectRotate(angle1,axisX,cent0); |
|
| 1279 |
effect[4] = new VertexEffectMove(move1); |
|
| 1280 |
effect[5] = new VertexEffectRotate(angle1,axisY,cent0); |
|
| 1281 |
effect[6] = new VertexEffectMove(move2); |
|
| 1282 |
effect[7] = new VertexEffectScale(flipX); |
|
| 1283 |
effect[8] = new VertexEffectRotate(angle2,axisX,cent0); |
|
| 1284 |
effect[9] = new VertexEffectMove(move3); |
|
| 1285 |
effect[10]= new VertexEffectRotate(angle3,axis ,cent1); |
|
| 1286 |
effect[11]= new VertexEffectScale(flipX); |
|
| 1287 |
|
|
| 1288 |
effect[0].setMeshAssociation(63,-1); // meshes 0,1,2,3,4,5 |
|
| 1289 |
effect[1].setMeshAssociation( 3,-1); // meshes 0,1 |
|
| 1290 |
effect[2].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1291 |
effect[3].setMeshAssociation( 2,-1); // mesh 1 |
|
| 1292 |
effect[4].setMeshAssociation(12,-1); // meshes 2,3 |
|
| 1293 |
effect[5].setMeshAssociation(60,-1); // meshes 2,3,4,5 |
|
| 1294 |
effect[6].setMeshAssociation(12,-1); // meshes 2,3 |
|
| 1295 |
effect[7].setMeshAssociation( 8,-1); // mesh 3 |
|
| 1296 |
effect[8].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 1297 |
effect[9].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 1298 |
effect[10].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 1299 |
effect[11].setMeshAssociation(32,-1); // mesh 5 |
|
| 1300 |
|
|
| 1301 |
return effect; |
|
| 1302 |
} |
|
| 1303 |
|
|
| 1304 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1305 |
|
|
| 1306 |
VertexEffect[] createVertexEffectsRediCorner() |
|
| 1307 |
{
|
|
| 1308 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1309 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1310 |
Static3D axisZ = new Static3D(0,0,1); |
|
| 1311 |
Static3D center = new Static3D(0,0,0); |
|
| 1312 |
Static1D angle90 = new Static1D(90); |
|
| 1313 |
Static1D angle270= new Static1D(270); |
|
| 1314 |
Static1D angle45 = new Static1D(-45); |
|
| 1315 |
Static3D scale = new Static3D(1.0f, SQ2, 1.0f); |
|
| 1316 |
|
|
| 1317 |
VertexEffect[] effect = new VertexEffect[7]; |
|
| 1318 |
|
|
| 1319 |
effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f)); |
|
| 1320 |
effect[1] = new VertexEffectRotate( angle270, axisX, center ); |
|
| 1321 |
effect[2] = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 1322 |
effect[3] = new VertexEffectScale(scale); |
|
| 1323 |
effect[4] = new VertexEffectRotate( angle45 , axisX, center ); |
|
| 1324 |
effect[5] = new VertexEffectRotate( angle90 , axisY, center ); |
|
| 1325 |
effect[6] = new VertexEffectRotate( angle270, axisZ, center ); |
|
| 1326 |
|
|
| 1327 |
effect[0].setMeshAssociation( 7,-1); // 0,1,2 |
|
| 1328 |
effect[1].setMeshAssociation( 2,-1); // 1 |
|
| 1329 |
effect[2].setMeshAssociation( 4,-1); // 2 |
|
| 1330 |
effect[3].setMeshAssociation(56,-1); // 3,4,5 |
|
| 1331 |
effect[4].setMeshAssociation(56,-1); // 3,4,5 |
|
| 1332 |
effect[5].setMeshAssociation(16,-1); // 4 |
|
| 1333 |
effect[6].setMeshAssociation(32,-1); // 5 |
|
| 1334 |
|
|
| 1335 |
return effect; |
|
| 1336 |
} |
|
| 1337 |
|
|
| 1338 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1339 |
|
|
| 1340 |
VertexEffect[] createVertexEffectsIvyCorner() |
|
| 1341 |
{
|
|
| 1342 |
Static3D axisX = new Static3D(1,0,0); |
|
| 1343 |
Static3D axisY = new Static3D(0,1,0); |
|
| 1344 |
Static1D angle1 = new Static1D(+90); |
|
| 1345 |
Static1D angle2 = new Static1D(-90); |
|
| 1346 |
Static3D center = new Static3D(0,0,0); |
|
| 1347 |
Static3D move1 = new Static3D(IVY_M-0.5f,IVY_M-0.5f,0); |
|
| 1348 |
|
|
| 1349 |
VertexEffect[] effect = new VertexEffect[5]; |
|
| 1350 |
|
|
| 1351 |
effect[0] = new VertexEffectScale(1/IVY_C); |
|
| 1352 |
effect[1] = new VertexEffectMove(move1); |
|
| 1353 |
effect[2] = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 1354 |
effect[3] = new VertexEffectRotate(angle1,axisX,center); |
|
| 1355 |
effect[4] = new VertexEffectRotate(angle2,axisY,center); |
|
| 1356 |
|
|
| 1357 |
effect[2].setMeshAssociation(54,-1); // meshes 1,2,4,5 |
|
| 1358 |
effect[3].setMeshAssociation(18,-1); // meshes 1,4 |
|
| 1359 |
effect[4].setMeshAssociation(36,-1); // meshes 2,5 |
|
| 1360 |
|
|
| 1361 |
return effect; |
|
| 1362 |
} |
|
| 1363 |
|
|
| 1364 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 1365 |
|
|
| 1366 |
VertexEffect[] createVertexEffectsRexEdge() |
|
| 1367 |
{
|
|
| 1368 |
float E = 0.5f - REX_D; |
|
| 1369 |
float F = 0.5f; |
|
| 1370 |
float G = (float)Math.sqrt(E*E+F*F); |
|
| 1371 |
float A = (float)((180/Math.PI)*Math.asin(E/G)); |
|
| 1372 |
|
|
| 1373 |
Static3D move1 = new Static3D( 0.0f, -E/3, 0.0f); |
|
| 1374 |
Static3D move2 = new Static3D(2*G/3 -F, +E/3, 0.0f); |
|
| 1375 |
|
|
| 1376 |
Static3D center0= new Static3D(0.0f, 0.0f, 0.0f); |
|
| 1377 |
Static3D center1= new Static3D( -F, 0.0f, 0.0f); |
|
| 1378 |
Static3D center2= new Static3D( +F, 0.0f, 0.0f); |
|
| 1379 |
Static3D axisX = new Static3D(1.0f, 0.0f, 0.0f); |
|
| 1380 |
Static3D axisY = new Static3D(0.0f, 1.0f, 0.0f); |
|
| 1381 |
Static3D axisZ = new Static3D(0.0f, 0.0f, 1.0f); |
|
| 1382 |
|
|
| 1383 |
Static1D angle180 = new Static1D(180); |
|
| 1384 |
Static1D angle90 = new Static1D( 90); |
|
| 1385 |
Static1D angle270 = new Static1D(270); |
|
| 1386 |
Static1D angle1 = new Static1D(+A); |
|
| 1387 |
Static1D angle2 = new Static1D(-A); |
|
| 1388 |
|
|
| 1389 |
VertexEffect[] effect = new VertexEffect[12]; |
|
| 1390 |
|
|
| 1391 |
effect[0] = new VertexEffectMove(move1); |
|
| 1392 |
effect[1] = new VertexEffectMove(move2); |
|
| 1393 |
effect[2] = new VertexEffectRotate( angle90, axisX, center0 ); |
|
| 1394 |
effect[3] = new VertexEffectRotate( angle270, axisX, center0 ); |
|
| 1395 |
effect[4] = new VertexEffectRotate( angle180, axisX, center0 ); |
|
| 1396 |
effect[5] = new VertexEffectRotate( angle180, axisY, center0 ); |
|
| 1397 |
effect[6] = new VertexEffectScale ( new Static3D(-1, 1, 1) ); |
|
| 1398 |
effect[7] = new VertexEffectScale ( new Static3D( 1,-1, 1) ); |
|
| 1399 |
effect[8] = new VertexEffectRotate( angle1, axisY, center1); |
|
| 1400 |
effect[9] = new VertexEffectRotate( angle2, axisY, center2); |
|
| 1401 |
effect[10]= new VertexEffectRotate( angle2, axisZ, center1); |
|
| 1402 |
effect[11]= new VertexEffectRotate( angle1, axisZ, center2); |
|
| 1403 |
|
|
| 1404 |
effect[0].setMeshAssociation( 3,-1); // meshes 0 & 1 |
|
| 1405 |
effect[1].setMeshAssociation(60,-1); // meshes 2,3,4,5 |
|
| 1406 |
effect[2].setMeshAssociation( 2,-1); // meshes 1 |
|
| 1407 |
effect[3].setMeshAssociation(12,-1); // meshes 2,3 |
|
| 1408 |
effect[4].setMeshAssociation(48,-1); // meshes 4,5 |
|
| 1409 |
effect[5].setMeshAssociation(32,-1); // mesh 5 |
|
| 1410 |
effect[6].setMeshAssociation( 8,-1); // apply to mesh 3 |
|
| 1411 |
effect[7].setMeshAssociation( 2,-1); // apply to mesh 1 |
|
| 1412 |
effect[8].setMeshAssociation(16,-1); // apply to mesh 4 |
|
| 1413 |
effect[9].setMeshAssociation(32,-1); // apply to mesh 5 |
|
| 1414 |
effect[10].setMeshAssociation(4,-1); // apply to mesh 2 |
|
| 1415 |
effect[11].setMeshAssociation(8,-1); // apply to mesh 3 |
|
| 1416 |
|
|
| 1417 |
return effect; |
|
| 1418 |
} |
|
| 1419 |
|
|
| 1420 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 362 |
// compute the normal vector |
|
| 363 |
if( foundIndex==-1 ) |
|
| 364 |
{
|
|
| 365 |
throw new RuntimeException("all vertices colinear");
|
|
| 366 |
} |
|
| 1421 | 367 |
|
| 1422 |
VertexEffect[] createVertexEffectsRexCorner() |
|
| 1423 |
{
|
|
| 1424 |
Static3D center= new Static3D(0.0f, 0.0f, 0.0f); |
|
| 1425 |
Static3D axisZ = new Static3D(0.0f, 0.0f, 1.0f); |
|
| 1426 |
Static1D angle = new Static1D(45); |
|
| 368 |
computeNormalVector(vert3D,0,1,foundIndex); |
|
| 369 |
|
|
| 370 |
// rotate so that the normal vector becomes (0,0,1) |
|
| 371 |
float axisX = -mBuffer[1]; |
|
| 372 |
float axisY = mBuffer[0]; |
|
| 373 |
float axisZ = 0.0f; |
|
| 374 |
|
|
| 375 |
float vecLen = mBuffer[0]*mBuffer[0] + mBuffer[1]*mBuffer[1] + mBuffer[2]*mBuffer[2]; |
|
| 376 |
vecLen = (float)Math.sqrt(vecLen); |
|
| 377 |
mBuffer[0] /= vecLen; |
|
| 378 |
mBuffer[1] /= vecLen; |
|
| 379 |
mBuffer[2] /= vecLen; |
|
| 380 |
|
|
| 381 |
float axiLen = axisX*axisX + axisY*axisY + axisZ*axisZ; |
|
| 382 |
axiLen = (float)Math.sqrt(axiLen); |
|
| 383 |
axisX /= axiLen; |
|
| 384 |
axisY /= axiLen; |
|
| 385 |
axisZ /= axiLen; |
|
| 386 |
|
|
| 387 |
float cosTheta = mBuffer[2]; |
|
| 388 |
float sinTheta = axiLen / vecLen; |
|
| 389 |
|
|
| 390 |
mQuat1[0] = axisX*sinTheta; |
|
| 391 |
mQuat1[1] = axisY*sinTheta; |
|
| 392 |
mQuat1[2] = axisZ*sinTheta; |
|
| 393 |
mQuat1[3] = cosTheta; |
|
| 394 |
mQuat2[0] = axisX*sinTheta; |
|
| 395 |
mQuat2[1] = axisY*sinTheta; |
|
| 396 |
mQuat2[2] = axisZ*sinTheta; |
|
| 397 |
mQuat2[3] = -cosTheta; |
|
| 398 |
|
|
| 399 |
for (float[] vert : vert3D) |
|
| 400 |
{
|
|
| 401 |
quatMultiply(mQuat1, vert, mQuat3); |
|
| 402 |
quatMultiply(mQuat3, mQuat2, vert); |
|
| 403 |
} |
|
| 1427 | 404 |
|
| 1428 |
VertexEffect[] effect = new VertexEffect[1];
|
|
| 1429 |
effect[0] = new VertexEffectRotate(angle, axisZ, center);
|
|
| 405 |
// fit the whole thing in a square and remember the scale & 2D vertices
|
|
| 406 |
fitInSquare(info, vert3D);
|
|
| 1430 | 407 |
|
| 1431 |
return effect; |
|
| 408 |
// remember the rotation |
|
| 409 |
info.qx = mQuat1[0]; |
|
| 410 |
info.qy = mQuat1[1]; |
|
| 411 |
info.qz = mQuat1[2]; |
|
| 412 |
info.qw =-mQuat1[3]; |
|
| 1432 | 413 |
} |
| 1433 | 414 |
|
| 1434 | 415 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 1435 | 416 |
|
| 1436 |
VertexEffect[] createVertexEffectsKilominxCorner()
|
|
| 417 |
private float computeCos(float x1, float y1, float x2, float y2, float len1, float len2)
|
|
| 1437 | 418 |
{
|
| 1438 |
VertexEffect[] effect = new VertexEffect[9]; |
|
| 1439 |
|
|
| 1440 |
float H = 0.5f*(SIN54 / COS54); |
|
| 1441 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
|
| 1442 |
float Y2= H/(2*COS_HALFD); |
|
| 1443 |
float A = (float)(Math.acos(-SQ5/5)*180/Math.PI); // dihedral angle of a dedecahedron in degrees |
|
| 1444 |
float sin18 = SIN18; |
|
| 1445 |
float cos18 = (float)(Math.sqrt(1- SIN18 * SIN18)); |
|
| 1446 |
float LEN = (float)Math.sqrt(H*H/(COS_HALFD*COS_HALFD) + 0.25f); |
|
| 1447 |
|
|
| 1448 |
Static3D axisZ = new Static3D(0.0f , 0.0f , 1.0f); |
|
| 1449 |
Static3D axisY = new Static3D(0.0f , 1.0f , 0.0f); |
|
| 1450 |
Static3D axisA = new Static3D(-sin18, cos18, 0.0f); |
|
| 1451 |
Static3D axisC = new Static3D( H/LEN, -0.5f/LEN,-H*SIN_HALFD/(COS_HALFD*LEN)); |
|
| 1452 |
|
|
| 1453 |
Static3D move1 = new Static3D(0,-Y1,0); |
|
| 1454 |
Static3D move2 = new Static3D(0,-Y2,0); |
|
| 1455 |
Static3D move3 = new Static3D(0.5f*cos18,0.5f*sin18,0); |
|
| 1456 |
Static3D center= new Static3D(0.0f, 0.0f, 0.0f); |
|
| 1457 |
|
|
| 1458 |
Static1D angle1 = new Static1D(54); |
|
| 1459 |
Static1D angle2 = new Static1D(A/2+18); |
|
| 1460 |
Static1D angle3 = new Static1D(90); |
|
| 1461 |
Static1D angle4 = new Static1D(120); |
|
| 1462 |
Static1D angle5 = new Static1D(240); |
|
| 1463 |
Static1D angle6 = new Static1D(90-A/2); |
|
| 1464 |
|
|
| 1465 |
effect[0] = new VertexEffectMove(move1); |
|
| 1466 |
effect[1] = new VertexEffectMove(move2); |
|
| 1467 |
effect[2] = new VertexEffectRotate(angle1, axisZ, center); |
|
| 1468 |
effect[3] = new VertexEffectRotate(angle2, axisZ, center); |
|
| 1469 |
effect[4] = new VertexEffectRotate(angle3, axisA, center); |
|
| 1470 |
effect[5] = new VertexEffectMove(move3); |
|
| 1471 |
effect[6] = new VertexEffectRotate(angle4, axisC, center); |
|
| 1472 |
effect[7] = new VertexEffectRotate(angle5, axisC, center); |
|
| 1473 |
effect[8] = new VertexEffectRotate(angle6, axisY, center); |
|
| 1474 |
|
|
| 1475 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 1476 |
effect[1].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
| 1477 |
effect[2].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
| 1478 |
effect[3].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
Also available in: Unified diff
Face cubit creation: compiles and runs now (but results are incorrect)