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
changing vertex buffer values after locking
Started by Anddos, Nov 18 2008 06:27 PM
7 replies to this topic
#1
Posted 18 November 2008 - 06:27 PM
#2
Posted 18 November 2008 - 06:31 PM
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.
vertexStruct *ver;
mesh.lock(*ver);
for (every vertex)
{
ver[i].position = whatever you want it to be;
}
mesh.unlock();
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.
vertexStruct *ver;
mesh.lock(*ver);
for (every vertex)
{
ver[i].position = whatever you want it to be;
}
mesh.unlock();
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.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
#3
Posted 18 November 2008 - 06:52 PM
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
#4
Posted 18 November 2008 - 07:28 PM
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.
reedbeta.com - developer blog, OpenGL demos, and other projects
#5
Posted 18 November 2008 - 07:33 PM
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
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
#6
Posted 18 November 2008 - 07:37 PM
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.
EDIT: well, it doesn't necessarily have to fail, but the right information will not be accessed.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
bunny also wants to fight spam: Click Here Bots!
#7
Posted 18 November 2008 - 07:46 PM
ive the correct values , i just cant set new values to teapot
#8
Posted 18 November 2008 - 08:02 PM
D3DXIntersectTri
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
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
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












