.. | .. |
---|
149 | 149 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 150 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 151 | } |
---|
152 | | - static CameraPane theRenderer; |
---|
153 | | - |
---|
| 152 | + |
---|
154 | 153 | void SetAsGLRenderer(boolean b) |
---|
155 | 154 | { |
---|
156 | 155 | isRenderer = b; |
---|
157 | | - theRenderer = this; |
---|
| 156 | + Globals.theRenderer = this; |
---|
158 | 157 | } |
---|
159 | 158 | |
---|
160 | 159 | CameraPane(Object3D o, Camera cam, boolean withcontext) |
---|
.. | .. |
---|
191 | 190 | } |
---|
192 | 191 | |
---|
193 | 192 | /// INTERFACE |
---|
| 193 | + |
---|
| 194 | + public boolean IsBoxMode() |
---|
| 195 | + { |
---|
| 196 | + return BOXMODE; |
---|
| 197 | + } |
---|
194 | 198 | |
---|
195 | 199 | public void ClearDepth() |
---|
196 | 200 | { |
---|
.. | .. |
---|
231 | 235 | return this.ambientOcclusion; |
---|
232 | 236 | } |
---|
233 | 237 | |
---|
| 238 | + public boolean IsDebugSelection() |
---|
| 239 | + { |
---|
| 240 | + return DEBUG_SELECTION; |
---|
| 241 | + } |
---|
| 242 | + |
---|
234 | 243 | public boolean IsFrozen() |
---|
235 | 244 | { |
---|
236 | | - boolean selectmode = this.DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 245 | + boolean selectmode = this.DrawMode() == SELECTION || this.IsDebugSelection(); |
---|
237 | 246 | |
---|
238 | 247 | return !selectmode && cameracount == 0; // != 0; |
---|
239 | 248 | } |
---|
.. | .. |
---|
254 | 263 | return lightCamera; |
---|
255 | 264 | } |
---|
256 | 265 | |
---|
| 266 | + public Camera ManipCamera() |
---|
| 267 | + { |
---|
| 268 | + return manipCamera; |
---|
| 269 | + } |
---|
| 270 | + |
---|
257 | 271 | public Camera RenderCamera() |
---|
258 | 272 | { |
---|
259 | 273 | return renderCamera; |
---|
| 274 | + } |
---|
| 275 | + |
---|
| 276 | + public Camera[] Cameras() |
---|
| 277 | + { |
---|
| 278 | + return cameras; |
---|
260 | 279 | } |
---|
261 | 280 | |
---|
262 | 281 | public void PushMaterial(Object3D obj, boolean selected) |
---|
.. | .. |
---|
403 | 422 | |
---|
404 | 423 | javax.media.opengl.GL gl = display.GetGL(); |
---|
405 | 424 | |
---|
406 | | - boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 425 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
407 | 426 | |
---|
408 | 427 | //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
409 | 428 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
.. | .. |
---|
566 | 585 | } |
---|
567 | 586 | } |
---|
568 | 587 | |
---|
| 588 | + /** |
---|
| 589 | + * <code>draw</code> renders a <code>TriMesh</code> object including |
---|
| 590 | + * it's normals, colors, textures and vertices. |
---|
| 591 | + * |
---|
| 592 | + * @see Renderer#draw(TriMesh) |
---|
| 593 | + * @param tris |
---|
| 594 | + * the mesh to render. |
---|
| 595 | + */ |
---|
| 596 | + public void DrawParticles(TriMesh geo, Object3D shape, boolean selected, boolean rotate) // TriMesh tris) |
---|
| 597 | + { |
---|
| 598 | + CameraPane display = this; |
---|
| 599 | + |
---|
| 600 | + float r = display.modelParams0[0]; |
---|
| 601 | + float g = display.modelParams0[1]; |
---|
| 602 | + float b = display.modelParams0[2]; |
---|
| 603 | + float opacity = display.modelParams5[1]; |
---|
| 604 | + |
---|
| 605 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 606 | + GL gl = display.GetGL(); // getGL(); |
---|
| 607 | + |
---|
| 608 | + FloatBuffer vertBuf = geo.vertBuf; |
---|
| 609 | + |
---|
| 610 | + int v = vertBuf.capacity(); |
---|
| 611 | + |
---|
| 612 | + int count = 0; |
---|
| 613 | + |
---|
| 614 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 615 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 616 | + // gl.glScalef(1.0f/1024,1.0f/1024,1.0f/1024); |
---|
| 617 | + for (int i=0; i<v/3; i++) |
---|
| 618 | + { |
---|
| 619 | + int index3 = i*3; |
---|
| 620 | + |
---|
| 621 | + if (geo.sizeBuf.get(index3+1) == 0) |
---|
| 622 | + continue; |
---|
| 623 | + |
---|
| 624 | + count++; |
---|
| 625 | + |
---|
| 626 | + int index4 = i*4; |
---|
| 627 | + |
---|
| 628 | + float tx = vertBuf.get(index3); |
---|
| 629 | + float ty = vertBuf.get(index3+1); |
---|
| 630 | + float tz = vertBuf.get(index3+2); |
---|
| 631 | + |
---|
| 632 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 633 | + // continue; |
---|
| 634 | + |
---|
| 635 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 636 | + gl.glPushMatrix(); |
---|
| 637 | + |
---|
| 638 | + float[] texmat = geo.texmat; |
---|
| 639 | + texmat[12] = texmat[13] = texmat[14] = i; |
---|
| 640 | + |
---|
| 641 | + gl.glMultMatrixf(texmat, 0); |
---|
| 642 | + |
---|
| 643 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 644 | + gl.glPushMatrix(); |
---|
| 645 | + |
---|
| 646 | + gl.glTranslatef(tx,ty,tz); |
---|
| 647 | + |
---|
| 648 | + if (rotate) |
---|
| 649 | + gl.glRotatef(i, 0, 1, 0); |
---|
| 650 | + |
---|
| 651 | + float size = geo.sizeBuf.get(index3) / 100; |
---|
| 652 | + gl.glScalef(size,size,size); |
---|
| 653 | + |
---|
| 654 | + float cr = geo.colorBuf.get(index4); |
---|
| 655 | + float cg = geo.colorBuf.get(index4+1); |
---|
| 656 | + float cb = geo.colorBuf.get(index4+2); |
---|
| 657 | + float ca = geo.colorBuf.get(index4+3); |
---|
| 658 | + |
---|
| 659 | + display.modelParams0[0] = r * cr; |
---|
| 660 | + display.modelParams0[1] = g * cg; |
---|
| 661 | + display.modelParams0[2] = b * cb; |
---|
| 662 | + |
---|
| 663 | + display.modelParams5[1] = opacity * ca; |
---|
| 664 | + |
---|
| 665 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 666 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 667 | + |
---|
| 668 | + RandomNode.globalseed = (int)geo.sizeBuf.get(index3+2); // i; |
---|
| 669 | + RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 670 | + |
---|
| 671 | +// gl.glColor4f(cr,cg,cb,ca); |
---|
| 672 | + // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 673 | + shape.Draw/*Node*/(display,null,selected,false); // blocked |
---|
| 674 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 675 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 676 | + gl.glPopMatrix(); |
---|
| 677 | + |
---|
| 678 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 679 | + gl.glPopMatrix(); |
---|
| 680 | + } |
---|
| 681 | + // gl.glScalef(1024,1024,1024); |
---|
| 682 | + if (!cf) |
---|
| 683 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 684 | + |
---|
| 685 | + display.modelParams0[0] = r; |
---|
| 686 | + display.modelParams0[1] = g; |
---|
| 687 | + display.modelParams0[2] = b; |
---|
| 688 | + |
---|
| 689 | + display.modelParams5[1] = opacity; |
---|
| 690 | + |
---|
| 691 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 692 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 693 | + |
---|
| 694 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 695 | + |
---|
| 696 | +// System.err.println("total = " + v/3 + "; displayed = " + count); |
---|
| 697 | + if (true) |
---|
| 698 | + return; |
---|
| 699 | + |
---|
| 700 | +//// if (!tris.predraw(this)) |
---|
| 701 | +//// { |
---|
| 702 | +//// return; |
---|
| 703 | +//// } |
---|
| 704 | +//// if (Debug.stats) |
---|
| 705 | +//// { |
---|
| 706 | +//// StatCollector.addStat(StatType.STAT_TRIANGLE_COUNT, tris.getTriangleCount()); |
---|
| 707 | +//// StatCollector.addStat(StatType.STAT_VERTEX_COUNT, tris.getVertexCount()); |
---|
| 708 | +//// StatCollector.addStat(StatType.STAT_GEOM_COUNT, 1); |
---|
| 709 | +//// } |
---|
| 710 | +//// |
---|
| 711 | +//// if (tris.getDisplayListID() != -1) |
---|
| 712 | +//// { |
---|
| 713 | +//// renderDisplayList(tris); |
---|
| 714 | +//// return; |
---|
| 715 | +//// } |
---|
| 716 | +//// |
---|
| 717 | +//// if (!generatingDisplayList) |
---|
| 718 | +//// { |
---|
| 719 | +//// applyStates(tris.states, tris); |
---|
| 720 | +//// } |
---|
| 721 | +//// if (Debug.stats) |
---|
| 722 | +//// { |
---|
| 723 | +//// StatCollector.startStat(StatType.STAT_RENDER_TIMER); |
---|
| 724 | +//// } |
---|
| 725 | +//// boolean transformed = doTransforms(tris); |
---|
| 726 | +// |
---|
| 727 | +// int glMode = GL.GL_TRIANGLES; |
---|
| 728 | +// switch (getMode()) |
---|
| 729 | +// { |
---|
| 730 | +// case Triangles: |
---|
| 731 | +// glMode = GL.GL_TRIANGLES; |
---|
| 732 | +// break; |
---|
| 733 | +// case Strip: |
---|
| 734 | +// glMode = GL.GL_TRIANGLE_STRIP; |
---|
| 735 | +// break; |
---|
| 736 | +// case Fan: |
---|
| 737 | +// glMode = GL.GL_TRIANGLE_FAN; |
---|
| 738 | +// break; |
---|
| 739 | +// } |
---|
| 740 | +// |
---|
| 741 | +// if (!predrawGeometry(gl)) |
---|
| 742 | +// { |
---|
| 743 | +// // make sure only the necessary indices are sent through on old |
---|
| 744 | +// // cards. |
---|
| 745 | +// IntBuffer indices = this.getIndexBuffer(); |
---|
| 746 | +// if (indices == null) |
---|
| 747 | +// { |
---|
| 748 | +// logger.severe("missing indices on geometry object: " + this.toString()); |
---|
| 749 | +// } else |
---|
| 750 | +// { |
---|
| 751 | +// indices.rewind(); |
---|
| 752 | +// indices.limit(this.getMaxIndex()); |
---|
| 753 | +// |
---|
| 754 | +// gl.glDrawElements(glMode, indices.limit(), GL.GL_UNSIGNED_INT, indices); // TODO Check <count> and assumed <type> of GL_UNSIGNED_INT |
---|
| 755 | +// |
---|
| 756 | +// indices.clear(); |
---|
| 757 | +// } |
---|
| 758 | +// } else |
---|
| 759 | +// { |
---|
| 760 | +// gl.glDrawElements(glMode, this.getIndexBuffer().limit(), |
---|
| 761 | +// GL.GL_UNSIGNED_INT, 0); |
---|
| 762 | +// } |
---|
| 763 | +// |
---|
| 764 | +//// postdrawGeometry(tris); |
---|
| 765 | +//// if (transformed) |
---|
| 766 | +//// { |
---|
| 767 | +//// undoTransforms(tris); |
---|
| 768 | +//// } |
---|
| 769 | +//// |
---|
| 770 | +//// if (Debug.stats) |
---|
| 771 | +//// { |
---|
| 772 | +//// StatCollector.endStat(StatType.STAT_RENDER_TIMER); |
---|
| 773 | +//// } |
---|
| 774 | +//// tris.postdraw(this); |
---|
| 775 | + } |
---|
| 776 | + |
---|
| 777 | + static Camera localcamera = new Camera(); |
---|
| 778 | + static cVector from = new cVector(); |
---|
| 779 | + static cVector to = new cVector(); |
---|
| 780 | + |
---|
| 781 | + public void PrepOcclusion(BoundaryRep br, double[][] transform) |
---|
| 782 | + { |
---|
| 783 | + CameraPane cp = this; |
---|
| 784 | + |
---|
| 785 | + Camera keep = cp.RenderCamera(); |
---|
| 786 | + cp.renderCamera = localcamera; |
---|
| 787 | + |
---|
| 788 | + if (br.trimmed) |
---|
| 789 | + { |
---|
| 790 | + float[] colors = new float[br.positions.length / 3]; |
---|
| 791 | + |
---|
| 792 | + int i3 = 0; |
---|
| 793 | + for (int i = 0; i < br.positions.length / 3; i++, i3 += 3) |
---|
| 794 | + { |
---|
| 795 | + if (br.normals[i3] == 0 && br.normals[i3+1] == 0 && br.normals[i3+2] == 0) |
---|
| 796 | + continue; |
---|
| 797 | + |
---|
| 798 | + from.set(br.positions[i3], br.positions[i3 + 1], br.positions[i3 + 2]); |
---|
| 799 | + to.set(br.positions[i3] + br.normals[i3], |
---|
| 800 | + br.positions[i3 + 1] + br.normals[i3 + 1], |
---|
| 801 | + br.positions[i3 + 2] + br.normals[i3 + 2]); |
---|
| 802 | + LA.xformPos(from, transform, from); |
---|
| 803 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 804 | + localcamera.setAim(from, to); |
---|
| 805 | + |
---|
| 806 | + CameraPane.occlusionbuffer.display(); |
---|
| 807 | + |
---|
| 808 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 809 | + cp.display(); // debug |
---|
| 810 | + |
---|
| 811 | + colors[i] = cp.vertexOcclusion.r; |
---|
| 812 | + //colors[i3 + 1] = cp.vertexOcclusion.g; |
---|
| 813 | + //colors[i3 + 2] = cp.vertexOcclusion.b; |
---|
| 814 | + |
---|
| 815 | + if ((i % 100) == 0 && i != 0) |
---|
| 816 | + { |
---|
| 817 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 818 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 819 | + System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")"); |
---|
| 820 | + } |
---|
| 821 | + } |
---|
| 822 | + |
---|
| 823 | + br.colors = colors; |
---|
| 824 | + } |
---|
| 825 | + else |
---|
| 826 | + { |
---|
| 827 | + for (int i = 0; i < br.VertexCount(); i++) |
---|
| 828 | + { |
---|
| 829 | + Vertex v = br.GetVertex(i); |
---|
| 830 | + |
---|
| 831 | + if (v.norm == null || v.norm.x == 0 && v.norm.y == 0 && v.norm.z == 0) |
---|
| 832 | + continue; |
---|
| 833 | + |
---|
| 834 | + from.set(v.x, v.y, v.z); |
---|
| 835 | + to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z); |
---|
| 836 | + LA.xformPos(from, transform, from); |
---|
| 837 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 838 | + localcamera.setAim(from, to); |
---|
| 839 | + |
---|
| 840 | + CameraPane.occlusionbuffer.display(); |
---|
| 841 | + |
---|
| 842 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 843 | + cp.display(); // debug |
---|
| 844 | + |
---|
| 845 | + v.AO = cp.vertexOcclusion.r; |
---|
| 846 | + |
---|
| 847 | + if ((i % 100) == 0 && i != 0) |
---|
| 848 | + { |
---|
| 849 | + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 850 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 851 | + System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")"); |
---|
| 852 | + } |
---|
| 853 | + } |
---|
| 854 | + } |
---|
| 855 | + |
---|
| 856 | + //System.out.println("done."); |
---|
| 857 | + |
---|
| 858 | + cp.renderCamera = keep; |
---|
| 859 | + } |
---|
| 860 | + |
---|
| 861 | + void DrawPointFLow(PointFlow pointFlow, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 862 | + { |
---|
| 863 | + CameraPane display = this; |
---|
| 864 | + pointFlow.CreateHT(); |
---|
| 865 | + |
---|
| 866 | + float r = display.modelParams0[0]; |
---|
| 867 | + float g = display.modelParams0[1]; |
---|
| 868 | + float b = display.modelParams0[2]; |
---|
| 869 | + float opacity = display.modelParams5[1]; |
---|
| 870 | + |
---|
| 871 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 872 | + GL gl = display.GetGL(); // getGL(); |
---|
| 873 | + |
---|
| 874 | + int s = pointFlow.points.size(); |
---|
| 875 | + |
---|
| 876 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 877 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 878 | + |
---|
| 879 | + for (int i=s; --i>=0;) |
---|
| 880 | + //for (int i=0; i<s; i++) |
---|
| 881 | + { |
---|
| 882 | + cVector v = pointFlow.points.get(i); |
---|
| 883 | + |
---|
| 884 | + double mindist = Double.MAX_VALUE; |
---|
| 885 | + |
---|
| 886 | + double size = pointFlow.minimumSize; |
---|
| 887 | + |
---|
| 888 | + double distancenext = 0; |
---|
| 889 | + |
---|
| 890 | + if (i > 0) |
---|
| 891 | + { |
---|
| 892 | + cVector w = pointFlow.points.get(i-1); |
---|
| 893 | + |
---|
| 894 | + double dist = w.distance(v); |
---|
| 895 | + |
---|
| 896 | + distancenext = dist; |
---|
| 897 | + |
---|
| 898 | + if (mindist > dist) |
---|
| 899 | + { |
---|
| 900 | + mindist = dist; |
---|
| 901 | + size = mindist*pointFlow.resizefactor; |
---|
| 902 | + } |
---|
| 903 | + } |
---|
| 904 | + |
---|
| 905 | + if (i < s-1) |
---|
| 906 | + { |
---|
| 907 | + cVector w = pointFlow.points.get(i+1); |
---|
| 908 | + |
---|
| 909 | + double dist = w.distance(v); |
---|
| 910 | + |
---|
| 911 | + if (mindist > dist) |
---|
| 912 | + { |
---|
| 913 | + mindist = dist; |
---|
| 914 | + size = mindist*pointFlow.resizefactor; |
---|
| 915 | + } |
---|
| 916 | + } |
---|
| 917 | + |
---|
| 918 | + if (size < pointFlow.minimumSize) |
---|
| 919 | + size = pointFlow.minimumSize; |
---|
| 920 | + if (size > pointFlow.maximumSize) |
---|
| 921 | + size = pointFlow.maximumSize; |
---|
| 922 | + |
---|
| 923 | + double tx = v.x; |
---|
| 924 | + double ty = v.y; |
---|
| 925 | + double tz = v.z; |
---|
| 926 | + |
---|
| 927 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 928 | + // continue; |
---|
| 929 | + |
---|
| 930 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 931 | + gl.glPushMatrix(); |
---|
| 932 | + pointFlow.texmat[12] = pointFlow.texmat[13] = pointFlow.texmat[14] = i; |
---|
| 933 | + |
---|
| 934 | + gl.glMultMatrixf(pointFlow.texmat, 0); |
---|
| 935 | + |
---|
| 936 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 937 | + gl.glPushMatrix(); |
---|
| 938 | + |
---|
| 939 | + gl.glTranslated(tx,ty,tz); |
---|
| 940 | + |
---|
| 941 | + gl.glScaled(size,size,size); |
---|
| 942 | + |
---|
| 943 | +// float cr = colorBuf.get(index4); |
---|
| 944 | +// float cg = colorBuf.get(index4+1); |
---|
| 945 | +// float cb = colorBuf.get(index4+2); |
---|
| 946 | +// float ca = colorBuf.get(index4+3); |
---|
| 947 | +// |
---|
| 948 | +// display.modelParams0[0] = r * cr; |
---|
| 949 | +// display.modelParams0[1] = g * cg; |
---|
| 950 | +// display.modelParams0[2] = b * cb; |
---|
| 951 | +// |
---|
| 952 | +// display.modelParams5[1] = opacity * ca; |
---|
| 953 | +// |
---|
| 954 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 955 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 956 | +// |
---|
| 957 | +// RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i; |
---|
| 958 | +// RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 959 | +// |
---|
| 960 | +//// gl.glColor4f(cr,cg,cb,ca); |
---|
| 961 | +// // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 962 | + pointFlow.geo.Draw/*Node*/(display,null,selected, blocked); |
---|
| 963 | + |
---|
| 964 | + gl.glPopMatrix(); |
---|
| 965 | + |
---|
| 966 | + double step = size/4; // |
---|
| 967 | + |
---|
| 968 | + if (i == 0 || size == 0 || distancenext > 8*size || distancenext < step) |
---|
| 969 | + continue; |
---|
| 970 | + |
---|
| 971 | + int nbsteps = (int)(distancenext/step); |
---|
| 972 | + |
---|
| 973 | + step = distancenext/nbsteps; |
---|
| 974 | + |
---|
| 975 | + cVector next = pointFlow.points.get(i-1); |
---|
| 976 | + |
---|
| 977 | + tmp.set(next); |
---|
| 978 | + tmp.sub(v); |
---|
| 979 | + tmp.normalize(); |
---|
| 980 | + tmp.mul(step); |
---|
| 981 | + |
---|
| 982 | + // calculate next size |
---|
| 983 | + mindist = Double.MAX_VALUE; |
---|
| 984 | + |
---|
| 985 | + double nextsize = pointFlow.minimumSize; |
---|
| 986 | + |
---|
| 987 | + if (i > 1) |
---|
| 988 | + { |
---|
| 989 | + cVector w = pointFlow.points.get(i-2); |
---|
| 990 | + |
---|
| 991 | + double dist = w.distance(next); |
---|
| 992 | + |
---|
| 993 | + if (mindist > dist) |
---|
| 994 | + { |
---|
| 995 | + mindist = dist; |
---|
| 996 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 997 | + } |
---|
| 998 | + } |
---|
| 999 | + |
---|
| 1000 | + double dist = v.distance(next); |
---|
| 1001 | + |
---|
| 1002 | + if (mindist > dist) |
---|
| 1003 | + { |
---|
| 1004 | + mindist = dist; |
---|
| 1005 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 1006 | + } |
---|
| 1007 | + |
---|
| 1008 | + if (nextsize < pointFlow.minimumSize) |
---|
| 1009 | + nextsize = pointFlow.minimumSize; |
---|
| 1010 | + if (nextsize > pointFlow.maximumSize) |
---|
| 1011 | + nextsize = pointFlow.maximumSize; |
---|
| 1012 | + // |
---|
| 1013 | + |
---|
| 1014 | + double count = 0; |
---|
| 1015 | + |
---|
| 1016 | + while (distancenext > 0.000000001) // step |
---|
| 1017 | + { |
---|
| 1018 | + gl.glPushMatrix(); |
---|
| 1019 | + |
---|
| 1020 | + gl.glTranslated(tx + tmp.x*count, ty + tmp.y*count, tz + tmp.z*count); |
---|
| 1021 | + |
---|
| 1022 | + double K = count/nbsteps; |
---|
| 1023 | + |
---|
| 1024 | + double intersize = K*nextsize + (1-K)*size; |
---|
| 1025 | + |
---|
| 1026 | + gl.glScaled(intersize,intersize,intersize); |
---|
| 1027 | + |
---|
| 1028 | + pointFlow.geo.Draw/*Node*/(display,null,selected,blocked); |
---|
| 1029 | + |
---|
| 1030 | + count++; |
---|
| 1031 | + |
---|
| 1032 | + distancenext -= step; |
---|
| 1033 | + |
---|
| 1034 | + gl.glPopMatrix(); |
---|
| 1035 | + } |
---|
| 1036 | + |
---|
| 1037 | + if (count != nbsteps) |
---|
| 1038 | + assert(count == nbsteps); |
---|
| 1039 | + |
---|
| 1040 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 1041 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 1042 | + |
---|
| 1043 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 1044 | + gl.glPopMatrix(); |
---|
| 1045 | + } |
---|
| 1046 | + |
---|
| 1047 | + if (!cf) |
---|
| 1048 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 1049 | + |
---|
| 1050 | +// display.modelParams0[0] = r; |
---|
| 1051 | +// display.modelParams0[1] = g; |
---|
| 1052 | +// display.modelParams0[2] = b; |
---|
| 1053 | +// |
---|
| 1054 | +// display.modelParams5[1] = opacity; |
---|
| 1055 | +// |
---|
| 1056 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 1057 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 1058 | + |
---|
| 1059 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 1060 | + } |
---|
| 1061 | + |
---|
569 | 1062 | /// INTERFACE |
---|
570 | 1063 | |
---|
571 | 1064 | void SetColor(Object3D obj, Vertex p0) |
---|
.. | .. |
---|
1129 | 1622 | |
---|
1130 | 1623 | static int camerachangeframe; |
---|
1131 | 1624 | |
---|
1132 | | - boolean SetCamera(Camera cam) |
---|
| 1625 | + public boolean SetCamera(Camera cam) |
---|
1133 | 1626 | { |
---|
1134 | 1627 | // may 2014 if (cam == cameras[0] || cam == cameras[1]) |
---|
1135 | 1628 | // return false; |
---|
.. | .. |
---|
1257 | 1750 | mainDL ^= true; |
---|
1258 | 1751 | } |
---|
1259 | 1752 | |
---|
1260 | | - void ToggleTexture() |
---|
| 1753 | + void ToggleFullScreen() |
---|
| 1754 | + { |
---|
| 1755 | + FULLSCREEN ^= true; |
---|
| 1756 | + } |
---|
| 1757 | + |
---|
| 1758 | + void ToggleCrowd() |
---|
| 1759 | + { |
---|
| 1760 | + Globals.CROWD ^= true; |
---|
| 1761 | + } |
---|
| 1762 | + |
---|
| 1763 | + void ToggleLocal() |
---|
| 1764 | + { |
---|
| 1765 | + LOCALTRANSFORM ^= true; |
---|
| 1766 | + } |
---|
| 1767 | + |
---|
| 1768 | + public void ToggleTexture() |
---|
1261 | 1769 | { |
---|
1262 | 1770 | textureon ^= true; |
---|
1263 | 1771 | } |
---|
1264 | 1772 | |
---|
1265 | | - void ToggleLive() |
---|
| 1773 | + public void ToggleLive() |
---|
1266 | 1774 | { |
---|
1267 | 1775 | Globals.setLIVE(Globals.isLIVE() ^ true); |
---|
1268 | 1776 | |
---|
.. | .. |
---|
1274 | 1782 | repaint(); // start loop // may 2013 |
---|
1275 | 1783 | } |
---|
1276 | 1784 | |
---|
1277 | | - void ToggleSupport() |
---|
| 1785 | + public void ToggleSupport() |
---|
1278 | 1786 | { |
---|
1279 | 1787 | SUPPORT ^= true; |
---|
1280 | 1788 | } |
---|
1281 | 1789 | |
---|
1282 | | - void ToggleAbort() |
---|
| 1790 | + public void ToggleAbort() |
---|
1283 | 1791 | { |
---|
1284 | 1792 | ABORTMODE ^= true; |
---|
1285 | 1793 | } |
---|
1286 | 1794 | |
---|
1287 | | - void ToggleFullScreen() |
---|
1288 | | - { |
---|
1289 | | - FULLSCREEN ^= true; |
---|
1290 | | - } |
---|
1291 | | - |
---|
1292 | | - void ToggleCrowd() |
---|
1293 | | - { |
---|
1294 | | - Globals.CROWD ^= true; |
---|
1295 | | - } |
---|
1296 | | - |
---|
1297 | | - void ToggleInertia() |
---|
| 1795 | + public void ToggleInertia() |
---|
1298 | 1796 | { |
---|
1299 | 1797 | INERTIA ^= true; |
---|
1300 | 1798 | } |
---|
1301 | 1799 | |
---|
1302 | | - void ToggleLocal() |
---|
1303 | | - { |
---|
1304 | | - LOCALTRANSFORM ^= true; |
---|
1305 | | - } |
---|
1306 | | - |
---|
1307 | | - void ToggleFast() |
---|
| 1800 | + public void ToggleFast() |
---|
1308 | 1801 | { |
---|
1309 | 1802 | FAST ^= true; |
---|
1310 | 1803 | } |
---|
1311 | 1804 | |
---|
1312 | | - void ToggleSlowPose() |
---|
| 1805 | + public void ToggleSlowPose() |
---|
1313 | 1806 | { |
---|
1314 | 1807 | SLOWPOSE ^= true; |
---|
1315 | 1808 | } |
---|
1316 | 1809 | |
---|
1317 | | - void ToggleFootContact() |
---|
1318 | | - { |
---|
1319 | | - FOOTCONTACT ^= true; |
---|
1320 | | - } |
---|
1321 | | - |
---|
1322 | | - void ToggleBoxMode() |
---|
| 1810 | + public void ToggleBoxMode() |
---|
1323 | 1811 | { |
---|
1324 | 1812 | BOXMODE ^= true; |
---|
1325 | 1813 | } |
---|
1326 | 1814 | |
---|
1327 | | - void ToggleSmoothFocus() |
---|
| 1815 | + public void ToggleSmoothFocus() |
---|
1328 | 1816 | { |
---|
1329 | 1817 | SMOOTHFOCUS ^= true; |
---|
1330 | 1818 | } |
---|
1331 | 1819 | |
---|
1332 | | - void ToggleImageFlip() |
---|
| 1820 | + public void ToggleImageFlip() |
---|
1333 | 1821 | { |
---|
1334 | 1822 | IMAGEFLIP ^= true; |
---|
1335 | 1823 | } |
---|
1336 | 1824 | |
---|
1337 | | - void ToggleSpeakerMocap() |
---|
| 1825 | + public void ToggleSpeakerMocap() |
---|
1338 | 1826 | { |
---|
1339 | 1827 | SPEAKERMOCAP ^= true; |
---|
1340 | 1828 | } |
---|
1341 | 1829 | |
---|
1342 | | - void ToggleSpeakerCamera() |
---|
| 1830 | + public void ToggleSpeakerCamera() |
---|
1343 | 1831 | { |
---|
1344 | 1832 | SPEAKERCAMERA ^= true; |
---|
1345 | 1833 | } |
---|
1346 | 1834 | |
---|
1347 | | - void ToggleSpeakerFocus() |
---|
| 1835 | + public void ToggleSpeakerFocus() |
---|
1348 | 1836 | { |
---|
1349 | 1837 | SPEAKERFOCUS ^= true; |
---|
1350 | 1838 | } |
---|
1351 | 1839 | |
---|
1352 | | - void ToggleDebug() |
---|
1353 | | - { |
---|
1354 | | - DEBUG ^= true; |
---|
1355 | | - } |
---|
1356 | | - |
---|
1357 | | - void ToggleFrustum() |
---|
| 1840 | + public void ToggleFrustum() |
---|
1358 | 1841 | { |
---|
1359 | 1842 | FRUSTUM ^= true; |
---|
1360 | 1843 | } |
---|
1361 | 1844 | |
---|
1362 | | - void ToggleTrack() |
---|
| 1845 | + public void ToggleTrack() |
---|
1363 | 1846 | { |
---|
1364 | 1847 | TRACK ^= true; |
---|
1365 | 1848 | if (TRACK) |
---|
.. | .. |
---|
1378 | 1861 | repaint(); |
---|
1379 | 1862 | } |
---|
1380 | 1863 | |
---|
1381 | | - void ToggleTrackOnce() |
---|
| 1864 | + public void ToggleTrackOnce() |
---|
1382 | 1865 | { |
---|
1383 | 1866 | TRACKONCE ^= true; |
---|
1384 | 1867 | } |
---|
1385 | 1868 | |
---|
1386 | | - void ToggleShadowTrack() |
---|
| 1869 | + public void ToggleShadowTrack() |
---|
1387 | 1870 | { |
---|
1388 | 1871 | SHADOWTRACK ^= true; |
---|
1389 | 1872 | repaint(); |
---|
1390 | 1873 | } |
---|
1391 | 1874 | |
---|
1392 | | - void ToggleOeil() |
---|
| 1875 | + public void ToggleOeil() |
---|
1393 | 1876 | { |
---|
1394 | 1877 | OEIL ^= true; |
---|
1395 | 1878 | } |
---|
1396 | 1879 | |
---|
1397 | | - void ToggleOeilOnce() |
---|
| 1880 | + public void ToggleOeilOnce() |
---|
1398 | 1881 | { |
---|
1399 | 1882 | OEILONCE ^= true; |
---|
| 1883 | + } |
---|
| 1884 | + |
---|
| 1885 | + void ToggleFootContact() |
---|
| 1886 | + { |
---|
| 1887 | + FOOTCONTACT ^= true; |
---|
| 1888 | + } |
---|
| 1889 | + |
---|
| 1890 | + void ToggleDebug() |
---|
| 1891 | + { |
---|
| 1892 | + DEBUG ^= true; |
---|
1400 | 1893 | } |
---|
1401 | 1894 | |
---|
1402 | 1895 | void ToggleLookAt() |
---|
.. | .. |
---|
7458 | 7951 | return texture!=null?texture.texture:null; |
---|
7459 | 7952 | } |
---|
7460 | 7953 | |
---|
7461 | | - com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 7954 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
7462 | 7955 | { |
---|
7463 | 7956 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
7464 | 7957 | |
---|
.. | .. |
---|
10146 | 10639 | fragmentMode |= (lightslot - 64) << 2; // 1; // first bit is available for aniso |
---|
10147 | 10640 | //System.out.println("fragmentMode = " + fragmentMode); |
---|
10148 | 10641 | |
---|
10149 | | - if (DrawMode() == DEFAULT || DrawMode() == SELECTION || DEBUG_SELECTION) |
---|
| 10642 | + if (DrawMode() == DEFAULT || DrawMode() == SELECTION || IsDebugSelection()) |
---|
10150 | 10643 | { |
---|
10151 | 10644 | /* |
---|
10152 | 10645 | if (CULLFACE || (ambientOcclusion && OCCLUSION_CULLING)) |
---|
.. | .. |
---|
10447 | 10940 | callist = gl.glGenLists(1); |
---|
10448 | 10941 | } |
---|
10449 | 10942 | |
---|
10450 | | - boolean selectmode = DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 10943 | + boolean selectmode = DrawMode() == SELECTION || IsDebugSelection(); |
---|
10451 | 10944 | |
---|
10452 | 10945 | boolean active = !selectmode; // DrawMode() != SELECTION; // mouseDown; |
---|
10453 | 10946 | |
---|
.. | .. |
---|
12922 | 13415 | cVector tmp2 = new cVector(); |
---|
12923 | 13416 | boolean isMoving; |
---|
12924 | 13417 | |
---|
| 13418 | + public cVector TargetLookAt() |
---|
| 13419 | + { |
---|
| 13420 | + return targetLookAt; |
---|
| 13421 | + } |
---|
| 13422 | + |
---|
12925 | 13423 | class PingThread extends Thread |
---|
12926 | 13424 | { |
---|
12927 | 13425 | boolean jump; |
---|
.. | .. |
---|
13653 | 14151 | SetMouseMode(modifiers); |
---|
13654 | 14152 | } |
---|
13655 | 14153 | |
---|
13656 | | - theRenderer.keyPressed(key); |
---|
| 14154 | + Globals.theRenderer.keyPressed(key); |
---|
13657 | 14155 | } |
---|
13658 | 14156 | |
---|
13659 | 14157 | int kompactbit = 4; // power bit |
---|
.. | .. |
---|
13665 | 14163 | float SATPOW = 1; // 2; // 0.5f; |
---|
13666 | 14164 | float BRIPOW = 1; // 0.5f; // 0.5f; |
---|
13667 | 14165 | |
---|
13668 | | - void keyPressed(int key) |
---|
| 14166 | + public void keyPressed(int key) |
---|
13669 | 14167 | { |
---|
13670 | 14168 | if (key >= '0' && key <= '5') |
---|
13671 | 14169 | clampbit = (key-'0'); |
---|
.. | .. |
---|
14102 | 14600 | } |
---|
14103 | 14601 | //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy); |
---|
14104 | 14602 | } |
---|
| 14603 | + |
---|
14105 | 14604 | static double OCCLUSIONBOOST = 1; // 0.5; |
---|
14106 | 14605 | |
---|
14107 | 14606 | void keyReleased(int key, int modifiers) |
---|
.. | .. |
---|
14113 | 14612 | } |
---|
14114 | 14613 | } |
---|
14115 | 14614 | |
---|
14116 | | - protected void processKeyEvent(KeyEvent e) |
---|
| 14615 | + public void processKeyEvent(KeyEvent e) |
---|
14117 | 14616 | { |
---|
14118 | 14617 | switch (e.getID()) |
---|
14119 | 14618 | { |
---|
.. | .. |
---|
15772 | 16271 | |
---|
15773 | 16272 | class AntialiasBuffer implements GLEventListener |
---|
15774 | 16273 | { |
---|
15775 | | - |
---|
15776 | 16274 | CameraPane parent = null; |
---|
15777 | 16275 | |
---|
15778 | 16276 | AntialiasBuffer(CameraPane p) |
---|
.. | .. |
---|
16165 | 16663 | } |
---|
16166 | 16664 | } |
---|
16167 | 16665 | |
---|
16168 | | - static void DrawPoints(CameraPane cpane) |
---|
| 16666 | + static void DrawPoints(iCameraPane cpane) |
---|
16169 | 16667 | { |
---|
16170 | 16668 | for (int i=0; i<8; i++) // first and last are red |
---|
16171 | 16669 | { |
---|