.. | .. |
---|
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++) |
---|
.. | .. |
---|
285 | 298 | return parent.GetName() + "#"; |
---|
286 | 299 | } |
---|
287 | 300 | |
---|
288 | | - boolean timeline = false; |
---|
289 | 301 | boolean live = false; |
---|
290 | 302 | boolean hide = false; |
---|
291 | 303 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
296 | 308 | boolean random = false; |
---|
297 | 309 | boolean speedup = false; |
---|
298 | 310 | boolean rewind = false; |
---|
| 311 | + |
---|
| 312 | + float NORMALPUSH = 0; |
---|
299 | 313 | |
---|
300 | 314 | Object3D support; |
---|
301 | 315 | |
---|
.. | .. |
---|
746 | 760 | |
---|
747 | 761 | int GetTransformCount() |
---|
748 | 762 | { |
---|
749 | | - // marde pour serialization de Texture |
---|
| 763 | + // patch pour serialization de Texture |
---|
750 | 764 | resetmaxcount(); |
---|
751 | 765 | resettransformcount(); |
---|
752 | 766 | resetstep(); |
---|
.. | .. |
---|
780 | 794 | // factor = CameraPane.STEP; |
---|
781 | 795 | // } |
---|
782 | 796 | |
---|
783 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 797 | + if (marked && Globals.isLIVE() && live && |
---|
| 798 | + //TEMP21aug2018 |
---|
| 799 | + Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 800 | + currentframe != Globals.framecount) |
---|
784 | 801 | { |
---|
785 | | - currentframe = CameraPane.framecount; |
---|
| 802 | + currentframe = Globals.framecount; |
---|
786 | 803 | |
---|
787 | 804 | // System.err.println("transformcount = " + transformcount); |
---|
788 | 805 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
2131 | 2148 | if (/*parent != null &&*/ material == null) |
---|
2132 | 2149 | { |
---|
2133 | 2150 | material = new cMaterial(GetMaterial()); |
---|
2134 | | - if (projectedVertices == null || projectedVertices.length <= 2) |
---|
2135 | | - { |
---|
2136 | | - projectedVertices = new Object3D.cVector2[3]; |
---|
2137 | | - } |
---|
2138 | | - for (int i = 0; i < 3; i++) |
---|
2139 | | - { |
---|
2140 | | - projectedVertices[i] = new cVector2(); // Others |
---|
2141 | | - } |
---|
2142 | | - projectedVertices[0].x = 100; // bump |
---|
| 2151 | + |
---|
| 2152 | + InitOthers(); |
---|
2143 | 2153 | |
---|
2144 | 2154 | if (this instanceof Camera) |
---|
2145 | 2155 | { |
---|
.. | .. |
---|
4162 | 4172 | } |
---|
4163 | 4173 | } |
---|
4164 | 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(); |
---|
| 4187 | + blockloop = false; |
---|
| 4188 | + } |
---|
| 4189 | + } |
---|
| 4190 | + |
---|
4165 | 4191 | void RepairTexture() |
---|
4166 | 4192 | { |
---|
4167 | 4193 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4975 | 5001 | } else // |
---|
4976 | 5002 | if (editWindow != null) |
---|
4977 | 5003 | { |
---|
4978 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5004 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5005 | + Globals.lighttouched = true; |
---|
4979 | 5006 | } |
---|
4980 | 5007 | } |
---|
4981 | 5008 | |
---|
.. | .. |
---|
5287 | 5314 | } |
---|
5288 | 5315 | } |
---|
5289 | 5316 | |
---|
5290 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5317 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5291 | 5318 | { |
---|
5292 | 5319 | Draw(display, root, selected, blocked); |
---|
5293 | 5320 | } |
---|
5294 | 5321 | |
---|
5295 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5296 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5297 | | - static int materialdepth = 0; |
---|
5298 | | - |
---|
5299 | 5322 | boolean NeedSupport() |
---|
5300 | 5323 | { |
---|
5301 | 5324 | return |
---|
5302 | 5325 | CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
5303 | 5326 | // PROBLEM with CROWD!! |
---|
5304 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5327 | + && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
5305 | 5328 | } |
---|
5306 | 5329 | |
---|
5307 | 5330 | |
---|
5308 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5331 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5309 | 5332 | { |
---|
5310 | 5333 | Invariants(); // june 2013 |
---|
5311 | 5334 | |
---|
.. | .. |
---|
5314 | 5337 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5315 | 5338 | } |
---|
5316 | 5339 | |
---|
5317 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
| 5340 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5318 | 5341 | hide) |
---|
5319 | 5342 | return; |
---|
5320 | 5343 | |
---|
.. | .. |
---|
5333 | 5356 | if (this instanceof Checker) |
---|
5334 | 5357 | return; |
---|
5335 | 5358 | |
---|
5336 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5359 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5337 | 5360 | return; |
---|
5338 | 5361 | |
---|
5339 | 5362 | if (count <= 0) |
---|
.. | .. |
---|
5341 | 5364 | return; |
---|
5342 | 5365 | } |
---|
5343 | 5366 | |
---|
5344 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5345 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5367 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5368 | + display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
5346 | 5369 | { |
---|
5347 | 5370 | return; |
---|
5348 | 5371 | } |
---|
.. | .. |
---|
5383 | 5406 | |
---|
5384 | 5407 | boolean compiled = false; |
---|
5385 | 5408 | |
---|
5386 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5409 | + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
5387 | 5410 | |
---|
5388 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
| 5411 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5389 | 5412 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5390 | 5413 | { |
---|
5391 | | - display.lighttouched = true; |
---|
| 5414 | + Globals.lighttouched = true; |
---|
5392 | 5415 | } // all panes... |
---|
5393 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5394 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5416 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5417 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5395 | 5418 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5396 | 5419 | { |
---|
5397 | 5420 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5422 | 5445 | } |
---|
5423 | 5446 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5424 | 5447 | // XXX touched = false; |
---|
5425 | | - display.lighttouched = true; // all panes... |
---|
| 5448 | + Globals.lighttouched = true; // all panes... |
---|
5426 | 5449 | } |
---|
5427 | 5450 | |
---|
5428 | 5451 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5461 | 5484 | |
---|
5462 | 5485 | // frustum culling |
---|
5463 | 5486 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5464 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5487 | + && display.DrawMode() != CameraPane.SELECTION) |
---|
5465 | 5488 | { |
---|
5466 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5489 | + if (display.DrawMode() == CameraPane.SHADOW) |
---|
5467 | 5490 | { |
---|
5468 | 5491 | if (!link2master // tricky to cull in shadow mode. |
---|
5469 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5492 | + && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) |
---|
5470 | 5493 | { |
---|
5471 | 5494 | //System.out.print("CULLED"); |
---|
5472 | 5495 | culled = true; |
---|
.. | .. |
---|
5474 | 5497 | } |
---|
5475 | 5498 | else |
---|
5476 | 5499 | //GetBRep().getBounds(v0, v1, this); |
---|
5477 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5500 | + if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) |
---|
5478 | 5501 | culled = true; |
---|
5479 | 5502 | |
---|
5480 | 5503 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5510 | 5533 | |
---|
5511 | 5534 | |
---|
5512 | 5535 | if (!culled) |
---|
5513 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5536 | + if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
5514 | 5537 | { |
---|
5515 | 5538 | if (GetBRep() != null) |
---|
5516 | 5539 | { |
---|
.. | .. |
---|
5536 | 5559 | color[2] /= 2; |
---|
5537 | 5560 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5538 | 5561 | */ |
---|
5539 | | - if (material != null) |
---|
5540 | | - { |
---|
5541 | | - materialstack[materialdepth] = material; |
---|
5542 | | - selectedstack[materialdepth] = selected; |
---|
5543 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5544 | | - //System.out.println("material " + material); |
---|
5545 | | - //Applet3D.tracein(this, selected); |
---|
5546 | | - display.vector2buffer = projectedVertices; |
---|
5547 | | - if (this instanceof Camera) |
---|
5548 | | - { |
---|
5549 | | - display.options1[0] = material.shift; |
---|
5550 | | - //System.out.println("shift " + material.shift); |
---|
5551 | | - display.options1[1] = material.lightarea; |
---|
5552 | | - display.options1[2] = material.shadowbias; |
---|
5553 | | - display.options1[3] = material.aniso; |
---|
5554 | | - display.options1[4] = material.anisoV; |
---|
5555 | | - display.options2[0] = material.opacity; |
---|
5556 | | - display.options2[1] = material.diffuse; |
---|
5557 | | - display.options2[2] = material.factor; |
---|
5558 | | - |
---|
5559 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5560 | | - display.options4[0] = material.cameralight/0.2f; |
---|
5561 | | - display.options4[1] = material.subsurface; |
---|
5562 | | - display.options4[2] = material.sheen; |
---|
5563 | | - |
---|
5564 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5565 | | - // display.options3[3] /= 4; |
---|
5566 | | - |
---|
5567 | | - /* |
---|
5568 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5569 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5570 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5571 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5572 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5573 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5574 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5575 | | - /**/ |
---|
5576 | | - } else |
---|
5577 | | - { |
---|
5578 | | - material.Draw(display, selected); |
---|
5579 | | - } |
---|
5580 | | - } else |
---|
5581 | | - { |
---|
5582 | | - if (selected && CameraPane.flash) |
---|
5583 | | - { |
---|
5584 | | - display.modelParams4[1] = 100; |
---|
5585 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5586 | | - } |
---|
5587 | | - } |
---|
| 5562 | + display.PushMaterial(this, selected); |
---|
5588 | 5563 | |
---|
5589 | 5564 | //System.out.println("call list " + list); |
---|
5590 | 5565 | //System.out.println(); |
---|
.. | .. |
---|
5626 | 5601 | } |
---|
5627 | 5602 | |
---|
5628 | 5603 | display.ReleaseTextures(tex); |
---|
5629 | | - |
---|
5630 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5631 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5632 | | - if (material != null) |
---|
5633 | | - { |
---|
5634 | | - materialdepth -= 1; |
---|
5635 | | - if (materialdepth > 0) |
---|
5636 | | - { |
---|
5637 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5638 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5639 | | - } |
---|
5640 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5641 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5642 | | - { |
---|
5643 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5644 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5645 | | - } |
---|
| 5604 | + |
---|
| 5605 | + display.PopMaterial(this, selected); |
---|
5646 | 5606 | } |
---|
5647 | 5607 | |
---|
5648 | 5608 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5684 | 5644 | // resetMasterNode(); |
---|
5685 | 5645 | } |
---|
5686 | 5646 | |
---|
5687 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5647 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5688 | 5648 | { |
---|
5689 | 5649 | if (GetBRep() == null) |
---|
5690 | 5650 | { |
---|
.. | .. |
---|
5767 | 5727 | boolean flipV = false; // true; |
---|
5768 | 5728 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5769 | 5729 | |
---|
5770 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5730 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5771 | 5731 | { |
---|
5772 | 5732 | if (hide) |
---|
5773 | 5733 | return; |
---|
.. | .. |
---|
5826 | 5786 | // // ??????????????????????????? Touch(); |
---|
5827 | 5787 | // } |
---|
5828 | 5788 | |
---|
5829 | | - if (material != null) |
---|
5830 | | - { |
---|
5831 | | - materialstack[materialdepth] = material; |
---|
5832 | | - selectedstack[materialdepth] = selected; |
---|
5833 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5834 | | - //System.out.println("material " + material); |
---|
5835 | | - //Applet3D.tracein("selected ", selected); |
---|
5836 | | - display.vector2buffer = projectedVertices; |
---|
5837 | | - material.Draw(display, selected); |
---|
5838 | | - } |
---|
| 5789 | +display.PushMaterial2(this, selected); |
---|
5839 | 5790 | |
---|
5840 | 5791 | Object3D child; |
---|
5841 | 5792 | boolean sel; |
---|
.. | .. |
---|
5887 | 5838 | */ |
---|
5888 | 5839 | //depth += 1; |
---|
5889 | 5840 | |
---|
5890 | | - if (material != null) |
---|
5891 | | - { |
---|
5892 | | - materialdepth -= 1; |
---|
5893 | | - if (materialdepth > 0) |
---|
5894 | | - { |
---|
5895 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5896 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5897 | | - } |
---|
5898 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5899 | | - //else |
---|
5900 | | - //material.Draw(display, false); |
---|
5901 | | - } |
---|
5902 | | - |
---|
| 5841 | +display.PopMaterial2(this); |
---|
5903 | 5842 | /* |
---|
5904 | 5843 | display.ReleaseTextures(tex); |
---|
5905 | 5844 | */ |
---|
.. | .. |
---|
5910 | 5849 | |
---|
5911 | 5850 | //static cVector min,max; |
---|
5912 | 5851 | |
---|
5913 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 5852 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5914 | 5853 | { |
---|
5915 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 5854 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5916 | 5855 | return; // no shadow for transparent objects |
---|
5917 | 5856 | |
---|
5918 | 5857 | if (hide) |
---|
.. | .. |
---|
5959 | 5898 | |
---|
5960 | 5899 | javax.media.opengl.GL gl = display.GetGL(); |
---|
5961 | 5900 | |
---|
5962 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 5901 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5963 | 5902 | { |
---|
5964 | 5903 | int fc = bRep.FaceCount(); |
---|
5965 | 5904 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
6034 | 5973 | { |
---|
6035 | 5974 | //throw new Error(); |
---|
6036 | 5975 | |
---|
6037 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5976 | + boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6038 | 5977 | |
---|
6039 | 5978 | int[] strips = bRep.getRawIndices(); |
---|
6040 | 5979 | |
---|
.. | .. |
---|
6278 | 6217 | // // r.norm.dot(v3) > -0.5) |
---|
6279 | 6218 | // // continue; |
---|
6280 | 6219 | |
---|
6281 | | - drawFace(p, q, r, display, face); |
---|
| 6220 | + display.DrawFace(this, p, q, r, face); |
---|
6282 | 6221 | } |
---|
6283 | 6222 | gl.glEnd(); |
---|
6284 | 6223 | } |
---|
.. | .. |
---|
6322 | 6261 | Vertex q = bRep.GetVertex(face.q); |
---|
6323 | 6262 | Vertex r = bRep.GetVertex(face.r); |
---|
6324 | 6263 | |
---|
6325 | | - drawFace(p, q, r, display, face); |
---|
| 6264 | + display.DrawFace(this, p, q, r, face); |
---|
6326 | 6265 | } |
---|
6327 | 6266 | gl.glEnd(); |
---|
6328 | 6267 | } |
---|
.. | .. |
---|
6462 | 6401 | |
---|
6463 | 6402 | transient FaceCompare[] facescompare = null; |
---|
6464 | 6403 | |
---|
6465 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6466 | | - { |
---|
6467 | | - if (display.RENDERPROGRAM == 0) |
---|
6468 | | - { |
---|
6469 | | - float r = 0; |
---|
6470 | | - if (bRep != null) |
---|
6471 | | - { |
---|
6472 | | - if (bRep.stripified) |
---|
6473 | | - { |
---|
6474 | | - r = 1; |
---|
6475 | | - } |
---|
6476 | | - } |
---|
6477 | | - float g = 0; |
---|
6478 | | - if (bRep != null) |
---|
6479 | | - { |
---|
6480 | | - if (bRep.trimmed) |
---|
6481 | | - { |
---|
6482 | | - g = 1; |
---|
6483 | | - } |
---|
6484 | | - } |
---|
6485 | | - float b = 0; |
---|
6486 | | - if (support != null && link2master) |
---|
6487 | | - { |
---|
6488 | | - b = 1; |
---|
6489 | | - } |
---|
6490 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6491 | | - return; |
---|
6492 | | - } |
---|
6493 | | - |
---|
6494 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6495 | | - return; |
---|
6496 | | - |
---|
6497 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6498 | | -// if (true) return; |
---|
6499 | | -// float ao = p.AO; |
---|
6500 | | -// |
---|
6501 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6502 | | -// // ao = 1; |
---|
6503 | | -// |
---|
6504 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6505 | | - |
---|
6506 | | -// CameraPane.selectedpoint. |
---|
6507 | | -// getAverage(cStatic.point1, true); |
---|
6508 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6509 | | - { |
---|
6510 | | - return; |
---|
6511 | | - } |
---|
6512 | | - |
---|
6513 | | - cStatic.point1.set(0,0,0); |
---|
6514 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6515 | | - |
---|
6516 | | - cStatic.point1.sub(p0); |
---|
6517 | | - |
---|
6518 | | - |
---|
6519 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6520 | | -// { |
---|
6521 | | -// return; |
---|
6522 | | -// } |
---|
6523 | | - |
---|
6524 | | - //if (true) |
---|
6525 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6526 | | - { |
---|
6527 | | - return; |
---|
6528 | | - } |
---|
6529 | | - |
---|
6530 | | - float[] colorV = new float[3]; |
---|
6531 | | - |
---|
6532 | | - if (false) // marked) |
---|
6533 | | - { |
---|
6534 | | - // debug rigging weights |
---|
6535 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6536 | | - { |
---|
6537 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6538 | | - |
---|
6539 | | - // if (weight < 0.1) |
---|
6540 | | - // { |
---|
6541 | | - // assert(weight == 0); |
---|
6542 | | - // continue; |
---|
6543 | | - // } |
---|
6544 | | - |
---|
6545 | | - if (p0.vertexlinks[object] == -1) |
---|
6546 | | - continue; |
---|
6547 | | - |
---|
6548 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6549 | | - |
---|
6550 | | - int color = //1 << object; // |
---|
6551 | | - //p.vertexlinks.length; |
---|
6552 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6553 | | - colorV[2] += (color & 1) * weight; |
---|
6554 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6555 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6556 | | - } |
---|
6557 | | - } |
---|
6558 | | - else |
---|
6559 | | - { |
---|
6560 | | - if (drawingstarted) |
---|
6561 | | - { |
---|
6562 | | - // find next point |
---|
6563 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6564 | | - { |
---|
6565 | | - bRep.InitFaceIndices(); |
---|
6566 | | - } |
---|
6567 | | - |
---|
6568 | | - double ymin = p0.y; |
---|
6569 | | - |
---|
6570 | | - Vertex newp = p0; |
---|
6571 | | - |
---|
6572 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6573 | | - { |
---|
6574 | | - int fi = p0.faceindices[fii]; |
---|
6575 | | - |
---|
6576 | | - if (fi == -1) |
---|
6577 | | - break; |
---|
6578 | | - |
---|
6579 | | - Face f = bRep.GetFace(fi); |
---|
6580 | | - |
---|
6581 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6582 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6583 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6584 | | - |
---|
6585 | | - int swap = (int)(Math.random()*3); |
---|
6586 | | - |
---|
6587 | | -// for (int s=swap; --s>=0;) |
---|
6588 | | -// { |
---|
6589 | | -// Vertex t = p; |
---|
6590 | | -// p = q; |
---|
6591 | | -// q = r; |
---|
6592 | | -// r = t; |
---|
6593 | | -// } |
---|
6594 | | - if (ymin > p.y) |
---|
6595 | | - { |
---|
6596 | | - ymin = p.y; |
---|
6597 | | - newp = p; |
---|
6598 | | -// break; |
---|
6599 | | - } |
---|
6600 | | - if (ymin > q.y) |
---|
6601 | | - { |
---|
6602 | | - ymin = q.y; |
---|
6603 | | - newp = q; |
---|
6604 | | -// break; |
---|
6605 | | - } |
---|
6606 | | - if (ymin > r.y) |
---|
6607 | | - { |
---|
6608 | | - ymin = r.y; |
---|
6609 | | - newp = r; |
---|
6610 | | -// break; |
---|
6611 | | - } |
---|
6612 | | - } |
---|
6613 | | - |
---|
6614 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6615 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6616 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6617 | | - |
---|
6618 | | - drawingstarted = false; |
---|
6619 | | - |
---|
6620 | | - // return; |
---|
6621 | | - } |
---|
6622 | | - |
---|
6623 | | - if (false) // CameraPane.DRAW |
---|
6624 | | - { |
---|
6625 | | - p0.AO = colorV[0] = 2; |
---|
6626 | | - colorV[1] = 2; |
---|
6627 | | - colorV[2] = 2; |
---|
6628 | | - } |
---|
6629 | | - |
---|
6630 | | - CameraPane.pointflow.add(p0); |
---|
6631 | | - CameraPane.pointflow.Touch(); |
---|
6632 | | - } |
---|
6633 | | - |
---|
6634 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6635 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6636 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6637 | | - } |
---|
6638 | | - |
---|
6639 | 6404 | void Print(Vertex v) |
---|
6640 | 6405 | { |
---|
6641 | 6406 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
.. | .. |
---|
6657 | 6422 | gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6658 | 6423 | } |
---|
6659 | 6424 | |
---|
6660 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6661 | | - CameraPane display, Face face) |
---|
6662 | | - { |
---|
6663 | | - if (pv.y == -10000 || |
---|
6664 | | - qv.y == -10000 || |
---|
6665 | | - rv.y == -10000) |
---|
6666 | | - return; |
---|
6667 | | - |
---|
6668 | | -// float b = f.nbiterations & 1; |
---|
6669 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6670 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6671 | | -// |
---|
6672 | | -// //if (f.weight == 10000) |
---|
6673 | | -// //{ |
---|
6674 | | -// // r = 1; g = b = 0; |
---|
6675 | | -// //} |
---|
6676 | | -// //else |
---|
6677 | | -// //{ |
---|
6678 | | -// // assert(f.weight < 10000); |
---|
6679 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6680 | | -// if (r<0) |
---|
6681 | | -// assert(r>=0); |
---|
6682 | | -// //} |
---|
6683 | | - |
---|
6684 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6685 | | - |
---|
6686 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6687 | | - |
---|
6688 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6689 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6690 | | - { |
---|
6691 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6692 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6693 | | - if (!hasnorm) |
---|
6694 | | - { |
---|
6695 | | - // System.out.println("FUCK!!"); |
---|
6696 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6697 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6698 | | - LA.vecCross(v0, v1, v2); |
---|
6699 | | - LA.vecNormalize(v2); |
---|
6700 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6701 | | - } |
---|
6702 | | - |
---|
6703 | | - if (hasnorm) |
---|
6704 | | - { |
---|
6705 | | -// if (!pv.norm.normalized()) |
---|
6706 | | -// assert(pv.norm.normalized()); |
---|
6707 | | - |
---|
6708 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6709 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6710 | | - } |
---|
6711 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6712 | | - SetColor(display, pv); |
---|
6713 | | - //gl.glColor4f(r, g, b, 1); |
---|
6714 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6715 | | - if (flipV) |
---|
6716 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6717 | | - else |
---|
6718 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6719 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6720 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6721 | | -// Print(pv); |
---|
6722 | | - if (hasnorm) |
---|
6723 | | - { |
---|
6724 | | -// assert(qv.norm.normalized()); |
---|
6725 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6726 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6727 | | - } |
---|
6728 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6729 | | - // boolean locked = false; |
---|
6730 | | - // float eps = 0.1f; |
---|
6731 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6732 | | - |
---|
6733 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6734 | | - |
---|
6735 | | - // if ((dot&1) == 0) |
---|
6736 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6737 | | - |
---|
6738 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6739 | | - if (flipV) |
---|
6740 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6741 | | - else |
---|
6742 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6743 | | - // else |
---|
6744 | | - // { |
---|
6745 | | - // locked = true; |
---|
6746 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6747 | | - // } |
---|
6748 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6749 | | - SetColor(display, qv); |
---|
6750 | | - //gl.glColor4f(r, g, b, 1); |
---|
6751 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6752 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6753 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6754 | | -// Print(qv); |
---|
6755 | | - if (hasnorm) |
---|
6756 | | - { |
---|
6757 | | -// assert(rv.norm.normalized()); |
---|
6758 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6759 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6760 | | - } |
---|
6761 | | - |
---|
6762 | | - // if ((dot&4) == 0) |
---|
6763 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6764 | | - |
---|
6765 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6766 | | - if (flipV) |
---|
6767 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6768 | | - else |
---|
6769 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6770 | | - // else |
---|
6771 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6772 | | - |
---|
6773 | | - // f.dot = dot; |
---|
6774 | | - |
---|
6775 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6776 | | - SetColor(display, rv); |
---|
6777 | | - //gl.glColor4f(r, g, b, 1); |
---|
6778 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6779 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6780 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6781 | | -// Print(rv); |
---|
6782 | | - //gl.glEnd(); |
---|
6783 | | - } |
---|
6784 | | - else |
---|
6785 | | - { |
---|
6786 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6787 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6788 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6789 | | - |
---|
6790 | | - } |
---|
6791 | | - |
---|
6792 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6793 | | - { |
---|
6794 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6795 | | - |
---|
6796 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6797 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6798 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6799 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6800 | | - gl.glEnd(); |
---|
6801 | | - |
---|
6802 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6803 | | - } |
---|
6804 | | - } |
---|
6805 | | - |
---|
6806 | 6425 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6807 | 6426 | { |
---|
6808 | 6427 | if (bRep == null) |
---|
.. | .. |
---|
8164 | 7783 | { |
---|
8165 | 7784 | Object3D targ = this; |
---|
8166 | 7785 | |
---|
| 7786 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 7787 | + |
---|
8167 | 7788 | if (obj.material != null) |
---|
8168 | 7789 | { |
---|
8169 | 7790 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|