Commit 70d72234 authored by Vijay Kiran Kamuju's avatar Vijay Kiran Kamuju Committed by Alexandre Julliard

d3dx9: Generate ID3DXSkinInfo in D3DXLoadSkinMeshFromXof() when needed.

Based on a patch by Michael Müller. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33904Signed-off-by: 's avatarVijay Kiran Kamuju <infyquest@gmail.com> Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a30fd8c0
...@@ -3332,6 +3332,13 @@ static HRESULT parse_mesh(ID3DXFileData *filedata, struct mesh_data *mesh_data, ...@@ -3332,6 +3332,13 @@ static HRESULT parse_mesh(ID3DXFileData *filedata, struct mesh_data *mesh_data,
goto end; goto end;
} }
if ((provide_flags & PROVIDE_SKININFO) && !mesh_data->skin_info)
{
if (FAILED(hr = D3DXCreateSkinInfoFVF(mesh_data->num_vertices, mesh_data->fvf,
mesh_data->nb_bones, &mesh_data->skin_info)))
goto end;
}
hr = D3D_OK; hr = D3D_OK;
end: end:
......
...@@ -11319,53 +11319,49 @@ static void test_load_skin_mesh_from_xof(void) ...@@ -11319,53 +11319,49 @@ static void test_load_skin_mesh_from_xof(void)
ok(!materials, "Got unexpected value %p.\n", materials); ok(!materials, "Got unexpected value %p.\n", materials);
ok(!effects, "Got unexpected value %p.\n", effects); ok(!effects, "Got unexpected value %p.\n", effects);
ok(!count, "Got unexpected value %u.\n", count); ok(!count, "Got unexpected value %u.\n", count);
todo_wine ok(!!skin_info, "Got unexpected value %p.\n", skin_info); ok(!!skin_info, "Got unexpected value %p.\n", skin_info);
ok(!!mesh, "Got unexpected value %p.\n", mesh); ok(!!mesh, "Got unexpected value %p.\n", mesh);
count = mesh->lpVtbl->GetNumVertices(mesh); count = mesh->lpVtbl->GetNumVertices(mesh);
ok(count == 3, "Got unexpected value %u.\n", count); ok(count == 3, "Got unexpected value %u.\n", count);
count = mesh->lpVtbl->GetNumFaces(mesh); count = mesh->lpVtbl->GetNumFaces(mesh);
ok(count == 1, "Got unexpected value %u.\n", count); ok(count == 1, "Got unexpected value %u.\n", count);
if (skin_info) hr = skin_info->lpVtbl->GetDeclaration(skin_info, declaration);
{ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = skin_info->lpVtbl->GetDeclaration(skin_info, declaration); compare_elements(declaration, expected_declaration, __LINE__, 0);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
compare_elements(declaration, expected_declaration, __LINE__, 0);
fvf = skin_info->lpVtbl->GetFVF(skin_info);
ok(fvf == D3DFVF_XYZ, "Got unexpected value %u.\n", fvf);
count = skin_info->lpVtbl->GetNumBones(skin_info); fvf = skin_info->lpVtbl->GetFVF(skin_info);
ok(!count, "Got unexpected value %u.\n", count); ok(fvf == D3DFVF_XYZ, "Got unexpected value %u.\n", fvf);
influence = skin_info->lpVtbl->GetMinBoneInfluence(skin_info); count = skin_info->lpVtbl->GetNumBones(skin_info);
ok(!influence, "Got unexpected value %.8e.\n", influence); ok(!count, "Got unexpected value %u.\n", count);
memset(max_influences, 0x55, sizeof(max_influences)); influence = skin_info->lpVtbl->GetMinBoneInfluence(skin_info);
hr = skin_info->lpVtbl->GetMaxVertexInfluences(skin_info, max_influences); ok(!influence, "Got unexpected value %.8e.\n", influence);
ok(hr == D3D_OK, "Got unexpected value %#x.\n", hr);
ok(!max_influences[0], "Got unexpected value %u.\n", max_influences[0]);
ok(max_influences[1] == 0x55555555, "Got unexpected value %u.\n", max_influences[1]);
ok(max_influences[2] == 0x55555555, "Got unexpected value %u.\n", max_influences[2]);
bone_name = skin_info->lpVtbl->GetBoneName(skin_info, 0); memset(max_influences, 0x55, sizeof(max_influences));
ok(!bone_name, "Got unexpected value %p.\n", bone_name); hr = skin_info->lpVtbl->GetMaxVertexInfluences(skin_info, max_influences);
todo_wine ok(hr == D3D_OK, "Got unexpected value %#x.\n", hr);
todo_wine ok(!max_influences[0], "Got unexpected value %u.\n", max_influences[0]);
ok(max_influences[1] == 0x55555555, "Got unexpected value %u.\n", max_influences[1]);
ok(max_influences[2] == 0x55555555, "Got unexpected value %u.\n", max_influences[2]);
count = skin_info->lpVtbl->GetNumBoneInfluences(skin_info, 0); bone_name = skin_info->lpVtbl->GetBoneName(skin_info, 0);
ok(!count, "Got unexpected value %u.\n", count); ok(!bone_name, "Got unexpected value %p.\n", bone_name);
count = skin_info->lpVtbl->GetNumBoneInfluences(skin_info, 1); count = skin_info->lpVtbl->GetNumBoneInfluences(skin_info, 0);
ok(!count, "Got unexpected value %u.\n", count); ok(!count, "Got unexpected value %u.\n", count);
matrix = skin_info->lpVtbl->GetBoneOffsetMatrix(skin_info, -1); count = skin_info->lpVtbl->GetNumBoneInfluences(skin_info, 1);
ok(!matrix, "Got unexpected value %p.\n", matrix); ok(!count, "Got unexpected value %u.\n", count);
matrix = skin_info->lpVtbl->GetBoneOffsetMatrix(skin_info, 0); matrix = skin_info->lpVtbl->GetBoneOffsetMatrix(skin_info, -1);
ok(!matrix, "Got unexpected value %p.\n", matrix); ok(!matrix, "Got unexpected value %p.\n", matrix);
skin_info->lpVtbl->Release(skin_info); matrix = skin_info->lpVtbl->GetBoneOffsetMatrix(skin_info, 0);
} ok(!matrix, "Got unexpected value %p.\n", matrix);
skin_info->lpVtbl->Release(skin_info);
mesh->lpVtbl->Release(mesh); mesh->lpVtbl->Release(mesh);
adjacency->lpVtbl->Release(adjacency); adjacency->lpVtbl->Release(adjacency);
file_data->lpVtbl->Release(file_data); file_data->lpVtbl->Release(file_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment