.. | .. |
---|
192 | 192 | |
---|
193 | 193 | /// INTERFACE |
---|
194 | 194 | |
---|
| 195 | + public boolean IsBoxMode() |
---|
| 196 | + { |
---|
| 197 | + return BOXMODE; |
---|
| 198 | + } |
---|
| 199 | + |
---|
195 | 200 | public void ClearDepth() |
---|
196 | 201 | { |
---|
197 | 202 | GetGL().glClear(GetGL().GL_DEPTH_BUFFER_BIT); |
---|
.. | .. |
---|
566 | 571 | } |
---|
567 | 572 | } |
---|
568 | 573 | |
---|
| 574 | + /** |
---|
| 575 | + * <code>draw</code> renders a <code>TriMesh</code> object including |
---|
| 576 | + * it's normals, colors, textures and vertices. |
---|
| 577 | + * |
---|
| 578 | + * @see Renderer#draw(TriMesh) |
---|
| 579 | + * @param tris |
---|
| 580 | + * the mesh to render. |
---|
| 581 | + */ |
---|
| 582 | + public void DrawParticles(TriMesh geo, Object3D shape, boolean selected, boolean rotate) // TriMesh tris) |
---|
| 583 | + { |
---|
| 584 | + CameraPane display = this; |
---|
| 585 | + |
---|
| 586 | + float r = display.modelParams0[0]; |
---|
| 587 | + float g = display.modelParams0[1]; |
---|
| 588 | + float b = display.modelParams0[2]; |
---|
| 589 | + float opacity = display.modelParams5[1]; |
---|
| 590 | + |
---|
| 591 | + //final GL gl = GLU.getCurrentGL(); |
---|
| 592 | + GL gl = display.GetGL(); // getGL(); |
---|
| 593 | + |
---|
| 594 | + FloatBuffer vertBuf = geo.vertBuf; |
---|
| 595 | + |
---|
| 596 | + int v = vertBuf.capacity(); |
---|
| 597 | + |
---|
| 598 | + int count = 0; |
---|
| 599 | + |
---|
| 600 | + boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
| 601 | + gl.glEnable(gl.GL_CULL_FACE); |
---|
| 602 | + // gl.glScalef(1.0f/1024,1.0f/1024,1.0f/1024); |
---|
| 603 | + for (int i=0; i<v/3; i++) |
---|
| 604 | + { |
---|
| 605 | + int index3 = i*3; |
---|
| 606 | + |
---|
| 607 | + if (geo.sizeBuf.get(index3+1) == 0) |
---|
| 608 | + continue; |
---|
| 609 | + |
---|
| 610 | + count++; |
---|
| 611 | + |
---|
| 612 | + int index4 = i*4; |
---|
| 613 | + |
---|
| 614 | + float tx = vertBuf.get(index3); |
---|
| 615 | + float ty = vertBuf.get(index3+1); |
---|
| 616 | + float tz = vertBuf.get(index3+2); |
---|
| 617 | + |
---|
| 618 | + // if (tx == 0 && ty == 0 && tz == 0) |
---|
| 619 | + // continue; |
---|
| 620 | + |
---|
| 621 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 622 | + gl.glPushMatrix(); |
---|
| 623 | + |
---|
| 624 | + float[] texmat = geo.texmat; |
---|
| 625 | + texmat[12] = texmat[13] = texmat[14] = i; |
---|
| 626 | + |
---|
| 627 | + gl.glMultMatrixf(texmat, 0); |
---|
| 628 | + |
---|
| 629 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 630 | + gl.glPushMatrix(); |
---|
| 631 | + |
---|
| 632 | + gl.glTranslatef(tx,ty,tz); |
---|
| 633 | + |
---|
| 634 | + if (rotate) |
---|
| 635 | + gl.glRotatef(i, 0, 1, 0); |
---|
| 636 | + |
---|
| 637 | + float size = geo.sizeBuf.get(index3) / 100; |
---|
| 638 | + gl.glScalef(size,size,size); |
---|
| 639 | + |
---|
| 640 | + float cr = geo.colorBuf.get(index4); |
---|
| 641 | + float cg = geo.colorBuf.get(index4+1); |
---|
| 642 | + float cb = geo.colorBuf.get(index4+2); |
---|
| 643 | + float ca = geo.colorBuf.get(index4+3); |
---|
| 644 | + |
---|
| 645 | + display.modelParams0[0] = r * cr; |
---|
| 646 | + display.modelParams0[1] = g * cg; |
---|
| 647 | + display.modelParams0[2] = b * cb; |
---|
| 648 | + |
---|
| 649 | + display.modelParams5[1] = opacity * ca; |
---|
| 650 | + |
---|
| 651 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 652 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 653 | + |
---|
| 654 | + RandomNode.globalseed = (int)geo.sizeBuf.get(index3+2); // i; |
---|
| 655 | + RandomNode.globalseed2 = RandomNode.globalseed; |
---|
| 656 | + |
---|
| 657 | +// gl.glColor4f(cr,cg,cb,ca); |
---|
| 658 | + // gl.glScalef(1024/16,1024/16,1024/16); |
---|
| 659 | + shape.Draw/*Node*/(display,null,selected,false); // blocked |
---|
| 660 | + // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
| 661 | + //gl.glTranslatef(-tx,-ty,-tz); |
---|
| 662 | + gl.glPopMatrix(); |
---|
| 663 | + |
---|
| 664 | + gl.glMatrixMode(gl.GL_TEXTURE); |
---|
| 665 | + gl.glPopMatrix(); |
---|
| 666 | + } |
---|
| 667 | + // gl.glScalef(1024,1024,1024); |
---|
| 668 | + if (!cf) |
---|
| 669 | + gl.glDisable(gl.GL_CULL_FACE); |
---|
| 670 | + |
---|
| 671 | + display.modelParams0[0] = r; |
---|
| 672 | + display.modelParams0[1] = g; |
---|
| 673 | + display.modelParams0[2] = b; |
---|
| 674 | + |
---|
| 675 | + display.modelParams5[1] = opacity; |
---|
| 676 | + |
---|
| 677 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
| 678 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
| 679 | + |
---|
| 680 | + gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
| 681 | + |
---|
| 682 | +// System.err.println("total = " + v/3 + "; displayed = " + count); |
---|
| 683 | + if (true) |
---|
| 684 | + return; |
---|
| 685 | + |
---|
| 686 | +//// if (!tris.predraw(this)) |
---|
| 687 | +//// { |
---|
| 688 | +//// return; |
---|
| 689 | +//// } |
---|
| 690 | +//// if (Debug.stats) |
---|
| 691 | +//// { |
---|
| 692 | +//// StatCollector.addStat(StatType.STAT_TRIANGLE_COUNT, tris.getTriangleCount()); |
---|
| 693 | +//// StatCollector.addStat(StatType.STAT_VERTEX_COUNT, tris.getVertexCount()); |
---|
| 694 | +//// StatCollector.addStat(StatType.STAT_GEOM_COUNT, 1); |
---|
| 695 | +//// } |
---|
| 696 | +//// |
---|
| 697 | +//// if (tris.getDisplayListID() != -1) |
---|
| 698 | +//// { |
---|
| 699 | +//// renderDisplayList(tris); |
---|
| 700 | +//// return; |
---|
| 701 | +//// } |
---|
| 702 | +//// |
---|
| 703 | +//// if (!generatingDisplayList) |
---|
| 704 | +//// { |
---|
| 705 | +//// applyStates(tris.states, tris); |
---|
| 706 | +//// } |
---|
| 707 | +//// if (Debug.stats) |
---|
| 708 | +//// { |
---|
| 709 | +//// StatCollector.startStat(StatType.STAT_RENDER_TIMER); |
---|
| 710 | +//// } |
---|
| 711 | +//// boolean transformed = doTransforms(tris); |
---|
| 712 | +// |
---|
| 713 | +// int glMode = GL.GL_TRIANGLES; |
---|
| 714 | +// switch (getMode()) |
---|
| 715 | +// { |
---|
| 716 | +// case Triangles: |
---|
| 717 | +// glMode = GL.GL_TRIANGLES; |
---|
| 718 | +// break; |
---|
| 719 | +// case Strip: |
---|
| 720 | +// glMode = GL.GL_TRIANGLE_STRIP; |
---|
| 721 | +// break; |
---|
| 722 | +// case Fan: |
---|
| 723 | +// glMode = GL.GL_TRIANGLE_FAN; |
---|
| 724 | +// break; |
---|
| 725 | +// } |
---|
| 726 | +// |
---|
| 727 | +// if (!predrawGeometry(gl)) |
---|
| 728 | +// { |
---|
| 729 | +// // make sure only the necessary indices are sent through on old |
---|
| 730 | +// // cards. |
---|
| 731 | +// IntBuffer indices = this.getIndexBuffer(); |
---|
| 732 | +// if (indices == null) |
---|
| 733 | +// { |
---|
| 734 | +// logger.severe("missing indices on geometry object: " + this.toString()); |
---|
| 735 | +// } else |
---|
| 736 | +// { |
---|
| 737 | +// indices.rewind(); |
---|
| 738 | +// indices.limit(this.getMaxIndex()); |
---|
| 739 | +// |
---|
| 740 | +// gl.glDrawElements(glMode, indices.limit(), GL.GL_UNSIGNED_INT, indices); // TODO Check <count> and assumed <type> of GL_UNSIGNED_INT |
---|
| 741 | +// |
---|
| 742 | +// indices.clear(); |
---|
| 743 | +// } |
---|
| 744 | +// } else |
---|
| 745 | +// { |
---|
| 746 | +// gl.glDrawElements(glMode, this.getIndexBuffer().limit(), |
---|
| 747 | +// GL.GL_UNSIGNED_INT, 0); |
---|
| 748 | +// } |
---|
| 749 | +// |
---|
| 750 | +//// postdrawGeometry(tris); |
---|
| 751 | +//// if (transformed) |
---|
| 752 | +//// { |
---|
| 753 | +//// undoTransforms(tris); |
---|
| 754 | +//// } |
---|
| 755 | +//// |
---|
| 756 | +//// if (Debug.stats) |
---|
| 757 | +//// { |
---|
| 758 | +//// StatCollector.endStat(StatType.STAT_RENDER_TIMER); |
---|
| 759 | +//// } |
---|
| 760 | +//// tris.postdraw(this); |
---|
| 761 | + } |
---|
| 762 | + |
---|
569 | 763 | /// INTERFACE |
---|
570 | 764 | |
---|
571 | 765 | void SetColor(Object3D obj, Vertex p0) |
---|
.. | .. |
---|
16 | 16 | frame = 0; |
---|
17 | 17 | } |
---|
18 | 18 | |
---|
19 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 19 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
20 | 20 | { |
---|
21 | 21 | while (realframe == 0) |
---|
22 | 22 | { |
---|
.. | .. |
---|
136 | 136 | } |
---|
137 | 137 | private static float[] glMat = new float[16]; |
---|
138 | 138 | |
---|
139 | | - static public void drawOpenGL(CameraPane display, Transform trans, CollisionShape shape, Vector3f color, int debugMode) { |
---|
| 139 | + static public void drawOpenGL(iCameraPane display, Transform trans, CollisionShape shape, Vector3f color, int debugMode) { |
---|
140 | 140 | ObjectPool<Transform> transformsPool = ObjectPool.get(Transform.class); |
---|
141 | 141 | ObjectPool<Vector3f> vectorsPool = ObjectPool.get(Vector3f.class); |
---|
142 | 142 | |
---|
143 | 143 | //System.out.println("shape="+shape+" type="+BroadphaseNativeTypes.forValue(shape.getShapeType())); |
---|
144 | 144 | |
---|
145 | | - GL gl = display.getGL(); |
---|
| 145 | + GL gl = display.GetGL(); |
---|
146 | 146 | |
---|
147 | 147 | gl.glPushMatrix(); |
---|
148 | 148 | trans.getOpenGLMatrix(glMat); |
---|
.. | .. |
---|
550 | 550 | private static Map<SphereKey, Integer> sphereDisplayLists = new HashMap<SphereKey, Integer>(); |
---|
551 | 551 | private static SphereKey sphereKey = new SphereKey(); |
---|
552 | 552 | |
---|
553 | | - static public void drawSphere(CameraPane display, float radius, int slices, int stacks) |
---|
| 553 | + static public void drawSphere(iCameraPane display, float radius, int slices, int stacks) |
---|
554 | 554 | { |
---|
555 | | - GL gl = display.getGL(); |
---|
| 555 | + GL gl = display.GetGL(); |
---|
556 | 556 | |
---|
557 | 557 | sphereKey.radius = radius; |
---|
558 | 558 | Integer glList = sphereDisplayLists.get(sphereKey); |
---|
.. | .. |
---|
622 | 622 | private static Map<CylinderKey, Integer> cylinderDisplayLists = new HashMap<CylinderKey, Integer>(); |
---|
623 | 623 | private static CylinderKey cylinderKey = new CylinderKey(); |
---|
624 | 624 | |
---|
625 | | - static public void drawCylinder(CameraPane display, float radius, float halfHeight, int upAxis) |
---|
| 625 | + static public void drawCylinder(iCameraPane display, float radius, float halfHeight, int upAxis) |
---|
626 | 626 | { |
---|
627 | | - GL gl = display.getGL(); |
---|
| 627 | + GL gl = display.GetGL(); |
---|
628 | 628 | |
---|
629 | 629 | gl.glPushMatrix(); |
---|
630 | 630 | switch (upAxis) |
---|
.. | .. |
---|
314 | 314 | bRep = null; |
---|
315 | 315 | } |
---|
316 | 316 | |
---|
317 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
| 317 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
318 | 318 | { |
---|
319 | 319 | // super.DrawNode(display,root,selected); |
---|
320 | 320 | |
---|
.. | .. |
---|
451 | 451 | int startvertex; |
---|
452 | 452 | int currentobject; |
---|
453 | 453 | |
---|
454 | | - public void renderme(CameraPane display) |
---|
| 454 | + public void renderme(iCameraPane display) |
---|
455 | 455 | { |
---|
456 | | - GL gl = display!=null?display.getGL():null; |
---|
| 456 | + GL gl = display!=null?display.GetGL():null; |
---|
457 | 457 | |
---|
458 | 458 | // gl0 = gl; |
---|
459 | 459 | if (GetDynamicsWorld() != null) |
---|
.. | .. |
---|
796 | 796 | } |
---|
797 | 797 | } |
---|
798 | 798 | |
---|
799 | | - public void drawCube(CameraPane display, float extent) |
---|
| 799 | + public void drawCube(iCameraPane display, float extent) |
---|
800 | 800 | { |
---|
801 | | - GL gl = display.getGL(); |
---|
| 801 | + GL gl = display.GetGL(); |
---|
802 | 802 | |
---|
803 | 803 | extent = extent * 0.5f; |
---|
804 | 804 | |
---|
.. | .. |
---|
838 | 838 | |
---|
839 | 839 | private /*static*/ float[] glMat = new float[16]; |
---|
840 | 840 | |
---|
841 | | - public void drawOpenGL(CameraPane display, Transform trans, CollisionShape shape, Vector3f color, int debugMode) |
---|
| 841 | + public void drawOpenGL(iCameraPane display, Transform trans, CollisionShape shape, Vector3f color, int debugMode) |
---|
842 | 842 | { |
---|
843 | 843 | GL gl = null; // display.getGL(); |
---|
844 | 844 | |
---|
.. | .. |
---|
1522 | 1522 | private static Map<SphereKey, Integer> sphereDisplayLists = new HashMap<SphereKey, Integer>(); |
---|
1523 | 1523 | private static SphereKey sphereKey = new SphereKey(); |
---|
1524 | 1524 | |
---|
1525 | | - public void drawSphere(CameraPane display, float radius, int slices, int stacks) |
---|
| 1525 | + public void drawSphere(iCameraPane display, float radius, int slices, int stacks) |
---|
1526 | 1526 | { |
---|
1527 | | - GL gl = display.getGL(); |
---|
| 1527 | + GL gl = display.GetGL(); |
---|
1528 | 1528 | |
---|
1529 | 1529 | sphereKey.radius = radius; |
---|
1530 | 1530 | Integer glList = sphereDisplayLists.get(sphereKey); |
---|
.. | .. |
---|
1594 | 1594 | private static Map<CylinderKey, Integer> cylinderDisplayLists = new HashMap<CylinderKey, Integer>(); |
---|
1595 | 1595 | private static CylinderKey cylinderKey = new CylinderKey(); |
---|
1596 | 1596 | |
---|
1597 | | - public void drawCylinder(CameraPane display, float radius, float halfHeight, int upAxis) |
---|
| 1597 | + public void drawCylinder(iCameraPane display, float radius, float halfHeight, int upAxis) |
---|
1598 | 1598 | { |
---|
1599 | | - GL gl = display.getGL(); |
---|
| 1599 | + GL gl = display.GetGL(); |
---|
1600 | 1600 | |
---|
1601 | 1601 | gl.glPushMatrix(); |
---|
1602 | 1602 | switch (upAxis) |
---|
.. | .. |
---|
75 | 75 | { |
---|
76 | 76 | static final long serialVersionUID = 0; |
---|
77 | 77 | |
---|
78 | | - abstract void DrawParticles(CameraPane display, Object3D geo, boolean selected, boolean rotate); |
---|
| 78 | + abstract void DrawParticles(iCameraPane display, Object3D geo, boolean selected, boolean rotate); |
---|
79 | 79 | |
---|
80 | 80 | private static final Logger logger = Logger.getLogger(Geometry.class.getName()); |
---|
81 | 81 | // private static final long serialVersionUID = 1; |
---|
.. | .. |
---|
135 | 135 | |
---|
136 | 136 | // ObjectArrayList<Transform> initialmatrices; |
---|
137 | 137 | |
---|
138 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
| 138 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
139 | 139 | { |
---|
140 | 140 | //if (support == null) |
---|
141 | 141 | // System.err.println("DrawNode Merge # " + ((Mocap)object).frame); |
---|
.. | .. |
---|
42 | 42 | morphobject.count = 1; // hide |
---|
43 | 43 | } |
---|
44 | 44 | |
---|
45 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 45 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
46 | 46 | { |
---|
47 | 47 | //System.err.println("Frame # " + frame); |
---|
48 | 48 | |
---|
.. | .. |
---|
344 | 344 | } |
---|
345 | 345 | } |
---|
346 | 346 | |
---|
347 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
| 347 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
348 | 348 | { |
---|
349 | | - if (display.DrawMode() == display.SELECTION || display.BOXMODE) |
---|
| 349 | + if (display.DrawMode() == display.SELECTION || display.IsBoxMode()) |
---|
350 | 350 | return; // hum... |
---|
351 | 351 | |
---|
352 | 352 | Object3D geo = test; |
---|
.. | .. |
---|
108 | 108 | |
---|
109 | 109 | float totalms = 0; |
---|
110 | 110 | |
---|
111 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 111 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
112 | 112 | { |
---|
113 | 113 | if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK |
---|
114 | 114 | { |
---|
.. | .. |
---|
1785 | 1785 | return live; |
---|
1786 | 1786 | } |
---|
1787 | 1787 | |
---|
1788 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 1788 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
1789 | 1789 | { |
---|
1790 | 1790 | if (CameraPane.ABORTED) |
---|
1791 | 1791 | { |
---|
.. | .. |
---|
46 | 46 | |
---|
47 | 47 | transient boolean toggleneutral; |
---|
48 | 48 | |
---|
49 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 49 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
50 | 50 | { |
---|
51 | 51 | //System.err.println("Frame # " + frame); |
---|
52 | 52 | |
---|
.. | .. |
---|
70 | 70 | */ |
---|
71 | 71 | public class TriMesh extends Geometry implements Serializable |
---|
72 | 72 | { |
---|
| 73 | + /** |
---|
| 74 | + * <code>draw</code> renders a <code>TriMesh</code> object including |
---|
| 75 | + * it's normals, colors, textures and vertices. |
---|
| 76 | + * |
---|
| 77 | + * @see Renderer#draw(TriMesh) |
---|
| 78 | + * @param tris |
---|
| 79 | + * the mesh to render. |
---|
| 80 | + */ |
---|
| 81 | + void DrawParticles(iCameraPane display, Object3D geo, boolean selected, boolean rotate) // TriMesh tris) |
---|
| 82 | + { |
---|
| 83 | + display.DrawParticles(this, geo, selected, rotate); |
---|
| 84 | + } |
---|
| 85 | + |
---|
73 | 86 | static final long serialVersionUID = 0; |
---|
74 | 87 | |
---|
75 | 88 | boolean IsStatic() |
---|
76 | 89 | { |
---|
77 | 90 | return false; |
---|
78 | 91 | } |
---|
| 92 | + |
---|
79 | 93 | private static final Logger logger = Logger.getLogger(TriMesh.class.getName()); |
---|
| 94 | + |
---|
80 | 95 | // private static final long serialVersionUID = 2L; |
---|
81 | 96 | public enum Mode |
---|
82 | 97 | { |
---|
.. | .. |
---|
270 | 285 | |
---|
271 | 286 | float[] texmat = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 }; |
---|
272 | 287 | |
---|
273 | | - // super.DrawNode(...); |
---|
274 | | - /** |
---|
275 | | - * <code>draw</code> renders a <code>TriMesh</code> object including |
---|
276 | | - * it's normals, colors, textures and vertices. |
---|
277 | | - * |
---|
278 | | - * @see Renderer#draw(TriMesh) |
---|
279 | | - * @param tris |
---|
280 | | - * the mesh to render. |
---|
281 | | - */ |
---|
282 | | - void DrawParticles(CameraPane display, Object3D geo, boolean selected, boolean rotate) // TriMesh tris) |
---|
283 | | - { |
---|
284 | | - float r = display.modelParams0[0]; |
---|
285 | | - float g = display.modelParams0[1]; |
---|
286 | | - float b = display.modelParams0[2]; |
---|
287 | | - float opacity = display.modelParams5[1]; |
---|
288 | | - |
---|
289 | | - //final GL gl = GLU.getCurrentGL(); |
---|
290 | | - GL gl = display.GetGL(); // getGL(); |
---|
291 | | - |
---|
292 | | - int v = vertBuf.capacity(); |
---|
293 | | - |
---|
294 | | - int count = 0; |
---|
295 | | - |
---|
296 | | - boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE); |
---|
297 | | - gl.glEnable(gl.GL_CULL_FACE); |
---|
298 | | - // gl.glScalef(1.0f/1024,1.0f/1024,1.0f/1024); |
---|
299 | | - for (int i=0; i<v/3; i++) |
---|
300 | | - { |
---|
301 | | - int index3 = i*3; |
---|
302 | | - |
---|
303 | | - if (sizeBuf.get(index3+1) == 0) |
---|
304 | | - continue; |
---|
305 | | - |
---|
306 | | - count++; |
---|
307 | | - |
---|
308 | | - int index4 = i*4; |
---|
309 | | - |
---|
310 | | - float tx = vertBuf.get(index3); |
---|
311 | | - float ty = vertBuf.get(index3+1); |
---|
312 | | - float tz = vertBuf.get(index3+2); |
---|
313 | | - |
---|
314 | | - // if (tx == 0 && ty == 0 && tz == 0) |
---|
315 | | - // continue; |
---|
316 | | - |
---|
317 | | - gl.glMatrixMode(gl.GL_TEXTURE); |
---|
318 | | - gl.glPushMatrix(); |
---|
319 | | - texmat[12] = texmat[13] = texmat[14] = i; |
---|
320 | | - |
---|
321 | | - gl.glMultMatrixf(texmat, 0); |
---|
322 | | - |
---|
323 | | - gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
324 | | - gl.glPushMatrix(); |
---|
325 | | - |
---|
326 | | - gl.glTranslatef(tx,ty,tz); |
---|
327 | | - |
---|
328 | | - if (rotate) |
---|
329 | | - gl.glRotatef(i, 0, 1, 0); |
---|
330 | | - |
---|
331 | | - float size = sizeBuf.get(index3) / 100; |
---|
332 | | - gl.glScalef(size,size,size); |
---|
333 | | - |
---|
334 | | - float cr = colorBuf.get(index4); |
---|
335 | | - float cg = colorBuf.get(index4+1); |
---|
336 | | - float cb = colorBuf.get(index4+2); |
---|
337 | | - float ca = colorBuf.get(index4+3); |
---|
338 | | - |
---|
339 | | - display.modelParams0[0] = r * cr; |
---|
340 | | - display.modelParams0[1] = g * cg; |
---|
341 | | - display.modelParams0[2] = b * cb; |
---|
342 | | - |
---|
343 | | - display.modelParams5[1] = opacity * ca; |
---|
344 | | - |
---|
345 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
346 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
347 | | - |
---|
348 | | - RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i; |
---|
349 | | - RandomNode.globalseed2 = RandomNode.globalseed; |
---|
350 | | - |
---|
351 | | -// gl.glColor4f(cr,cg,cb,ca); |
---|
352 | | - // gl.glScalef(1024/16,1024/16,1024/16); |
---|
353 | | - geo.Draw/*Node*/(display,null,selected,false); // blocked |
---|
354 | | - // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024); |
---|
355 | | - //gl.glTranslatef(-tx,-ty,-tz); |
---|
356 | | - gl.glPopMatrix(); |
---|
357 | | - |
---|
358 | | - gl.glMatrixMode(gl.GL_TEXTURE); |
---|
359 | | - gl.glPopMatrix(); |
---|
360 | | - } |
---|
361 | | - // gl.glScalef(1024,1024,1024); |
---|
362 | | - if (!cf) |
---|
363 | | - gl.glDisable(gl.GL_CULL_FACE); |
---|
364 | | - |
---|
365 | | - display.modelParams0[0] = r; |
---|
366 | | - display.modelParams0[1] = g; |
---|
367 | | - display.modelParams0[2] = b; |
---|
368 | | - |
---|
369 | | - display.modelParams5[1] = opacity; |
---|
370 | | - |
---|
371 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0); |
---|
372 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0); |
---|
373 | | - |
---|
374 | | - gl.glMatrixMode(gl.GL_MODELVIEW); |
---|
375 | | - |
---|
376 | | -// System.err.println("total = " + v/3 + "; displayed = " + count); |
---|
377 | | - if (true) |
---|
378 | | - return; |
---|
379 | | - |
---|
380 | | -//// if (!tris.predraw(this)) |
---|
381 | | -//// { |
---|
382 | | -//// return; |
---|
383 | | -//// } |
---|
384 | | -//// if (Debug.stats) |
---|
385 | | -//// { |
---|
386 | | -//// StatCollector.addStat(StatType.STAT_TRIANGLE_COUNT, tris.getTriangleCount()); |
---|
387 | | -//// StatCollector.addStat(StatType.STAT_VERTEX_COUNT, tris.getVertexCount()); |
---|
388 | | -//// StatCollector.addStat(StatType.STAT_GEOM_COUNT, 1); |
---|
389 | | -//// } |
---|
390 | | -//// |
---|
391 | | -//// if (tris.getDisplayListID() != -1) |
---|
392 | | -//// { |
---|
393 | | -//// renderDisplayList(tris); |
---|
394 | | -//// return; |
---|
395 | | -//// } |
---|
396 | | -//// |
---|
397 | | -//// if (!generatingDisplayList) |
---|
398 | | -//// { |
---|
399 | | -//// applyStates(tris.states, tris); |
---|
400 | | -//// } |
---|
401 | | -//// if (Debug.stats) |
---|
402 | | -//// { |
---|
403 | | -//// StatCollector.startStat(StatType.STAT_RENDER_TIMER); |
---|
404 | | -//// } |
---|
405 | | -//// boolean transformed = doTransforms(tris); |
---|
406 | | -// |
---|
407 | | -// int glMode = GL.GL_TRIANGLES; |
---|
408 | | -// switch (getMode()) |
---|
409 | | -// { |
---|
410 | | -// case Triangles: |
---|
411 | | -// glMode = GL.GL_TRIANGLES; |
---|
412 | | -// break; |
---|
413 | | -// case Strip: |
---|
414 | | -// glMode = GL.GL_TRIANGLE_STRIP; |
---|
415 | | -// break; |
---|
416 | | -// case Fan: |
---|
417 | | -// glMode = GL.GL_TRIANGLE_FAN; |
---|
418 | | -// break; |
---|
419 | | -// } |
---|
420 | | -// |
---|
421 | | -// if (!predrawGeometry(gl)) |
---|
422 | | -// { |
---|
423 | | -// // make sure only the necessary indices are sent through on old |
---|
424 | | -// // cards. |
---|
425 | | -// IntBuffer indices = this.getIndexBuffer(); |
---|
426 | | -// if (indices == null) |
---|
427 | | -// { |
---|
428 | | -// logger.severe("missing indices on geometry object: " + this.toString()); |
---|
429 | | -// } else |
---|
430 | | -// { |
---|
431 | | -// indices.rewind(); |
---|
432 | | -// indices.limit(this.getMaxIndex()); |
---|
433 | | -// |
---|
434 | | -// gl.glDrawElements(glMode, indices.limit(), GL.GL_UNSIGNED_INT, indices); // TODO Check <count> and assumed <type> of GL_UNSIGNED_INT |
---|
435 | | -// |
---|
436 | | -// indices.clear(); |
---|
437 | | -// } |
---|
438 | | -// } else |
---|
439 | | -// { |
---|
440 | | -// gl.glDrawElements(glMode, this.getIndexBuffer().limit(), |
---|
441 | | -// GL.GL_UNSIGNED_INT, 0); |
---|
442 | | -// } |
---|
443 | | -// |
---|
444 | | -//// postdrawGeometry(tris); |
---|
445 | | -//// if (transformed) |
---|
446 | | -//// { |
---|
447 | | -//// undoTransforms(tris); |
---|
448 | | -//// } |
---|
449 | | -//// |
---|
450 | | -//// if (Debug.stats) |
---|
451 | | -//// { |
---|
452 | | -//// StatCollector.endStat(StatType.STAT_RENDER_TIMER); |
---|
453 | | -//// } |
---|
454 | | -//// tris.postdraw(this); |
---|
455 | | - } |
---|
456 | | - |
---|
457 | 288 | final boolean supportsVBO = false; |
---|
458 | 289 | private FloatBuffer prevVerts; |
---|
459 | 290 | |
---|
.. | .. |
---|
484 | 484 | |
---|
485 | 485 | } |
---|
486 | 486 | |
---|
487 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
| 487 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
488 | 488 | { |
---|
489 | 489 | // super.DrawNode(display,root,selected); |
---|
490 | 490 | |
---|
.. | .. |
---|
526 | 526 | return debugMode; |
---|
527 | 527 | } |
---|
528 | 528 | |
---|
529 | | - public void renderme0(CameraPane display) |
---|
| 529 | + public void renderme0(iCameraPane display) |
---|
530 | 530 | { |
---|
531 | 531 | //updateCamera(); |
---|
532 | | - GL gl = display.getGL(); |
---|
| 532 | + GL gl = display.GetGL(); |
---|
533 | 533 | |
---|
534 | 534 | if (dynamicsWorld != null) { |
---|
535 | 535 | int numObjects = dynamicsWorld.getNumCollisionObjects(); |
---|
.. | .. |
---|
755 | 755 | |
---|
756 | 756 | // // to be implemented by the demo |
---|
757 | 757 | // @Override |
---|
758 | | - public void renderme(CameraPane display) |
---|
| 758 | + public void renderme(iCameraPane display) |
---|
759 | 759 | { |
---|
760 | 760 | // updateCamera(); |
---|
761 | 761 | |
---|
.. | .. |
---|
484 | 484 | } |
---|
485 | 485 | |
---|
486 | 486 | |
---|
487 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
| 487 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) // ?? |
---|
488 | 488 | { |
---|
489 | 489 | // ?????? if (size() > 0) |
---|
490 | 490 | // { |
---|
.. | .. |
---|
543 | 543 | } |
---|
544 | 544 | |
---|
545 | 545 | // serial lost |
---|
546 | | - void DrawNode0(CameraPane display) |
---|
| 546 | + void DrawNode0(iCameraPane display) |
---|
547 | 547 | { |
---|
548 | 548 | super.DrawNode(display, null, false); |
---|
549 | 549 | } |
---|
550 | 550 | |
---|
551 | 551 | |
---|
552 | | - void DrawNode/*notused*/(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 552 | + void DrawNode/*notused*/(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
553 | 553 | { |
---|
554 | 554 | // assert displaylist == -1; |
---|
555 | 555 | |
---|
.. | .. |
---|
5 | 5 | static final public int SELECTION = 1; |
---|
6 | 6 | static final public int SHADOW = 2; |
---|
7 | 7 | static final public int OCCLUSION = 3; |
---|
8 | | - |
---|
| 8 | + |
---|
| 9 | + boolean IsBoxMode(); |
---|
| 10 | + |
---|
9 | 11 | void ClearDepth(); |
---|
10 | 12 | |
---|
11 | 13 | void DepthTest(boolean depthtest); |
---|
.. | .. |
---|
50 | 52 | void ReleaseTextures(cTexture tex); |
---|
51 | 53 | |
---|
52 | 54 | void DrawFace(Object3D obj, Vertex pv, Vertex qv, Vertex rv, Face face); |
---|
| 55 | + |
---|
| 56 | + void DrawParticles(TriMesh geo, Object3D shape, boolean selected, boolean rotate); |
---|
53 | 57 | } |
---|