// Method A
// --------
// ------------------------------------------------------------------------------------
// translating a vertex using hardware vertex buffer
// ------------------------------------------------------------------------------------
Byte *data=mesh.parts(0).render.vtxLock(LOCK_READ_WRITE);
Int vtx_size=mesh.parts(0).render.vtxSize();
Int pos_ofs=mesh.parts(0).render.vtxOfs(VTX_POS);
Int tex0_ofs=mesh.parts(0).render.vtxOfs(VTX_TEX0);
Vec pos;
for(int i = 0; i < m; i++)
{
for(int j = 0; j < n; j++)
{
int k=i*n+j;
pos=*(Vec*)(data + pos_ofs + k*vtx_size);
if( i==0 && j==0) // edit to change (i,j) vertex
*((Vec*)(data + pos_ofs + k*vtx_size)) = Vec(pos.x, 5, pos.z); // raise selected vertex by 5 units
else
*((Vec*)(data + pos_ofs + k*vtx_size)) = Vec(pos.x, 0, pos.z); // all level
}
}
mesh.parts(0).render.vtxUnlock(); // NB unlock after all read/write is completed // all level
// --------------------------------------------------------------------------------------