.. | .. |
---|
5 | 5 | import java.util.Vector; |
---|
6 | 6 | |
---|
7 | 7 | import javax.media.j3d.Transform3D; |
---|
| 8 | +import javax.media.opengl.GL; |
---|
8 | 9 | import javax.vecmath.Vector3d; |
---|
9 | 10 | |
---|
10 | 11 | import javax.imageio.ImageIO; |
---|
.. | .. |
---|
20 | 21 | static final long serialVersionUID = 5022536242724664900L; |
---|
21 | 22 | |
---|
22 | 23 | ScriptNode scriptnode; |
---|
| 24 | + |
---|
| 25 | + void InitOthers() |
---|
| 26 | + { |
---|
| 27 | + if (projectedVertices == null || projectedVertices.length <= 2) |
---|
| 28 | + { |
---|
| 29 | + projectedVertices = new Object3D.cVector2[3]; |
---|
| 30 | + } |
---|
| 31 | + for (int i = 0; i < 3; i++) |
---|
| 32 | + { |
---|
| 33 | + projectedVertices[i] = new cVector2(); // Others |
---|
| 34 | + } |
---|
| 35 | + projectedVertices[0].x = 100; // bump |
---|
| 36 | + } |
---|
23 | 37 | |
---|
24 | 38 | void MinMax(cVector minima, cVector maxima) |
---|
25 | 39 | { |
---|
.. | .. |
---|
296 | 310 | boolean speedup = false; |
---|
297 | 311 | boolean rewind = false; |
---|
298 | 312 | |
---|
| 313 | + float NORMALPUSH = 0; |
---|
| 314 | + |
---|
299 | 315 | Object3D support; |
---|
300 | 316 | |
---|
301 | 317 | Object3D GetObject() |
---|
.. | .. |
---|
355 | 371 | |
---|
356 | 372 | int MemorySize() |
---|
357 | 373 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 374 | + if (true) // memorysize == 0) |
---|
359 | 375 | { |
---|
360 | 376 | try |
---|
361 | 377 | { |
---|
.. | .. |
---|
415 | 431 | { |
---|
416 | 432 | Object3D copy = this; |
---|
417 | 433 | |
---|
418 | | - Camera parentcam = CameraPane.theRenderer.manipCamera; |
---|
| 434 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
419 | 435 | |
---|
420 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) |
---|
| 436 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
421 | 437 | { |
---|
422 | | - parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 438 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
423 | 439 | } |
---|
424 | 440 | |
---|
425 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) |
---|
| 441 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
426 | 442 | { |
---|
427 | | - parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 443 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
428 | 444 | } |
---|
429 | 445 | |
---|
430 | 446 | if (this == parentcam) |
---|
.. | .. |
---|
432 | 448 | //assert(this instanceof Camera); |
---|
433 | 449 | |
---|
434 | 450 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
435 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); |
---|
| 451 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
436 | 452 | } |
---|
437 | 453 | |
---|
438 | 454 | copy.marked ^= true; |
---|
.. | .. |
---|
452 | 468 | //assert(this instanceof Camera); |
---|
453 | 469 | |
---|
454 | 470 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
455 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); |
---|
| 471 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
456 | 472 | } |
---|
457 | 473 | |
---|
458 | 474 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
587 | 603 | return; |
---|
588 | 604 | } |
---|
589 | 605 | |
---|
590 | | - if (CameraPane.fromscript) |
---|
| 606 | + if (Globals.fromscript) |
---|
591 | 607 | { |
---|
592 | 608 | transformcount = 0; |
---|
593 | 609 | return; |
---|
.. | .. |
---|
745 | 761 | |
---|
746 | 762 | int GetTransformCount() |
---|
747 | 763 | { |
---|
748 | | - // marde pour serialization de Texture |
---|
| 764 | + // patch pour serialization de Texture |
---|
749 | 765 | resetmaxcount(); |
---|
750 | 766 | resettransformcount(); |
---|
751 | 767 | resetstep(); |
---|
.. | .. |
---|
779 | 795 | // factor = CameraPane.STEP; |
---|
780 | 796 | // } |
---|
781 | 797 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 798 | + if (marked && Globals.isLIVE() && live && |
---|
| 799 | + //TEMP21aug2018 |
---|
| 800 | + Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 801 | + currentframe != Globals.framecount) |
---|
783 | 802 | { |
---|
784 | | - currentframe = CameraPane.framecount; |
---|
| 803 | + currentframe = Globals.framecount; |
---|
785 | 804 | |
---|
786 | 805 | // System.err.println("transformcount = " + transformcount); |
---|
787 | 806 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
1446 | 1465 | // if (other == null) |
---|
1447 | 1466 | // return; |
---|
1448 | 1467 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1468 | + if (other != null) |
---|
| 1469 | + { |
---|
| 1470 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1471 | + |
---|
| 1472 | + // Set default to 0.1 |
---|
| 1473 | + BoundaryRep.SEUIL /= 2; |
---|
| 1474 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1475 | + } |
---|
| 1476 | + |
---|
| 1477 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1478 | |
---|
1451 | 1479 | //if (bRep != null) |
---|
1452 | 1480 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1816 | 1844 | if (obj.name == null) |
---|
1817 | 1845 | continue; // can't be a null one |
---|
1818 | 1846 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1847 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1848 | + //if (n.startsWith(obj.name)) |
---|
| 1849 | + if (n.contains(name)) |
---|
1821 | 1850 | { |
---|
1822 | 1851 | theobj = obj; |
---|
1823 | 1852 | count++; |
---|
.. | .. |
---|
2120 | 2149 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2150 | { |
---|
2122 | 2151 | 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 |
---|
| 2152 | + |
---|
| 2153 | + InitOthers(); |
---|
2132 | 2154 | |
---|
2133 | 2155 | if (this instanceof Camera) |
---|
2134 | 2156 | { |
---|
.. | .. |
---|
2278 | 2300 | { |
---|
2279 | 2301 | if (newWindow) |
---|
2280 | 2302 | { |
---|
| 2303 | + new Exception().printStackTrace(); |
---|
2281 | 2304 | System.exit(0); |
---|
2282 | 2305 | if (parent != null) |
---|
2283 | 2306 | { |
---|
.. | .. |
---|
2732 | 2755 | blockloop = false; |
---|
2733 | 2756 | } |
---|
2734 | 2757 | |
---|
| 2758 | + void GenNormalsMINE() |
---|
| 2759 | + { |
---|
| 2760 | + if (blockloop) |
---|
| 2761 | + return; |
---|
| 2762 | + |
---|
| 2763 | + blockloop = true; |
---|
| 2764 | + GenNormalsMINE0(); |
---|
| 2765 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2766 | + { |
---|
| 2767 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2768 | + if (child == null) |
---|
| 2769 | + continue; |
---|
| 2770 | + child.GenNormalsMINE(); |
---|
| 2771 | +// Children().release(i); |
---|
| 2772 | + } |
---|
| 2773 | + blockloop = false; |
---|
| 2774 | + } |
---|
| 2775 | + |
---|
2735 | 2776 | void ClearColors() |
---|
2736 | 2777 | { |
---|
2737 | 2778 | if (blockloop) |
---|
.. | .. |
---|
2866 | 2907 | { |
---|
2867 | 2908 | if (bRep != null) |
---|
2868 | 2909 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 2910 | + bRep.GenUV(); //1); |
---|
| 2911 | + //bRep.UnfoldUV(); |
---|
2870 | 2912 | Touch(); |
---|
2871 | 2913 | } |
---|
2872 | 2914 | } |
---|
.. | .. |
---|
2876 | 2918 | if (bRep != null) |
---|
2877 | 2919 | { |
---|
2878 | 2920 | bRep.GenerateNormals(crease); |
---|
| 2921 | + Touch(); |
---|
| 2922 | + } |
---|
| 2923 | + } |
---|
| 2924 | + |
---|
| 2925 | + void GenNormalsMINE0() |
---|
| 2926 | + { |
---|
| 2927 | + if (bRep != null) |
---|
| 2928 | + { |
---|
| 2929 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 2930 | Touch(); |
---|
2880 | 2931 | } |
---|
2881 | 2932 | } |
---|
.. | .. |
---|
4111 | 4162 | if (blockloop) |
---|
4112 | 4163 | return; |
---|
4113 | 4164 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4165 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4166 | { |
---|
4116 | 4167 | if (get(i).parent != this) |
---|
4117 | 4168 | { |
---|
.. | .. |
---|
4120 | 4171 | } |
---|
4121 | 4172 | blockloop = true; |
---|
4122 | 4173 | get(i).RepairParent(); |
---|
| 4174 | + blockloop = false; |
---|
| 4175 | + } |
---|
| 4176 | + } |
---|
| 4177 | + |
---|
| 4178 | + void RepairShadow() |
---|
| 4179 | + { |
---|
| 4180 | + if (blockloop) |
---|
| 4181 | + return; |
---|
| 4182 | + |
---|
| 4183 | + if (this.material != null) |
---|
| 4184 | + this.InitOthers(); |
---|
| 4185 | + |
---|
| 4186 | + for (int i=0; i<Size(); i++) |
---|
| 4187 | + { |
---|
| 4188 | + blockloop = true; |
---|
| 4189 | + get(i).RepairShadow(); |
---|
4123 | 4190 | blockloop = false; |
---|
4124 | 4191 | } |
---|
4125 | 4192 | } |
---|
.. | .. |
---|
4790 | 4857 | return globalTransform; |
---|
4791 | 4858 | } |
---|
4792 | 4859 | |
---|
4793 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 4860 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4794 | 4861 | { |
---|
4795 | 4862 | /* |
---|
4796 | 4863 | if (AOdone) |
---|
.. | .. |
---|
4937 | 5004 | } else // |
---|
4938 | 5005 | if (editWindow != null) |
---|
4939 | 5006 | { |
---|
4940 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5007 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5008 | + Globals.lighttouched = true; |
---|
4941 | 5009 | } |
---|
4942 | 5010 | } |
---|
4943 | 5011 | |
---|
.. | .. |
---|
5091 | 5159 | |
---|
5092 | 5160 | // System.out.println("Fullname = " + fullname); |
---|
5093 | 5161 | |
---|
5094 | | - if (fullname.name.indexOf(":") == -1) |
---|
5095 | | - return fullname.name; |
---|
| 5162 | + // Does not work on Windows due to C: |
---|
| 5163 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5164 | +// return fullname.name; |
---|
| 5165 | +// |
---|
| 5166 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5096 | 5167 | |
---|
5097 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5168 | + String[] split = fullname.name.split(":"); |
---|
| 5169 | + |
---|
| 5170 | + if (split.length == 0) |
---|
| 5171 | + { |
---|
| 5172 | + return ""; |
---|
| 5173 | + } |
---|
| 5174 | + |
---|
| 5175 | + if (split.length <= 2) |
---|
| 5176 | + { |
---|
| 5177 | + if (fullname.name.endsWith(":")) |
---|
| 5178 | + { |
---|
| 5179 | + // Windows |
---|
| 5180 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5181 | + } |
---|
| 5182 | + |
---|
| 5183 | + return split[0]; |
---|
| 5184 | + } |
---|
| 5185 | + |
---|
| 5186 | + // Windows |
---|
| 5187 | + assert(split.length == 4); |
---|
| 5188 | + |
---|
| 5189 | + return split[0] + ":" + split[1]; |
---|
5098 | 5190 | } |
---|
5099 | 5191 | |
---|
5100 | 5192 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5103 | 5195 | return ""; |
---|
5104 | 5196 | |
---|
5105 | 5197 | // System.out.println("Fullname = " + fullname); |
---|
5106 | | - if (fullname.name.indexOf(":") == -1) |
---|
5107 | | - return ""; |
---|
5108 | | - |
---|
5109 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5198 | + // Does not work on Windows due to C: |
---|
| 5199 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5200 | +// return ""; |
---|
| 5201 | +// |
---|
| 5202 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5203 | + String[] split = fullname.name.split(":"); |
---|
| 5204 | + |
---|
| 5205 | + if (split.length == 0) |
---|
| 5206 | + { |
---|
| 5207 | + return ""; |
---|
| 5208 | + } |
---|
| 5209 | + |
---|
| 5210 | + if (split.length == 1) |
---|
| 5211 | + { |
---|
| 5212 | + return ""; |
---|
| 5213 | + } |
---|
| 5214 | + |
---|
| 5215 | + if (split.length == 2) |
---|
| 5216 | + { |
---|
| 5217 | + if (fullname.name.endsWith(":")) |
---|
| 5218 | + { |
---|
| 5219 | + // Windows |
---|
| 5220 | + return ""; |
---|
| 5221 | + } |
---|
| 5222 | + |
---|
| 5223 | + return split[1]; |
---|
| 5224 | + } |
---|
| 5225 | + |
---|
| 5226 | + // Windows |
---|
| 5227 | + assert(split.length == 4); |
---|
| 5228 | + |
---|
| 5229 | + return split[2] + ":" + split[3]; |
---|
5110 | 5230 | } |
---|
5111 | 5231 | |
---|
5112 | 5232 | String GetPigmentTexture() |
---|
.. | .. |
---|
5180 | 5300 | System.out.print("; textures = " + textures); |
---|
5181 | 5301 | System.out.println("; usedtextures = " + usedtextures); |
---|
5182 | 5302 | |
---|
5183 | | - if (GetTextures() == null) |
---|
| 5303 | + if (GetTextures() == null) // What is that?? |
---|
5184 | 5304 | GetTextures().name = ":"; |
---|
5185 | 5305 | |
---|
5186 | 5306 | String texname = tex; |
---|
.. | .. |
---|
5249 | 5369 | } |
---|
5250 | 5370 | } |
---|
5251 | 5371 | |
---|
5252 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5372 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5253 | 5373 | { |
---|
5254 | 5374 | Draw(display, root, selected, blocked); |
---|
5255 | 5375 | } |
---|
5256 | 5376 | |
---|
5257 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5258 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5259 | | - static int materialdepth = 0; |
---|
5260 | | - |
---|
5261 | 5377 | boolean NeedSupport() |
---|
5262 | 5378 | { |
---|
5263 | 5379 | return |
---|
5264 | 5380 | CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
5265 | 5381 | // PROBLEM with CROWD!! |
---|
5266 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5382 | + && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
5267 | 5383 | } |
---|
5268 | 5384 | |
---|
| 5385 | + static boolean DEBUG_SELECTION = false; |
---|
5269 | 5386 | |
---|
5270 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5387 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5271 | 5388 | { |
---|
5272 | 5389 | Invariants(); // june 2013 |
---|
5273 | 5390 | |
---|
.. | .. |
---|
5276 | 5393 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5277 | 5394 | } |
---|
5278 | 5395 | |
---|
5279 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
| 5396 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5280 | 5397 | hide) |
---|
5281 | 5398 | return; |
---|
5282 | 5399 | |
---|
.. | .. |
---|
5295 | 5412 | if (this instanceof Checker) |
---|
5296 | 5413 | return; |
---|
5297 | 5414 | |
---|
5298 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5415 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5299 | 5416 | return; |
---|
5300 | 5417 | |
---|
5301 | 5418 | if (count <= 0) |
---|
.. | .. |
---|
5303 | 5420 | return; |
---|
5304 | 5421 | } |
---|
5305 | 5422 | |
---|
5306 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5307 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5423 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5424 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5308 | 5425 | { |
---|
5309 | 5426 | return; |
---|
5310 | 5427 | } |
---|
5311 | 5428 | |
---|
5312 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5429 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5313 | 5430 | |
---|
5314 | 5431 | /* |
---|
5315 | 5432 | if (touched) |
---|
.. | .. |
---|
5345 | 5462 | |
---|
5346 | 5463 | boolean compiled = false; |
---|
5347 | 5464 | |
---|
5348 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5465 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5349 | 5466 | |
---|
5350 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
| 5467 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5351 | 5468 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5352 | 5469 | { |
---|
5353 | | - display.lighttouched = true; |
---|
| 5470 | + Globals.lighttouched = true; |
---|
5354 | 5471 | } // all panes... |
---|
5355 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5356 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5472 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5473 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5357 | 5474 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5358 | 5475 | { |
---|
5359 | 5476 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5361 | 5478 | //if (displaylist == -1 && usecalllists) |
---|
5362 | 5479 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5363 | 5480 | { |
---|
5364 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5481 | + bRep.displaylist = display.GenList(); |
---|
5365 | 5482 | assert(bRep.displaylist != 0); |
---|
5366 | 5483 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5367 | 5484 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5373 | 5490 | if (usecalllists) |
---|
5374 | 5491 | { |
---|
5375 | 5492 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5376 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5493 | + display.NewList(bRep.displaylist); |
---|
5377 | 5494 | } |
---|
| 5495 | + |
---|
5378 | 5496 | CallList(display, root, selected, blocked); |
---|
| 5497 | + |
---|
5379 | 5498 | // compiled = true; |
---|
5380 | 5499 | if (usecalllists) |
---|
5381 | 5500 | { |
---|
5382 | 5501 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5383 | | - gl.glEndList(); |
---|
| 5502 | + display.EndList(); |
---|
5384 | 5503 | } |
---|
5385 | 5504 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5386 | 5505 | // XXX touched = false; |
---|
5387 | | - display.lighttouched = true; // all panes... |
---|
| 5506 | + Globals.lighttouched = true; // all panes... |
---|
5388 | 5507 | } |
---|
5389 | 5508 | |
---|
5390 | 5509 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5423 | 5542 | |
---|
5424 | 5543 | // frustum culling |
---|
5425 | 5544 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5426 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5545 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5427 | 5546 | { |
---|
5428 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5547 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5429 | 5548 | { |
---|
5430 | 5549 | if (!link2master // tricky to cull in shadow mode. |
---|
5431 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5550 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5432 | 5551 | { |
---|
5433 | 5552 | //System.out.print("CULLED"); |
---|
5434 | 5553 | culled = true; |
---|
.. | .. |
---|
5436 | 5555 | } |
---|
5437 | 5556 | else |
---|
5438 | 5557 | //GetBRep().getBounds(v0, v1, this); |
---|
5439 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5558 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5440 | 5559 | culled = true; |
---|
5441 | 5560 | |
---|
5442 | 5561 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5472 | 5591 | |
---|
5473 | 5592 | |
---|
5474 | 5593 | if (!culled) |
---|
5475 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5594 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5476 | 5595 | { |
---|
5477 | 5596 | if (GetBRep() != null) |
---|
5478 | 5597 | { |
---|
5479 | | - CameraPane.NextIndex(this, gl); |
---|
| 5598 | + display.NextIndex(); |
---|
5480 | 5599 | // vertex color conflict : gl.glCallList(list); |
---|
5481 | 5600 | DrawNode(display, root, selected); |
---|
5482 | 5601 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5498 | 5617 | color[2] /= 2; |
---|
5499 | 5618 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5500 | 5619 | */ |
---|
5501 | | - if (material != null) |
---|
5502 | | - { |
---|
5503 | | - materialstack[materialdepth] = material; |
---|
5504 | | - selectedstack[materialdepth] = selected; |
---|
5505 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5506 | | - //System.out.println("material " + material); |
---|
5507 | | - //Applet3D.tracein(this, selected); |
---|
5508 | | - display.vector2buffer = projectedVertices; |
---|
5509 | | - if (this instanceof Camera) |
---|
5510 | | - { |
---|
5511 | | - display.options1[0] = material.shift; |
---|
5512 | | - //System.out.println("shift " + material.shift); |
---|
5513 | | - display.options1[1] = material.lightarea; |
---|
5514 | | - display.options1[2] = material.shadowbias; |
---|
5515 | | - display.options1[3] = material.aniso; |
---|
5516 | | - display.options1[4] = material.anisoV; |
---|
5517 | | - display.options2[0] = material.opacity; |
---|
5518 | | - display.options2[1] = material.diffuse; |
---|
5519 | | - display.options2[2] = material.factor; |
---|
5520 | | - |
---|
5521 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5522 | | - display.options4[0] = material.cameralight/0.2f; |
---|
5523 | | - display.options4[1] = material.subsurface; |
---|
5524 | | - display.options4[2] = material.sheen; |
---|
5525 | | - |
---|
5526 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5527 | | - // display.options3[3] /= 4; |
---|
5528 | | - |
---|
5529 | | - /* |
---|
5530 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5531 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5532 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5533 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5534 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5535 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5536 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5537 | | - /**/ |
---|
5538 | | - } else |
---|
5539 | | - { |
---|
5540 | | - material.Draw(display, selected); |
---|
5541 | | - } |
---|
5542 | | - } else |
---|
5543 | | - { |
---|
5544 | | - if (selected && CameraPane.flash) |
---|
5545 | | - { |
---|
5546 | | - display.modelParams4[1] = 100; |
---|
5547 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5548 | | - } |
---|
5549 | | - } |
---|
| 5620 | + display.PushMaterial(this, selected); |
---|
5550 | 5621 | |
---|
5551 | 5622 | //System.out.println("call list " + list); |
---|
5552 | 5623 | //System.out.println(); |
---|
.. | .. |
---|
5581 | 5652 | |
---|
5582 | 5653 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5583 | 5654 | assert(bRep.displaylist != 0); |
---|
5584 | | - gl.glCallList(bRep.displaylist); |
---|
| 5655 | + display.CallList(bRep.displaylist); |
---|
5585 | 5656 | // june 2013 drawSelf(display, root, selected); |
---|
5586 | 5657 | } |
---|
5587 | 5658 | } |
---|
5588 | 5659 | } |
---|
5589 | 5660 | |
---|
5590 | 5661 | display.ReleaseTextures(tex); |
---|
5591 | | - |
---|
5592 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5593 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5594 | | - if (material != null) |
---|
5595 | | - { |
---|
5596 | | - materialdepth -= 1; |
---|
5597 | | - if (materialdepth > 0) |
---|
5598 | | - { |
---|
5599 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5600 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5601 | | - } |
---|
5602 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5603 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5604 | | - { |
---|
5605 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5606 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5607 | | - } |
---|
| 5662 | + |
---|
| 5663 | + display.PopMaterial(this, selected); |
---|
5608 | 5664 | } |
---|
5609 | 5665 | |
---|
5610 | 5666 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5646 | 5702 | // resetMasterNode(); |
---|
5647 | 5703 | } |
---|
5648 | 5704 | |
---|
5649 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5705 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5650 | 5706 | { |
---|
5651 | 5707 | if (GetBRep() == null) |
---|
5652 | 5708 | { |
---|
.. | .. |
---|
5729 | 5785 | boolean flipV = false; // true; |
---|
5730 | 5786 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5731 | 5787 | |
---|
5732 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5788 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5733 | 5789 | { |
---|
5734 | 5790 | if (hide) |
---|
5735 | 5791 | return; |
---|
.. | .. |
---|
5788 | 5844 | // // ??????????????????????????? Touch(); |
---|
5789 | 5845 | // } |
---|
5790 | 5846 | |
---|
5791 | | - if (material != null) |
---|
5792 | | - { |
---|
5793 | | - materialstack[materialdepth] = material; |
---|
5794 | | - selectedstack[materialdepth] = selected; |
---|
5795 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5796 | | - //System.out.println("material " + material); |
---|
5797 | | - //Applet3D.tracein("selected ", selected); |
---|
5798 | | - display.vector2buffer = projectedVertices; |
---|
5799 | | - material.Draw(display, selected); |
---|
5800 | | - } |
---|
| 5847 | +display.PushMaterial2(this, selected); |
---|
5801 | 5848 | |
---|
5802 | 5849 | Object3D child; |
---|
5803 | 5850 | boolean sel; |
---|
.. | .. |
---|
5849 | 5896 | */ |
---|
5850 | 5897 | //depth += 1; |
---|
5851 | 5898 | |
---|
5852 | | - if (material != null) |
---|
5853 | | - { |
---|
5854 | | - materialdepth -= 1; |
---|
5855 | | - if (materialdepth > 0) |
---|
5856 | | - { |
---|
5857 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5858 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5859 | | - } |
---|
5860 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5861 | | - //else |
---|
5862 | | - //material.Draw(display, false); |
---|
5863 | | - } |
---|
5864 | | - |
---|
| 5899 | +display.PopMaterial2(this); |
---|
5865 | 5900 | /* |
---|
5866 | 5901 | display.ReleaseTextures(tex); |
---|
5867 | 5902 | */ |
---|
.. | .. |
---|
5872 | 5907 | |
---|
5873 | 5908 | //static cVector min,max; |
---|
5874 | 5909 | |
---|
5875 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 5910 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5876 | 5911 | { |
---|
5877 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 5912 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5878 | 5913 | return; // no shadow for transparent objects |
---|
5879 | 5914 | |
---|
5880 | 5915 | if (hide) |
---|
.. | .. |
---|
5917 | 5952 | return; |
---|
5918 | 5953 | } |
---|
5919 | 5954 | |
---|
| 5955 | + //bRep.GenUV(1/material.diffuseness); |
---|
5920 | 5956 | // bRep.lock = true; |
---|
5921 | 5957 | |
---|
5922 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5958 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5923 | 5959 | |
---|
5924 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 5960 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5925 | 5961 | { |
---|
5926 | 5962 | int fc = bRep.FaceCount(); |
---|
5927 | 5963 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5936 | 5972 | |
---|
5937 | 5973 | bRep.getMinMax(min, max, 100); |
---|
5938 | 5974 | |
---|
5939 | | - gl.glBegin(gl.GL_LINES); |
---|
5940 | | - |
---|
5941 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5942 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5943 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5944 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5945 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5946 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5947 | | - |
---|
5948 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5949 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5950 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5951 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5952 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5953 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5954 | | - |
---|
5955 | | - gl.glEnd(); |
---|
| 5975 | + display.DrawBox(min, max); |
---|
5956 | 5976 | |
---|
5957 | 5977 | return; |
---|
5958 | 5978 | } |
---|
.. | .. |
---|
5996 | 6016 | { |
---|
5997 | 6017 | //throw new Error(); |
---|
5998 | 6018 | |
---|
5999 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 6019 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
6000 | 6020 | |
---|
6001 | 6021 | int[] strips = bRep.getRawIndices(); |
---|
6002 | 6022 | |
---|
.. | .. |
---|
6006 | 6026 | new Exception().printStackTrace(); |
---|
6007 | 6027 | return; |
---|
6008 | 6028 | } |
---|
6009 | | - |
---|
6010 | | - // TRIANGLE STRIP ARRAY |
---|
6011 | | - if (bRep.trimmed) |
---|
6012 | | - { |
---|
6013 | | - float[] v = bRep.getRawVertices(); |
---|
6014 | | - float[] n = bRep.getRawNormals(); |
---|
6015 | | - float[] c = bRep.getRawColors(); |
---|
6016 | | - float[] uv = bRep.getRawUVMap(); |
---|
6017 | | - |
---|
6018 | | - int count2 = 0; |
---|
6019 | | - int count3 = 0; |
---|
6020 | | - |
---|
6021 | | - if (n.length > 0) |
---|
6022 | | - { |
---|
6023 | | - for (int i = 0; i < strips.length; i++) |
---|
6024 | | - { |
---|
6025 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6026 | | - |
---|
6027 | | - /* |
---|
6028 | | - boolean locked = false; |
---|
6029 | | - float eps = 0.1f; |
---|
6030 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6031 | | - |
---|
6032 | | - int dot = 0; |
---|
6033 | | - |
---|
6034 | | - if ((dot&1) == 0) |
---|
6035 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6036 | | - |
---|
6037 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6038 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6039 | | - else |
---|
6040 | | - { |
---|
6041 | | - locked = true; |
---|
6042 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6043 | | - } |
---|
6044 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6045 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6046 | | - if (hasnorm) |
---|
6047 | | - { |
---|
6048 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6049 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6050 | | - } |
---|
6051 | | - |
---|
6052 | | - if ((dot&4) == 0) |
---|
6053 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6054 | | - |
---|
6055 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6056 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6057 | | - else |
---|
6058 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6059 | | - |
---|
6060 | | - f.dot = dot; |
---|
6061 | | - */ |
---|
6062 | | - |
---|
6063 | | - if (!selectmode) |
---|
6064 | | - { |
---|
6065 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6066 | | - { |
---|
6067 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6068 | | - } else |
---|
6069 | | - { |
---|
6070 | | - gl.glNormal3f(0, 0, 1); |
---|
6071 | | - } |
---|
6072 | | - |
---|
6073 | | - if (c != null) |
---|
6074 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6075 | | - { |
---|
6076 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6077 | | - } |
---|
6078 | | - } |
---|
6079 | | - if (flipV) |
---|
6080 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6081 | | - else |
---|
6082 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6083 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6084 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6085 | | - |
---|
6086 | | - count2 += 2; |
---|
6087 | | - count3 += 3; |
---|
6088 | | - if (!selectmode) |
---|
6089 | | - { |
---|
6090 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6091 | | - { |
---|
6092 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6093 | | - } else |
---|
6094 | | - { |
---|
6095 | | - gl.glNormal3f(0, 0, 1); |
---|
6096 | | - } |
---|
6097 | | - if (c != null) |
---|
6098 | | - { |
---|
6099 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6100 | | - } |
---|
6101 | | - } |
---|
6102 | | - if (flipV) |
---|
6103 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6104 | | - else |
---|
6105 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6106 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6107 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6108 | | - |
---|
6109 | | - count2 += 2; |
---|
6110 | | - count3 += 3; |
---|
6111 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6112 | | - { |
---|
6113 | | - //gl.glTexCoord2d(...); |
---|
6114 | | - if (!selectmode) |
---|
6115 | | - { |
---|
6116 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6117 | | - { |
---|
6118 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6119 | | - } else |
---|
6120 | | - { |
---|
6121 | | - gl.glNormal3f(0, 0, 1); |
---|
6122 | | - } |
---|
6123 | | - if (c != null) |
---|
6124 | | - { |
---|
6125 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6126 | | - } |
---|
6127 | | - } |
---|
6128 | | - |
---|
6129 | | - if (flipV) |
---|
6130 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6131 | | - else |
---|
6132 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6133 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6134 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6135 | | - count2 += 2; |
---|
6136 | | - count3 += 3; |
---|
6137 | | - } |
---|
6138 | | - |
---|
6139 | | - gl.glEnd(); |
---|
6140 | | - } |
---|
6141 | | - } |
---|
6142 | | - |
---|
6143 | | - assert count3 == v.length; |
---|
6144 | | - } |
---|
6145 | | - else // !trimmed |
---|
6146 | | - { |
---|
6147 | | - int count = 0; |
---|
6148 | | - for (int i = 0; i < strips.length; i++) |
---|
6149 | | - { |
---|
6150 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6151 | | - |
---|
6152 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6153 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6154 | | - |
---|
6155 | | - drawVertex(gl, p, selectmode); |
---|
6156 | | - drawVertex(gl, q, selectmode); |
---|
6157 | | - |
---|
6158 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6159 | | - { |
---|
6160 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6161 | | - |
---|
6162 | | -// if (j%2 == 0) |
---|
6163 | | -// drawFace(p, q, r, display, null); |
---|
6164 | | -// else |
---|
6165 | | -// drawFace(p, r, q, display, null); |
---|
6166 | | - |
---|
6167 | | -// p = q; |
---|
6168 | | -// q = r; |
---|
6169 | | - drawVertex(gl, r, selectmode); |
---|
6170 | | - } |
---|
6171 | | - |
---|
6172 | | - gl.glEnd(); |
---|
6173 | | - } |
---|
6174 | | - } |
---|
| 6029 | + |
---|
| 6030 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6175 | 6031 | } else // catch (Error e) |
---|
6176 | 6032 | { |
---|
6177 | 6033 | // TRIANGLE ARRAY |
---|
6178 | 6034 | if (IsOpaque()) // Static()) |
---|
6179 | 6035 | { |
---|
6180 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6036 | + display.StartTriangles(); |
---|
6181 | 6037 | int facecount = bRep.FaceCount(); |
---|
6182 | 6038 | for (int i = 0; i < facecount; i++) |
---|
6183 | 6039 | { |
---|
.. | .. |
---|
6240 | 6096 | // // r.norm.dot(v3) > -0.5) |
---|
6241 | 6097 | // // continue; |
---|
6242 | 6098 | |
---|
6243 | | - drawFace(p, q, r, display, face); |
---|
| 6099 | + display.DrawFace(this, p, q, r, face); |
---|
6244 | 6100 | } |
---|
6245 | | - gl.glEnd(); |
---|
| 6101 | + display.EndTriangles(); |
---|
6246 | 6102 | } |
---|
6247 | 6103 | else |
---|
6248 | 6104 | { |
---|
.. | .. |
---|
6271 | 6127 | //System.out.println("SORT"); |
---|
6272 | 6128 | |
---|
6273 | 6129 | java.util.Arrays.sort(facescompare); |
---|
6274 | | - |
---|
6275 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6130 | + |
---|
| 6131 | + display.StartTriangles(); |
---|
6276 | 6132 | for (int i = 0; i < facecount; i++) |
---|
6277 | 6133 | { |
---|
6278 | 6134 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6284 | 6140 | Vertex q = bRep.GetVertex(face.q); |
---|
6285 | 6141 | Vertex r = bRep.GetVertex(face.r); |
---|
6286 | 6142 | |
---|
6287 | | - drawFace(p, q, r, display, face); |
---|
| 6143 | + display.DrawFace(this, p, q, r, face); |
---|
6288 | 6144 | } |
---|
6289 | | - gl.glEnd(); |
---|
| 6145 | + display.EndTriangles(); |
---|
6290 | 6146 | } |
---|
6291 | 6147 | |
---|
6292 | 6148 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6293 | 6149 | { |
---|
| 6150 | + /* |
---|
6294 | 6151 | gl.glDisable(gl.GL_LIGHTING); |
---|
6295 | 6152 | float[] colorV = new float[3]; |
---|
6296 | 6153 | |
---|
.. | .. |
---|
6369 | 6226 | // gl.glEnd(); |
---|
6370 | 6227 | } |
---|
6371 | 6228 | } |
---|
| 6229 | + */ |
---|
6372 | 6230 | } |
---|
6373 | 6231 | } |
---|
6374 | 6232 | |
---|
.. | .. |
---|
6413 | 6271 | center.add(r); |
---|
6414 | 6272 | center.mul(1.0/3); |
---|
6415 | 6273 | |
---|
6416 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6274 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6417 | 6275 | |
---|
6418 | 6276 | distance = center.dot(center); |
---|
6419 | 6277 | } |
---|
.. | .. |
---|
6424 | 6282 | |
---|
6425 | 6283 | transient FaceCompare[] facescompare = null; |
---|
6426 | 6284 | |
---|
6427 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6428 | | - { |
---|
6429 | | - if (display.RENDERPROGRAM == 0) |
---|
6430 | | - { |
---|
6431 | | - float r = 0; |
---|
6432 | | - if (bRep != null) |
---|
6433 | | - { |
---|
6434 | | - if (bRep.stripified) |
---|
6435 | | - { |
---|
6436 | | - r = 1; |
---|
6437 | | - } |
---|
6438 | | - } |
---|
6439 | | - float g = 0; |
---|
6440 | | - if (bRep != null) |
---|
6441 | | - { |
---|
6442 | | - if (bRep.trimmed) |
---|
6443 | | - { |
---|
6444 | | - g = 1; |
---|
6445 | | - } |
---|
6446 | | - } |
---|
6447 | | - float b = 0; |
---|
6448 | | - if (support != null && link2master) |
---|
6449 | | - { |
---|
6450 | | - b = 1; |
---|
6451 | | - } |
---|
6452 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6453 | | - return; |
---|
6454 | | - } |
---|
6455 | | - |
---|
6456 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6457 | | - return; |
---|
6458 | | - |
---|
6459 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6460 | | -// if (true) return; |
---|
6461 | | -// float ao = p.AO; |
---|
6462 | | -// |
---|
6463 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6464 | | -// // ao = 1; |
---|
6465 | | -// |
---|
6466 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6467 | | - |
---|
6468 | | -// CameraPane.selectedpoint. |
---|
6469 | | -// getAverage(cStatic.point1, true); |
---|
6470 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6471 | | - { |
---|
6472 | | - return; |
---|
6473 | | - } |
---|
6474 | | - |
---|
6475 | | - cStatic.point1.set(0,0,0); |
---|
6476 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6477 | | - |
---|
6478 | | - cStatic.point1.sub(p0); |
---|
6479 | | - |
---|
6480 | | - |
---|
6481 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6482 | | -// { |
---|
6483 | | -// return; |
---|
6484 | | -// } |
---|
6485 | | - |
---|
6486 | | - //if (true) |
---|
6487 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6488 | | - { |
---|
6489 | | - return; |
---|
6490 | | - } |
---|
6491 | | - |
---|
6492 | | - float[] colorV = new float[3]; |
---|
6493 | | - |
---|
6494 | | - if (false) // marked) |
---|
6495 | | - { |
---|
6496 | | - // debug rigging weights |
---|
6497 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6498 | | - { |
---|
6499 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6500 | | - |
---|
6501 | | - // if (weight < 0.1) |
---|
6502 | | - // { |
---|
6503 | | - // assert(weight == 0); |
---|
6504 | | - // continue; |
---|
6505 | | - // } |
---|
6506 | | - |
---|
6507 | | - if (p0.vertexlinks[object] == -1) |
---|
6508 | | - continue; |
---|
6509 | | - |
---|
6510 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6511 | | - |
---|
6512 | | - int color = //1 << object; // |
---|
6513 | | - //p.vertexlinks.length; |
---|
6514 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6515 | | - colorV[2] += (color & 1) * weight; |
---|
6516 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6517 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6518 | | - } |
---|
6519 | | - } |
---|
6520 | | - else |
---|
6521 | | - { |
---|
6522 | | - if (drawingstarted) |
---|
6523 | | - { |
---|
6524 | | - // find next point |
---|
6525 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6526 | | - { |
---|
6527 | | - bRep.InitFaceIndices(); |
---|
6528 | | - } |
---|
6529 | | - |
---|
6530 | | - double ymin = p0.y; |
---|
6531 | | - |
---|
6532 | | - Vertex newp = p0; |
---|
6533 | | - |
---|
6534 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6535 | | - { |
---|
6536 | | - int fi = p0.faceindices[fii]; |
---|
6537 | | - |
---|
6538 | | - if (fi == -1) |
---|
6539 | | - break; |
---|
6540 | | - |
---|
6541 | | - Face f = bRep.GetFace(fi); |
---|
6542 | | - |
---|
6543 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6544 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6545 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6546 | | - |
---|
6547 | | - int swap = (int)(Math.random()*3); |
---|
6548 | | - |
---|
6549 | | -// for (int s=swap; --s>=0;) |
---|
6550 | | -// { |
---|
6551 | | -// Vertex t = p; |
---|
6552 | | -// p = q; |
---|
6553 | | -// q = r; |
---|
6554 | | -// r = t; |
---|
6555 | | -// } |
---|
6556 | | - if (ymin > p.y) |
---|
6557 | | - { |
---|
6558 | | - ymin = p.y; |
---|
6559 | | - newp = p; |
---|
6560 | | -// break; |
---|
6561 | | - } |
---|
6562 | | - if (ymin > q.y) |
---|
6563 | | - { |
---|
6564 | | - ymin = q.y; |
---|
6565 | | - newp = q; |
---|
6566 | | -// break; |
---|
6567 | | - } |
---|
6568 | | - if (ymin > r.y) |
---|
6569 | | - { |
---|
6570 | | - ymin = r.y; |
---|
6571 | | - newp = r; |
---|
6572 | | -// break; |
---|
6573 | | - } |
---|
6574 | | - } |
---|
6575 | | - |
---|
6576 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6577 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6578 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6579 | | - |
---|
6580 | | - drawingstarted = false; |
---|
6581 | | - |
---|
6582 | | - // return; |
---|
6583 | | - } |
---|
6584 | | - |
---|
6585 | | - if (false) // CameraPane.DRAW |
---|
6586 | | - { |
---|
6587 | | - p0.AO = colorV[0] = 2; |
---|
6588 | | - colorV[1] = 2; |
---|
6589 | | - colorV[2] = 2; |
---|
6590 | | - } |
---|
6591 | | - |
---|
6592 | | - CameraPane.pointflow.add(p0); |
---|
6593 | | - CameraPane.pointflow.Touch(); |
---|
6594 | | - } |
---|
6595 | | - |
---|
6596 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6597 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6598 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6599 | | - } |
---|
6600 | | - |
---|
6601 | 6285 | void Print(Vertex v) |
---|
6602 | 6286 | { |
---|
6603 | 6287 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6604 | 6288 | } |
---|
6605 | 6289 | |
---|
6606 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6607 | | - { |
---|
6608 | | - if (!selectmode) |
---|
6609 | | - { |
---|
6610 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6611 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6612 | | - |
---|
6613 | | - if (flipV) |
---|
6614 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6615 | | - else |
---|
6616 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6617 | | - } |
---|
6618 | | - |
---|
6619 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6620 | | - } |
---|
6621 | | - |
---|
6622 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6623 | | - CameraPane display, Face face) |
---|
6624 | | - { |
---|
6625 | | - if (pv.y == -10000 || |
---|
6626 | | - qv.y == -10000 || |
---|
6627 | | - rv.y == -10000) |
---|
6628 | | - return; |
---|
6629 | | - |
---|
6630 | | -// float b = f.nbiterations & 1; |
---|
6631 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6632 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6633 | | -// |
---|
6634 | | -// //if (f.weight == 10000) |
---|
6635 | | -// //{ |
---|
6636 | | -// // r = 1; g = b = 0; |
---|
6637 | | -// //} |
---|
6638 | | -// //else |
---|
6639 | | -// //{ |
---|
6640 | | -// // assert(f.weight < 10000); |
---|
6641 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6642 | | -// if (r<0) |
---|
6643 | | -// assert(r>=0); |
---|
6644 | | -// //} |
---|
6645 | | - |
---|
6646 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6647 | | - |
---|
6648 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6649 | | - |
---|
6650 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6651 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6652 | | - { |
---|
6653 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6654 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6655 | | - if (!hasnorm) |
---|
6656 | | - { |
---|
6657 | | - // System.out.println("FUCK!!"); |
---|
6658 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6659 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6660 | | - LA.vecCross(v0, v1, v2); |
---|
6661 | | - LA.vecNormalize(v2); |
---|
6662 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6663 | | - } |
---|
6664 | | - |
---|
6665 | | - if (hasnorm) |
---|
6666 | | - { |
---|
6667 | | -// if (!pv.norm.normalized()) |
---|
6668 | | -// assert(pv.norm.normalized()); |
---|
6669 | | - |
---|
6670 | | - //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); |
---|
6672 | | - } |
---|
6673 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6674 | | - SetColor(display, pv); |
---|
6675 | | - //gl.glColor4f(r, g, b, 1); |
---|
6676 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6677 | | - if (flipV) |
---|
6678 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6679 | | - else |
---|
6680 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6681 | | - //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); |
---|
6683 | | -// Print(pv); |
---|
6684 | | - if (hasnorm) |
---|
6685 | | - { |
---|
6686 | | -// assert(qv.norm.normalized()); |
---|
6687 | | - //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); |
---|
6689 | | - } |
---|
6690 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6691 | | - // boolean locked = false; |
---|
6692 | | - // float eps = 0.1f; |
---|
6693 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6694 | | - |
---|
6695 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6696 | | - |
---|
6697 | | - // if ((dot&1) == 0) |
---|
6698 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6699 | | - |
---|
6700 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6701 | | - if (flipV) |
---|
6702 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6703 | | - else |
---|
6704 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6705 | | - // else |
---|
6706 | | - // { |
---|
6707 | | - // locked = true; |
---|
6708 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6709 | | - // } |
---|
6710 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6711 | | - SetColor(display, qv); |
---|
6712 | | - //gl.glColor4f(r, g, b, 1); |
---|
6713 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6714 | | - //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 | | -// Print(qv); |
---|
6717 | | - if (hasnorm) |
---|
6718 | | - { |
---|
6719 | | -// assert(rv.norm.normalized()); |
---|
6720 | | - //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); |
---|
6722 | | - } |
---|
6723 | | - |
---|
6724 | | - // if ((dot&4) == 0) |
---|
6725 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6726 | | - |
---|
6727 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6728 | | - if (flipV) |
---|
6729 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6730 | | - else |
---|
6731 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6732 | | - // else |
---|
6733 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6734 | | - |
---|
6735 | | - // f.dot = dot; |
---|
6736 | | - |
---|
6737 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6738 | | - SetColor(display, rv); |
---|
6739 | | - //gl.glColor4f(r, g, b, 1); |
---|
6740 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6741 | | - //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); |
---|
6743 | | -// Print(rv); |
---|
6744 | | - //gl.glEnd(); |
---|
6745 | | - } |
---|
6746 | | - else |
---|
6747 | | - { |
---|
6748 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6749 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6750 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6751 | | - |
---|
6752 | | - } |
---|
6753 | | - |
---|
6754 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6755 | | - { |
---|
6756 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6757 | | - |
---|
6758 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6759 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6760 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6761 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6762 | | - gl.glEnd(); |
---|
6763 | | - |
---|
6764 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6765 | | - } |
---|
6766 | | - } |
---|
6767 | | - |
---|
6768 | 6290 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6769 | 6291 | { |
---|
6770 | 6292 | if (bRep == null) |
---|
.. | .. |
---|
7336 | 6858 | int spotw = spot.x + spot.width; |
---|
7337 | 6859 | int spoth = spot.y + spot.height; |
---|
7338 | 6860 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7339 | | - if (CameraPane.Xmin > spot.x) |
---|
7340 | | - { |
---|
7341 | | - CameraPane.Xmin = spot.x; |
---|
7342 | | - } |
---|
7343 | | - if (CameraPane.Xmax < spotw) |
---|
7344 | | - { |
---|
7345 | | - CameraPane.Xmax = spotw; |
---|
7346 | | - } |
---|
7347 | | - if (CameraPane.Ymin > spot.y) |
---|
7348 | | - { |
---|
7349 | | - CameraPane.Ymin = spot.y; |
---|
7350 | | - } |
---|
7351 | | - if (CameraPane.Ymax < spoth) |
---|
7352 | | - { |
---|
7353 | | - CameraPane.Ymax = spoth; |
---|
7354 | | - } |
---|
| 6861 | +// if (CameraPane.Xmin > spot.x) |
---|
| 6862 | +// { |
---|
| 6863 | +// CameraPane.Xmin = spot.x; |
---|
| 6864 | +// } |
---|
| 6865 | +// if (CameraPane.Xmax < spotw) |
---|
| 6866 | +// { |
---|
| 6867 | +// CameraPane.Xmax = spotw; |
---|
| 6868 | +// } |
---|
| 6869 | +// if (CameraPane.Ymin > spot.y) |
---|
| 6870 | +// { |
---|
| 6871 | +// CameraPane.Ymin = spot.y; |
---|
| 6872 | +// } |
---|
| 6873 | +// if (CameraPane.Ymax < spoth) |
---|
| 6874 | +// { |
---|
| 6875 | +// CameraPane.Ymax = spoth; |
---|
| 6876 | +// } |
---|
7355 | 6877 | spot.translate(32, 32); |
---|
7356 | 6878 | spotw = spot.x + spot.width; |
---|
7357 | 6879 | spoth = spot.y + spot.height; |
---|
7358 | 6880 | info.g.setColor(Color.blue); |
---|
7359 | 6881 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7360 | | - if (CameraPane.Xmin > spot.x) |
---|
7361 | | - { |
---|
7362 | | - CameraPane.Xmin = spot.x; |
---|
7363 | | - } |
---|
7364 | | - if (CameraPane.Xmax < spotw) |
---|
7365 | | - { |
---|
7366 | | - CameraPane.Xmax = spotw; |
---|
7367 | | - } |
---|
7368 | | - if (CameraPane.Ymin > spot.y) |
---|
7369 | | - { |
---|
7370 | | - CameraPane.Ymin = spot.y; |
---|
7371 | | - } |
---|
7372 | | - if (CameraPane.Ymax < spoth) |
---|
7373 | | - { |
---|
7374 | | - CameraPane.Ymax = spoth; |
---|
7375 | | - } |
---|
| 6882 | +// if (CameraPane.Xmin > spot.x) |
---|
| 6883 | +// { |
---|
| 6884 | +// CameraPane.Xmin = spot.x; |
---|
| 6885 | +// } |
---|
| 6886 | +// if (CameraPane.Xmax < spotw) |
---|
| 6887 | +// { |
---|
| 6888 | +// CameraPane.Xmax = spotw; |
---|
| 6889 | +// } |
---|
| 6890 | +// if (CameraPane.Ymin > spot.y) |
---|
| 6891 | +// { |
---|
| 6892 | +// CameraPane.Ymin = spot.y; |
---|
| 6893 | +// } |
---|
| 6894 | +// if (CameraPane.Ymax < spoth) |
---|
| 6895 | +// { |
---|
| 6896 | +// CameraPane.Ymax = spoth; |
---|
| 6897 | +// } |
---|
7376 | 6898 | info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7377 | 6899 | info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
7378 | 6900 | spot.translate(0, -32); |
---|
7379 | 6901 | info.g.setColor(Color.green); |
---|
7380 | 6902 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7381 | | - if (CameraPane.Xmin > spot.x) |
---|
7382 | | - { |
---|
7383 | | - CameraPane.Xmin = spot.x; |
---|
7384 | | - } |
---|
7385 | | - if (CameraPane.Xmax < spotw) |
---|
7386 | | - { |
---|
7387 | | - CameraPane.Xmax = spotw; |
---|
7388 | | - } |
---|
7389 | | - if (CameraPane.Ymin > spot.y) |
---|
7390 | | - { |
---|
7391 | | - CameraPane.Ymin = spot.y; |
---|
7392 | | - } |
---|
7393 | | - if (CameraPane.Ymax < spoth) |
---|
7394 | | - { |
---|
7395 | | - CameraPane.Ymax = spoth; |
---|
7396 | | - } |
---|
| 6903 | +// if (CameraPane.Xmin > spot.x) |
---|
| 6904 | +// { |
---|
| 6905 | +// CameraPane.Xmin = spot.x; |
---|
| 6906 | +// } |
---|
| 6907 | +// if (CameraPane.Xmax < spotw) |
---|
| 6908 | +// { |
---|
| 6909 | +// CameraPane.Xmax = spotw; |
---|
| 6910 | +// } |
---|
| 6911 | +// if (CameraPane.Ymin > spot.y) |
---|
| 6912 | +// { |
---|
| 6913 | +// CameraPane.Ymin = spot.y; |
---|
| 6914 | +// } |
---|
| 6915 | +// if (CameraPane.Ymax < spoth) |
---|
| 6916 | +// { |
---|
| 6917 | +// CameraPane.Ymax = spoth; |
---|
| 6918 | +// } |
---|
7397 | 6919 | info.g.drawArc(boundary.x, boundary.y, |
---|
7398 | 6920 | boundary.width, boundary.height, 0, 360); |
---|
7399 | 6921 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7400 | | - if (CameraPane.Xmin > boundary.x) |
---|
7401 | | - { |
---|
7402 | | - CameraPane.Xmin = boundary.x; |
---|
7403 | | - } |
---|
7404 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7405 | | - { |
---|
7406 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7407 | | - } |
---|
7408 | | - if (CameraPane.Ymin > boundary.y) |
---|
7409 | | - { |
---|
7410 | | - CameraPane.Ymin = boundary.y; |
---|
7411 | | - } |
---|
7412 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7413 | | - { |
---|
7414 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7415 | | - } |
---|
| 6922 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 6923 | +// { |
---|
| 6924 | +// CameraPane.Xmin = boundary.x; |
---|
| 6925 | +// } |
---|
| 6926 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 6927 | +// { |
---|
| 6928 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 6929 | +// } |
---|
| 6930 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 6931 | +// { |
---|
| 6932 | +// CameraPane.Ymin = boundary.y; |
---|
| 6933 | +// } |
---|
| 6934 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 6935 | +// { |
---|
| 6936 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 6937 | +// } |
---|
7416 | 6938 | return; |
---|
7417 | 6939 | } |
---|
7418 | 6940 | } |
---|
.. | .. |
---|
7515 | 7037 | |
---|
7516 | 7038 | case hitCenter: // Translate |
---|
7517 | 7039 | |
---|
7518 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7040 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7519 | 7041 | |
---|
7520 | 7042 | if (modified) |
---|
7521 | 7043 | { |
---|
.. | .. |
---|
7563 | 7085 | } |
---|
7564 | 7086 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7565 | 7087 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7566 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7088 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7567 | 7089 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7568 | 7090 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7569 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7091 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7570 | 7092 | //LA.vecCross(up, cVector.Z, right2); |
---|
7571 | 7093 | |
---|
7572 | 7094 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7624 | 7146 | } |
---|
7625 | 7147 | /**/ |
---|
7626 | 7148 | |
---|
7627 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7149 | + switch (info.pane.RenderCamera().viewCode) |
---|
7628 | 7150 | { |
---|
7629 | 7151 | case 1: // '\001' |
---|
7630 | 7152 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7680 | 7202 | } |
---|
7681 | 7203 | /**/ |
---|
7682 | 7204 | |
---|
7683 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7205 | + switch (info.pane.RenderCamera().viewCode) |
---|
7684 | 7206 | { |
---|
7685 | 7207 | case 3: // '\001' |
---|
7686 | 7208 | if (modified) |
---|
.. | .. |
---|
7733 | 7255 | if (parent == null) |
---|
7734 | 7256 | { |
---|
7735 | 7257 | System.out.println("NULL PARENT"); |
---|
7736 | | - new Exception().printStackTrace(); |
---|
| 7258 | + //new Exception().printStackTrace(); |
---|
7737 | 7259 | } else |
---|
7738 | 7260 | { |
---|
7739 | 7261 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
7908 | 7430 | objectUI.closeUI(); |
---|
7909 | 7431 | if (editWindow != null) |
---|
7910 | 7432 | { |
---|
| 7433 | + editWindow.ctrlPanel.FlushUI(); |
---|
7911 | 7434 | editWindow.refreshContents(); |
---|
7912 | 7435 | } // ? new |
---|
7913 | 7436 | objectUI = null; |
---|
.. | .. |
---|
8126 | 7649 | { |
---|
8127 | 7650 | Object3D targ = this; |
---|
8128 | 7651 | |
---|
| 7652 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 7653 | + |
---|
8129 | 7654 | if (obj.material != null) |
---|
8130 | 7655 | { |
---|
8131 | 7656 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|