Changeset 1281
 Timestamp:
 Apr 23, 2012, 2:20:30 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/orbital/mesh.h
r1280 r1281 25 25 vec4 v4; 26 26 vec3 v3; 27 float f1, f2, f3, f4, f5, f6 ;27 float f1, f2, f3, f4, f5, f6, f7, f8; 28 28 29 29 for (char const *p = command; p && *p; ) … … 62 62 else CASE("at") { p = GetArg(p, f1, f2); AppendSimpleTriangle(f1, (int)f2); } 63 63 else CASE("aq") { p = GetArg(p, f1, f2); AppendSimpleQuad(f1, (int)f2); } 64 else CASE("acg") { /* TODO */}64 else CASE("acg") { p = GetArg(p, f1, f2, f3, f4); p = GetArg(p, f5, f6, f7, f8); AppendCog((int)f1, f2, f3, f4, f5, f6, f7, (int)f8); } 65 65 else CASE("irb") { MeshConvert(); } 66 66 else CASE("frb") { /* TODO */ } … … 810 810 } 811 811 812 void AppendCog() {} /* TODO */ 812 void AppendCog(int nbsides, float h, float r1, float r2, 813 float r12, float r22, float sidemul, int offset) 814 { 815 int qibase = m_quadidx.Count(); 816 int vbase = m_vert.Count(); 817 818 AppendQuadVert(vec3(0.f, h * .5f, 0.f)); 819 AppendQuadVert(vec3(0.f, h * .5f, 0.f)); 820 SetCurVertColor(m_color2); 821 822 mat3 rotmat = mat3::rotate(180.0f / nbsides, 0.f, 1.f, 0.f); 823 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; 833 834 rotmat = rotmat * rotmat; 835 836 for (int i = 0; i < nbsides; i++) 837 { 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; 888 } 889 890 ComputeQuadNormals(qibase, m_quadidx.Count()  qibase); 891 } 813 892 814 893 private:
Note: See TracChangeset
for help on using the changeset viewer.