 Timestamp:
 Apr 23, 2012, 8:13:17 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/orbital/mesh.h
r1281 r1282 514 514 for (int i = 0; i < nsides; i++) 515 515 { 516 AppendQuadVert(p1); 517 SetCurVertNormal(n); 518 AppendQuadVert(p2); 519 SetCurVertNormal(n); 516 AppendQuadVert(p1); SetCurVertNormal(n); 517 AppendQuadVert(p2); SetCurVertNormal(n); 520 518 SetCurVertColor(m_color2); 521 519 … … 533 531 if (!smooth) 534 532 { 535 AppendQuadVert(p1); 536 SetCurVertNormal(n); 537 AppendQuadVert(p2); 538 SetCurVertNormal(n); 533 AppendQuadVert(p1); SetCurVertNormal(n); 534 AppendQuadVert(p2); SetCurVertNormal(n); 539 535 SetCurVertColor(m_color2); 540 536 … … 736 732 AppendQuadVert(p1); 737 733 AppendQuadVert(p2); 738 AppendQuadVert(p3); 739 SetCurVertColor(m_color2); 740 AppendQuadVert(p4); 741 SetCurVertColor(m_color2); 734 AppendQuadVert(p3); SetCurVertColor(m_color2); 735 AppendQuadVert(p4); SetCurVertColor(m_color2); 742 736 743 737 int j = (i + 1) % nbranches; … … 822 816 mat3 rotmat = mat3::rotate(180.0f / nbsides, 0.f, 1.f, 0.f); 823 817 824 vec3 p1(r1, h * .5f, 0.f); 825 vec3 p2 = rotmat * p1; 826 vec3 p3 = rotmat * vec3(r1 + r12, h * .5f, 0.f); 827 vec3 p4 = rotmat * p3; 828 829 vec3 p5(r2, h * .5f, 0.f); 830 vec3 p6 = rotmat * p5; 831 vec3 p7 = rotmat * vec3(r2 + r22, h * .5f, 0.f); 832 vec3 p8 = rotmat * p7; 818 vec3 p[8]; 819 820 p[0] = vec3(r1, h * .5f, 0.f); 821 p[1] = rotmat * p[0]; 822 p[2] = rotmat * vec3(r1 + r12, h * .5f, 0.f); 823 p[3] = rotmat * p[2]; 824 825 p[4] = vec3(r2, h * .5f, 0.f); 826 p[5] = rotmat * p[4]; 827 p[6] = rotmat * vec3(r2 + r22, h * .5f, 0.f); 828 p[7] = rotmat * p[6]; 833 829 834 830 rotmat = rotmat * rotmat; … … 836 832 for (int i = 0; i < nbsides; i++) 837 833 { 838 AppendQuadVert(p1); 839 AppendQuadVert(p2); 840 AppendQuadVert(p3); 841 AppendQuadVert(p4); 842 843 AppendQuadVert(p5); SetCurVertColor(m_color2); 844 AppendQuadVert(p6); SetCurVertColor(m_color2); 845 AppendQuadVert(p7); SetCurVertColor(m_color2); 846 AppendQuadVert(p8); SetCurVertColor(m_color2); 847 848 int j = (i + 1) % nbsides; 849 850 AppendQuad(2, 24 * i, 24 * i + 1, 24 * j, vbase + 2); 851 AppendQuad(1, 24 * j + 4, 24 * i + 5, 24 * i + 4, vbase + 2); 852 853 AppendQuad(24 * i + 1, 24 * i + 2, 24 * i + 3, 24 * j, vbase + 2); 854 AppendQuad(24 * j + 4, 24 * i + 7, 24 * i + 6, 24 * i + 5, vbase + 2); 855 856 AppendQuadVert(p1); 857 AppendQuadVert(p2); 858 AppendQuadVert(p5); SetCurVertColor(m_color2); 859 AppendQuadVert(p6); SetCurVertColor(m_color2); 860 AppendQuad(24 * i + 9, 24 * i + 8, 24 * i + 10, 24 * i + 11, vbase + 2); 861 862 AppendQuadVert(p2); 863 AppendQuadVert(p3); 864 AppendQuadVert(p6); SetCurVertColor(m_color2); 865 AppendQuadVert(p7); SetCurVertColor(m_color2); 866 AppendQuad(24 * i + 13, 24 * i + 12, 24 * i + 14, 24 * i + 15, vbase + 2); 867 868 AppendQuadVert(p3); 869 AppendQuadVert(p4); 870 AppendQuadVert(p7); SetCurVertColor(m_color2); 871 AppendQuadVert(p8); SetCurVertColor(m_color2); 872 AppendQuad(24 * i + 17, 24 * i + 16, 24 * i + 18, 24 * i + 19, vbase + 2); 873 874 AppendQuadVert(p4); 875 AppendQuadVert(p1); 876 AppendQuadVert(p8); SetCurVertColor(m_color2); 877 AppendQuadVert(p5); SetCurVertColor(m_color2); 878 AppendQuad(24 * j + 21, 24 * i + 20, 24 * i + 22, 24 * j + 23, vbase + 2); 879 880 p1 = rotmat * p1; 881 p2 = rotmat * p2; 882 p3 = rotmat * p3; 883 p4 = rotmat * p4; 884 p5 = rotmat * p5; 885 p6 = rotmat * p6; 886 p7 = rotmat * p7; 887 p8 = rotmat * p8; 834 /* Each vertex will share three faces, so three different 835 * normals, therefore we add each vertex three times. */ 836 for (int n = 0; n < 24; n++) 837 { 838 AppendQuadVert(p[n / 3]); 839 if (n / 3 >= 4) 840 SetCurVertColor(m_color2); 841 } 842 843 int j = 24 * i, k = 24 * ((i + 1) % nbsides); 844 845 /* The top and bottom faces */ 846 AppendQuad(0, j + 2, j + 5, k + 2, vbase); 847 AppendQuad(1, k + 14, j + 17, j + 14, vbase); 848 AppendQuad(j + 5, j + 8, j + 11, k + 2, vbase); 849 AppendQuad(k + 14, j + 23, j + 20, j + 17, vbase); 850 851 /* The side quads */ 852 AppendQuad(j + 6, j + 3, j + 15, j + 18, vbase); 853 AppendQuad(j + 9, j + 7, j + 19, j + 21, vbase); 854 AppendQuad(j + 12, j + 10, j + 22, j + 24, vbase); 855 AppendQuad(k + 4, j + 13, j + 25, k + 16, vbase); 856 857 for (int n = 0; n < 8; n++) 858 p[n] = rotmat * p[n]; 888 859 } 889 860
Note: See TracChangeset
for help on using the changeset viewer.