I have a function:
void findMinMax(XMFLOAT3& center, XMFLOAT3& extents)
{
XMFLOAT3 vMin = XMFLOAT3(-INFINITY, -INFINITY, -INFINITY);
XMFLOAT3 vMax = XMFLOAT3(INFINITY, INFINITY, INFINITY);
XMVECTOR min = XMLoadFloat3(&vMin);
XMVECTOR max = XMLoadFloat3(&vMax);
for (int i = 0; i < meshList[0].vertices.size(); i++)
{
XMVECTOR p = XMLoadFloat3(&meshList[0].vertices[i].pos);
min = XMVectorMin(min, p);
max = XMVectorMax(max, p);
}
XMVECTOR c = 0.5f *(min + max);
XMVECTOR e = 0.5f*(max - min);
XMStoreFloat3(¢er, c);
XMStoreFloat3(&extents, e);
}
...got it out of the frank luna book. IT's supposed to find the extents and center of a AABB box I think. What am I doing wrong because its not working? The box doesn't draw. It draws when I put other values just not these vectors.