ReactOS  0.4.15-dev-3331-g8ebe441
skin.c
Go to the documentation of this file.
1 #ifdef __REACTOS__
2 #include "precomp.h"
3 #else
4 /*
5  * Skin Info operations specific to D3DX9.
6  *
7  * Copyright (C) 2011 Dylan Smith
8  * Copyright (C) 2013 Christian Costa
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 
26 #include "d3dx9_private.h"
27 #endif /* __REACTOS__ */
28 
30 
31 struct bone
32 {
33  char *name;
38 };
39 
41 {
42  ID3DXSkinInfo ID3DXSkinInfo_iface;
44 
49  struct bone *bones;
50 };
51 
52 static inline struct d3dx9_skin_info *impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
53 {
55 }
56 
57 static HRESULT WINAPI d3dx9_skin_info_QueryInterface(ID3DXSkinInfo *iface, REFIID riid, void **out)
58 {
59  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
60 
61  if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXSkinInfo))
62  {
63  IUnknown_AddRef(iface);
64  *out = iface;
65  return D3D_OK;
66  }
67 
68  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
69 
70  return E_NOINTERFACE;
71 }
72 
73 static ULONG WINAPI d3dx9_skin_info_AddRef(ID3DXSkinInfo *iface)
74 {
75  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
76  ULONG refcount = InterlockedIncrement(&skin->ref);
77 
78  TRACE("%p increasing refcount to %u.\n", skin, refcount);
79 
80  return refcount;
81 }
82 
83 static ULONG WINAPI d3dx9_skin_info_Release(ID3DXSkinInfo *iface)
84 {
85  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
86  ULONG refcount = InterlockedDecrement(&skin->ref);
87 
88  TRACE("%p decreasing refcount to %u.\n", skin, refcount);
89 
90  if (!refcount)
91  {
92  DWORD i;
93 
94  for (i = 0; i < skin->num_bones; ++i)
95  {
96  HeapFree(GetProcessHeap(), 0, skin->bones[i].name);
97  HeapFree(GetProcessHeap(), 0, skin->bones[i].vertices);
98  HeapFree(GetProcessHeap(), 0, skin->bones[i].weights);
99  }
100  HeapFree(GetProcessHeap(), 0, skin->bones);
101  HeapFree(GetProcessHeap(), 0, skin);
102  }
103 
104  return refcount;
105 }
106 
107 static HRESULT WINAPI d3dx9_skin_info_SetBoneInfluence(ID3DXSkinInfo *iface,
108  DWORD bone_num, DWORD num_influences, const DWORD *vertices, const float *weights)
109 {
110  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
111  struct bone *bone;
112  DWORD *new_vertices = NULL;
113  FLOAT *new_weights = NULL;
114 
115  TRACE("iface %p, bone_num %u, num_influences %u, vertices %p, weights %p.\n",
116  iface, bone_num, num_influences, vertices, weights);
117 
118  if (bone_num >= skin->num_bones || !vertices || !weights)
119  return D3DERR_INVALIDCALL;
120 
121  if (num_influences) {
122  new_vertices = HeapAlloc(GetProcessHeap(), 0, num_influences * sizeof(*vertices));
123  if (!new_vertices)
124  return E_OUTOFMEMORY;
125  new_weights = HeapAlloc(GetProcessHeap(), 0, num_influences * sizeof(*weights));
126  if (!new_weights) {
127  HeapFree(GetProcessHeap(), 0, new_vertices);
128  return E_OUTOFMEMORY;
129  }
130  memcpy(new_vertices, vertices, num_influences * sizeof(*vertices));
131  memcpy(new_weights, weights, num_influences * sizeof(*weights));
132  }
133  bone = &skin->bones[bone_num];
137  bone->vertices = new_vertices;
138  bone->weights = new_weights;
139 
140  return D3D_OK;
141 }
142 
144  DWORD bone_num, DWORD influence_num, float weight)
145 {
146  FIXME("iface %p, bone_num %u, influence_num %u, weight %.8e stub!\n",
147  iface, bone_num, influence_num, weight);
148 
149  return E_NOTIMPL;
150 }
151 
152 static DWORD WINAPI d3dx9_skin_info_GetNumBoneInfluences(ID3DXSkinInfo *iface, DWORD bone_num)
153 {
154  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
155 
156  TRACE("iface %p, bone_num %u.\n", iface, bone_num);
157 
158  if (bone_num >= skin->num_bones)
159  return 0;
160 
161  return skin->bones[bone_num].num_influences;
162 }
163 
164 static HRESULT WINAPI d3dx9_skin_info_GetBoneInfluence(ID3DXSkinInfo *iface,
165  DWORD bone_num, DWORD *vertices, float *weights)
166 {
167  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
168  struct bone *bone;
169 
170  TRACE("iface %p, bone_num %u, vertices %p, weights %p.\n",
171  iface, bone_num, vertices, weights);
172 
173  if (bone_num >= skin->num_bones || !vertices)
174  return D3DERR_INVALIDCALL;
175 
176  bone = &skin->bones[bone_num];
177  if (!bone->num_influences)
178  return D3D_OK;
179 
181  if (weights)
183 
184  return D3D_OK;
185 }
186 
188  DWORD bone_num, DWORD influence_num, float *weight, DWORD *vertex_num)
189 {
190  FIXME("iface %p, bone_num %u, influence_num %u, weight %p, vertex_num %p stub!\n",
191  iface, bone_num, influence_num, weight, vertex_num);
192 
193  return E_NOTIMPL;
194 }
195 
196 static HRESULT WINAPI d3dx9_skin_info_GetMaxVertexInfluences(ID3DXSkinInfo *iface, DWORD *max_vertex_influences)
197 {
198  FIXME("iface %p, max_vertex_influences %p stub!\n", iface, max_vertex_influences);
199 
200  return E_NOTIMPL;
201 }
202 
203 static DWORD WINAPI d3dx9_skin_info_GetNumBones(ID3DXSkinInfo *iface)
204 {
205  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
206 
207  TRACE("iface %p.\n", iface);
208 
209  return skin->num_bones;
210 }
211 
213  DWORD bone_num, DWORD vertex_num, DWORD *influence_index)
214 {
215  FIXME("iface %p, bone_num %u, vertex_num %u, influence_index %p stub!\n",
216  iface, bone_num, vertex_num, influence_index);
217 
218  return E_NOTIMPL;
219 }
220 
221 static HRESULT WINAPI d3dx9_skin_info_GetMaxFaceInfluences(struct ID3DXSkinInfo *iface,
222  struct IDirect3DIndexBuffer9 *index_buffer, DWORD num_faces, DWORD *max_face_influences)
223 {
224  FIXME("iface %p, index_buffer %p, num_faces %u, max_face_influences %p stub!\n",
225  iface, index_buffer, num_faces, max_face_influences);
226 
227  return E_NOTIMPL;
228 }
229 
230 static HRESULT WINAPI d3dx9_skin_info_SetMinBoneInfluence(ID3DXSkinInfo *iface, float min_influence)
231 {
232  FIXME("iface %p, min_influence %.8e stub!\n", iface, min_influence);
233 
234  return E_NOTIMPL;
235 }
236 
237 static float WINAPI d3dx9_skin_info_GetMinBoneInfluence(ID3DXSkinInfo *iface)
238 {
239  FIXME("iface %p stub!\n", iface);
240 
241  return 0.0f;
242 }
243 
244 static HRESULT WINAPI d3dx9_skin_info_SetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx, const char *name)
245 {
246  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
247  char *new_name;
248  size_t size;
249 
250  TRACE("iface %p, bone_idx %u, name %s.\n", iface, bone_idx, debugstr_a(name));
251 
252  if (bone_idx >= skin->num_bones || !name)
253  return D3DERR_INVALIDCALL;
254 
255  size = strlen(name) + 1;
256  new_name = HeapAlloc(GetProcessHeap(), 0, size);
257  if (!new_name)
258  return E_OUTOFMEMORY;
259  memcpy(new_name, name, size);
260  HeapFree(GetProcessHeap(), 0, skin->bones[bone_idx].name);
261  skin->bones[bone_idx].name = new_name;
262 
263  return D3D_OK;
264 }
265 
266 static const char * WINAPI d3dx9_skin_info_GetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx)
267 {
268  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
269 
270  TRACE("iface %p, bone_idx %u.\n", iface, bone_idx);
271 
272  if (bone_idx >= skin->num_bones)
273  return NULL;
274 
275  return skin->bones[bone_idx].name;
276 }
277 
279  DWORD bone_num, const D3DXMATRIX *bone_transform)
280 {
281  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
282 
283  TRACE("iface %p, bone_num %u, bone_transform %p.\n", iface, bone_num, bone_transform);
284 
285  if (bone_num >= skin->num_bones || !bone_transform)
286  return D3DERR_INVALIDCALL;
287 
288  skin->bones[bone_num].transform = *bone_transform;
289  return D3D_OK;
290 }
291 
292 static D3DXMATRIX * WINAPI d3dx9_skin_info_GetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num)
293 {
294  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
295 
296  TRACE("iface %p, bone_num %u.\n", iface, bone_num);
297 
298  if (bone_num >= skin->num_bones)
299  return NULL;
300 
301  return &skin->bones[bone_num].transform;
302 }
303 
304 static HRESULT WINAPI d3dx9_skin_info_Clone(ID3DXSkinInfo *iface, ID3DXSkinInfo **skin_info)
305 {
306  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
307  unsigned int i;
308  HRESULT hr;
309 
310  TRACE("iface %p, skin_info %p.\n", iface, skin_info);
311 
312  if (FAILED(hr = D3DXCreateSkinInfo(skin->num_vertices, skin->vertex_declaration, skin->num_bones, skin_info)))
313  return hr;
314 
315  for (i = 0; i < skin->num_bones; ++i)
316  {
317  struct bone *current_bone = &skin->bones[i];
318 
319  if (current_bone->name && FAILED(hr = (*skin_info)->lpVtbl->SetBoneName(*skin_info, i, current_bone->name)))
320  break;
321  if (FAILED(hr = (*skin_info)->lpVtbl->SetBoneOffsetMatrix(*skin_info, i, &current_bone->transform)))
322  break;
323  if (current_bone->vertices && current_bone->weights
324  && FAILED(hr = (*skin_info)->lpVtbl->SetBoneInfluence(*skin_info, i, current_bone->num_influences,
325  current_bone->vertices, current_bone->weights)))
326  break;
327  }
328 
329  if (FAILED(hr))
330  (*skin_info)->lpVtbl->Release(*skin_info);
331 
332  return hr;
333 }
334 
335 static HRESULT WINAPI d3dx9_skin_info_Remap(ID3DXSkinInfo *iface, DWORD num_vertices, DWORD *vertex_remap)
336 {
337  FIXME("iface %p, num_vertices %u, vertex_remap %p stub!\n", iface, num_vertices, vertex_remap);
338 
339  return E_NOTIMPL;
340 }
341 
342 static HRESULT WINAPI d3dx9_skin_info_SetFVF(ID3DXSkinInfo *iface, DWORD fvf)
343 {
344  HRESULT hr;
346 
347  TRACE("iface %p, fvf %#x.\n", iface, fvf);
348 
350  if (FAILED(hr)) return hr;
351 
352  return iface->lpVtbl->SetDeclaration(iface, declaration);
353 }
354 
356 {
357  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
358  HRESULT hr;
359  int count;
360 
361  TRACE("iface %p, declaration %p.\n", iface, declaration);
362 
363  if (!declaration)
364  return D3DERR_INVALIDCALL;
365  for (count = 0; declaration[count].Stream != 0xff; count++) {
366  if (declaration[count].Stream != 0) {
367  WARN("Invalid vertex element %u; contains non-zero stream %u\n",
369  return D3DERR_INVALIDCALL;
370  }
371  }
372  count++;
373 
375 
376  if (FAILED(hr = D3DXFVFFromDeclarator(skin->vertex_declaration, &skin->fvf)))
377  skin->fvf = 0;
378 
379  return D3D_OK;
380 }
381 
382 static DWORD WINAPI d3dx9_skin_info_GetFVF(ID3DXSkinInfo *iface)
383 {
384  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
385 
386  TRACE("iface %p.\n", iface);
387 
388  return skin->fvf;
389 }
390 
391 static HRESULT WINAPI d3dx9_skin_info_GetDeclaration(ID3DXSkinInfo *iface,
393 {
394  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
395  UINT count = 0;
396 
397  TRACE("iface %p, declaration %p.\n", iface, declaration);
398 
399  while (skin->vertex_declaration[count++].Stream != 0xff);
400  memcpy(declaration, skin->vertex_declaration, count * sizeof(declaration[0]));
401  return D3D_OK;
402 }
403 
404 static HRESULT WINAPI d3dx9_skin_info_UpdateSkinnedMesh(ID3DXSkinInfo *iface, const D3DXMATRIX *bone_transforms,
405  const D3DXMATRIX *bone_inv_transpose_transforms, const void *src_vertices, void *dst_vertices)
406 {
407  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
409  DWORD i, j;
410 
411  TRACE("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p\n",
412  skin, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices);
413 
414  if (bone_inv_transpose_transforms)
415  FIXME("Skinning vertices with two position elements not supported\n");
416 
417  if ((skin->fvf & D3DFVF_POSITION_MASK) != D3DFVF_XYZ) {
418  FIXME("Vertex type %#x not supported\n", skin->fvf & D3DFVF_POSITION_MASK);
419  return E_FAIL;
420  }
421 
422  /* Reset all positions */
423  for (i = 0; i < skin->num_vertices; i++) {
424  D3DXVECTOR3 *position = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i);
425  position->x = 0.0f;
426  position->y = 0.0f;
427  position->z = 0.0f;
428  }
429 
430  /* Update positions that are influenced by bones */
431  for (i = 0; i < skin->num_bones; i++) {
432  D3DXMATRIX bone_inverse, matrix;
433 
434  D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
435  D3DXMatrixMultiply(&matrix, &bone_transforms[i], &bone_inverse);
436  D3DXMatrixMultiply(&matrix, &matrix, &skin->bones[i].transform);
437 
438  for (j = 0; j < skin->bones[i].num_influences; j++) {
439  D3DXVECTOR3 position;
440  D3DXVECTOR3 *position_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j]);
441  D3DXVECTOR3 *position_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j]);
442  FLOAT weight = skin->bones[i].weights[j];
443 
444  D3DXVec3TransformCoord(&position, position_src, &matrix);
445  position_dest->x += weight * position.x;
446  position_dest->y += weight * position.y;
447  position_dest->z += weight * position.z;
448  }
449  }
450 
451  if (skin->fvf & D3DFVF_NORMAL) {
452  /* Reset all normals */
453  for (i = 0; i < skin->num_vertices; i++) {
454  D3DXVECTOR3 *normal = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i + sizeof(D3DXVECTOR3));
455  normal->x = 0.0f;
456  normal->y = 0.0f;
457  normal->z = 0.0f;
458  }
459 
460  /* Update normals that are influenced by bones */
461  for (i = 0; i < skin->num_bones; i++) {
462  D3DXMATRIX bone_inverse, matrix;
463 
464  D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
465  D3DXMatrixMultiply(&matrix, &skin->bones[i].transform, &bone_transforms[i]);
466 
467  for (j = 0; j < skin->bones[i].num_influences; j++) {
469  D3DXVECTOR3 *normal_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
470  D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
471  FLOAT weight = skin->bones[i].weights[j];
472 
473  D3DXVec3TransformNormal(&normal, normal_src, &bone_inverse);
475  normal_dest->x += weight * normal.x;
476  normal_dest->y += weight * normal.y;
477  normal_dest->z += weight * normal.z;
478  }
479  }
480 
481  /* Normalize all normals that are influenced by bones*/
482  for (i = 0; i < skin->num_vertices; i++) {
483  D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + (i * size) + sizeof(D3DXVECTOR3));
484  if ((normal_dest->x != 0.0f) && (normal_dest->y != 0.0f) && (normal_dest->z != 0.0f))
485  D3DXVec3Normalize(normal_dest, normal_dest);
486  }
487  }
488 
489  return D3D_OK;
490 }
491 
492 static HRESULT WINAPI d3dx9_skin_info_ConvertToBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in,
493  DWORD options, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap,
494  ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations,
495  ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out)
496 {
497  FIXME("iface %p, mesh_in %p, options %#x, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, "
498  "max_face_infl %p, num_bone_combinations %p, bone_combination_table %p, mesh_out %p stub!\n",
499  iface, mesh_in, options, adjacency_in, adjacency_out, face_remap, vertex_remap,
500  max_face_infl, num_bone_combinations, bone_combination_table, mesh_out);
501 
502  return E_NOTIMPL;
503 }
504 
505 static HRESULT WINAPI d3dx9_skin_info_ConvertToIndexedBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in,
506  DWORD options, DWORD palette_size, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap,
507  ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations,
508  ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out)
509 {
510  FIXME("iface %p, mesh_in %p, options %#x, palette_size %u, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, "
511  "max_face_infl %p, num_bone_combinations %p, bone_combination_table %p, mesh_out %p stub!\n",
512  iface, mesh_in, options, palette_size, adjacency_in, adjacency_out, face_remap, vertex_remap,
513  max_face_infl, num_bone_combinations, bone_combination_table, mesh_out);
514 
515  return E_NOTIMPL;
516 }
517 
518 static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl =
519 {
547 };
548 
550  DWORD num_bones, ID3DXSkinInfo **skin_info)
551 {
552  HRESULT hr;
553  static const D3DVERTEXELEMENT9 empty_declaration = D3DDECL_END();
554  struct d3dx9_skin_info *object = NULL;
555 
556  TRACE("num_vertices %u, declaration %p, num_bones %u, skin_info %p.\n",
557  num_vertices, declaration, num_bones, skin_info);
558 
559  if (!skin_info || !declaration)
560  return D3DERR_INVALIDCALL;
561 
562  object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
563  if (!object)
564  return E_OUTOFMEMORY;
565 
566  object->ID3DXSkinInfo_iface.lpVtbl = &d3dx9_skin_info_vtbl;
567  object->ref = 1;
568  object->num_vertices = num_vertices;
569  object->num_bones = num_bones;
570  object->vertex_declaration[0] = empty_declaration;
571  object->fvf = 0;
572 
573  object->bones = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, num_bones * sizeof(*object->bones));
574  if (!object->bones) {
575  hr = E_OUTOFMEMORY;
576  goto error;
577  }
578 
579  if (FAILED(hr = d3dx9_skin_info_SetDeclaration(&object->ID3DXSkinInfo_iface, declaration)))
580  goto error;
581 
582  *skin_info = &object->ID3DXSkinInfo_iface;
583 
584  return D3D_OK;
585 error:
586  HeapFree(GetProcessHeap(), 0, object->bones);
587  HeapFree(GetProcessHeap(), 0, object);
588  return hr;
589 }
590 
592 {
593  HRESULT hr;
595 
596  TRACE("(%u, %x, %u, %p)\n", num_vertices, fvf, num_bones, skin_info);
597 
599  if (FAILED(hr))
600  return hr;
601 
603 }
struct bone * bones
Definition: skin.c:49
static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
Definition: skin.c:518
Definition: skin.c:31
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
D3DVERTEXELEMENT9 vertex_declaration[MAX_FVF_DECL_SIZE]
Definition: skin.c:46
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
static DWORD WINAPI d3dx9_skin_info_GetNumBones(ID3DXSkinInfo *iface)
Definition: skin.c:203
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1928
REFIID riid
Definition: precomp.h:44
GLuint GLenum matrix
Definition: glext.h:9407
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:397
static HRESULT WINAPI d3dx9_skin_info_GetMaxVertexInfluences(ID3DXSkinInfo *iface, DWORD *max_vertex_influences)
Definition: skin.c:196
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
static D3DXMATRIX *WINAPI d3dx9_skin_info_GetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num)
Definition: skin.c:292
static HRESULT WINAPI d3dx9_skin_info_Remap(ID3DXSkinInfo *iface, DWORD num_vertices, DWORD *vertex_remap)
Definition: skin.c:335
#define WARN(fmt,...)
Definition: debug.h:112
static DWORD WINAPI d3dx9_skin_info_GetNumBoneInfluences(ID3DXSkinInfo *iface, DWORD bone_num)
Definition: skin.c:152
#define D3DERR_INVALIDCALL
DWORD num_vertices
Definition: skin.c:47
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF)
Definition: mesh.c:2289
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT WINAPI d3dx9_skin_info_QueryInterface(ID3DXSkinInfo *iface, REFIID riid, void **out)
Definition: skin.c:57
static HRESULT WINAPI d3dx9_skin_info_SetMinBoneInfluence(ID3DXSkinInfo *iface, float min_influence)
Definition: skin.c:230
WINE_DEFAULT_DEBUG_CHANNEL(d3dx)
static HRESULT WINAPI d3dx9_skin_info_SetBoneVertexInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float weight)
Definition: skin.c:143
static HRESULT WINAPI d3dx9_skin_info_SetBoneInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD num_influences, const DWORD *vertices, const float *weights)
Definition: skin.c:107
DWORD fvf
Definition: skin.c:45
ID3DXSkinInfo ID3DXSkinInfo_iface
Definition: skin.c:42
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
long LONG
Definition: pedump.c:60
static HRESULT WINAPI d3dx9_skin_info_FindBoneVertexInfluenceIndex(ID3DXSkinInfo *iface, DWORD bone_num, DWORD vertex_num, DWORD *influence_index)
Definition: skin.c:212
static HRESULT WINAPI d3dx9_skin_info_ConvertToBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in, DWORD options, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations, ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out)
Definition: skin.c:492
static float WINAPI d3dx9_skin_info_GetMinBoneInfluence(ID3DXSkinInfo *iface)
Definition: skin.c:237
#define FIXME(fmt,...)
Definition: debug.h:111
ULONG Release()
static HRESULT WINAPI d3dx9_skin_info_SetFVF(ID3DXSkinInfo *iface, DWORD fvf)
Definition: skin.c:342
struct ID3DXBuffer ID3DXBuffer
Definition: d3dx8core.h:51
#define debugstr_guid
Definition: kernel32.h:35
static HRESULT WINAPI d3dx9_skin_info_GetBoneInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD *vertices, float *weights)
Definition: skin.c:164
static DWORD WINAPI d3dx9_skin_info_GetFVF(ID3DXSkinInfo *iface)
Definition: skin.c:382
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static HRESULT WINAPI d3dx9_skin_info_SetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num, const D3DXMATRIX *bone_transform)
Definition: skin.c:278
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
Definition: math.c:258
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
#define D3DFVF_XYZ
Definition: d3d8types.h:113
const GUID IID_IUnknown
static HRESULT WINAPI d3dx9_skin_info_GetDeclaration(ID3DXSkinInfo *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
Definition: skin.c:391
#define WINAPI
Definition: msvc.h:6
LONG ref
Definition: skin.c:43
struct _D3DVECTOR D3DXVECTOR3
Definition: d3dx9math.h:97
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT WINAPI d3dx9_skin_info_SetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx, const char *name)
Definition: skin.c:244
static HRESULT WINAPI d3dx9_skin_info_GetMaxFaceInfluences(struct ID3DXSkinInfo *iface, struct IDirect3DIndexBuffer9 *index_buffer, DWORD num_faces, DWORD *max_face_influences)
Definition: skin.c:221
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1895
HRESULT WINAPI D3DXFVFFromDeclarator(const D3DVERTEXELEMENT9 *declaration, DWORD *fvf)
Definition: mesh.c:2134
static HRESULT WINAPI d3dx9_skin_info_SetDeclaration(ID3DXSkinInfo *iface, const D3DVERTEXELEMENT9 *declaration)
Definition: skin.c:355
#define InterlockedDecrement
Definition: armddk.h:52
static unsigned int palette_size(DWORD flags)
Definition: palette.c:241
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const char *WINAPI d3dx9_skin_info_GetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx)
Definition: skin.c:266
static HRESULT WINAPI d3dx9_skin_info_UpdateSkinnedMesh(ID3DXSkinInfo *iface, const D3DXMATRIX *bone_transforms, const D3DXMATRIX *bone_inv_transpose_transforms, const void *src_vertices, void *dst_vertices)
Definition: skin.c:404
#define D3DDECL_END()
Definition: d3d9types.h:311
unsigned char BYTE
Definition: xxhash.c:193
HRESULT WINAPI D3DXCreateSkinInfo(DWORD num_vertices, const D3DVERTEXELEMENT9 *declaration, DWORD num_bones, ID3DXSkinInfo **skin_info)
Definition: skin.c:549
static HRESULT WINAPI d3dx9_skin_info_ConvertToIndexedBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in, DWORD options, DWORD palette_size, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations, ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out)
Definition: skin.c:505
HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD fvf, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
Definition: mesh.c:2036
#define D3D_OK
Definition: d3d.h:106
weight
Definition: sortkey.c:156
#define InterlockedIncrement
Definition: armddk.h:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI D3DXCreateSkinInfoFVF(DWORD num_vertices, DWORD fvf, DWORD num_bones, ID3DXSkinInfo **skin_info)
Definition: skin.c:591
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
FLOAT * weights
Definition: skin.c:37
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:52
static HRESULT WINAPI d3dx9_skin_info_Clone(ID3DXSkinInfo *iface, ID3DXSkinInfo **skin_info)
Definition: skin.c:304
Definition: name.c:38
float FLOAT
Definition: typedefs.h:69
static HRESULT WINAPI d3dx9_skin_info_GetBoneVertexInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float *weight, DWORD *vertex_num)
Definition: skin.c:187
DWORD * vertices
Definition: skin.c:36
unsigned int ULONG
Definition: retypes.h:1
static ULONG WINAPI d3dx9_skin_info_AddRef(ID3DXSkinInfo *iface)
Definition: skin.c:73
const GLbyte * weights
Definition: glext.h:6523
DWORD num_influences
Definition: skin.c:35
DWORD num_bones
Definition: skin.c:48
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1805
static ULONG WINAPI d3dx9_skin_info_Release(ID3DXSkinInfo *iface)
Definition: skin.c:83
#define HeapFree(x, y, z)
Definition: compat.h:594
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
char * name
Definition: skin.c:33
D3DXMATRIX transform
Definition: skin.c:34