Thank you for your quick response.
I am not sure about the meaning of the vertices sequence number of the JSON file currently in use.
"vertices": [
2,
79,
7.590000152587891,
12.449999809265137,
0.9625700116157532,
93,
-3.4200000762939453,
11.550000190734863,
0.03742000088095665,
. . . ],
- Number of WeightedMesh
- ?
- Bind X Position
- Bind Y Position
- Weight Value
Also, when checking the file data with Direct11,
when trying to output only one part, I do not understand how WeightedMesh is applied to Local and World.
this code is Create Skins Code.
struct spineSkins
{
SKIN_TYPE type;
string name;
string path;
DOUBLE width;
DOUBLE height;
D3DXCOLOR color;
signed int hull;
vector<D3DXVECTOR2> vecTexcord;
vector<vector<WeightedVertex>> vecVertex;
vector<UINT> vecTri;
vector<UINT> vecEdge;
DOUBLE x;
DOUBLE y;
D3DXVECTOR2 scale;
DOUBLE rotation;
D3DXMATRIX worldMatrix;
ID3D11Buffer* worldBuffer;
vector<PTVertex> vertex;
ID3D11Buffer* vertexBuffer;
};
map<string, spineSkins*> mSkins;
for (auto& it : mSkins)
{
D3DXMatrixIdentity(&it.second->worldMatrix);
it.second->worldMatrix._11 = 1;
it.second->worldMatrix._22 = 1;
CreateConstantBuffer(&it.second->worldBuffer, sizeof(D3DXMATRIX), &it.second->worldMatrix);
if (it.second->type == SKINNED_MESH)
{
it.second->vertex.reserve(it.second->vecTri.size());
for (size_t i = 0; i < it.second->vecTri.size(); ++i)
{
UINT idx = it.second->vecTri[i];
D3DXVECTOR3 p = D3DXVECTOR3(0, 0, 0);
for (size_t inner = 0; inner < it.second->vecVertex[idx].size(); ++inner)
p += D3DXVECTOR3(it.second->vecVertex[idx][inner].bindPos.x * it.second->vecVertex[idx][inner].weight
, it.second->vecVertex[idx][inner].bindPos.y * it.second->vecVertex[idx][inner].weight, 0);
it.second->vertex.push_back(PTVertex(p, it.second->vecTexcord[idx]));
}
CreateVertexBuffer(&it.second->vertexBuffer, sizeof(PTVertex)*it.second->vertex.size(), &it.second->vertex[0]);
}
else if (it.second->type == NOSKINNED_REGION)
{
it.second->vertex.reserve(6);
it.second->vertex.push_back(PTVertex(D3DXVECTOR3(-1.0f, -1.0f, 0.0f), D3DXVECTOR2(0, 1)));
it.second->vertex.push_back(PTVertex(D3DXVECTOR3(-1.0, 1.0, 0.0f), D3DXVECTOR2(0, 0)));
it.second->vertex.push_back(PTVertex(D3DXVECTOR3(1.0, 1.0, 0.0f), D3DXVECTOR2(1, 0)));
it.second->vertex.push_back(PTVertex(D3DXVECTOR3(-1.0, -1.0, 0.0f), D3DXVECTOR2(0, 1)));
it.second->vertex.push_back(PTVertex(D3DXVECTOR3(1.0, 1.0, 0.0f), D3DXVECTOR2(1, 0)));
it.second->vertex.push_back(PTVertex(D3DXVECTOR3(1.0, -1.0, 0.0), D3DXVECTOR2(1, 1)));
CreateVertexBuffer(&it.second->vertexBuffer, sizeof(PTVertex) * 6, &it.second->vertex[0]);
}
}