math & physics
say i want to create a smash effect on my model , i am stuck on how i would change the vertex buffer ,x,y,z , i know how to get the current values , i just dont know how to apply new values so the mesh looks diferent
sorry, don't have time currently to give a long response, but you can modify the information in the same fashion as you would with an array of pointers.
for (every vertex)
ver.position = whatever you want it to be;
EDIT: keep in mind this isn't the only way though. If you're using SM 3.0 you can create damage effects in the vertex shader. IMO it's much more straight forward and faster.
yes but how does that know to apply it after all you only retrieve the postions , and it dosent feel like if i changes those values its not going to set them
No, locking the vertex buffer means you get a pointer to the actual, real data. It is not just a copy of it and if you change the data, it will change what is rendered.
ahh right , i see why its not made any effectr on the teapot , but i think it will work on a .x ,
so if i load a terrain .x intersect with it , i would need to only get the 3*x,y,z the mouse is over, then if i press mouse 1 i would increment the data on y axis to make the terrain heigher
You know, I just realized. If you're using a mesh with a vertex format you don't have access to, you're probably not locking it with the correct vertex structure. The structure "ver" must be the same size and order as the meshes vertex format, if it's not accurate, the lock will fail.
EDIT: well, it doesn't necessarily have to fail, but the right information will not be accessed.
ive the correct values , i just cant set new values to teapot
do i set the taken vertices points from locking and i put them in this function then? , i want to test which triangle in a mesh the ray intersects