ReactOS  0.4.13-dev-99-g7e18b6d
skin.c File Reference
#include "config.h"
#include "wine/port.h"
#include "d3dx9_private.h"
Include dependency graph for skin.c:

Go to the source code of this file.

Classes

struct  bone
 
struct  d3dx9_skin_info
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static struct d3dx9_skin_infoimpl_from_ID3DXSkinInfo (ID3DXSkinInfo *iface)
 
static HRESULT WINAPI d3dx9_skin_info_QueryInterface (ID3DXSkinInfo *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx9_skin_info_AddRef (ID3DXSkinInfo *iface)
 
static ULONG WINAPI d3dx9_skin_info_Release (ID3DXSkinInfo *iface)
 
static HRESULT WINAPI d3dx9_skin_info_SetBoneInfluence (ID3DXSkinInfo *iface, DWORD bone_num, DWORD num_influences, const DWORD *vertices, const float *weights)
 
static HRESULT WINAPI d3dx9_skin_info_SetBoneVertexInfluence (ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float weight)
 
static DWORD WINAPI d3dx9_skin_info_GetNumBoneInfluences (ID3DXSkinInfo *iface, DWORD bone_num)
 
static HRESULT WINAPI d3dx9_skin_info_GetBoneInfluence (ID3DXSkinInfo *iface, DWORD bone_num, DWORD *vertices, float *weights)
 
static HRESULT WINAPI d3dx9_skin_info_GetBoneVertexInfluence (ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float *weight, DWORD *vertex_num)
 
static HRESULT WINAPI d3dx9_skin_info_GetMaxVertexInfluences (ID3DXSkinInfo *iface, DWORD *max_vertex_influences)
 
static DWORD WINAPI d3dx9_skin_info_GetNumBones (ID3DXSkinInfo *iface)
 
static HRESULT WINAPI d3dx9_skin_info_FindBoneVertexInfluenceIndex (ID3DXSkinInfo *iface, DWORD bone_num, DWORD vertex_num, DWORD *influence_index)
 
static HRESULT WINAPI d3dx9_skin_info_GetMaxFaceInfluences (struct ID3DXSkinInfo *iface, struct IDirect3DIndexBuffer9 *index_buffer, DWORD num_faces, DWORD *max_face_influences)
 
static HRESULT WINAPI d3dx9_skin_info_SetMinBoneInfluence (ID3DXSkinInfo *iface, float min_influence)
 
static float WINAPI d3dx9_skin_info_GetMinBoneInfluence (ID3DXSkinInfo *iface)
 
static HRESULT WINAPI d3dx9_skin_info_SetBoneName (ID3DXSkinInfo *iface, DWORD bone_idx, const char *name)
 
static const char *WINAPI d3dx9_skin_info_GetBoneName (ID3DXSkinInfo *iface, DWORD bone_idx)
 
static HRESULT WINAPI d3dx9_skin_info_SetBoneOffsetMatrix (ID3DXSkinInfo *iface, DWORD bone_num, const D3DXMATRIX *bone_transform)
 
static D3DXMATRIX *WINAPI d3dx9_skin_info_GetBoneOffsetMatrix (ID3DXSkinInfo *iface, DWORD bone_num)
 
static HRESULT WINAPI d3dx9_skin_info_Clone (ID3DXSkinInfo *iface, ID3DXSkinInfo **skin_info)
 
static HRESULT WINAPI d3dx9_skin_info_Remap (ID3DXSkinInfo *iface, DWORD num_vertices, DWORD *vertex_remap)
 
static HRESULT WINAPI d3dx9_skin_info_SetFVF (ID3DXSkinInfo *iface, DWORD fvf)
 
static HRESULT WINAPI d3dx9_skin_info_SetDeclaration (ID3DXSkinInfo *iface, const D3DVERTEXELEMENT9 *declaration)
 
static DWORD WINAPI d3dx9_skin_info_GetFVF (ID3DXSkinInfo *iface)
 
static HRESULT WINAPI d3dx9_skin_info_GetDeclaration (ID3DXSkinInfo *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
 
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)
 
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)
 
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)
 
HRESULT WINAPI D3DXCreateSkinInfo (DWORD num_vertices, const D3DVERTEXELEMENT9 *declaration, DWORD num_bones, ID3DXSkinInfo **skin_info)
 
HRESULT WINAPI D3DXCreateSkinInfoFVF (DWORD num_vertices, DWORD fvf, DWORD num_bones, ID3DXSkinInfo **skin_info)
 
HRESULT create_dummy_skin (ID3DXSkinInfo **iface)
 

Variables

static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
 

Function Documentation

◆ create_dummy_skin()

HRESULT create_dummy_skin ( ID3DXSkinInfo **  iface)

Definition at line 579 of file skin.c.

580 {
581  static const D3DVERTEXELEMENT9 empty_declaration = D3DDECL_END();
582  struct d3dx9_skin_info *object = NULL;
583 
584  object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
585  if (!object) return E_OUTOFMEMORY;
586 
587  object->ID3DXSkinInfo_iface.lpVtbl = &d3dx9_skin_info_vtbl;
588  object->ref = 1;
589  object->num_vertices = 0;
590  object->num_bones = 0;
591  object->vertex_declaration[0] = empty_declaration;
592  object->fvf = 0;
593  object->bones = NULL;
594 
595  *iface = &object->ID3DXSkinInfo_iface;
596  return D3D_OK;
597 }
static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
Definition: skin.c:492
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define D3DDECL_END()
Definition: d3d9types.h:311
#define D3D_OK
Definition: d3d.h:106

Referenced by parse_mesh().

◆ d3dx9_skin_info_AddRef()

static ULONG WINAPI d3dx9_skin_info_AddRef ( ID3DXSkinInfo *  iface)
static

Definition at line 71 of file skin.c.

72 {
73  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
74  ULONG refcount = InterlockedIncrement(&skin->ref);
75 
76  TRACE("%p increasing refcount to %u.\n", skin, refcount);
77 
78  return refcount;
79 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG ref
Definition: skin.c:41
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
unsigned int ULONG
Definition: retypes.h:1

◆ d3dx9_skin_info_Clone()

static HRESULT WINAPI d3dx9_skin_info_Clone ( ID3DXSkinInfo *  iface,
ID3DXSkinInfo **  skin_info 
)
static

Definition at line 302 of file skin.c.

303 {
304  FIXME("iface %p, skin_info %p stub!\n", iface, skin_info);
305 
306  return E_NOTIMPL;
307 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_ConvertToBlendedMesh()

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 
)
static

Definition at line 466 of file skin.c.

470 {
471  FIXME("iface %p, mesh_in %p, options %#x, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, "
472  "max_face_infl %p, num_bone_combinations %p, bone_combination_table %p, mesh_out %p stub!\n",
473  iface, mesh_in, options, adjacency_in, adjacency_out, face_remap, vertex_remap,
474  max_face_infl, num_bone_combinations, bone_combination_table, mesh_out);
475 
476  return E_NOTIMPL;
477 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_ConvertToIndexedBlendedMesh()

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 
)
static

Definition at line 479 of file skin.c.

483 {
484  FIXME("iface %p, mesh_in %p, options %#x, palette_size %u, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, "
485  "max_face_infl %p, num_bone_combinations %p, bone_combination_table %p, mesh_out %p stub!\n",
486  iface, mesh_in, options, palette_size, adjacency_in, adjacency_out, face_remap, vertex_remap,
487  max_face_infl, num_bone_combinations, bone_combination_table, mesh_out);
488 
489  return E_NOTIMPL;
490 }
#define FIXME(fmt,...)
Definition: debug.h:110
static unsigned int palette_size(DWORD flags)
Definition: palette.c:241
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_FindBoneVertexInfluenceIndex()

static HRESULT WINAPI d3dx9_skin_info_FindBoneVertexInfluenceIndex ( ID3DXSkinInfo *  iface,
DWORD  bone_num,
DWORD  vertex_num,
DWORD influence_index 
)
static

Definition at line 210 of file skin.c.

212 {
213  FIXME("iface %p, bone_num %u, vertex_num %u, influence_index %p stub!\n",
214  iface, bone_num, vertex_num, influence_index);
215 
216  return E_NOTIMPL;
217 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_GetBoneInfluence()

static HRESULT WINAPI d3dx9_skin_info_GetBoneInfluence ( ID3DXSkinInfo *  iface,
DWORD  bone_num,
DWORD vertices,
float *  weights 
)
static

Definition at line 162 of file skin.c.

164 {
165  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
166  struct bone *bone;
167 
168  TRACE("iface %p, bone_num %u, vertices %p, weights %p.\n",
169  iface, bone_num, vertices, weights);
170 
171  if (bone_num >= skin->num_bones || !vertices)
172  return D3DERR_INVALIDCALL;
173 
174  bone = &skin->bones[bone_num];
175  if (!bone->num_influences)
176  return D3D_OK;
177 
179  if (weights)
181 
182  return D3D_OK;
183 }
struct bone * bones
Definition: skin.c:47
Definition: skin.c:29
#define D3DERR_INVALIDCALL
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
FLOAT * weights
Definition: skin.c:35
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
DWORD * vertices
Definition: skin.c:34
const GLbyte * weights
Definition: glext.h:6523
DWORD num_influences
Definition: skin.c:33
DWORD num_bones
Definition: skin.c:46

◆ d3dx9_skin_info_GetBoneName()

static const char* WINAPI d3dx9_skin_info_GetBoneName ( ID3DXSkinInfo *  iface,
DWORD  bone_idx 
)
static

Definition at line 264 of file skin.c.

265 {
266  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
267 
268  TRACE("iface %p, bone_idx %u.\n", iface, bone_idx);
269 
270  if (bone_idx >= skin->num_bones)
271  return NULL;
272 
273  return skin->bones[bone_idx].name;
274 }
struct bone * bones
Definition: skin.c:47
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
DWORD num_bones
Definition: skin.c:46

◆ d3dx9_skin_info_GetBoneOffsetMatrix()

static D3DXMATRIX* WINAPI d3dx9_skin_info_GetBoneOffsetMatrix ( ID3DXSkinInfo *  iface,
DWORD  bone_num 
)
static

Definition at line 290 of file skin.c.

291 {
292  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
293 
294  TRACE("iface %p, bone_num %u.\n", iface, bone_num);
295 
296  if (bone_num >= skin->num_bones)
297  return NULL;
298 
299  return &skin->bones[bone_num].transform;
300 }
struct bone * bones
Definition: skin.c:47
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
DWORD num_bones
Definition: skin.c:46

◆ d3dx9_skin_info_GetBoneVertexInfluence()

static HRESULT WINAPI d3dx9_skin_info_GetBoneVertexInfluence ( ID3DXSkinInfo *  iface,
DWORD  bone_num,
DWORD  influence_num,
float *  weight,
DWORD vertex_num 
)
static

Definition at line 185 of file skin.c.

187 {
188  FIXME("iface %p, bone_num %u, influence_num %u, weight %p, vertex_num %p stub!\n",
189  iface, bone_num, influence_num, weight, vertex_num);
190 
191  return E_NOTIMPL;
192 }
GLuint GLuint GLfloat weight
Definition: glext.h:11719
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_GetDeclaration()

static HRESULT WINAPI d3dx9_skin_info_GetDeclaration ( ID3DXSkinInfo *  iface,
D3DVERTEXELEMENT9  declaration[MAX_FVF_DECL_SIZE] 
)
static

Definition at line 365 of file skin.c.

367 {
368  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
369  UINT count = 0;
370 
371  TRACE("iface %p, declaration %p.\n", iface, declaration);
372 
373  while (skin->vertex_declaration[count++].Stream != 0xff);
374  memcpy(declaration, skin->vertex_declaration, count * sizeof(declaration[0]));
375  return D3D_OK;
376 }
D3DVERTEXELEMENT9 vertex_declaration[MAX_FVF_DECL_SIZE]
Definition: skin.c:44
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
unsigned int UINT
Definition: ndis.h:50
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50

◆ d3dx9_skin_info_GetFVF()

static DWORD WINAPI d3dx9_skin_info_GetFVF ( ID3DXSkinInfo *  iface)
static

Definition at line 356 of file skin.c.

357 {
358  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
359 
360  TRACE("iface %p.\n", iface);
361 
362  return skin->fvf;
363 }
DWORD fvf
Definition: skin.c:43
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50

◆ d3dx9_skin_info_GetMaxFaceInfluences()

static HRESULT WINAPI d3dx9_skin_info_GetMaxFaceInfluences ( struct ID3DXSkinInfo *  iface,
struct IDirect3DIndexBuffer9 *  index_buffer,
DWORD  num_faces,
DWORD max_face_influences 
)
static

Definition at line 219 of file skin.c.

221 {
222  FIXME("iface %p, index_buffer %p, num_faces %u, max_face_influences %p stub!\n",
223  iface, index_buffer, num_faces, max_face_influences);
224 
225  return E_NOTIMPL;
226 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_GetMaxVertexInfluences()

static HRESULT WINAPI d3dx9_skin_info_GetMaxVertexInfluences ( ID3DXSkinInfo *  iface,
DWORD max_vertex_influences 
)
static

Definition at line 194 of file skin.c.

195 {
196  FIXME("iface %p, max_vertex_influences %p stub!\n", iface, max_vertex_influences);
197 
198  return E_NOTIMPL;
199 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_GetMinBoneInfluence()

static float WINAPI d3dx9_skin_info_GetMinBoneInfluence ( ID3DXSkinInfo *  iface)
static

Definition at line 235 of file skin.c.

236 {
237  FIXME("iface %p stub!\n", iface);
238 
239  return 0.0f;
240 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ d3dx9_skin_info_GetNumBoneInfluences()

static DWORD WINAPI d3dx9_skin_info_GetNumBoneInfluences ( ID3DXSkinInfo *  iface,
DWORD  bone_num 
)
static

Definition at line 150 of file skin.c.

151 {
152  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
153 
154  TRACE("iface %p, bone_num %u.\n", iface, bone_num);
155 
156  if (bone_num >= skin->num_bones)
157  return 0;
158 
159  return skin->bones[bone_num].num_influences;
160 }
struct bone * bones
Definition: skin.c:47
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
DWORD num_bones
Definition: skin.c:46

◆ d3dx9_skin_info_GetNumBones()

static DWORD WINAPI d3dx9_skin_info_GetNumBones ( ID3DXSkinInfo *  iface)
static

Definition at line 201 of file skin.c.

202 {
203  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
204 
205  TRACE("iface %p.\n", iface);
206 
207  return skin->num_bones;
208 }
#define TRACE(s)
Definition: solgame.cpp:4
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
DWORD num_bones
Definition: skin.c:46

◆ d3dx9_skin_info_QueryInterface()

static HRESULT WINAPI d3dx9_skin_info_QueryInterface ( ID3DXSkinInfo *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 55 of file skin.c.

56 {
57  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
58 
59  if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXSkinInfo))
60  {
61  IUnknown_AddRef(iface);
62  *out = iface;
63  return D3D_OK;
64  }
65 
66  WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
67 
68  return E_NOINTERFACE;
69 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define D3D_OK
Definition: d3d.h:106
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ d3dx9_skin_info_Release()

static ULONG WINAPI d3dx9_skin_info_Release ( ID3DXSkinInfo *  iface)
static

Definition at line 81 of file skin.c.

82 {
83  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
84  ULONG refcount = InterlockedDecrement(&skin->ref);
85 
86  TRACE("%p decreasing refcount to %u.\n", skin, refcount);
87 
88  if (!refcount)
89  {
90  DWORD i;
91 
92  for (i = 0; i < skin->num_bones; ++i)
93  {
94  HeapFree(GetProcessHeap(), 0, skin->bones[i].name);
95  HeapFree(GetProcessHeap(), 0, skin->bones[i].vertices);
96  HeapFree(GetProcessHeap(), 0, skin->bones[i].weights);
97  }
98  if (skin->bones) HeapFree(GetProcessHeap(), 0, skin->bones);
99  HeapFree(GetProcessHeap(), 0, skin);
100  }
101 
102  return refcount;
103 }
struct bone * bones
Definition: skin.c:47
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 TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
LONG ref
Definition: skin.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define InterlockedDecrement
Definition: armddk.h:52
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
unsigned int ULONG
Definition: retypes.h:1
DWORD num_bones
Definition: skin.c:46
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ d3dx9_skin_info_Remap()

static HRESULT WINAPI d3dx9_skin_info_Remap ( ID3DXSkinInfo *  iface,
DWORD  num_vertices,
DWORD vertex_remap 
)
static

Definition at line 309 of file skin.c.

310 {
311  FIXME("iface %p, num_vertices %u, vertex_remap %p stub!\n", iface, num_vertices, vertex_remap);
312 
313  return E_NOTIMPL;
314 }
DWORD num_vertices
Definition: skin.c:45
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_SetBoneInfluence()

static HRESULT WINAPI d3dx9_skin_info_SetBoneInfluence ( ID3DXSkinInfo *  iface,
DWORD  bone_num,
DWORD  num_influences,
const DWORD vertices,
const float *  weights 
)
static

Definition at line 105 of file skin.c.

107 {
108  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
109  struct bone *bone;
110  DWORD *new_vertices = NULL;
111  FLOAT *new_weights = NULL;
112 
113  TRACE("iface %p, bone_num %u, num_influences %u, vertices %p, weights %p.\n",
114  iface, bone_num, num_influences, vertices, weights);
115 
116  if (bone_num >= skin->num_bones || !vertices || !weights)
117  return D3DERR_INVALIDCALL;
118 
119  if (num_influences) {
120  new_vertices = HeapAlloc(GetProcessHeap(), 0, num_influences * sizeof(*vertices));
121  if (!new_vertices)
122  return E_OUTOFMEMORY;
123  new_weights = HeapAlloc(GetProcessHeap(), 0, num_influences * sizeof(*weights));
124  if (!new_weights) {
125  HeapFree(GetProcessHeap(), 0, new_vertices);
126  return E_OUTOFMEMORY;
127  }
128  memcpy(new_vertices, vertices, num_influences * sizeof(*vertices));
129  memcpy(new_weights, weights, num_influences * sizeof(*weights));
130  }
131  bone = &skin->bones[bone_num];
135  bone->vertices = new_vertices;
136  bone->weights = new_weights;
137 
138  return D3D_OK;
139 }
struct bone * bones
Definition: skin.c:47
Definition: skin.c:29
#define D3DERR_INVALIDCALL
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
FLOAT * weights
Definition: skin.c:35
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
float FLOAT
Definition: typedefs.h:67
DWORD * vertices
Definition: skin.c:34
const GLbyte * weights
Definition: glext.h:6523
DWORD num_influences
Definition: skin.c:33
DWORD num_bones
Definition: skin.c:46
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ d3dx9_skin_info_SetBoneName()

static HRESULT WINAPI d3dx9_skin_info_SetBoneName ( ID3DXSkinInfo *  iface,
DWORD  bone_idx,
const char name 
)
static

Definition at line 242 of file skin.c.

243 {
244  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
245  char *new_name;
246  size_t size;
247 
248  TRACE("iface %p, bone_idx %u, name %s.\n", iface, bone_idx, debugstr_a(name));
249 
250  if (bone_idx >= skin->num_bones || !name)
251  return D3DERR_INVALIDCALL;
252 
253  size = strlen(name) + 1;
254  new_name = HeapAlloc(GetProcessHeap(), 0, size);
255  if (!new_name)
256  return E_OUTOFMEMORY;
257  memcpy(new_name, name, size);
258  HeapFree(GetProcessHeap(), 0, skin->bones[bone_idx].name);
259  skin->bones[bone_idx].name = new_name;
260 
261  return D3D_OK;
262 }
struct bone * bones
Definition: skin.c:47
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define D3DERR_INVALIDCALL
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
Definition: name.c:36
DWORD num_bones
Definition: skin.c:46
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ d3dx9_skin_info_SetBoneOffsetMatrix()

static HRESULT WINAPI d3dx9_skin_info_SetBoneOffsetMatrix ( ID3DXSkinInfo *  iface,
DWORD  bone_num,
const D3DXMATRIX bone_transform 
)
static

Definition at line 276 of file skin.c.

278 {
279  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
280 
281  TRACE("iface %p, bone_num %u, bone_transform %p.\n", iface, bone_num, bone_transform);
282 
283  if (bone_num >= skin->num_bones || !bone_transform)
284  return D3DERR_INVALIDCALL;
285 
286  skin->bones[bone_num].transform = *bone_transform;
287  return D3D_OK;
288 }
struct bone * bones
Definition: skin.c:47
#define D3DERR_INVALIDCALL
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
DWORD num_bones
Definition: skin.c:46

◆ d3dx9_skin_info_SetBoneVertexInfluence()

static HRESULT WINAPI d3dx9_skin_info_SetBoneVertexInfluence ( ID3DXSkinInfo *  iface,
DWORD  bone_num,
DWORD  influence_num,
float  weight 
)
static

Definition at line 141 of file skin.c.

143 {
144  FIXME("iface %p, bone_num %u, influence_num %u, weight %.8e stub!\n",
145  iface, bone_num, influence_num, weight);
146 
147  return E_NOTIMPL;
148 }
GLuint GLuint GLfloat weight
Definition: glext.h:11719
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_SetDeclaration()

static HRESULT WINAPI d3dx9_skin_info_SetDeclaration ( ID3DXSkinInfo *  iface,
const D3DVERTEXELEMENT9 declaration 
)
static

Definition at line 329 of file skin.c.

330 {
331  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
332  HRESULT hr;
333  int count;
334 
335  TRACE("iface %p, declaration %p.\n", iface, declaration);
336 
337  if (!declaration)
338  return D3DERR_INVALIDCALL;
339  for (count = 0; declaration[count].Stream != 0xff; count++) {
340  if (declaration[count].Stream != 0) {
341  WARN("Invalid vertex element %u; contains non-zero stream %u\n",
343  return D3DERR_INVALIDCALL;
344  }
345  }
346  count++;
347 
349 
350  if (FAILED(hr = D3DXFVFFromDeclarator(skin->vertex_declaration, &skin->fvf)))
351  skin->fvf = 0;
352 
353  return D3D_OK;
354 }
D3DVERTEXELEMENT9 vertex_declaration[MAX_FVF_DECL_SIZE]
Definition: skin.c:44
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define D3DERR_INVALIDCALL
DWORD fvf
Definition: skin.c:43
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
HRESULT WINAPI D3DXFVFFromDeclarator(const D3DVERTEXELEMENT9 *declaration, DWORD *fvf)
Definition: mesh.c:2135
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

Referenced by D3DXCreateSkinInfo().

◆ d3dx9_skin_info_SetFVF()

static HRESULT WINAPI d3dx9_skin_info_SetFVF ( ID3DXSkinInfo *  iface,
DWORD  fvf 
)
static

Definition at line 316 of file skin.c.

317 {
318  HRESULT hr;
320 
321  TRACE("iface %p, fvf %#x.\n", iface, fvf);
322 
324  if (FAILED(hr)) return hr;
325 
326  return iface->lpVtbl->SetDeclaration(iface, declaration);
327 }
HRESULT hr
Definition: shlfolder.c:183
DWORD fvf
Definition: skin.c:43
HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD fvf, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
Definition: mesh.c:2037
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77

◆ d3dx9_skin_info_SetMinBoneInfluence()

static HRESULT WINAPI d3dx9_skin_info_SetMinBoneInfluence ( ID3DXSkinInfo *  iface,
float  min_influence 
)
static

Definition at line 228 of file skin.c.

229 {
230  FIXME("iface %p, min_influence %.8e stub!\n", iface, min_influence);
231 
232  return E_NOTIMPL;
233 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_skin_info_UpdateSkinnedMesh()

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 
)
static

Definition at line 378 of file skin.c.

380 {
381  struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
383  DWORD i, j;
384 
385  TRACE("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p\n",
386  skin, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices);
387 
388  if (bone_inv_transpose_transforms)
389  FIXME("Skinning vertices with two position elements not supported\n");
390 
391  if ((skin->fvf & D3DFVF_POSITION_MASK) != D3DFVF_XYZ) {
392  FIXME("Vertex type %#x not supported\n", skin->fvf & D3DFVF_POSITION_MASK);
393  return E_FAIL;
394  }
395 
396  /* Reset all positions */
397  for (i = 0; i < skin->num_vertices; i++) {
398  D3DXVECTOR3 *position = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i);
399  position->x = 0.0f;
400  position->y = 0.0f;
401  position->z = 0.0f;
402  }
403 
404  /* Update positions that are influenced by bones */
405  for (i = 0; i < skin->num_bones; i++) {
406  D3DXMATRIX bone_inverse, matrix;
407 
408  D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
409  D3DXMatrixMultiply(&matrix, &bone_transforms[i], &bone_inverse);
410  D3DXMatrixMultiply(&matrix, &matrix, &skin->bones[i].transform);
411 
412  for (j = 0; j < skin->bones[i].num_influences; j++) {
413  D3DXVECTOR3 position;
414  D3DXVECTOR3 *position_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j]);
415  D3DXVECTOR3 *position_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j]);
416  FLOAT weight = skin->bones[i].weights[j];
417 
418  D3DXVec3TransformCoord(&position, position_src, &matrix);
419  position_dest->x += weight * position.x;
420  position_dest->y += weight * position.y;
421  position_dest->z += weight * position.z;
422  }
423  }
424 
425  if (skin->fvf & D3DFVF_NORMAL) {
426  /* Reset all normals */
427  for (i = 0; i < skin->num_vertices; i++) {
428  D3DXVECTOR3 *normal = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i + sizeof(D3DXVECTOR3));
429  normal->x = 0.0f;
430  normal->y = 0.0f;
431  normal->z = 0.0f;
432  }
433 
434  /* Update normals that are influenced by bones */
435  for (i = 0; i < skin->num_bones; i++) {
436  D3DXMATRIX bone_inverse, matrix;
437 
438  D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
439  D3DXMatrixMultiply(&matrix, &skin->bones[i].transform, &bone_transforms[i]);
440 
441  for (j = 0; j < skin->bones[i].num_influences; j++) {
443  D3DXVECTOR3 *normal_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
444  D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
445  FLOAT weight = skin->bones[i].weights[j];
446 
447  D3DXVec3TransformNormal(&normal, normal_src, &bone_inverse);
449  normal_dest->x += weight * normal.x;
450  normal_dest->y += weight * normal.y;
451  normal_dest->z += weight * normal.z;
452  }
453  }
454 
455  /* Normalize all normals that are influenced by bones*/
456  for (i = 0; i < skin->num_vertices; i++) {
457  D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + (i * size) + sizeof(D3DXVECTOR3));
458  if ((normal_dest->x != 0.0f) && (normal_dest->y != 0.0f) && (normal_dest->z != 0.0f))
459  D3DXVec3Normalize(normal_dest, normal_dest);
460  }
461  }
462 
463  return D3D_OK;
464 }
struct bone * bones
Definition: skin.c:47
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1972
GLuint GLenum matrix
Definition: glext.h:9407
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:393
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
DWORD num_vertices
Definition: skin.c:45
#define E_FAIL
Definition: ddrawi.h:102
GLuint GLuint GLfloat weight
Definition: glext.h:11719
DWORD fvf
Definition: skin.c:43
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 D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
#define FIXME(fmt,...)
Definition: debug.h:110
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF)
Definition: mesh.c:2290
smooth NULL
Definition: ftsmooth.c:416
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
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
Definition: math.c:254
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define D3DFVF_XYZ
Definition: d3d8types.h:113
struct _D3DVECTOR D3DXVECTOR3
Definition: d3dx9math.h:97
unsigned long DWORD
Definition: ntddk_ex.h:95
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1939
unsigned char BYTE
Definition: mem.h:68
#define D3D_OK
Definition: d3d.h:106
static struct d3dx9_skin_info * impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface)
Definition: skin.c:50
float FLOAT
Definition: typedefs.h:67
DWORD num_bones
Definition: skin.c:46
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1849

◆ D3DXCreateSkinInfo()

HRESULT WINAPI D3DXCreateSkinInfo ( DWORD  num_vertices,
const D3DVERTEXELEMENT9 declaration,
DWORD  num_bones,
ID3DXSkinInfo **  skin_info 
)

Definition at line 523 of file skin.c.

525 {
526  HRESULT hr;
527  static const D3DVERTEXELEMENT9 empty_declaration = D3DDECL_END();
528  struct d3dx9_skin_info *object = NULL;
529 
530  TRACE("num_vertices %u, declaration %p, num_bones %u, skin_info %p.\n",
531  num_vertices, declaration, num_bones, skin_info);
532 
533  if (!skin_info || !declaration)
534  return D3DERR_INVALIDCALL;
535 
536  object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
537  if (!object)
538  return E_OUTOFMEMORY;
539 
540  object->ID3DXSkinInfo_iface.lpVtbl = &d3dx9_skin_info_vtbl;
541  object->ref = 1;
542  object->num_vertices = num_vertices;
543  object->num_bones = num_bones;
544  object->vertex_declaration[0] = empty_declaration;
545  object->fvf = 0;
546 
547  object->bones = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, num_bones * sizeof(*object->bones));
548  if (!object->bones) {
549  hr = E_OUTOFMEMORY;
550  goto error;
551  }
552 
553  if (FAILED(hr = d3dx9_skin_info_SetDeclaration(&object->ID3DXSkinInfo_iface, declaration)))
554  goto error;
555 
556  *skin_info = &object->ID3DXSkinInfo_iface;
557 
558  return D3D_OK;
559 error:
560  HeapFree(GetProcessHeap(), 0, object->bones);
561  HeapFree(GetProcessHeap(), 0, object);
562  return hr;
563 }
static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
Definition: skin.c:492
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
#define D3DERR_INVALIDCALL
DWORD num_vertices
Definition: skin.c:45
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
static HRESULT WINAPI d3dx9_skin_info_SetDeclaration(ID3DXSkinInfo *iface, const D3DVERTEXELEMENT9 *declaration)
Definition: skin.c:329
#define D3DDECL_END()
Definition: d3d9types.h:311
#define D3D_OK
Definition: d3d.h:106
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD num_bones
Definition: skin.c:46
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by D3DXCreateSkinInfoFVF().

◆ D3DXCreateSkinInfoFVF()

HRESULT WINAPI D3DXCreateSkinInfoFVF ( DWORD  num_vertices,
DWORD  fvf,
DWORD  num_bones,
ID3DXSkinInfo **  skin_info 
)

Definition at line 565 of file skin.c.

566 {
567  HRESULT hr;
569 
570  TRACE("(%u, %x, %u, %p)\n", num_vertices, fvf, num_bones, skin_info);
571 
573  if (FAILED(hr))
574  return hr;
575 
577 }
HRESULT hr
Definition: shlfolder.c:183
DWORD num_vertices
Definition: skin.c:45
DWORD fvf
Definition: skin.c:43
HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD fvf, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
Definition: mesh.c:2037
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI D3DXCreateSkinInfo(DWORD num_vertices, const D3DVERTEXELEMENT9 *declaration, DWORD num_bones, ID3DXSkinInfo **skin_info)
Definition: skin.c:523
DWORD num_bones
Definition: skin.c:46

Referenced by parse_skin_mesh_info().

◆ impl_from_ID3DXSkinInfo()

static struct d3dx9_skin_info* impl_from_ID3DXSkinInfo ( ID3DXSkinInfo *  iface)
inlinestatic

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dx  )

Variable Documentation

◆ d3dx9_skin_info_vtbl

const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
static
Initial value:
=
{
}
static DWORD WINAPI d3dx9_skin_info_GetNumBones(ID3DXSkinInfo *iface)
Definition: skin.c:201
static HRESULT WINAPI d3dx9_skin_info_GetMaxVertexInfluences(ID3DXSkinInfo *iface, DWORD *max_vertex_influences)
Definition: skin.c:194
static D3DXMATRIX *WINAPI d3dx9_skin_info_GetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num)
Definition: skin.c:290
static HRESULT WINAPI d3dx9_skin_info_Remap(ID3DXSkinInfo *iface, DWORD num_vertices, DWORD *vertex_remap)
Definition: skin.c:309
static DWORD WINAPI d3dx9_skin_info_GetNumBoneInfluences(ID3DXSkinInfo *iface, DWORD bone_num)
Definition: skin.c:150
static HRESULT WINAPI d3dx9_skin_info_QueryInterface(ID3DXSkinInfo *iface, REFIID riid, void **out)
Definition: skin.c:55
static HRESULT WINAPI d3dx9_skin_info_SetMinBoneInfluence(ID3DXSkinInfo *iface, float min_influence)
Definition: skin.c:228
static HRESULT WINAPI d3dx9_skin_info_SetBoneVertexInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float weight)
Definition: skin.c:141
static HRESULT WINAPI d3dx9_skin_info_SetBoneInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD num_influences, const DWORD *vertices, const float *weights)
Definition: skin.c:105
static HRESULT WINAPI d3dx9_skin_info_FindBoneVertexInfluenceIndex(ID3DXSkinInfo *iface, DWORD bone_num, DWORD vertex_num, DWORD *influence_index)
Definition: skin.c:210
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:466
static float WINAPI d3dx9_skin_info_GetMinBoneInfluence(ID3DXSkinInfo *iface)
Definition: skin.c:235
static HRESULT WINAPI d3dx9_skin_info_SetFVF(ID3DXSkinInfo *iface, DWORD fvf)
Definition: skin.c:316
static HRESULT WINAPI d3dx9_skin_info_GetBoneInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD *vertices, float *weights)
Definition: skin.c:162
static DWORD WINAPI d3dx9_skin_info_GetFVF(ID3DXSkinInfo *iface)
Definition: skin.c:356
static HRESULT WINAPI d3dx9_skin_info_SetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num, const D3DXMATRIX *bone_transform)
Definition: skin.c:276
static HRESULT WINAPI d3dx9_skin_info_GetDeclaration(ID3DXSkinInfo *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
Definition: skin.c:365
static HRESULT WINAPI d3dx9_skin_info_SetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx, const char *name)
Definition: skin.c:242
static HRESULT WINAPI d3dx9_skin_info_GetMaxFaceInfluences(struct ID3DXSkinInfo *iface, struct IDirect3DIndexBuffer9 *index_buffer, DWORD num_faces, DWORD *max_face_influences)
Definition: skin.c:219
static HRESULT WINAPI d3dx9_skin_info_SetDeclaration(ID3DXSkinInfo *iface, const D3DVERTEXELEMENT9 *declaration)
Definition: skin.c:329
static const char *WINAPI d3dx9_skin_info_GetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx)
Definition: skin.c:264
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:378
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:479
static HRESULT WINAPI d3dx9_skin_info_Clone(ID3DXSkinInfo *iface, ID3DXSkinInfo **skin_info)
Definition: skin.c:302
static HRESULT WINAPI d3dx9_skin_info_GetBoneVertexInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float *weight, DWORD *vertex_num)
Definition: skin.c:185
static ULONG WINAPI d3dx9_skin_info_AddRef(ID3DXSkinInfo *iface)
Definition: skin.c:71
static ULONG WINAPI d3dx9_skin_info_Release(ID3DXSkinInfo *iface)
Definition: skin.c:81

Definition at line 492 of file skin.c.

Referenced by create_dummy_skin(), and D3DXCreateSkinInfo().