Page 1 of 1

edit ISkinnedMesh vertices

Posted: Thu May 23, 2013 7:39 pm
by khatarat
hi
i want to load a directx skinned mesh file and animate it with bone and some times i need to edit position of vertices individually.
i use this code to change vertices position:

Code: Select all

 
              ISkinnedMesh * BaseMesh=(ISkinnedMesh*)m_Scene->getMesh("tmp.X");
 
              SMeshBuffer * buf= (SMeshBuffer *) BaseMesh->getMeshBuffer(bufnum);
    const S3DVertex * v1=(S3DVertex *)buf->getVertices();
    //const S3DVertex * v2=(S3DVertex *)TargetMorphs[MTInd]->getMeshBuffer(bufnum)->getVertices();
    u16 i;
    
    for(i=0;i<buf->getVertexCount();i++)
    {
        vector3df *vec1=(vector3df *)&v1[i].Pos;
        vector3df *vec2=(vector3df *)&v2[i].Pos;
        vector3df tmp;
        tmp=vec2->getInterpolated(*vec1,weight);
        vec1->set(tmp);
        
    }
    buf->recalculateBoundingBox();
 
when i export only meshes code works good. but when i export mesh with bones this code does not do anything and vertices remain without any change.
any one know what is problem?

Re: edit ISkinnedMesh vertices

Posted: Fri May 24, 2013 4:10 am
by wing64
Check SWeight struct. If you want modify vertices then you must change value in StaticPos variable because ISkinnedMesh use this when skinning.

Re: edit ISkinnedMesh vertices

Posted: Fri May 24, 2013 5:37 pm
by khatarat
StaticPos is a private member of class SWeight. how its possible to access it?

Re: edit ISkinnedMesh vertices

Posted: Fri May 24, 2013 11:29 pm
by wing64
You have one choice to access that are delete or comment a private accessibility then you can control vertices in skinned mesh on the fly.
This video is example i edited skinned mesh
http://irrlicht.sourceforge.net/forum/v ... 10#p277572
http://irrlicht.sourceforge.net/forum/v ... 95#p276902