Ignore:
Timestamp:
Apr 24, 2012, 1:07:32 AM (11 years ago)
Author:
sam
Message:

orbital: implement sidemul and offset in the cog mesh builder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/orbital/mesh.h

    r1282 r1284  
    497497                        int dualside, int smooth)
    498498    {
    499         int ibase = m_quadidx.Count();
    500499        int vbase = m_vert.Count();
    501500
     
    815814
    816815        mat3 rotmat = mat3::rotate(180.0f / nbsides, 0.f, 1.f, 0.f);
     816        mat3 smat1 = mat3::rotate(sidemul * 180.0f / nbsides, 0.f, 1.f, 0.f);
     817        mat3 smat2 = mat3::rotate(sidemul * -360.0f / nbsides, 0.f, 1.f, 0.f);
    817818
    818819        vec3 p[8];
     
    820821        p[0] = vec3(r1, h * .5f, 0.f);
    821822        p[1] = rotmat * p[0];
    822         p[2] = rotmat * vec3(r1 + r12, h * .5f, 0.f);
    823         p[3] = rotmat * p[2];
     823        p[2] = smat1 * (rotmat * vec3(r1 + r12, h * .5f, 0.f));
     824        p[3] = smat2 * (rotmat * p[2]);
    824825
    825826        p[4] = vec3(r2, h * -.5f, 0.f);
    826827        p[5] = rotmat * p[4];
    827         p[6] = rotmat * vec3(r2 + r22, h * -.5f, 0.f);
    828         p[7] = rotmat * p[6];
     828        p[6] = smat1 * (rotmat * vec3(r2 + r22, h * -.5f, 0.f));
     829        p[7] = smat2 * (rotmat * p[6]);
     830
     831        if (offset & 1)
     832            for (int n = 0; n < 8; n++)
     833                p[n] = rotmat * p[n];
    829834
    830835        rotmat = rotmat * rotmat;
Note: See TracChangeset for help on using the changeset viewer.