.. | .. |
---|
21 | 21 | |
---|
22 | 22 | ScriptNode scriptnode; |
---|
23 | 23 | |
---|
| 24 | + void InitOthers() |
---|
| 25 | + { |
---|
| 26 | + if (projectedVertices == null || projectedVertices.length <= 2) |
---|
| 27 | + { |
---|
| 28 | + projectedVertices = new Object3D.cVector2[3]; |
---|
| 29 | + } |
---|
| 30 | + for (int i = 0; i < 3; i++) |
---|
| 31 | + { |
---|
| 32 | + projectedVertices[i] = new cVector2(); // Others |
---|
| 33 | + } |
---|
| 34 | + projectedVertices[0].x = 100; // bump |
---|
| 35 | + } |
---|
| 36 | + |
---|
24 | 37 | void MinMax(cVector minima, cVector maxima) |
---|
25 | 38 | { |
---|
26 | 39 | for (int xyz = 0; xyz < 3; xyz++) |
---|
.. | .. |
---|
296 | 309 | boolean speedup = false; |
---|
297 | 310 | boolean rewind = false; |
---|
298 | 311 | |
---|
| 312 | + float NORMALPUSH = 0; |
---|
| 313 | + |
---|
299 | 314 | Object3D support; |
---|
300 | 315 | |
---|
301 | 316 | Object3D GetObject() |
---|
.. | .. |
---|
355 | 370 | |
---|
356 | 371 | int MemorySize() |
---|
357 | 372 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 373 | + if (true) // memorysize == 0) |
---|
359 | 374 | { |
---|
360 | 375 | try |
---|
361 | 376 | { |
---|
.. | .. |
---|
779 | 794 | // factor = CameraPane.STEP; |
---|
780 | 795 | // } |
---|
781 | 796 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 797 | + if (marked && CameraPane.isLIVE() && live && |
---|
| 798 | + //TEMP21aug2018 |
---|
| 799 | + CameraPane.drawMode == CameraPane.SHADOW && |
---|
| 800 | + currentframe != CameraPane.framecount) |
---|
783 | 801 | { |
---|
784 | 802 | currentframe = CameraPane.framecount; |
---|
785 | 803 | |
---|
.. | .. |
---|
1446 | 1464 | // if (other == null) |
---|
1447 | 1465 | // return; |
---|
1448 | 1466 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1467 | + if (other != null) |
---|
| 1468 | + { |
---|
| 1469 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1470 | + |
---|
| 1471 | + // Set default to 0.1 |
---|
| 1472 | + BoundaryRep.SEUIL /= 2; |
---|
| 1473 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1474 | + } |
---|
| 1475 | + |
---|
| 1476 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1477 | |
---|
1451 | 1478 | //if (bRep != null) |
---|
1452 | 1479 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1816 | 1843 | if (obj.name == null) |
---|
1817 | 1844 | continue; // can't be a null one |
---|
1818 | 1845 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1846 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1847 | + //if (n.startsWith(obj.name)) |
---|
| 1848 | + if (n.contains(name)) |
---|
1821 | 1849 | { |
---|
1822 | 1850 | theobj = obj; |
---|
1823 | 1851 | count++; |
---|
.. | .. |
---|
2120 | 2148 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2149 | { |
---|
2122 | 2150 | material = new cMaterial(GetMaterial()); |
---|
2123 | | - if (projectedVertices == null || projectedVertices.length <= 2) |
---|
2124 | | - { |
---|
2125 | | - projectedVertices = new Object3D.cVector2[3]; |
---|
2126 | | - } |
---|
2127 | | - for (int i = 0; i < 3; i++) |
---|
2128 | | - { |
---|
2129 | | - projectedVertices[i] = new cVector2(); // Others |
---|
2130 | | - } |
---|
2131 | | - projectedVertices[0].x = 100; // bump |
---|
| 2151 | + |
---|
| 2152 | + InitOthers(); |
---|
2132 | 2153 | |
---|
2133 | 2154 | if (this instanceof Camera) |
---|
2134 | 2155 | { |
---|
.. | .. |
---|
2732 | 2753 | blockloop = false; |
---|
2733 | 2754 | } |
---|
2734 | 2755 | |
---|
| 2756 | + void GenNormalsMINE() |
---|
| 2757 | + { |
---|
| 2758 | + if (blockloop) |
---|
| 2759 | + return; |
---|
| 2760 | + |
---|
| 2761 | + blockloop = true; |
---|
| 2762 | + GenNormalsMINE0(); |
---|
| 2763 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2764 | + { |
---|
| 2765 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2766 | + if (child == null) |
---|
| 2767 | + continue; |
---|
| 2768 | + child.GenNormalsMINE(); |
---|
| 2769 | +// Children().release(i); |
---|
| 2770 | + } |
---|
| 2771 | + blockloop = false; |
---|
| 2772 | + } |
---|
| 2773 | + |
---|
2735 | 2774 | void ClearColors() |
---|
2736 | 2775 | { |
---|
2737 | 2776 | if (blockloop) |
---|
.. | .. |
---|
2876 | 2915 | if (bRep != null) |
---|
2877 | 2916 | { |
---|
2878 | 2917 | bRep.GenerateNormals(crease); |
---|
| 2918 | + Touch(); |
---|
| 2919 | + } |
---|
| 2920 | + } |
---|
| 2921 | + |
---|
| 2922 | + void GenNormalsMINE0() |
---|
| 2923 | + { |
---|
| 2924 | + if (bRep != null) |
---|
| 2925 | + { |
---|
| 2926 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 2927 | Touch(); |
---|
2880 | 2928 | } |
---|
2881 | 2929 | } |
---|
.. | .. |
---|
4111 | 4159 | if (blockloop) |
---|
4112 | 4160 | return; |
---|
4113 | 4161 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4162 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4163 | { |
---|
4116 | 4164 | if (get(i).parent != this) |
---|
4117 | 4165 | { |
---|
.. | .. |
---|
4120 | 4168 | } |
---|
4121 | 4169 | blockloop = true; |
---|
4122 | 4170 | get(i).RepairParent(); |
---|
| 4171 | + blockloop = false; |
---|
| 4172 | + } |
---|
| 4173 | + } |
---|
| 4174 | + |
---|
| 4175 | + void RepairShadow() |
---|
| 4176 | + { |
---|
| 4177 | + if (blockloop) |
---|
| 4178 | + return; |
---|
| 4179 | + |
---|
| 4180 | + if (this.material != null) |
---|
| 4181 | + this.InitOthers(); |
---|
| 4182 | + |
---|
| 4183 | + for (int i=0; i<Size(); i++) |
---|
| 4184 | + { |
---|
| 4185 | + blockloop = true; |
---|
| 4186 | + get(i).RepairShadow(); |
---|
4123 | 4187 | blockloop = false; |
---|
4124 | 4188 | } |
---|
4125 | 4189 | } |
---|
.. | .. |
---|
5921 | 5985 | |
---|
5922 | 5986 | javax.media.opengl.GL gl = display.GetGL(); |
---|
5923 | 5987 | |
---|
5924 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 5988 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5925 | 5989 | { |
---|
5926 | 5990 | int fc = bRep.FaceCount(); |
---|
5927 | 5991 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
6662 | 6726 | gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6663 | 6727 | } |
---|
6664 | 6728 | |
---|
| 6729 | + // P |
---|
| 6730 | + float x = (float)pv.x; |
---|
| 6731 | + float y = (float)pv.y; |
---|
| 6732 | + float z = (float)pv.z; |
---|
| 6733 | + |
---|
6665 | 6734 | if (hasnorm) |
---|
6666 | 6735 | { |
---|
6667 | 6736 | // if (!pv.norm.normalized()) |
---|
6668 | 6737 | // assert(pv.norm.normalized()); |
---|
6669 | 6738 | |
---|
6670 | 6739 | //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6671 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
| 6740 | + float nx = (float)pv.norm.x; |
---|
| 6741 | + float ny = (float)pv.norm.y; |
---|
| 6742 | + float nz = (float)pv.norm.z; |
---|
| 6743 | + |
---|
| 6744 | + x += nx * NORMALPUSH; |
---|
| 6745 | + y += ny * NORMALPUSH; |
---|
| 6746 | + z += nz * NORMALPUSH; |
---|
| 6747 | + |
---|
| 6748 | + gl.glNormal3f(nx, ny, nz); |
---|
6672 | 6749 | } |
---|
6673 | 6750 | gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6674 | 6751 | SetColor(display, pv); |
---|
.. | .. |
---|
6679 | 6756 | else |
---|
6680 | 6757 | gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6681 | 6758 | //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6682 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
| 6759 | + |
---|
| 6760 | + gl.glVertex3f(x, y, z); |
---|
| 6761 | + |
---|
| 6762 | + // Q |
---|
| 6763 | + x = (float)qv.x; |
---|
| 6764 | + y = (float)qv.y; |
---|
| 6765 | + z = (float)qv.z; |
---|
| 6766 | + |
---|
6683 | 6767 | // Print(pv); |
---|
6684 | 6768 | if (hasnorm) |
---|
6685 | 6769 | { |
---|
6686 | 6770 | // assert(qv.norm.normalized()); |
---|
6687 | 6771 | //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6688 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
| 6772 | + float nx = (float)qv.norm.x; |
---|
| 6773 | + float ny = (float)qv.norm.y; |
---|
| 6774 | + float nz = (float)qv.norm.z; |
---|
| 6775 | + |
---|
| 6776 | + x += nx * NORMALPUSH; |
---|
| 6777 | + y += ny * NORMALPUSH; |
---|
| 6778 | + z += nz * NORMALPUSH; |
---|
| 6779 | + |
---|
| 6780 | + gl.glNormal3f(nx, ny, nz); |
---|
6689 | 6781 | } |
---|
6690 | 6782 | //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6691 | 6783 | // boolean locked = false; |
---|
.. | .. |
---|
6709 | 6801 | // } |
---|
6710 | 6802 | gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6711 | 6803 | SetColor(display, qv); |
---|
| 6804 | + |
---|
| 6805 | + gl.glVertex3f(x, y, z); |
---|
6712 | 6806 | //gl.glColor4f(r, g, b, 1); |
---|
6713 | 6807 | //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6714 | 6808 | //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6715 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6716 | 6809 | // Print(qv); |
---|
| 6810 | + |
---|
| 6811 | + // R |
---|
| 6812 | + x = (float)rv.x; |
---|
| 6813 | + y = (float)rv.y; |
---|
| 6814 | + z = (float)rv.z; |
---|
| 6815 | + |
---|
6717 | 6816 | if (hasnorm) |
---|
6718 | 6817 | { |
---|
6719 | 6818 | // assert(rv.norm.normalized()); |
---|
6720 | 6819 | //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6721 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
| 6820 | + float nx = (float)rv.norm.x; |
---|
| 6821 | + float ny = (float)rv.norm.y; |
---|
| 6822 | + float nz = (float)rv.norm.z; |
---|
| 6823 | + |
---|
| 6824 | + x += nx * NORMALPUSH; |
---|
| 6825 | + y += ny * NORMALPUSH; |
---|
| 6826 | + z += nz * NORMALPUSH; |
---|
| 6827 | + |
---|
| 6828 | + gl.glNormal3f(nx, ny, nz); |
---|
6722 | 6829 | } |
---|
6723 | 6830 | |
---|
6724 | 6831 | // if ((dot&4) == 0) |
---|
.. | .. |
---|
6739 | 6846 | //gl.glColor4f(r, g, b, 1); |
---|
6740 | 6847 | //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6741 | 6848 | //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6742 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
| 6849 | + gl.glVertex3f(x, y, z); |
---|
6743 | 6850 | // Print(rv); |
---|
6744 | 6851 | //gl.glEnd(); |
---|
6745 | 6852 | } |
---|
.. | .. |
---|
7733 | 7840 | if (parent == null) |
---|
7734 | 7841 | { |
---|
7735 | 7842 | System.out.println("NULL PARENT"); |
---|
7736 | | - new Exception().printStackTrace(); |
---|
| 7843 | + //new Exception().printStackTrace(); |
---|
7737 | 7844 | } else |
---|
7738 | 7845 | { |
---|
7739 | 7846 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
8126 | 8233 | { |
---|
8127 | 8234 | Object3D targ = this; |
---|
8128 | 8235 | |
---|
| 8236 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 8237 | + |
---|
8129 | 8238 | if (obj.material != null) |
---|
8130 | 8239 | { |
---|
8131 | 8240 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|