edit ISkinnedMesh vertices

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
khatarat
Posts: 18
Joined: Wed Dec 19, 2012 10:41 am

edit ISkinnedMesh vertices

Post 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?
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: edit ISkinnedMesh vertices

Post by wing64 »

Check SWeight struct. If you want modify vertices then you must change value in StaticPos variable because ISkinnedMesh use this when skinning.
khatarat
Posts: 18
Joined: Wed Dec 19, 2012 10:41 am

Re: edit ISkinnedMesh vertices

Post by khatarat »

StaticPos is a private member of class SWeight. how its possible to access it?
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: edit ISkinnedMesh vertices

Post 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
Post Reply