BoundaryRep.java | ●●●●● patch | view | raw | blame | history | |
CameraPane.java | ●●●●● patch | view | raw | blame | history | |
GrafreeD.java | ●●●●● patch | view | raw | blame | history | |
GroupEditor.java | ●●●●● patch | view | raw | blame | history | |
Object3D.java | ●●●●● patch | view | raw | blame | history | |
timeflow/app/TimeflowApp.java | ●●●●● patch | view | raw | blame | history | |
timeflow/views/IntroView.java | ●●●●● patch | view | raw | blame | history |
BoundaryRep.java
.. .. @@ -3155,7 +3155,27 @@ 3155 3155 */ 3156 3156 } 3157 3157 3158 - void GenUV()3158 + void UnfoldUV()3159 + {3160 + for (int i = 0; i < VertexCount(); i++)3161 + {3162 + Vertex v = GetVertex(i);3163 +3164 + v.x = v.s;3165 + v.y = v.t;3166 + v.z = 0;3167 +3168 + v.norm.x = 0;3169 + v.norm.y = 0;3170 + v.norm.z = 1;3171 +3172 + SetVertex(v, i);3173 + }3174 + }3175 +3176 + float power = 2;3177 +3178 + void GenUV() // float power)3159 3179 { 3160 3180 Trim(); 3161 3181 .. .. @@ -3219,6 +3239,115 @@ 3219 3239 y -= 0.5; 3220 3240 z -= 0.5; 3221 3241 3242 + double ax = Math.abs(x);3243 + double ay = Math.abs(y);3244 + double max = ax;3245 + if (max < ay)3246 + {3247 + max = ay;3248 + }3249 +3250 + x /= max;3251 + y /= max;3252 +3253 + double angle = Math.acos(Math.abs(z*2));3254 +3255 + double k = angle / Math.PI * 2;3256 +3257 + // k == 0 => uv = 0 (center)3258 + // k == 1 => uv = -1,1 (border)3259 +3260 + if (i == 0)3261 + System.out.println("power = " + power);3262 +3263 + double length1 = (ax+ay)/max;3264 + double length2 = Math.sqrt(ax*ax + ay*ay) / max;3265 +3266 + double t = k;3267 +3268 + t = Math.pow(t, 3);3269 +3270 + // Interpolate between k/length2 (center) and k (border)3271 + k = k / length2 * (1 - t) + k * t;3272 +3273 + double u = k*x;3274 + double v = k*y;3275 +3276 + u /= 2;3277 + v /= 2;3278 + u += 0.5;3279 + v += 0.5;3280 +3281 + uvmap[i2] = (float) u;3282 + uvmap[i2+1] = (float) v;3283 + }3284 + }3285 +3286 + void GenUVold(float power)3287 + {3288 + Trim();3289 +3290 + cVector boxcenter = null;3291 + cVector minima, maxima;3292 + minima = new cVector();3293 + maxima = new cVector();3294 + minima.x = minima.y = minima.z = Double.MAX_VALUE;3295 + maxima.x = maxima.y = maxima.z = -Double.MAX_VALUE;3296 + for (int i = 0; i < VertexCount(); i++)3297 + {3298 + Vertex v = GetVertex(i);3299 +3300 + if (minima.x > v.x)3301 + {3302 + minima.x = v.x;3303 + }3304 + if (minima.y > v.y)3305 + {3306 + minima.y = v.y;3307 + }3308 + if (minima.z > v.z)3309 + {3310 + minima.z = v.z;3311 + }3312 +3313 + if (maxima.x < v.x)3314 + {3315 + maxima.x = v.x;3316 + }3317 + if (maxima.y < v.y)3318 + {3319 + maxima.y = v.y;3320 + }3321 + if (maxima.z < v.z)3322 + {3323 + maxima.z = v.z;3324 + }3325 + }3326 +3327 + boxcenter = new cVector((maxima.x + minima.x) / 2, (maxima.y + minima.y) / 2, (maxima.z + minima.z) / 2);3328 + int i2 = 0, i3 = 0;3329 + for (int i = 0; i < positions.length/3; i++, i3 += 3, i2 += 2)3330 + {3331 +// //uvmap[i2] = (float) normals[i3]*0.5f + 0.5f; // v.x;3332 +// //uvmap[i2 + 1] = (float) normals[i3+1]*0.5f + 0.5f; //z;3333 +// uvmap[i2] = (float) (positions[i3] - boxcenter.x);3334 +// uvmap[i2 + 1] = (float) (positions[i3+2] - boxcenter.z);3335 +// uvmap[i2] = (float) Math.atan2(positions[i3+1] - boxcenter.y, positions[i3] - boxcenter.x);3336 +// uvmap[i2 + 1] = (float)(positions[i3+2] - boxcenter.z);3337 + // box UV3338 + double x = positions[i3] - minima.x; // - Math.floor(positions[i3]);3339 + double y = positions[i3+1] - minima.y; // - Math.floor(positions[i3+1]);3340 + double z = positions[i3+2] - minima.z; // - Math.floor(positions[i3+2]);3341 +3342 + // [-1/2, 1/2]3343 + x /= maxima.x - minima.x;3344 + y /= maxima.y - minima.y;3345 + z /= maxima.z - minima.z;3346 +3347 + x -= 0.5;3348 + y -= 0.5;3349 + z -= 0.5;3350 +3222 3351 // x *= 2; 3223 3352 // y *= 2; 3224 3353 // z *= 2; .. .. @@ -3245,6 +3374,15 @@ 3245 3374 3246 3375 z = Math.cos(angle/2); 3247 3376 3377 + assert(z >= 0);3378 + assert(z <= 1);3379 +3380 + /**/3381 + //z = Math.pow(z, power); //1.08f);3382 +3383 + if (i == 0)3384 + System.out.println("power = " + power);3385 +3248 3386 // sqrt(k2*x2 + k2*z2 + y2) = length 3249 3387 // k2*x2 + k2*z2 = length2 - y2 3250 3388 // k2 = (length2 - y2) / (x2 + z2) .. .. @@ -3264,6 +3402,7 @@ 3264 3402 3265 3403 x *= k; 3266 3404 y *= k; 3405 + /**/3267 3406 3268 3407 double max = Math.abs(x); 3269 3408 if (max < Math.abs(y)) .. .. @@ -3276,10 +3415,15 @@ 3276 3415 } 3277 3416 3278 3417 // max = Math.sqrt(max*2)/2; 3418 +// double x2 = Math.pow(Math.abs(x), 1/power);3419 +// double y2 = Math.pow(Math.abs(y), 1/power);3420 +// double z2 = Math.pow(Math.abs(z), 1/power);3421 +// max = Math.pow(x2 + y2 + z2, power);3279 3422 3280 3423 // if (!(max > 0)) 3281 - assert(max > 0);3282 -3424 + //assert(max > 0);3425 + assert(max >= 0);3426 +3283 3427 x /= max; 3284 3428 y /= max; 3285 3429 z /= max; CameraPane.java
.. .. @@ -86,12 +86,14 @@ 86 86 static boolean FULLSCREEN = false; 87 87 static boolean SUPPORT = true; 88 88 static boolean INERTIA = true; 89 -static boolean FAST = false;89 +static boolean FAST = true; // false;90 90 static boolean SLOWPOSE = false; 91 91 static boolean FOOTCONTACT = true; 92 92 93 93 static int tickcount = 0; // slow pose issue 94 94 95 +static boolean BUTTONLESSWHEEL = false;96 +static boolean ZOOMBOXMODE = false;95 97 static boolean BOXMODE = false; 96 98 static boolean IMAGEFLIP = false; 97 99 static boolean SMOOTHFOCUS = false; .. .. @@ -223,6 +225,11 @@ 223 225 public boolean IsBoxMode() 224 226 { 225 227 return BOXMODE; 228 + }229 +230 + public boolean IsZoomBoxMode()231 + {232 + return ZOOMBOXMODE;226 233 } 227 234 228 235 public void ClearDepth() .. .. @@ -1612,12 +1619,12 @@ 1612 1619 //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); 1613 1620 if (!material.multiply) 1614 1621 { 1615 - display.color = color;1622 + display.color = material.color;1616 1623 display.saturation = material.modulation; 1617 1624 } 1618 1625 else 1619 1626 { 1620 - display.color *= color*2;1627 + display.color *= material.color*2;1621 1628 display.saturation *= material.modulation*2; 1622 1629 } 1623 1630 .. .. @@ -2168,6 +2175,11 @@ 2168 2175 public void ToggleBoxMode() 2169 2176 { 2170 2177 BOXMODE ^= true; 2178 + }2179 +2180 + public void ToggleZoomBoxMode()2181 + {2182 + ZOOMBOXMODE ^= true;2171 2183 } 2172 2184 2173 2185 public void ToggleSmoothFocus() .. .. @@ -13523,6 +13535,7 @@ 13523 13535 13524 13536 //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); 13525 13537 13538 + if (BUTTONLESSWHEEL)13526 13539 if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) 13527 13540 { 13528 13541 return; .. .. @@ -13531,7 +13544,7 @@ 13531 13544 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); 13532 13545 13533 13546 // TIMER 13534 - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR13547 + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR13535 13548 { 13536 13549 keepboxmode = BOXMODE; 13537 13550 keepsupport = SUPPORT; .. .. @@ -13748,11 +13761,11 @@ 13748 13761 13749 13762 public void mouseDragged(MouseEvent e) 13750 13763 { 13764 + //System.out.println("mouseDragged: " + e);13751 13765 if (isRenderer) 13752 13766 movingcamera = true; 13753 13767 //if (drawing) 13754 13768 //return; 13755 - //System.out.println("mouseDragged: " + e);13756 13769 if ((e.getModifiersEx() & CTRL) != 0 13757 13770 || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) 13758 13771 { .. .. @@ -14287,7 +14300,6 @@ 14287 14300 public void mouseMoved(MouseEvent e) 14288 14301 { 14289 14302 //System.out.println("mouseMoved: " + e); 14290 -14291 14303 if (isRenderer) 14292 14304 return; 14293 14305 .. .. @@ -15100,8 +15112,9 @@ 15100 15112 15101 15113 protected void processMouseMotionEvent(MouseEvent e) 15102 15114 { 15103 - //System.out.println("processMouseMotionEvent: " + mouseMode);15104 - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)15115 + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());15116 + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)15117 + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)15105 15118 { 15106 15119 mouseMoved(e); 15107 15120 } else GrafreeD.java
.. .. @@ -595,6 +595,9 @@ 595 595 596 596 public static void main(String argv[]) 597 597 { 598 + String osArch = System.getProperty("os.arch");599 + System.out.println("os.arch = " + osArch);600 +598 601 if (argv.length == 0) 599 602 { 600 603 String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; .. .. @@ -626,7 +629,11 @@ 626 629 System.out.println("jarfile = " + jarfile); 627 630 jarpath = jarpath.substring(1, jarpath.length()); 628 631 System.out.println("jarpath = " + jarpath); 629 - command += "native" + File.separator + "windows_amd64";632 + command += "native" + File.separator;633 + if (osArch.equals("amd64"))634 + command += "windows_amd64";635 + else636 + command += "windows_i586";630 637 } 631 638 else 632 639 command += "native" + File.separator + "macosx"; GroupEditor.java
.. .. @@ -438,10 +438,16 @@ 438 438 oe.aConstraints.gridx = 0; 439 439 440 440 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints); 441 + liveCB.setToolTipText("Enabled animation");441 442 liveCB.addItemListener(this); 442 443 443 444 oe.aConstraints.gridx += 1; 445 + oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);446 + fastCB.setToolTipText("Fast mode");447 + fastCB.addItemListener(this);448 + oe.aConstraints.gridx += 1;444 449 oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints); 450 + supportCB.setToolTipText("Enabled rigging");445 451 supportCB.addItemListener(this); 446 452 447 453 // oe.aConstraints.gridx += 1; .. .. @@ -450,21 +456,26 @@ 450 456 451 457 oe.aConstraints.gridx += 1; 452 458 oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints); 459 + crowdCB.setToolTipText("Used for crowds");453 460 crowdCB.addItemListener(this); 454 461 455 462 oe.aConstraints.gridx += 1; 456 463 oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints); 464 + smoothCB.setToolTipText("Snapping delay");457 465 smoothCB.addItemListener(this); 458 466 459 467 oe.aConstraints.gridx += 1; 460 - oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);461 - fastCB.addItemListener(this);462 - oe.aConstraints.gridx += 1;463 468 oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints); 469 + slowCB.setToolTipText("Smooth interpolation");464 470 slowCB.addItemListener(this); 465 471 oe.aConstraints.gridx += 1; 466 - oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);472 + oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), oe.aConstraints);473 + boxCB.setToolTipText("Display bounding boxes");467 474 boxCB.addItemListener(this); 475 + oe.aConstraints.gridx += 1;476 + oe.toolbarPanel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), oe.aConstraints);477 + zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");478 + zoomBoxCB.addItemListener(this);468 479 469 480 // oe.aConstraints.gridx += 1; 470 481 // oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints); .. .. @@ -491,19 +502,22 @@ 491 502 // debugCB.addItemListener(this); 492 503 493 504 oe.aConstraints.gridx += 1; 494 - oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);505 + oe.toolbarPanel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), oe.aConstraints);495 506 oeilCB.addItemListener(this); 496 507 497 508 oe.aConstraints.gridx += 1; 498 - oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);509 + oe.toolbarPanel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), oe.aConstraints);510 + lookAtCB.setToolTipText("Look-at target");499 511 lookAtCB.addItemListener(this); 500 512 501 513 oe.aConstraints.gridx += 1; 502 514 oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints); 515 + trackCB.setToolTipText("Enable tracking");503 516 trackCB.addItemListener(this); 504 517 505 518 oe.aConstraints.gridx += 1; 506 519 oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints); 520 + screenfitButton.setToolTipText("Screen fit");507 521 screenfitButton.addActionListener(this); 508 522 oe.aConstraints.gridx += 1; 509 523 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints); .. .. @@ -511,6 +525,7 @@ 511 525 // oe.aConstraints.gridx += 1; 512 526 oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints); 513 527 snapobjectButton.addActionListener(this); 528 + snapobjectButton.setToolTipText("Snap Object");514 529 oe.aConstraints.gridx += 1; 515 530 516 531 //aConstraints.gridx = 0; .. .. @@ -519,6 +534,7 @@ 519 534 oe.aConstraints.gridwidth = 1; 520 535 521 536 oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints); 537 + flashSelectionButton.setToolTipText("Show selection");522 538 flashSelectionButton.addActionListener(this); 523 539 524 540 oe.toolbarPanel.add(new cButton(" ", false)); .. .. @@ -529,21 +545,28 @@ 529 545 530 546 // 531 547 oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints); 548 + twoButton.setToolTipText("Show center view only");532 549 twoButton.addActionListener(this); 533 550 oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints); 534 551 fourButton.addActionListener(this); 552 + fourButton.setToolTipText("Show left panel only");535 553 oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints); 554 + sixButton.setToolTipText("2-column layout left");536 555 sixButton.addActionListener(this); 537 556 oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints); 557 + threeButton.setToolTipText("2-column layout right");538 558 threeButton.addActionListener(this); 539 559 oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints); 560 + sevenButton.setToolTipText("3-column layout");540 561 sevenButton.addActionListener(this); 541 562 // 542 563 543 - oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);564 + oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);565 + rootButton.setToolTipText("Edit object in new tab");544 566 rootButton.addActionListener(this); 545 567 oe.aConstraints.gridx += 1; 546 568 oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints); 569 + closeButton.setToolTipText("Close tab");547 570 closeButton.addActionListener(this); 548 571 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); 549 572 //clearButton.addActionListener(this); .. .. @@ -676,6 +699,7 @@ 676 699 JCheckBox fastCB; 677 700 JCheckBox slowCB; 678 701 JCheckBox boxCB; 702 + JCheckBox zoomBoxCB;679 703 JCheckBox trackCB; 680 704 JCheckBox smoothfocusCB; 681 705 // JCheckBox speakerMocapCB; .. .. @@ -756,6 +780,10 @@ 756 780 cameraView.repaint(); 757 781 // refreshContents(); 758 782 } 783 + else if(e.getSource() == zoomBoxCB)784 + {785 + cameraView.ToggleZoomBoxMode();786 + }759 787 else if(e.getSource() == smoothfocusCB) 760 788 { 761 789 cameraView.ToggleSmoothFocus(); Object3D.java
.. .. @@ -2906,7 +2906,8 @@ 2906 2906 { 2907 2907 if (bRep != null) 2908 2908 { 2909 - bRep.GenUV();2909 + bRep.GenUV(); //1);2910 + //bRep.UnfoldUV();2910 2911 Touch(); 2911 2912 } 2912 2913 } .. .. @@ -5898,6 +5899,7 @@ 5898 5899 return; 5899 5900 } 5900 5901 5902 + //bRep.GenUV(1/material.diffuseness);5901 5903 // bRep.lock = true; 5902 5904 5903 5905 //javax.media.opengl.GL gl = display.GetGL(); timeflow/app/TimeflowApp.java
.. .. @@ -1,5 +1,6 @@ 1 1 package timeflow.app; 2 2 3 +import java.net.URL;3 4 import timeflow.app.ui.*; 4 5 import timeflow.app.actions.*; 5 6 import timeflow.app.ui.filter.*; .. .. @@ -696,7 +697,9 @@ 696 697 System.out.println("getVisibleFiles = " + dir); 697 698 try 698 699 { 699 - String[] s = new File(TimeflowApp.class.getClassLoader().getResource(dir).toURI()).list();700 + final URL resource = TimeflowApp.class.getClassLoader().getResource(dir);701 + System.out.println("resource = " + resource);702 + String[] s = new File(resource.toURI()).list();700 703 ArrayList<String> real = new ArrayList<String>(); 701 704 for (int i = 0; i < s.length; i++) 702 705 { .. .. @@ -709,6 +712,7 @@ 709 712 } 710 713 catch (Exception e) 711 714 { 715 + e.printStackTrace();712 716 return new String[0]; 713 717 } 714 718 } timeflow/views/IntroView.java
.. .. @@ -73,7 +73,14 @@ 73 73 { 74 74 try 75 75 { 76 - String sidebar = IO.read(new File(IntroView.class.getClassLoader().getResource("timeflow/settings/sidebar.html").toURI()));76 + //resource = jar:file:/Users/nbriere/Projects/GrafreeD/dist/GrafreeD.jar!/timeflow/settings/sidebar.html77 + //java.lang.IllegalArgumentException: URI is not hierarchical78 +79 + //if (true) return;80 +81 + final URL resource = IntroView.class.getClassLoader().getResource("sidebar.html");82 + System.out.println("resource = " + resource);83 + String sidebar = IO.read(new File(resource.toURI()));77 84 controls = new HtmlControls(sidebar); 78 85 } catch (Exception e) 79 86 {