System memory copy of vertices/mesh

Started by
3 comments, last by iedoc 6 years, 8 months ago

I needed a system memory copy of the vertices for AABB Collision so I can update there min/max because I only have static vertices access. How can I do this. Im in directx 11. c++. As my object translates, I need to calculale the new AABB min/max and I cant get to the vertices.

 


void IvAABB::Set( const IvPoint3* points, unsigned int numPoints)
 {
 ASSERT( points);
 // compute minimal and maximal bounds
 mMinima.Set(points[0]);
 mMaxima.Set(points[0]);
 for (unsigned int i = 1; i < numPoints; ++i) 
{ 
if (points.x < mMinima.x) 
mMinima.x = points.x; 
else if (points.x > mMaxima.x)
 mMaxima.x = points.x;
 if (points.y < mMinima.y)
 mMinima.y = points.y; else if (points.y > mMaxima.y)
 mMaxima.y = points.y; 
if (points.z < mMinima.z)
 mMinima.z = points.z; 
else if (points.z > mMaxima.z)
 mMaxima.z = points.z; }
 }

 

Advertisement

Just keep a copy of whatever you need. Your app had the vertices at some point before copying them to the GPU, there's no reason you can't keep them around if you must. This also doesn't have anything to do with the graphics API's you are using

Also: The AABB of translated vertices is just the translated AABB.

haha, i had automatically assumed he meant transformed. That's good you pointed that out

This topic is closed to new replies.

Advertisement