void MlUVView::drawControlVectors(MlFeather * f) { Vector3F baseP(f->baseUV()); GeoDrawer * dr = getDrawer(); glPushMatrix(); Matrix44F s; s.setTranslation(baseP); float * quill = f->getQuilly(); Vector3F b, a; Vector2F *d; for(short i=0; i <= f->numSegment(); i++) { dr->useSpace(s); a.setZero(); d = f->uvDisplaceAt(i, 0); for(short j = 0; j < 3; j++) { b = d[j]; dr->arrow(a, a + b); a += b; } a.setZero(); d = f->uvDisplaceAt(i, 1); for(short j = 0; j < 3; j++) { b = d[j]; dr->arrow(a, a + b); a += b; } a.setZero(); b.set(0.f, quill[i], 0.f); if(i<f->numSegment()) dr->arrow(a, b); s.setTranslation(b); } glPopMatrix(); }
void Graphics2D::drawBlockD(Image const& src, Vector2D const& dstP, int x, int y) { enum Pattern { A , B , C , D7, D8, D9, D4, D5, D6, D1, D2, D3, }; Vector2D PAT_P[12]; for(int i = 0; i < 4; i++) for(int j = 0; j < 3; j++) PAT_P[3*i + j](j, i) *= 16; Vector2D baseP( CHIP_SIZE[0]*(3*(x%2) + (x<4 ? 0 : 6)), CHIP_SIZE[1]*(4*(x/2) - (x<4 ? 0 : 8)) ); Pattern pat[4] = { D5, D5, D5, D5 }; if(y < 0x10) { for(int i = 0; i < 4; i++) pat[i] = y&(0x01<<i) ? C : D5; } else if(y < 0x14) { pat[0] = D4; pat[1] = y&0x01 ? C : D5; pat[3] = D4; pat[2] = y&0x02 ? C : D5; } else if(y < 0x18) { pat[0] = D8; pat[1] = D8; pat[3] = y&0x02 ? C : D5; pat[2] = y&0x01 ? C : D5; } else if(y < 0x1C) { pat[0] = y&0x01 ? C : D5; pat[1] = D6; pat[3] = y&0x02 ? C : D5; pat[2] = D6; } else if(y < 0x20) { pat[0] = y&0x01 ? C : D5; pat[1] = y&0x02 ? C : D5; pat[3] = D2; pat[2] = D2; } else if(y == 0x20) { pat[0] = D4; pat[1] = D6; pat[3] = D4; pat[2] = D6; } else if(y == 0x21) { pat[0] = D8; pat[1] = D8; pat[3] = D2; pat[2] = D2; } else if(y < 0x24) { pat[0] = D7; pat[1] = D7; pat[3] = D7; pat[2] = y&0x01 ? C : D7; } else if(y < 0x26) { pat[0] = D9; pat[1] = D9; pat[3] = y&0x01 ? C : D9; pat[2] = D9; } else if(y < 0x28) { pat[0] = y&0x01 ? C : D3; pat[1] = D3; pat[3] = D3; pat[2] = D3; } else if(y < 0x2a) { pat[0] = D1; pat[1] = y&0x01 ? C : D1; pat[3] = D1; pat[2] = D1; } else if(y == 0x2a) { pat[0] = D7; pat[1] = D9; pat[3] = D7; pat[2] = D9; } else if(y == 0x2b) { pat[0] = D7; pat[1] = D7; pat[3] = D1; pat[2] = D1; } else if(y == 0x2c) { pat[0] = D1; pat[1] = D3; pat[3] = D1; pat[2] = D3; } else if(y == 0x2d) { pat[0] = D9; pat[1] = D9; pat[3] = D3; pat[2] = D3; } else if(y == 0x2e) { pat[0] = D7; pat[1] = D9; pat[3] = D1; pat[2] = D3; } else return; for(int i = 0; i < 4; i++) { drawImage(src, dstP+SEG_P[i], baseP+PAT_P[pat[i]]+SEG_P[i], CHIP_SIZE/2); } }