.. | .. |
---|
300 | 300 | } |
---|
301 | 301 | |
---|
302 | 302 | boolean live = false; |
---|
| 303 | + boolean dontselect = false; |
---|
303 | 304 | boolean hide = false; |
---|
304 | 305 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 306 | boolean marked = false; // animation node |
---|
.. | .. |
---|
774 | 775 | if (step == 0) |
---|
775 | 776 | step = 1; |
---|
776 | 777 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 778 | + maxcount = 128; // 2048; // 4; |
---|
778 | 779 | // if (acceleration == 0) |
---|
779 | 780 | // acceleration = 10; |
---|
780 | 781 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 798 | |
---|
798 | 799 | if (marked && Globals.isLIVE() && live && |
---|
799 | 800 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 801 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
801 | 802 | currentframe != Globals.framecount) |
---|
802 | 803 | { |
---|
803 | 804 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
912 | 913 | fromParent = null; // LA.newMatrix(); |
---|
913 | 914 | bRep = null; // new BoundaryRep(); |
---|
914 | 915 | |
---|
| 916 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 917 | + { |
---|
| 918 | + name = oname; |
---|
| 919 | + } |
---|
| 920 | + |
---|
915 | 921 | /* |
---|
916 | 922 | float hue = (float)Math.random(); |
---|
917 | 923 | Color col; |
---|
.. | .. |
---|
1470 | 1476 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1477 | |
---|
1472 | 1478 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1479 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1480 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1481 | } |
---|
1476 | 1482 | |
---|
.. | .. |
---|
1829 | 1835 | if (obj.name == null) |
---|
1830 | 1836 | continue; // can't be a null one |
---|
1831 | 1837 | |
---|
| 1838 | + // Try perfect match first. |
---|
1832 | 1839 | if (n.equals(obj.name)) |
---|
1833 | 1840 | { |
---|
1834 | 1841 | theobj = obj; |
---|
1835 | 1842 | count++; |
---|
1836 | 1843 | } |
---|
1837 | 1844 | } |
---|
| 1845 | + |
---|
| 1846 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1847 | |
---|
1839 | 1848 | if (count != 1) |
---|
1840 | 1849 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2983 | 2992 | blockloop = false; |
---|
2984 | 2993 | } |
---|
2985 | 2994 | |
---|
| 2995 | + void TransformChildren() |
---|
| 2996 | + { |
---|
| 2997 | + if (toParent != null) |
---|
| 2998 | + { |
---|
| 2999 | + for (int i=Size(); --i>=0;) |
---|
| 3000 | + { |
---|
| 3001 | + Object3D v = get(i); |
---|
| 3002 | + |
---|
| 3003 | + if (v.toParent == null) |
---|
| 3004 | + { |
---|
| 3005 | + v.toParent = LA.newMatrix(); |
---|
| 3006 | + v.fromParent = LA.newMatrix(); |
---|
| 3007 | + } |
---|
| 3008 | + |
---|
| 3009 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3010 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3011 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3012 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3013 | + } |
---|
| 3014 | + |
---|
| 3015 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3016 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3017 | + |
---|
| 3018 | + Touch(); |
---|
| 3019 | + } |
---|
| 3020 | + } |
---|
| 3021 | + |
---|
2986 | 3022 | void TransformGeometry() |
---|
2987 | 3023 | { |
---|
2988 | 3024 | Object3D obj = this; |
---|
.. | .. |
---|
3206 | 3242 | bRep.support = null; |
---|
3207 | 3243 | BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3244 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3245 | + |
---|
| 3246 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3247 | + |
---|
3210 | 3248 | bRep = temprep; |
---|
3211 | 3249 | bRep.support = sup; |
---|
3212 | 3250 | Touch(); |
---|
.. | .. |
---|
4681 | 4719 | |
---|
4682 | 4720 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4721 | { |
---|
4684 | | - if (hide) |
---|
| 4722 | + if (hide || dontselect) |
---|
4685 | 4723 | return null; |
---|
4686 | 4724 | |
---|
4687 | 4725 | if (count <= 0) |
---|
.. | .. |
---|
4707 | 4745 | |
---|
4708 | 4746 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 4747 | { |
---|
4710 | | - if (hide) |
---|
| 4748 | + if (hide || dontselect) |
---|
4711 | 4749 | return null; |
---|
4712 | 4750 | |
---|
4713 | 4751 | if (count <= 0) |
---|
.. | .. |
---|
5377 | 5415 | boolean NeedSupport() |
---|
5378 | 5416 | { |
---|
5379 | 5417 | return |
---|
5380 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5418 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5381 | 5419 | // PROBLEM with CROWD!! |
---|
5382 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5420 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5383 | 5421 | } |
---|
5384 | 5422 | |
---|
5385 | 5423 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5394 | 5432 | } |
---|
5395 | 5433 | |
---|
5396 | 5434 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5397 | | - hide) |
---|
| 5435 | + (hide || dontselect)) |
---|
5398 | 5436 | return; |
---|
5399 | 5437 | |
---|
5400 | 5438 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5636 | 5674 | tex = GetTextures(); |
---|
5637 | 5675 | } |
---|
5638 | 5676 | |
---|
5639 | | - display.BindTextures(tex, texres); |
---|
| 5677 | + boolean failed = false; |
---|
| 5678 | + |
---|
| 5679 | + try |
---|
| 5680 | + { |
---|
| 5681 | + display.BindTextures(tex, texres); |
---|
| 5682 | + } |
---|
| 5683 | + catch (Exception e) |
---|
| 5684 | + { |
---|
| 5685 | + System.err.println("FAILED: " + this); |
---|
| 5686 | + failed = true; |
---|
| 5687 | + } |
---|
5640 | 5688 | |
---|
5641 | 5689 | if (!compiled) |
---|
5642 | 5690 | { |
---|
.. | .. |
---|
5658 | 5706 | } |
---|
5659 | 5707 | } |
---|
5660 | 5708 | |
---|
5661 | | - display.ReleaseTextures(tex); |
---|
| 5709 | + if (!failed) |
---|
| 5710 | + display.ReleaseTextures(tex); |
---|
5662 | 5711 | |
---|
5663 | 5712 | display.PopMaterial(this, selected); |
---|
5664 | 5713 | } |
---|
.. | .. |
---|
5787 | 5836 | |
---|
5788 | 5837 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5789 | 5838 | { |
---|
| 5839 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5840 | + return; |
---|
| 5841 | + |
---|
5790 | 5842 | if (hide) |
---|
5791 | 5843 | return; |
---|
5792 | 5844 | // shadow optimisation |
---|
.. | .. |
---|
5911 | 5963 | { |
---|
5912 | 5964 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5913 | 5965 | return; // no shadow for transparent objects |
---|
| 5966 | + |
---|
| 5967 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5968 | + return; |
---|
5914 | 5969 | |
---|
5915 | 5970 | if (hide) |
---|
5916 | 5971 | return; |
---|
.. | .. |
---|
6895 | 6950 | // { |
---|
6896 | 6951 | // CameraPane.Ymax = spoth; |
---|
6897 | 6952 | // } |
---|
6898 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6899 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 6953 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 6954 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
6900 | 6955 | spot.translate(0, -32); |
---|
6901 | 6956 | info.g.setColor(Color.green); |
---|
6902 | 6957 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
6951 | 7006 | startX = info.x; |
---|
6952 | 7007 | startY = info.y; |
---|
6953 | 7008 | |
---|
6954 | | - hitSomething = 0; |
---|
| 7009 | + hitSomething = -1; |
---|
6955 | 7010 | cVector origin = new cVector(); |
---|
6956 | 7011 | //LA.xformPos(origin, toParent, origin); |
---|
6957 | 7012 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7027 | 7082 | //System.out.println("hitSomething = " + hitSomething); |
---|
7028 | 7083 | |
---|
7029 | 7084 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7085 | + |
---|
7030 | 7086 | cVector xlate = new cVector(); |
---|
7031 | 7087 | //cVector xlate2 = new cVector(); |
---|
7032 | 7088 | switch (hitSomething) |
---|
.. | .. |
---|
7175 | 7231 | |
---|
7176 | 7232 | case hitScale: // scale |
---|
7177 | 7233 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7234 | + double sign = 1; |
---|
| 7235 | + if (hScale < 0) |
---|
| 7236 | + { |
---|
| 7237 | + sign = -1; |
---|
| 7238 | + } |
---|
| 7239 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7178 | 7240 | if (hScale < 0.01) |
---|
7179 | 7241 | { |
---|
7180 | | - hScale = 0.01; |
---|
| 7242 | + //hScale = 0.01; |
---|
7181 | 7243 | } |
---|
7182 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7183 | | - if (hScale < 0.01) |
---|
7184 | | - { |
---|
7185 | | - hScale = 0.01; |
---|
7186 | | - } |
---|
| 7244 | + |
---|
7187 | 7245 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7188 | | - if (vScale < 0.01) |
---|
| 7246 | + sign = 1; |
---|
| 7247 | + if (vScale < 0) |
---|
7189 | 7248 | { |
---|
7190 | | - vScale = 0.01; |
---|
| 7249 | + sign = -1; |
---|
7191 | 7250 | } |
---|
7192 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7251 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7193 | 7252 | if (vScale < 0.01) |
---|
7194 | 7253 | { |
---|
7195 | | - vScale = 0.01; |
---|
| 7254 | + //vScale = 0.01; |
---|
7196 | 7255 | } |
---|
7197 | 7256 | LA.matCopy(startMat, toParent); |
---|
7198 | 7257 | /**/ |
---|
.. | .. |
---|
7203 | 7262 | } |
---|
7204 | 7263 | /**/ |
---|
7205 | 7264 | |
---|
| 7265 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7266 | + |
---|
| 7267 | + if (totalScale < 0.01) |
---|
| 7268 | + { |
---|
| 7269 | + totalScale = 0.01; |
---|
| 7270 | + } |
---|
| 7271 | + |
---|
7206 | 7272 | switch (info.pane.RenderCamera().viewCode) |
---|
7207 | 7273 | { |
---|
7208 | 7274 | case 3: // '\001' |
---|
7209 | 7275 | if (modified) |
---|
7210 | 7276 | { |
---|
7211 | 7277 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7212 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7278 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7213 | 7279 | } // vScale, 1); |
---|
7214 | 7280 | else |
---|
7215 | 7281 | { |
---|
7216 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7282 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7217 | 7283 | } // vScale, 1); |
---|
7218 | 7284 | break; |
---|
7219 | 7285 | |
---|
.. | .. |
---|
7221 | 7287 | if (modified) |
---|
7222 | 7288 | { |
---|
7223 | 7289 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7224 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7290 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7225 | 7291 | } else |
---|
7226 | 7292 | { |
---|
7227 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7293 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7228 | 7294 | } |
---|
7229 | 7295 | break; |
---|
7230 | 7296 | |
---|
.. | .. |
---|
7232 | 7298 | if (modified) |
---|
7233 | 7299 | { |
---|
7234 | 7300 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7235 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7301 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7236 | 7302 | } else |
---|
7237 | 7303 | { |
---|
7238 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7304 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7239 | 7305 | } |
---|
7240 | 7306 | break; |
---|
7241 | 7307 | } |
---|
.. | .. |
---|
7368 | 7434 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7369 | 7435 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7370 | 7436 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7437 | + |
---|
| 7438 | + String objname; |
---|
| 7439 | + |
---|
7371 | 7440 | if (false) //parent != null) |
---|
7372 | 7441 | { |
---|
7373 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7442 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7374 | 7443 | } else |
---|
7375 | 7444 | { |
---|
7376 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7445 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7377 | 7446 | } // + super.toString(); |
---|
7378 | 7447 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7448 | + |
---|
| 7449 | + if (!Globals.ADVANCED) |
---|
| 7450 | + return objname; |
---|
| 7451 | + |
---|
| 7452 | + return objname + " " + System.identityHashCode(this); |
---|
7379 | 7453 | } |
---|
7380 | 7454 | |
---|
7381 | 7455 | public int hashCode() |
---|
.. | .. |
---|
7616 | 7690 | private static cVector edge2 = new cVector(); |
---|
7617 | 7691 | //private static cVector norm = new cVector(); |
---|
7618 | 7692 | /*transient private*/ int hitSomething; |
---|
7619 | | - private static final int hitCenter = 1; |
---|
7620 | | - private static final int hitScale = 2; |
---|
7621 | | - private static final int hitRotate = 3; |
---|
| 7693 | + static final int hitCenter = 1; |
---|
| 7694 | + static final int hitScale = 2; |
---|
| 7695 | + static final int hitRotate = 3; |
---|
7622 | 7696 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7623 | 7697 | /*transient*/ private Point centerPt; |
---|
7624 | 7698 | /*transient*/ private int startX; |
---|