fxfire195

I'm writing a Json Load Class using DirectX.

The structure of the skinnedmesh vertices in skins data is not well understood.

If you have more than uv counts, I know that they are vertices with weights, but I don't know the clear rules.

please answer about my question.
fxfire195
  • Bài viết: 2

Mario

Spine 2.1 is very old and the format documentation is no longer existant. You can find the old spine-runtimes sources for that version here to check how it worked: GitHub - EsotericSoftware/spine-runtimes at 2.1.08
Hình đại diện của thành viên
Mario

Mario
  • Bài viết: 2360

fxfire195

badlogic đã viết:Spine 2.1 is very old and the format documentation is no longer existant. You can find the old spine-runtimes sources for that version here to check how it worked: https://github.com/EsotericSoftware/spine-runtimes/tree/2.1.08
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]);
}
}
fxfire195
  • Bài viết: 2

Mario

I think the easiest way for you to get things going for 2.1.x is to look at our old spine-sfml renderer. Translating that to DirectX should be trivial: spine-runtimes/spine-sfml.cpp at 2.1.08

I'm afraid 2.1 is a bit before my time with Spine, so I can't help much deciphering the old format. However, by debugging the spine-sfml example, you should be able to see how things fit together.
Hình đại diện của thành viên
Mario

Mario
  • Bài viết: 2360


Quay về Runtimes