void SetVertexPos(std::array<DefaultVertex,4>& v,XMFLOAT3 pos,XMFLOAT2 base,XMFLOAT2 size,float angle) { v[0].pos = XMFLOAT3(pos.x, pos.y , pos.z); v[1].pos = XMFLOAT3(pos.x + size.x, pos.y, pos.z); v[2].pos = XMFLOAT3(pos.x, pos.y + size.y, pos.z); v[3].pos = XMFLOAT3(pos.x + size.x, pos.y + size.y, pos.z); std::for_each(v.begin(), v.end(), [base](DefaultVertex& p) { p.pos = p.pos - XMFLOAT3(base.x, base.y, 0.f); }); XMFLOAT3X3 matRotate; XMStoreFloat3x3(&matRotate, XMMatrixIdentity()); float rad = XMConvertToRadians(angle); matRotate._11 = matRotate._22 = cosf(rad); matRotate._12 = sinf(rad); matRotate._21 = -sinf(rad); std::for_each(v.begin(), v.end(), [base, matRotate](DefaultVertex& p) { XMStoreFloat3(&p.pos, XMVector3Transform(XMLoadFloat3(&p.pos), XMLoadFloat3x3(&matRotate))); p.pos = XMFLOAT3(p.pos.x + base.x, p.pos.y + base.y, p.pos.z); }); }
XMMATRIX Float3x3::ToSIMD() const { return XMLoadFloat3x3(this); }