.. | .. |
---|
149 | 149 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 150 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 151 | } |
---|
| 152 | + |
---|
152 | 153 | static CameraPane theRenderer; |
---|
153 | | - |
---|
| 154 | + |
---|
154 | 155 | void SetAsGLRenderer(boolean b) |
---|
155 | 156 | { |
---|
156 | 157 | isRenderer = b; |
---|
.. | .. |
---|
192 | 193 | |
---|
193 | 194 | /// INTERFACE |
---|
194 | 195 | |
---|
| 196 | + public boolean IsBoxMode() |
---|
| 197 | + { |
---|
| 198 | + return BOXMODE; |
---|
| 199 | + } |
---|
| 200 | + |
---|
195 | 201 | public void ClearDepth() |
---|
196 | 202 | { |
---|
197 | 203 | GetGL().glClear(GetGL().GL_DEPTH_BUFFER_BIT); |
---|
.. | .. |
---|
231 | 237 | return this.ambientOcclusion; |
---|
232 | 238 | } |
---|
233 | 239 | |
---|
| 240 | + public boolean IsDebugSelection() |
---|
| 241 | + { |
---|
| 242 | + return DEBUG_SELECTION; |
---|
| 243 | + } |
---|
| 244 | + |
---|
234 | 245 | public boolean IsFrozen() |
---|
235 | 246 | { |
---|
236 | | - boolean selectmode = this.DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 247 | + boolean selectmode = this.DrawMode() == SELECTION || this.IsDebugSelection(); |
---|
237 | 248 | |
---|
238 | 249 | return !selectmode && cameracount == 0; // != 0; |
---|
239 | 250 | } |
---|
.. | .. |
---|
254 | 265 | return lightCamera; |
---|
255 | 266 | } |
---|
256 | 267 | |
---|
| 268 | + public Camera ManipCamera() |
---|
| 269 | + { |
---|
| 270 | + return manipCamera; |
---|
| 271 | + } |
---|
| 272 | + |
---|
257 | 273 | public Camera RenderCamera() |
---|
258 | 274 | { |
---|
259 | 275 | return renderCamera; |
---|
| 276 | + } |
---|
| 277 | + |
---|
| 278 | + public Camera[] Cameras() |
---|
| 279 | + { |
---|
| 280 | + return cameras; |
---|
260 | 281 | } |
---|
261 | 282 | |
---|
262 | 283 | public void PushMaterial(Object3D obj, boolean selected) |
---|
.. | .. |
---|
403 | 424 | |
---|
404 | 425 | javax.media.opengl.GL gl = display.GetGL(); |
---|
405 | 426 | |
---|
406 | | - boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 427 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
407 | 428 | |
---|
408 | 429 | //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
409 | 430 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
.. | .. |
---|
566 | 587 | } |
---|
567 | 588 | } |
---|
568 | 589 | |
---|
| 590 | + /** |
---|
| 591 | + * <code>draw</code> renders a <code>TriMesh</code> object including |
---|
| 592 | + * it's normals, colors, textures and vertices. |
---|
| 593 | + * |
---|
| 594 | + * @see Renderer#draw(TriMesh) |
---|
| 595 | + * @param tris |
---|
| 596 | + * the mesh to render. |
---|
| 597 | + */ |
---|
| 598 | + public void DrawParticles(TriMesh geo, Object3D shape, boolean selected, boolean rotate) // TriMesh tris) |
---|
| 599 | + { |
---|
| 600 | + CameraPane display = this; |
---|
| 601 | + |
---|
| 602 | + float r = display.modelParams0[0]; |
---|
| 603 | + float g = display.modelParams0[1]; |
---|
| 604 | + float b = display.modelParams0[2]; |
---|
| 605 | + float opacity = display.modelParams5[1]; |
---|
| 606 | + |
---|
| 607 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 608 | + GL gl = display.GetGL(); // getGL(); |
---|
| 609 | + |
---|
| 610 | + FloatBuffer vertBuf = geo.vertBuf; |
---|
| 611 | + |
---|
| 612 | + int v = vertBuf.capacity(); |
---|
| 613 | + |
---|
| 614 | + int count = 0; |
---|
| 615 | + |
---|
| 616 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 617 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 618 | + // gl.glScalef(1.0f/1024,1.0f/1024,1.0f/1024); |
---|
| 619 | + for (int i=0; i<v/3; i++) |
---|
| 620 | + { |
---|
| 621 | + int index3 = i*3; |
---|
| 622 | + |
---|
| 623 | + if (geo.sizeBuf.get(index3+1) == 0) |
---|
| 624 | + continue; |
---|
| 625 | + |
---|
| 626 | + count++; |
---|
| 627 | + |
---|
| 628 | + int index4 = i*4; |
---|
| 629 | + |
---|
| 630 | + float tx = vertBuf.get(index3); |
---|
| 631 | + float ty = vertBuf.get(index3+1); |
---|
| 632 | + float tz = vertBuf.get(index3+2); |
---|
| 633 | + |
---|
| 634 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 635 | + // continue; |
---|
| 636 | + |
---|
| 637 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 638 | + gl.glPushMatrix(); |
---|
| 639 | + |
---|
| 640 | + float[] texmat = geo.texmat; |
---|
| 641 | + texmat[12] = texmat[13] = texmat[14] = i; |
---|
| 642 | + |
---|
| 643 | + gl.glMultMatrixf(texmat, 0); |
---|
| 644 | + |
---|
| 645 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 646 | + gl.glPushMatrix(); |
---|
| 647 | + |
---|
| 648 | + gl.glTranslatef(tx,ty,tz); |
---|
| 649 | + |
---|
| 650 | + if (rotate) |
---|
| 651 | + gl.glRotatef(i, 0, 1, 0); |
---|
| 652 | + |
---|
| 653 | + float size = geo.sizeBuf.get(index3) / 100; |
---|
| 654 | + gl.glScalef(size,size,size); |
---|
| 655 | + |
---|
| 656 | + float cr = geo.colorBuf.get(index4); |
---|
| 657 | + float cg = geo.colorBuf.get(index4+1); |
---|
| 658 | + float cb = geo.colorBuf.get(index4+2); |
---|
| 659 | + float ca = geo.colorBuf.get(index4+3); |
---|
| 660 | + |
---|
| 661 | + display.modelParams0[0] = r * cr; |
---|
| 662 | + display.modelParams0[1] = g * cg; |
---|
| 663 | + display.modelParams0[2] = b * cb; |
---|
| 664 | + |
---|
| 665 | + display.modelParams5[1] = opacity * ca; |
---|
| 666 | + |
---|
| 667 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 668 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 669 | + |
---|
| 670 | + RandomNode.globalseed = (int)geo.sizeBuf.get(index3+2); // i; |
---|
| 671 | + RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 672 | + |
---|
| 673 | +// gl.glColor4f(cr,cg,cb,ca); |
---|
| 674 | + // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 675 | + shape.Draw/*Node*/(display,null,selected,false); // blocked |
---|
| 676 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 677 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 678 | + gl.glPopMatrix(); |
---|
| 679 | + |
---|
| 680 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 681 | + gl.glPopMatrix(); |
---|
| 682 | + } |
---|
| 683 | + // gl.glScalef(1024,1024,1024); |
---|
| 684 | + if (!cf) |
---|
| 685 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 686 | + |
---|
| 687 | + display.modelParams0[0] = r; |
---|
| 688 | + display.modelParams0[1] = g; |
---|
| 689 | + display.modelParams0[2] = b; |
---|
| 690 | + |
---|
| 691 | + display.modelParams5[1] = opacity; |
---|
| 692 | + |
---|
| 693 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 694 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 695 | + |
---|
| 696 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 697 | + |
---|
| 698 | +// System.err.println("total = " + v/3 + "; displayed = " + count); |
---|
| 699 | + if (true) |
---|
| 700 | + return; |
---|
| 701 | + |
---|
| 702 | +//// if (!tris.predraw(this)) |
---|
| 703 | +//// { |
---|
| 704 | +//// return; |
---|
| 705 | +//// } |
---|
| 706 | +//// if (Debug.stats) |
---|
| 707 | +//// { |
---|
| 708 | +//// StatCollector.addStat(StatType.STAT_TRIANGLE_COUNT, tris.getTriangleCount()); |
---|
| 709 | +//// StatCollector.addStat(StatType.STAT_VERTEX_COUNT, tris.getVertexCount()); |
---|
| 710 | +//// StatCollector.addStat(StatType.STAT_GEOM_COUNT, 1); |
---|
| 711 | +//// } |
---|
| 712 | +//// |
---|
| 713 | +//// if (tris.getDisplayListID() != -1) |
---|
| 714 | +//// { |
---|
| 715 | +//// renderDisplayList(tris); |
---|
| 716 | +//// return; |
---|
| 717 | +//// } |
---|
| 718 | +//// |
---|
| 719 | +//// if (!generatingDisplayList) |
---|
| 720 | +//// { |
---|
| 721 | +//// applyStates(tris.states, tris); |
---|
| 722 | +//// } |
---|
| 723 | +//// if (Debug.stats) |
---|
| 724 | +//// { |
---|
| 725 | +//// StatCollector.startStat(StatType.STAT_RENDER_TIMER); |
---|
| 726 | +//// } |
---|
| 727 | +//// boolean transformed = doTransforms(tris); |
---|
| 728 | +// |
---|
| 729 | +// int glMode = GL.GL_TRIANGLES; |
---|
| 730 | +// switch (getMode()) |
---|
| 731 | +// { |
---|
| 732 | +// case Triangles: |
---|
| 733 | +// glMode = GL.GL_TRIANGLES; |
---|
| 734 | +// break; |
---|
| 735 | +// case Strip: |
---|
| 736 | +// glMode = GL.GL_TRIANGLE_STRIP; |
---|
| 737 | +// break; |
---|
| 738 | +// case Fan: |
---|
| 739 | +// glMode = GL.GL_TRIANGLE_FAN; |
---|
| 740 | +// break; |
---|
| 741 | +// } |
---|
| 742 | +// |
---|
| 743 | +// if (!predrawGeometry(gl)) |
---|
| 744 | +// { |
---|
| 745 | +// // make sure only the necessary indices are sent through on old |
---|
| 746 | +// // cards. |
---|
| 747 | +// IntBuffer indices = this.getIndexBuffer(); |
---|
| 748 | +// if (indices == null) |
---|
| 749 | +// { |
---|
| 750 | +// logger.severe("missing indices on geometry object: " + this.toString()); |
---|
| 751 | +// } else |
---|
| 752 | +// { |
---|
| 753 | +// indices.rewind(); |
---|
| 754 | +// indices.limit(this.getMaxIndex()); |
---|
| 755 | +// |
---|
| 756 | +// gl.glDrawElements(glMode, indices.limit(), GL.GL_UNSIGNED_INT, indices); // TODO Check <count> and assumed <type> of GL_UNSIGNED_INT |
---|
| 757 | +// |
---|
| 758 | +// indices.clear(); |
---|
| 759 | +// } |
---|
| 760 | +// } else |
---|
| 761 | +// { |
---|
| 762 | +// gl.glDrawElements(glMode, this.getIndexBuffer().limit(), |
---|
| 763 | +// GL.GL_UNSIGNED_INT, 0); |
---|
| 764 | +// } |
---|
| 765 | +// |
---|
| 766 | +//// postdrawGeometry(tris); |
---|
| 767 | +//// if (transformed) |
---|
| 768 | +//// { |
---|
| 769 | +//// undoTransforms(tris); |
---|
| 770 | +//// } |
---|
| 771 | +//// |
---|
| 772 | +//// if (Debug.stats) |
---|
| 773 | +//// { |
---|
| 774 | +//// StatCollector.endStat(StatType.STAT_RENDER_TIMER); |
---|
| 775 | +//// } |
---|
| 776 | +//// tris.postdraw(this); |
---|
| 777 | + } |
---|
| 778 | + |
---|
| 779 | + static Camera localcamera = new Camera(); |
---|
| 780 | + static cVector from = new cVector(); |
---|
| 781 | + static cVector to = new cVector(); |
---|
| 782 | + |
---|
| 783 | + public void PrepOcclusion(BoundaryRep br, double[][] transform) |
---|
| 784 | + { |
---|
| 785 | + CameraPane cp = this; |
---|
| 786 | + |
---|
| 787 | + Camera keep = cp.RenderCamera(); |
---|
| 788 | + cp.renderCamera = localcamera; |
---|
| 789 | + |
---|
| 790 | + if (br.trimmed) |
---|
| 791 | + { |
---|
| 792 | + float[] colors = new float[br.positions.length / 3]; |
---|
| 793 | + |
---|
| 794 | + int i3 = 0; |
---|
| 795 | + for (int i = 0; i < br.positions.length / 3; i++, i3 += 3) |
---|
| 796 | + { |
---|
| 797 | + if (br.normals[i3] == 0 && br.normals[i3+1] == 0 && br.normals[i3+2] == 0) |
---|
| 798 | + continue; |
---|
| 799 | + |
---|
| 800 | + from.set(br.positions[i3], br.positions[i3 + 1], br.positions[i3 + 2]); |
---|
| 801 | + to.set(br.positions[i3] + br.normals[i3], |
---|
| 802 | + br.positions[i3 + 1] + br.normals[i3 + 1], |
---|
| 803 | + br.positions[i3 + 2] + br.normals[i3 + 2]); |
---|
| 804 | + LA.xformPos(from, transform, from); |
---|
| 805 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 806 | + localcamera.setAim(from, to); |
---|
| 807 | + |
---|
| 808 | + CameraPane.occlusionbuffer.display(); |
---|
| 809 | + |
---|
| 810 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 811 | + cp.display(); // debug |
---|
| 812 | + |
---|
| 813 | + colors[i] = cp.vertexOcclusion.r; |
---|
| 814 | + //colors[i3 + 1] = cp.vertexOcclusion.g; |
---|
| 815 | + //colors[i3 + 2] = cp.vertexOcclusion.b; |
---|
| 816 | + |
---|
| 817 | + if ((i % 100) == 0 && i != 0) |
---|
| 818 | + { |
---|
| 819 | + CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 820 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 821 | + System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")"); |
---|
| 822 | + } |
---|
| 823 | + } |
---|
| 824 | + |
---|
| 825 | + br.colors = colors; |
---|
| 826 | + } |
---|
| 827 | + else |
---|
| 828 | + { |
---|
| 829 | + for (int i = 0; i < br.VertexCount(); i++) |
---|
| 830 | + { |
---|
| 831 | + Vertex v = br.GetVertex(i); |
---|
| 832 | + |
---|
| 833 | + if (v.norm == null || v.norm.x == 0 && v.norm.y == 0 && v.norm.z == 0) |
---|
| 834 | + continue; |
---|
| 835 | + |
---|
| 836 | + from.set(v.x, v.y, v.z); |
---|
| 837 | + to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z); |
---|
| 838 | + LA.xformPos(from, transform, from); |
---|
| 839 | + LA.xformPos(to, transform, to); // RIGID ONLY |
---|
| 840 | + localcamera.setAim(from, to); |
---|
| 841 | + |
---|
| 842 | + CameraPane.occlusionbuffer.display(); |
---|
| 843 | + |
---|
| 844 | + if (CameraPane.DEBUG_OCCLUSION) |
---|
| 845 | + cp.display(); // debug |
---|
| 846 | + |
---|
| 847 | + v.AO = cp.vertexOcclusion.r; |
---|
| 848 | + |
---|
| 849 | + if ((i % 100) == 0 && i != 0) |
---|
| 850 | + { |
---|
| 851 | + CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); |
---|
| 852 | + //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done"); |
---|
| 853 | + System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")"); |
---|
| 854 | + } |
---|
| 855 | + } |
---|
| 856 | + } |
---|
| 857 | + |
---|
| 858 | + //System.out.println("done."); |
---|
| 859 | + |
---|
| 860 | + cp.renderCamera = keep; |
---|
| 861 | + } |
---|
| 862 | + |
---|
| 863 | + void DrawPointFLow(PointFlow pointFlow, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 864 | + { |
---|
| 865 | + CameraPane display = this; |
---|
| 866 | + pointFlow.CreateHT(); |
---|
| 867 | + |
---|
| 868 | + float r = display.modelParams0[0]; |
---|
| 869 | + float g = display.modelParams0[1]; |
---|
| 870 | + float b = display.modelParams0[2]; |
---|
| 871 | + float opacity = display.modelParams5[1]; |
---|
| 872 | + |
---|
| 873 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 874 | + GL gl = display.GetGL(); // getGL(); |
---|
| 875 | + |
---|
| 876 | + int s = pointFlow.points.size(); |
---|
| 877 | + |
---|
| 878 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 879 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 880 | + |
---|
| 881 | + for (int i=s; --i>=0;) |
---|
| 882 | + //for (int i=0; i<s; i++) |
---|
| 883 | + { |
---|
| 884 | + cVector v = pointFlow.points.get(i); |
---|
| 885 | + |
---|
| 886 | + double mindist = Double.MAX_VALUE; |
---|
| 887 | + |
---|
| 888 | + double size = pointFlow.minimumSize; |
---|
| 889 | + |
---|
| 890 | + double distancenext = 0; |
---|
| 891 | + |
---|
| 892 | + if (i > 0) |
---|
| 893 | + { |
---|
| 894 | + cVector w = pointFlow.points.get(i-1); |
---|
| 895 | + |
---|
| 896 | + double dist = w.distance(v); |
---|
| 897 | + |
---|
| 898 | + distancenext = dist; |
---|
| 899 | + |
---|
| 900 | + if (mindist > dist) |
---|
| 901 | + { |
---|
| 902 | + mindist = dist; |
---|
| 903 | + size = mindist*pointFlow.resizefactor; |
---|
| 904 | + } |
---|
| 905 | + } |
---|
| 906 | + |
---|
| 907 | + if (i < s-1) |
---|
| 908 | + { |
---|
| 909 | + cVector w = pointFlow.points.get(i+1); |
---|
| 910 | + |
---|
| 911 | + double dist = w.distance(v); |
---|
| 912 | + |
---|
| 913 | + if (mindist > dist) |
---|
| 914 | + { |
---|
| 915 | + mindist = dist; |
---|
| 916 | + size = mindist*pointFlow.resizefactor; |
---|
| 917 | + } |
---|
| 918 | + } |
---|
| 919 | + |
---|
| 920 | + if (size < pointFlow.minimumSize) |
---|
| 921 | + size = pointFlow.minimumSize; |
---|
| 922 | + if (size > pointFlow.maximumSize) |
---|
| 923 | + size = pointFlow.maximumSize; |
---|
| 924 | + |
---|
| 925 | + double tx = v.x; |
---|
| 926 | + double ty = v.y; |
---|
| 927 | + double tz = v.z; |
---|
| 928 | + |
---|
| 929 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 930 | + // continue; |
---|
| 931 | + |
---|
| 932 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 933 | + gl.glPushMatrix(); |
---|
| 934 | + pointFlow.texmat[12] = pointFlow.texmat[13] = pointFlow.texmat[14] = i; |
---|
| 935 | + |
---|
| 936 | + gl.glMultMatrixf(pointFlow.texmat, 0); |
---|
| 937 | + |
---|
| 938 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 939 | + gl.glPushMatrix(); |
---|
| 940 | + |
---|
| 941 | + gl.glTranslated(tx,ty,tz); |
---|
| 942 | + |
---|
| 943 | + gl.glScaled(size,size,size); |
---|
| 944 | + |
---|
| 945 | +// float cr = colorBuf.get(index4); |
---|
| 946 | +// float cg = colorBuf.get(index4+1); |
---|
| 947 | +// float cb = colorBuf.get(index4+2); |
---|
| 948 | +// float ca = colorBuf.get(index4+3); |
---|
| 949 | +// |
---|
| 950 | +// display.modelParams0[0] = r * cr; |
---|
| 951 | +// display.modelParams0[1] = g * cg; |
---|
| 952 | +// display.modelParams0[2] = b * cb; |
---|
| 953 | +// |
---|
| 954 | +// display.modelParams5[1] = opacity * ca; |
---|
| 955 | +// |
---|
| 956 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 957 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 958 | +// |
---|
| 959 | +// RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i; |
---|
| 960 | +// RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 961 | +// |
---|
| 962 | +//// gl.glColor4f(cr,cg,cb,ca); |
---|
| 963 | +// // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 964 | + pointFlow.geo.Draw/*Node*/(display,null,selected, blocked); |
---|
| 965 | + |
---|
| 966 | + gl.glPopMatrix(); |
---|
| 967 | + |
---|
| 968 | + double step = size/4; // |
---|
| 969 | + |
---|
| 970 | + if (i == 0 || size == 0 || distancenext > 8*size || distancenext < step) |
---|
| 971 | + continue; |
---|
| 972 | + |
---|
| 973 | + int nbsteps = (int)(distancenext/step); |
---|
| 974 | + |
---|
| 975 | + step = distancenext/nbsteps; |
---|
| 976 | + |
---|
| 977 | + cVector next = pointFlow.points.get(i-1); |
---|
| 978 | + |
---|
| 979 | + tmp.set(next); |
---|
| 980 | + tmp.sub(v); |
---|
| 981 | + tmp.normalize(); |
---|
| 982 | + tmp.mul(step); |
---|
| 983 | + |
---|
| 984 | + // calculate next size |
---|
| 985 | + mindist = Double.MAX_VALUE; |
---|
| 986 | + |
---|
| 987 | + double nextsize = pointFlow.minimumSize; |
---|
| 988 | + |
---|
| 989 | + if (i > 1) |
---|
| 990 | + { |
---|
| 991 | + cVector w = pointFlow.points.get(i-2); |
---|
| 992 | + |
---|
| 993 | + double dist = w.distance(next); |
---|
| 994 | + |
---|
| 995 | + if (mindist > dist) |
---|
| 996 | + { |
---|
| 997 | + mindist = dist; |
---|
| 998 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 999 | + } |
---|
| 1000 | + } |
---|
| 1001 | + |
---|
| 1002 | + double dist = v.distance(next); |
---|
| 1003 | + |
---|
| 1004 | + if (mindist > dist) |
---|
| 1005 | + { |
---|
| 1006 | + mindist = dist; |
---|
| 1007 | + nextsize = mindist*pointFlow.resizefactor; |
---|
| 1008 | + } |
---|
| 1009 | + |
---|
| 1010 | + if (nextsize < pointFlow.minimumSize) |
---|
| 1011 | + nextsize = pointFlow.minimumSize; |
---|
| 1012 | + if (nextsize > pointFlow.maximumSize) |
---|
| 1013 | + nextsize = pointFlow.maximumSize; |
---|
| 1014 | + // |
---|
| 1015 | + |
---|
| 1016 | + double count = 0; |
---|
| 1017 | + |
---|
| 1018 | + while (distancenext > 0.000000001) // step |
---|
| 1019 | + { |
---|
| 1020 | + gl.glPushMatrix(); |
---|
| 1021 | + |
---|
| 1022 | + gl.glTranslated(tx + tmp.x*count, ty + tmp.y*count, tz + tmp.z*count); |
---|
| 1023 | + |
---|
| 1024 | + double K = count/nbsteps; |
---|
| 1025 | + |
---|
| 1026 | + double intersize = K*nextsize + (1-K)*size; |
---|
| 1027 | + |
---|
| 1028 | + gl.glScaled(intersize,intersize,intersize); |
---|
| 1029 | + |
---|
| 1030 | + pointFlow.geo.Draw/*Node*/(display,null,selected,blocked); |
---|
| 1031 | + |
---|
| 1032 | + count++; |
---|
| 1033 | + |
---|
| 1034 | + distancenext -= step; |
---|
| 1035 | + |
---|
| 1036 | + gl.glPopMatrix(); |
---|
| 1037 | + } |
---|
| 1038 | + |
---|
| 1039 | + if (count != nbsteps) |
---|
| 1040 | + assert(count == nbsteps); |
---|
| 1041 | + |
---|
| 1042 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 1043 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 1044 | + |
---|
| 1045 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 1046 | + gl.glPopMatrix(); |
---|
| 1047 | + } |
---|
| 1048 | + |
---|
| 1049 | + if (!cf) |
---|
| 1050 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 1051 | + |
---|
| 1052 | +// display.modelParams0[0] = r; |
---|
| 1053 | +// display.modelParams0[1] = g; |
---|
| 1054 | +// display.modelParams0[2] = b; |
---|
| 1055 | +// |
---|
| 1056 | +// display.modelParams5[1] = opacity; |
---|
| 1057 | +// |
---|
| 1058 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 1059 | +// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 1060 | + |
---|
| 1061 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 1062 | + } |
---|
| 1063 | + |
---|
569 | 1064 | /// INTERFACE |
---|
570 | 1065 | |
---|
571 | 1066 | void SetColor(Object3D obj, Vertex p0) |
---|
.. | .. |
---|
10146 | 10641 | fragmentMode |= (lightslot - 64) << 2; // 1; // first bit is available for aniso |
---|
10147 | 10642 | //System.out.println("fragmentMode = " + fragmentMode); |
---|
10148 | 10643 | |
---|
10149 | | - if (DrawMode() == DEFAULT || DrawMode() == SELECTION || DEBUG_SELECTION) |
---|
| 10644 | + if (DrawMode() == DEFAULT || DrawMode() == SELECTION || IsDebugSelection()) |
---|
10150 | 10645 | { |
---|
10151 | 10646 | /* |
---|
10152 | 10647 | if (CULLFACE || (ambientOcclusion && OCCLUSION_CULLING)) |
---|
.. | .. |
---|
10447 | 10942 | callist = gl.glGenLists(1); |
---|
10448 | 10943 | } |
---|
10449 | 10944 | |
---|
10450 | | - boolean selectmode = DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 10945 | + boolean selectmode = DrawMode() == SELECTION || IsDebugSelection(); |
---|
10451 | 10946 | |
---|
10452 | 10947 | boolean active = !selectmode; // DrawMode() != SELECTION; // mouseDown; |
---|
10453 | 10948 | |
---|
.. | .. |
---|
12921 | 13416 | cVector tmp = new cVector(); |
---|
12922 | 13417 | cVector tmp2 = new cVector(); |
---|
12923 | 13418 | boolean isMoving; |
---|
| 13419 | + |
---|
| 13420 | + public cVector TargetLookAt() |
---|
| 13421 | + { |
---|
| 13422 | + return targetLookAt; |
---|
| 13423 | + } |
---|
12924 | 13424 | |
---|
12925 | 13425 | class PingThread extends Thread |
---|
12926 | 13426 | { |
---|
.. | .. |
---|
15772 | 16272 | |
---|
15773 | 16273 | class AntialiasBuffer implements GLEventListener |
---|
15774 | 16274 | { |
---|
15775 | | - |
---|
15776 | 16275 | CameraPane parent = null; |
---|
15777 | 16276 | |
---|
15778 | 16277 | AntialiasBuffer(CameraPane p) |
---|
.. | .. |
---|
16165 | 16664 | } |
---|
16166 | 16665 | } |
---|
16167 | 16666 | |
---|
16168 | | - static void DrawPoints(CameraPane cpane) |
---|
| 16667 | + static void DrawPoints(iCameraPane cpane) |
---|
16169 | 16668 | { |
---|
16170 | 16669 | for (int i=0; i<8; i++) // first and last are red |
---|
16171 | 16670 | { |
---|