ReactOS 0.4.15-dev-8116-gf69e256
d3dx9mesh.h File Reference
#include <d3dx9.h>
Include dependency graph for d3dx9mesh.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _D3DXATTRIBUTERANGE
 
struct  _D3DXMATERIAL
 
struct  _D3DXEFFECTDEFAULT
 
struct  _D3DXEFFECTINSTANCE
 
struct  _D3DXATTRIBUTEWEIGHTS
 
struct  _D3DXWELDEPSILONS
 
struct  _D3DXBONECOMBINATION
 
struct  _D3DXPATCHINFO
 
struct  _D3DXINTERSECTINFO
 
struct  _D3DXSHMATERIAL
 
struct  _D3DXSHPRTSPLITMESHVERTDATA
 
struct  _D3DXSHPRTSPLITMESHCLUSTERDATA
 
struct  _XFILECOMPRESSEDANIMATIONSET
 

Macros

#define UNUSED16   (0xffff)
 
#define UNUSED32   (0xffffffff)
 
#define INTERFACE   ID3DXBaseMesh
 
#define INTERFACE   ID3DXMesh
 
#define INTERFACE   ID3DXPMesh
 
#define INTERFACE   ID3DXSPMesh
 
#define INTERFACE   ID3DXPatchMesh
 
#define INTERFACE   ID3DXSkinInfo
 
#define INTERFACE   ID3DXPRTBuffer
 
#define INTERFACE   ID3DXPRTCompBuffer
 
#define INTERFACE   ID3DXTextureGutterHelper
 
#define INTERFACE   ID3DXPRTEngine
 
#define D3DXLoadMeshFromX   WINELIB_NAME_AW(D3DXLoadMeshFromX)
 
#define D3DXLoadPRTBufferFromFile   WINELIB_NAME_AW(D3DXLoadPRTBufferFromFile)
 
#define D3DXLoadPRTCompBufferFromFile   WINELIB_NAME_AW(D3DXLoadPRTCompBufferFromFile)
 
#define D3DXSaveMeshToX   WINELIB_NAME_AW(D3DXSaveMeshToX)
 
#define D3DXSavePRTBufferToFile   WINELIB_NAME_AW(D3DXSavePRTBufferToFile)
 
#define D3DXSavePRTCompBufferToFile   WINELIB_NAME_AW(D3DXSavePRTCompBufferToFile)
 
#define XSKINEXP_TEMPLATES    "xof 0303txt 0032\ template XSkinMeshHeader \ { \ <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ WORD nMaxSkinWeightsPerVertex; \ WORD nMaxSkinWeightsPerFace; \ WORD nBones; \ } \ template VertexDuplicationIndices \ { \ <B8D65549-D7C9-4995-89CF-53A9A8B031E3> \ DWORD nIndices; \ DWORD nOriginalVertices; \ array DWORD indices[nIndices]; \ } \ template FaceAdjacency \ { \ <A64C844A-E282-4756-8B80-250CDE04398C> \ DWORD nIndices; \ array DWORD indices[nIndices]; \ } \ template SkinWeights \ { \ <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ STRING transformNodeName; \ DWORD nWeights; \ array DWORD vertexIndices[nWeights]; \ array float weights[nWeights]; \ Matrix4x4 matrixOffset; \ } \ template Patch \ { \ <A3EB5D44-FC22-429D-9AFB-3221CB9719A6> \ DWORD nControlIndices; \ array DWORD controlIndices[nControlIndices]; \ } \ template PatchMesh \ { \ <D02C95CC-EDBA-4305-9B5D-1820D7704BBF> \ DWORD nVertices; \ array Vector vertices[nVertices]; \ DWORD nPatches; \ array Patch patches[nPatches]; \ [ ... ] \ } \ template PatchMesh9 \ { \ <B9EC94E1-B9A6-4251-BA18-94893F02C0EA> \ DWORD Type; \ DWORD Degree; \ DWORD Basis; \ DWORD nVertices; \ array Vector vertices[nVertices]; \ DWORD nPatches; \ array Patch patches[nPatches]; \ [ ... ] \ } template EffectFloats \ { \ <F1CFE2B3-0DE3-4e28-AFA1-155A750A282D> \ DWORD nFloats; \ array float Floats[nFloats]; \ } \ template EffectString \ { \ <D55B097E-BDB6-4c52-B03D-6051C89D0E42> \ STRING Value; \ } \ template EffectDWord \ { \ <622C0ED0-956E-4da9-908A-2AF94F3CE716> \ DWORD Value; \ } template EffectParamFloats \ { \ <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> \ STRING ParamName; \ DWORD nFloats; \ array float Floats[nFloats]; \ } template EffectParamString \ { \ <1DBC4C88-94C1-46ee-9076-2C28818C9481> \ STRING ParamName; \ STRING Value; \ } \ template EffectParamDWord \ { \ <E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5> \ STRING ParamName; \ DWORD Value; \ } \ template EffectInstance \ { \ <E331F7E4-0559-4cc2-8E99-1CEC1657928F> \ STRING EffectFilename; \ [ ... ] \ } template AnimTicksPerSecond \ { \ <9E415A43-7BA6-4a73-8743-B73D47E88476> \ DWORD AnimTicksPerSecond; \ } \ template CompressedAnimationSet \ { \ <7F9B00B3-F125-4890-876E-1C42BF697C4D> \ DWORD CompressedBlockSize; \ FLOAT TicksPerSec; \ DWORD PlaybackType; \ DWORD BufferLength; \ array DWORD CompressedData[BufferLength]; \ } "
 
#define XEXTENSIONS_TEMPLATES    "xof 0303txt 0032\ template FVFData \ { \ <B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897> \ DWORD dwFVF; \ DWORD nDWords; \ array DWORD data[nDWords]; \ } \ template VertexElement \ { \ <F752461C-1E23-48f6-B9F8-8350850F336F> \ DWORD Type; \ DWORD Method; \ DWORD Usage; \ DWORD UsageIndex; \ } \ template DeclData \ { \ <BF22E553-292C-4781-9FEA-62BD554BDD93> \ DWORD nElements; \ array VertexElement Elements[nElements]; \ DWORD nDWords; \ array DWORD data[nDWords]; \ } \ template PMAttributeRange \ { \ <917E0427-C61E-4a14-9C64-AFE65F9E9844> \ DWORD iFaceOffset; \ DWORD nFacesMin; \ DWORD nFacesMax; \ DWORD iVertexOffset; \ DWORD nVerticesMin; \ DWORD nVerticesMax; \ } \ template PMVSplitRecord \ { \ <574CCC14-F0B3-4333-822D-93E8A8A08E4C> \ DWORD iFaceCLW; \ DWORD iVlrOffset; \ DWORD iCode; \ } \ template PMInfo \ { \ <B6C3E656-EC8B-4b92-9B62-681659522947> \ DWORD nAttributes; \ array PMAttributeRange attributeRanges[nAttributes]; \ DWORD nMaxValence; \ DWORD nMinLogicalVertices; \ DWORD nMaxLogicalVertices; \ DWORD nVSplits; \ array PMVSplitRecord splitRecords[nVSplits]; \ DWORD nAttributeMispredicts; \ array DWORD attributeMispredicts[nAttributeMispredicts]; \ } "
 

Typedefs

typedef enum _D3DXPATCHMESHTYPE D3DXPATCHMESHTYPE
 
typedef enum D3DXCLEANTYPE D3DXCLEANTYPE
 
typedef enum _D3DXTANGENT D3DXTANGENT
 
typedef enum _D3DXIMT D3DXIMT
 
typedef enum _D3DXUVATLAS D3DXUVATLAS
 
typedef enum _D3DXEFFECTDEFAULTTYPE D3DXEFFECTDEFAULTTYPE
 
typedef enum _D3DXSHCOMPRESSQUALITYTYPE D3DXSHCOMPRESSQUALITYTYPE
 
typedef enum _D3DXSHGPUSIMOPT D3DXSHGPUSIMOPT
 
typedef struct ID3DXBaseMesh * LPD3DXBASEMESH
 
typedef struct ID3DXMesh * LPD3DXMESH
 
typedef struct ID3DXPMesh * LPD3DXPMESH
 
typedef struct ID3DXSPMesh * LPD3DXSPMESH
 
typedef struct ID3DXSkinInfo * LPD3DXSKININFO
 
typedef struct ID3DXPatchMesh * LPD3DXPATCHMESH
 
typedef struct ID3DXPRTBuffer * LPD3DXPRTBUFFER
 
typedef struct ID3DXPRTCompBuffer * LPD3DXPRTCOMPBUFFER
 
typedef struct ID3DXPRTEngine * LPD3DXPRTENGINE
 
typedef struct ID3DXTextureGutterHelper * LPD3DXTEXTUREGUTTERHELPER
 
typedef struct _D3DXATTRIBUTERANGE D3DXATTRIBUTERANGE
 
typedef D3DXATTRIBUTERANGELPD3DXATTRIBUTERANGE
 
typedef struct _D3DXMATERIAL D3DXMATERIAL
 
typedef struct _D3DXMATERIALLPD3DXMATERIAL
 
typedef struct _D3DXEFFECTDEFAULT D3DXEFFECTDEFAULT
 
typedef struct _D3DXEFFECTDEFAULTLPD3DXEFFECTDEFAULT
 
typedef struct _D3DXEFFECTINSTANCE D3DXEFFECTINSTANCE
 
typedef struct _D3DXEFFECTINSTANCELPD3DXEFFECTINSTANCE
 
typedef struct _D3DXATTRIBUTEWEIGHTS D3DXATTRIBUTEWEIGHTS
 
typedef struct _D3DXATTRIBUTEWEIGHTSLPD3DXATTRIBUTEWEIGHTS
 
typedef struct _D3DXWELDEPSILONS D3DXWELDEPSILONS
 
typedef struct _D3DXWELDEPSILONSLPD3DXWELDEPSILONS
 
typedef struct _D3DXBONECOMBINATION D3DXBONECOMBINATION
 
typedef struct _D3DXBONECOMBINATIONLPD3DXBONECOMBINATION
 
typedef struct _D3DXPATCHINFO D3DXPATCHINFO
 
typedef struct _D3DXPATCHINFOLPD3DXPATCHINFO
 
typedef struct _D3DXINTERSECTINFO D3DXINTERSECTINFO
 
typedef struct _D3DXINTERSECTINFOLPD3DXINTERSECTINFO
 
typedef struct _D3DXSHMATERIAL D3DXSHMATERIAL
 
typedef struct _D3DXSHPRTSPLITMESHVERTDATA D3DXSHPRTSPLITMESHVERTDATA
 
typedef struct _D3DXSHPRTSPLITMESHCLUSTERDATA D3DXSHPRTSPLITMESHCLUSTERDATA
 
typedef struct _XFILECOMPRESSEDANIMATIONSET XFILECOMPRESSEDANIMATIONSET
 
typedef HRESULT(WINAPILPD3DXUVATLASCB) (float complete, void *ctx)
 
typedef HRESULT(WINAPILPD3DXIMTSIGNALCALLBACK) (const D3DXVECTOR2 *, UINT, UINT, void *, FLOAT *)
 
typedef HRESULT(WINAPILPD3DXSHPRTSIMCB) (float complete, void *ctx)
 

Enumerations

enum  _MAX_FVF_DECL_SIZE { MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 }
 
enum  _D3DXMESH {
  D3DXMESH_32BIT = 0x001 , D3DXMESH_DONOTCLIP = 0x002 , D3DXMESH_POINTS = 0x004 , D3DXMESH_RTPATCHES = 0x008 ,
  D3DXMESH_NPATCHES = 0x4000 , D3DXMESH_VB_SYSTEMMEM = 0x010 , D3DXMESH_VB_MANAGED = 0x020 , D3DXMESH_VB_WRITEONLY = 0x040 ,
  D3DXMESH_VB_DYNAMIC = 0x080 , D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000 , D3DXMESH_IB_SYSTEMMEM = 0x100 , D3DXMESH_IB_MANAGED = 0x200 ,
  D3DXMESH_IB_WRITEONLY = 0x400 , D3DXMESH_IB_DYNAMIC = 0x800 , D3DXMESH_IB_SOFTWAREPROCESSING = 0x10000 , D3DXMESH_VB_SHARE = 0x1000 ,
  D3DXMESH_USEHWONLY = 0x2000 , D3DXMESH_SYSTEMMEM = 0x110 , D3DXMESH_MANAGED = 0x220 , D3DXMESH_WRITEONLY = 0x440 ,
  D3DXMESH_DYNAMIC = 0x880 , D3DXMESH_SOFTWAREPROCESSING = 0x18000
}
 
enum  _D3DXMESHOPT {
  D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000 , D3DXMESHOPT_COMPACT = 0x01000000 , D3DXMESHOPT_ATTRSORT = 0x02000000 , D3DXMESHOPT_VERTEXCACHE = 0x04000000 ,
  D3DXMESHOPT_STRIPREORDER = 0x08000000 , D3DXMESHOPT_IGNOREVERTS = 0x10000000 , D3DXMESHOPT_DONOTSPLIT = 0x20000000
}
 
enum  _D3DXPATCHMESHTYPE { D3DXPATCHMESH_RECT = 1 , D3DXPATCHMESH_TRI = 2 , D3DXPATCHMESH_NPATCH = 3 , D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff }
 
enum  _D3DXPATCHMESH { D3DXPATCHMESH_DEFAULT = 0 }
 
enum  _D3DXMESHSIMP { D3DXMESHSIMP_VERTEX = 0x1 , D3DXMESHSIMP_FACE = 0x2 }
 
enum  D3DXCLEANTYPE {
  D3DXCLEAN_BACKFACING = 0x00000001 , D3DXCLEAN_BOWTIES = 0x00000002 , D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING , D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING ,
  D3DXCLEAN_SIMPLIFICATION = D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES
}
 
enum  _D3DXTANGENT {
  D3DXTANGENT_WRAP_U = 0x0001 , D3DXTANGENT_WRAP_V = 0x0002 , D3DXTANGENT_WRAP_UV = 0x0003 , D3DXTANGENT_DONT_NORMALIZE_PARTIALS = 0x0004 ,
  D3DXTANGENT_DONT_ORTHOGONALIZE = 0x0008 , D3DXTANGENT_ORTHOGONALIZE_FROM_V = 0x0010 , D3DXTANGENT_ORTHOGONALIZE_FROM_U = 0x0020 , D3DXTANGENT_WEIGHT_BY_AREA = 0x0040 ,
  D3DXTANGENT_WEIGHT_EQUAL = 0x0080 , D3DXTANGENT_WIND_CW = 0x0100 , D3DXTANGENT_CALCULATE_NORMALS = 0x0200 , D3DXTANGENT_GENERATE_IN_PLACE = 0x0400
}
 
enum  _D3DXIMT { D3DXIMT_WRAP_U = 0x01 , D3DXIMT_WRAP_V = 0x02 , D3DXIMT_WRAP_UV = 0x03 }
 
enum  _D3DXUVATLAS { D3DXUVATLAS_DEFAULT = 0x00 , D3DXUVATLAS_GEODESIC_FAST = 0x01 , D3DXUVATLAS_GEODESIC_QUALITY = 0x02 }
 
enum  _D3DXEFFECTDEFAULTTYPE { D3DXEDT_STRING = 1 , D3DXEDT_FLOATS = 2 , D3DXEDT_DWORD = 3 , D3DXEDT_FORCEDWORD = 0x7fffffff }
 
enum  _D3DXWELDEPSILONSFLAGS { D3DXWELDEPSILONS_WELDALL = 0x1 , D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2 , D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4 , D3DXWELDEPSILONS_DONOTSPLIT = 0x8 }
 
enum  _D3DXSHCOMPRESSQUALITYTYPE { D3DXSHCQUAL_FASTLOWQUALITY = 1 , D3DXSHCQUAL_SLOWHIGHQUALITY = 2 , D3DXSHCQUAL_FORCE_DWORD = 0x7fffffff }
 
enum  _D3DXSHGPUSIMOPT {
  D3DXSHGPUSIMOPT_SHADOWRES256 = 1 , D3DXSHGPUSIMOPT_SHADOWRES512 = 0 , D3DXSHGPUSIMOPT_SHADOWRES1024 = 2 , D3DXSHGPUSIMOPT_SHADOWRES2048 = 3 ,
  D3DXSHGPUSIMOPT_HIGHQUALITY = 4 , D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff
}
 

Functions

 DEFINE_GUID (IID_ID3DXBaseMesh, 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30)
 
 DEFINE_GUID (IID_ID3DXMesh, 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95)
 
 DEFINE_GUID (IID_ID3DXPMesh, 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96)
 
 DEFINE_GUID (IID_ID3DXSPMesh, 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x02, 0x90, 0xb8, 0x3c, 0xc5)
 
 DEFINE_GUID (IID_ID3DXSkinInfo, 0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0x0c, 0xc4)
 
 DEFINE_GUID (IID_ID3DXPatchMesh, 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39)
 
 DEFINE_GUID (IID_ID3DXPRTBuffer, 0xf1827e47, 0x00a8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28)
 
 DEFINE_GUID (IID_ID3DXPRTCompBuffer, 0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x07)
 
 DEFINE_GUID (IID_ID3DXTextureGutterHelper, 0x838f01ec, 0x9729, 0x4527, 0xaa, 0xdb, 0xdf, 0x70, 0xad, 0xe7, 0xfe, 0xa9)
 
 DEFINE_GUID (IID_ID3DXPRTEngine, 0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53)
 
 DECLARE_INTERFACE_ (ID3DXBaseMesh, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXMesh, ID3DXBaseMesh)
 
 DECLARE_INTERFACE_ (ID3DXPMesh, ID3DXBaseMesh)
 
 DECLARE_INTERFACE_ (ID3DXSPMesh, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXPatchMesh, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXSkinInfo, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXPRTBuffer, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXPRTCompBuffer, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXTextureGutterHelper, IUnknown)
 
 DECLARE_INTERFACE_ (ID3DXPRTEngine, IUnknown)
 
HRESULT WINAPI D3DXCreateMesh (DWORD face_count, DWORD vertex_count, DWORD flags, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXCreateMeshFVF (DWORD face_count, DWORD vertex_count, DWORD flags, DWORD fvf, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXCreateBuffer (DWORD size, ID3DXBuffer **buffer)
 
HRESULT WINAPI D3DXCreateSPMesh (ID3DXMesh *mesh, const DWORD *adjacency, const D3DXATTRIBUTEWEIGHTS *attribute_weights, const float *vertex_weights, ID3DXSPMesh **spmesh)
 
HRESULT WINAPI D3DXCreatePMeshFromStream (struct IStream *stream, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXPMesh **mesh)
 
HRESULT WINAPI D3DXCreateSkinInfo (DWORD vertex_count, const D3DVERTEXELEMENT9 *declaration, DWORD bone_count, ID3DXSkinInfo **skin_info)
 
HRESULT WINAPI D3DXCreateSkinInfoFVF (DWORD vertex_count, DWORD fvf, DWORD bone_count, ID3DXSkinInfo **skin_info)
 
HRESULT WINAPI D3DXCreateSkinInfoFromBlendedMesh (ID3DXBaseMesh *mesh, DWORD bone_count, const D3DXBONECOMBINATION *bone_combination_table, ID3DXSkinInfo **skin_info)
 
HRESULT WINAPI D3DXCreatePatchMesh (const D3DXPATCHINFO *patch_info, DWORD patch_count, DWORD vertex_count, DWORD flags, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXPatchMesh **mesh)
 
HRESULT WINAPI D3DXCreatePRTBuffer (UINT sample_count, UINT coeff_count, UINT channel_count, ID3DXPRTBuffer **buffer)
 
HRESULT WINAPI D3DXCreatePRTBufferTex (UINT width, UINT height, UINT coeff_count, UINT channel_count, ID3DXPRTBuffer **buffer)
 
HRESULT WINAPI D3DXCreatePRTCompBuffer (D3DXSHCOMPRESSQUALITYTYPE quality, UINT cluster_count, UINT pca_count, LPD3DXSHPRTSIMCB cb, void *ctx, ID3DXPRTBuffer *input, ID3DXPRTCompBuffer **buffer)
 
HRESULT WINAPI D3DXCreateTextureGutterHelper (UINT width, UINT height, ID3DXMesh *mesh, float gutter_size, ID3DXTextureGutterHelper **gh)
 
HRESULT WINAPI D3DXCreatePRTEngine (ID3DXMesh *mesh, DWORD *adjacency, BOOL extract_uv, ID3DXMesh *blocker_mesh, ID3DXPRTEngine **engine)
 
HRESULT WINAPI D3DXLoadMeshFromXA (const char *filename, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXLoadMeshFromXW (const WCHAR *filename, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXLoadMeshFromXInMemory (const void *data, DWORD data_size, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXLoadMeshFromXResource (HMODULE module, const char *resource, const char *resource_type, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXLoadMeshFromXof (struct ID3DXFileData *file_data, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXLoadPatchMeshFromXof (struct ID3DXFileData *file_data, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXPatchMesh **mesh)
 
HRESULT WINAPI D3DXLoadSkinMeshFromXof (struct ID3DXFileData *file_data, DWORD flags, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *material_count, struct ID3DXSkinInfo **skin_info, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXLoadPRTBufferFromFileA (const char *filename, ID3DXPRTBuffer **buffer)
 
HRESULT WINAPI D3DXLoadPRTBufferFromFileW (const WCHAR *filename, ID3DXPRTBuffer **buffer)
 
HRESULT WINAPI D3DXLoadPRTCompBufferFromFileA (const char *filename, ID3DXPRTCompBuffer **buffer)
 
HRESULT WINAPI D3DXLoadPRTCompBufferFromFileW (const WCHAR *filename, ID3DXPRTCompBuffer **buffer)
 
HRESULT WINAPI D3DXSaveMeshToXA (const char *filename, ID3DXMesh *mesh, const DWORD *adjacency, const D3DXMATERIAL *materials, const D3DXEFFECTINSTANCE *effect_instances, DWORD material_count, DWORD format)
 
HRESULT WINAPI D3DXSaveMeshToXW (const WCHAR *filename, ID3DXMesh *mesh, const DWORD *adjacency, const D3DXMATERIAL *materials, const D3DXEFFECTINSTANCE *effect_instances, DWORD material_count, DWORD format)
 
HRESULT WINAPI D3DXSavePRTBufferToFileA (const char *filename, ID3DXPRTBuffer *buffer)
 
HRESULT WINAPI D3DXSavePRTBufferToFileW (const WCHAR *filename, ID3DXPRTBuffer *buffer)
 
HRESULT WINAPI D3DXSavePRTCompBufferToFileA (const char *filename, ID3DXPRTCompBuffer *buffer)
 
HRESULT WINAPI D3DXSavePRTCompBufferToFileW (const WCHAR *filename, ID3DXPRTCompBuffer *buffer)
 
UINT WINAPI D3DXGetDeclLength (const D3DVERTEXELEMENT9 *decl)
 
UINT WINAPI D3DXGetDeclVertexSize (const D3DVERTEXELEMENT9 *decl, DWORD stream_idx)
 
UINT WINAPI D3DXGetFVFVertexSize (DWORD)
 
BOOL WINAPI D3DXBoxBoundProbe (const D3DXVECTOR3 *vmin, const D3DXVECTOR3 *vmax, const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir)
 
BOOL WINAPI D3DXSphereBoundProbe (const D3DXVECTOR3 *center, FLOAT radius, const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir)
 
HRESULT WINAPI D3DXCleanMesh (D3DXCLEANTYPE clean_type, ID3DXMesh *mesh_in, const DWORD *adjacency_in, ID3DXMesh **mesh_out, DWORD *adjacency_out, ID3DXBuffer **errors)
 
HRESULT WINAPI D3DXConcatenateMeshes (struct ID3DXMesh **meshes, UINT mesh_count, DWORD flags, const D3DXMATRIX *geometry_matrices, const D3DXMATRIX *texture_matrices, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
 
HRESULT WINAPI D3DXComputeBoundingBox (const D3DXVECTOR3 *first_pos, DWORD num_vertices, DWORD stride, D3DXVECTOR3 *vmin, D3DXVECTOR3 *vmax)
 
HRESULT WINAPI D3DXComputeBoundingSphere (const D3DXVECTOR3 *first_pos, DWORD num_vertices, DWORD stride, D3DXVECTOR3 *center, FLOAT *radius)
 
HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal (ID3DXMesh *mesh, DWORD texture_idx, float *texel_signal, UINT width, UINT height, UINT signal_dimension, UINT component_count, DWORD flags, LPD3DXUVATLASCB cb, void *ctx, ID3DXBuffer **buffer)
 
HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal (ID3DXMesh *mesh, const float *vertex_signal, UINT signal_dimension, UINT signal_stride, DWORD flags, LPD3DXUVATLASCB cb, void *ctx, ID3DXBuffer **buffer)
 
HRESULT WINAPI D3DXComputeIMTFromSignal (ID3DXMesh *mesh, DWORD texture_idx, UINT signal_dimension, float max_uv_distance, DWORD flags, LPD3DXIMTSIGNALCALLBACK signal_cb, void *signal_ctx, LPD3DXUVATLASCB status_cb, void *status_ctx, ID3DXBuffer **buffer)
 
HRESULT WINAPI D3DXComputeIMTFromTexture (struct ID3DXMesh *mesh, struct IDirect3DTexture9 *texture, DWORD texture_idx, DWORD options, LPD3DXUVATLASCB cb, void *ctx, struct ID3DXBuffer **out)
 
HRESULT WINAPI D3DXComputeNormals (ID3DXBaseMesh *mesh, const DWORD *adjacency)
 
HRESULT WINAPI D3DXComputeTangentFrameEx (ID3DXMesh *mesh_in, DWORD texture_in_semantic, DWORD texture_in_idx, DWORD u_partial_out_semantic, DWORD u_partial_out_idx, DWORD v_partial_out_semantic, DWORD v_partial_out_idx, DWORD normal_out_semantic, DWORD normal_out_idx, DWORD flags, const DWORD *adjacency, float partial_edge_threshold, float singular_point_threshold, float normal_edge_threshold, ID3DXMesh **mesh_out, ID3DXBuffer **buffer)
 
HRESULT WINAPI D3DXComputeTangent (ID3DXMesh *mesh, DWORD stage, DWORD tangent_idx, DWORD binorm_idx, DWORD wrap, const DWORD *adjacency)
 
HRESULT WINAPI D3DXConvertMeshSubsetToSingleStrip (struct ID3DXBaseMesh *mesh_in, DWORD attribute_id, DWORD ib_flags, struct IDirect3DIndexBuffer9 **index_buffer, DWORD *index_count)
 
HRESULT WINAPI D3DXConvertMeshSubsetToStrips (struct ID3DXBaseMesh *mesh_in, DWORD attribute_id, DWORD ib_flags, struct IDirect3DIndexBuffer9 **index_buffer, DWORD *index_count, struct ID3DXBuffer **strip_lengths, DWORD *strip_count)
 
HRESULT WINAPI D3DXDeclaratorFromFVF (DWORD, D3DVERTEXELEMENT9[MAX_FVF_DECL_SIZE])
 
HRESULT WINAPI D3DXFVFFromDeclarator (const D3DVERTEXELEMENT9 *decl, DWORD *fvf)
 
HRESULT WINAPI D3DXGenerateOutputDecl (D3DVERTEXELEMENT9 *decl_out, const D3DVERTEXELEMENT9 *decl_in)
 
HRESULT WINAPI D3DXGeneratePMesh (ID3DXMesh *mesh, const DWORD *adjacency, const D3DXATTRIBUTEWEIGHTS *attribute_weights, const float *vertex_weights, DWORD min_value, DWORD flags, ID3DXPMesh **pmesh)
 
HRESULT WINAPI D3DXIntersect (ID3DXBaseMesh *mesh, const D3DXVECTOR3 *ray_position, const D3DXVECTOR3 *ray_direction, BOOL *hit, DWORD *face_idx, float *u, float *v, float *distance, ID3DXBuffer **hits, DWORD *hit_count)
 
HRESULT WINAPI D3DXIntersectSubset (ID3DXBaseMesh *mesh, DWORD attribute_id, const D3DXVECTOR3 *ray_position, const D3DXVECTOR3 *ray_direction, BOOL *hit, DWORD *face_idx, float *u, float *v, float *distance, ID3DXBuffer **hits, DWORD *hit_count)
 
BOOL WINAPI D3DXIntersectTri (const D3DXVECTOR3 *vtx0, const D3DXVECTOR3 *vtx1, const D3DXVECTOR3 *vtx2, const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir, FLOAT *u, FLOAT *v, FLOAT *dist)
 
HRESULT WINAPI D3DXOptimizeFaces (const void *indices, UINT face_count, UINT vertex_count, BOOL idx_32bit, DWORD *face_remap)
 
HRESULT WINAPI D3DXOptimizeVertices (const void *indices, UINT face_count, UINT vertex_count, BOOL idx_32bit, DWORD *vertex_remap)
 
HRESULT WINAPI D3DXRectPatchSize (const FLOAT *segment_count, DWORD *num_triangles, DWORD *num_vertices)
 
HRESULT WINAPI D3DXSHPRTCompSuperCluster (UINT *cluster_ids, ID3DXMesh *scene, UINT max_cluster_count, UINT cluster_count, UINT *scluster_ids, UINT *scluster_count)
 
HRESULT WINAPI D3DXSHPRTCompSplitMeshSC (UINT *cluster_idx, UINT vertex_count, UINT cluster_count, UINT *scluster_ids, UINT scluster_count, void *index_buffer_in, BOOL ib_in_32bit, UINT face_count, ID3DXBuffer **index_buffer_out, UINT *index_buffer_size, BOOL ib_out_32bit, ID3DXBuffer **face_remap, ID3DXBuffer **vertex_data, UINT *vertex_data_length, UINT *sc_cluster_list, D3DXSHPRTSPLITMESHCLUSTERDATA *sc_data)
 
HRESULT WINAPI D3DXSimplifyMesh (ID3DXMesh *mesh_in, const DWORD *adjacency, const D3DXATTRIBUTEWEIGHTS *attribute_weights, const float *vertex_weights, DWORD min_value, DWORD flags, ID3DXMesh **mesh_out)
 
HRESULT WINAPI D3DXSplitMesh (ID3DXMesh *mesh_in, const DWORD *adjacency_in, const DWORD max_size, const DWORD flags, DWORD *mesh_out_count, ID3DXBuffer **mesh_out, ID3DXBuffer **adjacency_out, ID3DXBuffer **face_remap_out, ID3DXBuffer **vertex_remap_out)
 
HRESULT WINAPI D3DXTessellateNPatches (ID3DXMesh *mesh_in, const DWORD *adjacency_in, float segment_count, BOOL quad_interp, ID3DXMesh **mesh_out, ID3DXBuffer **adjacency_out)
 
HRESULT WINAPI D3DXTessellateRectPatch (struct IDirect3DVertexBuffer9 *buffer, const float *segment_count, const D3DVERTEXELEMENT9 *declaration, const D3DRECTPATCH_INFO *patch_info, struct ID3DXMesh *mesh)
 
HRESULT WINAPI D3DXTessellateTriPatch (struct IDirect3DVertexBuffer9 *buffer, const float *segment_count, const D3DVERTEXELEMENT9 *declaration, const D3DTRIPATCH_INFO *patch_info, struct ID3DXMesh *mesh)
 
HRESULT WINAPI D3DXTriPatchSize (const FLOAT *segment_count, DWORD *num_triangles, DWORD *num_vertices)
 
HRESULT WINAPI D3DXUVAtlasCreate (ID3DXMesh *mesh_in, UINT max_chart_count, float max_stretch_in, UINT width, UINT height, float gutter, DWORD texture_idx, const DWORD *adjacency, const DWORD *false_edges, const float *imt_array, LPD3DXUVATLASCB cb, float cb_freq, void *ctx, DWORD flags, ID3DXMesh **mesh_out, ID3DXBuffer **face_partitioning_out, ID3DXBuffer **vertex_remap_out, float *max_stretch_out, UINT *chart_count)
 
HRESULT WINAPI D3DXUVAtlasPack (ID3DXMesh *mesh, UINT width, UINT height, float gutter, DWORD texture_idx, const DWORD *partition_result_adjacency, LPD3DXUVATLASCB cb, float cb_freq, void *ctx, DWORD flags, ID3DXBuffer *face_partitioning)
 
HRESULT WINAPI D3DXUVAtlasPartition (ID3DXMesh *mesh_in, UINT max_chart_count, float max_stretch_in, DWORD texture_idx, const DWORD *adjacency, const DWORD *false_edges, const float *imt_array, LPD3DXUVATLASCB cb, float cb_freq, void *ctx, DWORD flags, ID3DXMesh **mesh_out, ID3DXBuffer **face_partitioning_out, ID3DXBuffer **vertex_remap_out, ID3DXBuffer **adjacency_out, float *max_stretch_out, UINT *chart_count)
 
HRESULT WINAPI D3DXValidMesh (ID3DXMesh *mesh, const DWORD *adjacency, ID3DXBuffer **errors)
 
HRESULT WINAPI D3DXValidPatchMesh (ID3DXPatchMesh *mesh, DWORD *degenerate_vertex_count, DWORD *degenerate_patch_count, ID3DXBuffer **errors)
 
HRESULT WINAPI D3DXWeldVertices (ID3DXMesh *mesh, DWORD flags, const D3DXWELDEPSILONS *epsilons, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap_out, ID3DXBuffer **vertex_remap_out)
 
 DEFINE_GUID (DXFILEOBJ_XSkinMeshHeader, 0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2)
 
 DEFINE_GUID (DXFILEOBJ_VertexDuplicationIndices, 0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3)
 
 DEFINE_GUID (DXFILEOBJ_FaceAdjacency, 0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0x0c, 0xde, 0x04, 0x39, 0x8c)
 
 DEFINE_GUID (DXFILEOBJ_SkinWeights, 0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb)
 
 DEFINE_GUID (DXFILEOBJ_Patch, 0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6)
 
 DEFINE_GUID (DXFILEOBJ_PatchMesh, 0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4d, 0xbf)
 
 DEFINE_GUID (DXFILEOBJ_PatchMesh9, 0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x02, 0xc0, 0xea)
 
 DEFINE_GUID (DXFILEOBJ_PMInfo, 0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47)
 
 DEFINE_GUID (DXFILEOBJ_PMAttributeRange, 0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44)
 
 DEFINE_GUID (DXFILEOBJ_PMVSplitRecord, 0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c)
 
 DEFINE_GUID (DXFILEOBJ_FVFData, 0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97)
 
 DEFINE_GUID (DXFILEOBJ_VertexElement, 0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0x0f, 0x33, 0x6f)
 
 DEFINE_GUID (DXFILEOBJ_DeclData, 0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93)
 
 DEFINE_GUID (DXFILEOBJ_EffectFloats, 0xf1cfe2b3, 0x0de3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0x0a, 0x28, 0x2d)
 
 DEFINE_GUID (DXFILEOBJ_EffectString, 0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0x0e, 0x42)
 
 DEFINE_GUID (DXFILEOBJ_EffectDWord, 0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16)
 
 DEFINE_GUID (DXFILEOBJ_EffectParamFloats, 0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b)
 
 DEFINE_GUID (DXFILEOBJ_EffectParamString, 0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81)
 
 DEFINE_GUID (DXFILEOBJ_EffectParamDWord, 0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0x0f, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5)
 
 DEFINE_GUID (DXFILEOBJ_EffectInstance, 0xe331f7e4, 0x0559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f)
 
 DEFINE_GUID (DXFILEOBJ_AnimTicksPerSecond, 0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76)
 
 DEFINE_GUID (DXFILEOBJ_CompressedAnimationSet, 0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d)
 

Macro Definition Documentation

◆ D3DXLoadMeshFromX

#define D3DXLoadMeshFromX   WINELIB_NAME_AW(D3DXLoadMeshFromX)

Definition at line 733 of file d3dx9mesh.h.

◆ D3DXLoadPRTBufferFromFile

#define D3DXLoadPRTBufferFromFile   WINELIB_NAME_AW(D3DXLoadPRTBufferFromFile)

Definition at line 752 of file d3dx9mesh.h.

◆ D3DXLoadPRTCompBufferFromFile

#define D3DXLoadPRTCompBufferFromFile   WINELIB_NAME_AW(D3DXLoadPRTCompBufferFromFile)

Definition at line 755 of file d3dx9mesh.h.

◆ D3DXSaveMeshToX

#define D3DXSaveMeshToX   WINELIB_NAME_AW(D3DXSaveMeshToX)

Definition at line 760 of file d3dx9mesh.h.

◆ D3DXSavePRTBufferToFile

#define D3DXSavePRTBufferToFile   WINELIB_NAME_AW(D3DXSavePRTBufferToFile)

Definition at line 763 of file d3dx9mesh.h.

◆ D3DXSavePRTCompBufferToFile

#define D3DXSavePRTCompBufferToFile   WINELIB_NAME_AW(D3DXSavePRTCompBufferToFile)

Definition at line 766 of file d3dx9mesh.h.

◆ INTERFACE [1/10]

#define INTERFACE   ID3DXBaseMesh

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [2/10]

#define INTERFACE   ID3DXMesh

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [3/10]

#define INTERFACE   ID3DXPMesh

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [4/10]

#define INTERFACE   ID3DXSPMesh

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [5/10]

#define INTERFACE   ID3DXPatchMesh

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [6/10]

#define INTERFACE   ID3DXSkinInfo

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [7/10]

#define INTERFACE   ID3DXPRTBuffer

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [8/10]

#define INTERFACE   ID3DXPRTCompBuffer

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [9/10]

#define INTERFACE   ID3DXTextureGutterHelper

Definition at line 635 of file d3dx9mesh.h.

◆ INTERFACE [10/10]

#define INTERFACE   ID3DXPRTEngine

Definition at line 635 of file d3dx9mesh.h.

◆ UNUSED16

#define UNUSED16   (0xffff)

Definition at line 36 of file d3dx9mesh.h.

◆ UNUSED32

#define UNUSED32   (0xffffffff)

Definition at line 37 of file d3dx9mesh.h.

◆ XEXTENSIONS_TEMPLATES

#define XEXTENSIONS_TEMPLATES    "xof 0303txt 0032\ template FVFData \ { \ <B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897> \ DWORD dwFVF; \ DWORD nDWords; \ array DWORD data[nDWords]; \ } \ template VertexElement \ { \ <F752461C-1E23-48f6-B9F8-8350850F336F> \ DWORD Type; \ DWORD Method; \ DWORD Usage; \ DWORD UsageIndex; \ } \ template DeclData \ { \ <BF22E553-292C-4781-9FEA-62BD554BDD93> \ DWORD nElements; \ array VertexElement Elements[nElements]; \ DWORD nDWords; \ array DWORD data[nDWords]; \ } \ template PMAttributeRange \ { \ <917E0427-C61E-4a14-9C64-AFE65F9E9844> \ DWORD iFaceOffset; \ DWORD nFacesMin; \ DWORD nFacesMax; \ DWORD iVertexOffset; \ DWORD nVerticesMin; \ DWORD nVerticesMax; \ } \ template PMVSplitRecord \ { \ <574CCC14-F0B3-4333-822D-93E8A8A08E4C> \ DWORD iFaceCLW; \ DWORD iVlrOffset; \ DWORD iCode; \ } \ template PMInfo \ { \ <B6C3E656-EC8B-4b92-9B62-681659522947> \ DWORD nAttributes; \ array PMAttributeRange attributeRanges[nAttributes]; \ DWORD nMaxValence; \ DWORD nMinLogicalVertices; \ DWORD nMaxLogicalVertices; \ DWORD nVSplits; \ array PMVSplitRecord splitRecords[nVSplits]; \ DWORD nAttributeMispredicts; \ array DWORD attributeMispredicts[nAttributeMispredicts]; \ } "

Definition at line 1002 of file d3dx9mesh.h.

◆ XSKINEXP_TEMPLATES

#define XSKINEXP_TEMPLATES    "xof 0303txt 0032\ template XSkinMeshHeader \ { \ <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ WORD nMaxSkinWeightsPerVertex; \ WORD nMaxSkinWeightsPerFace; \ WORD nBones; \ } \ template VertexDuplicationIndices \ { \ <B8D65549-D7C9-4995-89CF-53A9A8B031E3> \ DWORD nIndices; \ DWORD nOriginalVertices; \ array DWORD indices[nIndices]; \ } \ template FaceAdjacency \ { \ <A64C844A-E282-4756-8B80-250CDE04398C> \ DWORD nIndices; \ array DWORD indices[nIndices]; \ } \ template SkinWeights \ { \ <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ STRING transformNodeName; \ DWORD nWeights; \ array DWORD vertexIndices[nWeights]; \ array float weights[nWeights]; \ Matrix4x4 matrixOffset; \ } \ template Patch \ { \ <A3EB5D44-FC22-429D-9AFB-3221CB9719A6> \ DWORD nControlIndices; \ array DWORD controlIndices[nControlIndices]; \ } \ template PatchMesh \ { \ <D02C95CC-EDBA-4305-9B5D-1820D7704BBF> \ DWORD nVertices; \ array Vector vertices[nVertices]; \ DWORD nPatches; \ array Patch patches[nPatches]; \ [ ... ] \ } \ template PatchMesh9 \ { \ <B9EC94E1-B9A6-4251-BA18-94893F02C0EA> \ DWORD Type; \ DWORD Degree; \ DWORD Basis; \ DWORD nVertices; \ array Vector vertices[nVertices]; \ DWORD nPatches; \ array Patch patches[nPatches]; \ [ ... ] \ } template EffectFloats \ { \ <F1CFE2B3-0DE3-4e28-AFA1-155A750A282D> \ DWORD nFloats; \ array float Floats[nFloats]; \ } \ template EffectString \ { \ <D55B097E-BDB6-4c52-B03D-6051C89D0E42> \ STRING Value; \ } \ template EffectDWord \ { \ <622C0ED0-956E-4da9-908A-2AF94F3CE716> \ DWORD Value; \ } template EffectParamFloats \ { \ <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> \ STRING ParamName; \ DWORD nFloats; \ array float Floats[nFloats]; \ } template EffectParamString \ { \ <1DBC4C88-94C1-46ee-9076-2C28818C9481> \ STRING ParamName; \ STRING Value; \ } \ template EffectParamDWord \ { \ <E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5> \ STRING ParamName; \ DWORD Value; \ } \ template EffectInstance \ { \ <E331F7E4-0559-4cc2-8E99-1CEC1657928F> \ STRING EffectFilename; \ [ ... ] \ } template AnimTicksPerSecond \ { \ <9E415A43-7BA6-4a73-8743-B73D47E88476> \ DWORD AnimTicksPerSecond; \ } \ template CompressedAnimationSet \ { \ <7F9B00B3-F125-4890-876E-1C42BF697C4D> \ DWORD CompressedBlockSize; \ FLOAT TicksPerSec; \ DWORD PlaybackType; \ DWORD BufferLength; \ array DWORD CompressedData[BufferLength]; \ } "

Definition at line 892 of file d3dx9mesh.h.

Typedef Documentation

◆ D3DXATTRIBUTERANGE

◆ D3DXATTRIBUTEWEIGHTS

◆ D3DXBONECOMBINATION

◆ D3DXCLEANTYPE

◆ D3DXEFFECTDEFAULT

◆ D3DXEFFECTDEFAULTTYPE

◆ D3DXEFFECTINSTANCE

◆ D3DXIMT

◆ D3DXINTERSECTINFO

◆ D3DXMATERIAL

◆ D3DXPATCHINFO

◆ D3DXPATCHMESHTYPE

◆ D3DXSHCOMPRESSQUALITYTYPE

◆ D3DXSHGPUSIMOPT

◆ D3DXSHMATERIAL

◆ D3DXSHPRTSPLITMESHCLUSTERDATA

◆ D3DXSHPRTSPLITMESHVERTDATA

◆ D3DXTANGENT

◆ D3DXUVATLAS

◆ D3DXWELDEPSILONS

◆ LPD3DXATTRIBUTERANGE

Definition at line 191 of file d3dx9mesh.h.

◆ LPD3DXATTRIBUTEWEIGHTS

◆ LPD3DXBASEMESH

typedef struct ID3DXBaseMesh* LPD3DXBASEMESH

Definition at line 172 of file d3dx9mesh.h.

◆ LPD3DXBONECOMBINATION

◆ LPD3DXEFFECTDEFAULT

◆ LPD3DXEFFECTINSTANCE

◆ LPD3DXIMTSIGNALCALLBACK

typedef HRESULT(WINAPI * LPD3DXIMTSIGNALCALLBACK) (const D3DXVECTOR2 *, UINT, UINT, void *, FLOAT *)

Definition at line 301 of file d3dx9mesh.h.

◆ LPD3DXINTERSECTINFO

◆ LPD3DXMATERIAL

◆ LPD3DXMESH

typedef struct ID3DXMesh* LPD3DXMESH

Definition at line 173 of file d3dx9mesh.h.

◆ LPD3DXPATCHINFO

◆ LPD3DXPATCHMESH

typedef struct ID3DXPatchMesh* LPD3DXPATCHMESH

Definition at line 177 of file d3dx9mesh.h.

◆ LPD3DXPMESH

typedef struct ID3DXPMesh* LPD3DXPMESH

Definition at line 174 of file d3dx9mesh.h.

◆ LPD3DXPRTBUFFER

typedef struct ID3DXPRTBuffer* LPD3DXPRTBUFFER

Definition at line 178 of file d3dx9mesh.h.

◆ LPD3DXPRTCOMPBUFFER

typedef struct ID3DXPRTCompBuffer* LPD3DXPRTCOMPBUFFER

Definition at line 179 of file d3dx9mesh.h.

◆ LPD3DXPRTENGINE

typedef struct ID3DXPRTEngine* LPD3DXPRTENGINE

Definition at line 180 of file d3dx9mesh.h.

◆ LPD3DXSHPRTSIMCB

typedef HRESULT(WINAPI * LPD3DXSHPRTSIMCB) (float complete, void *ctx)

Definition at line 302 of file d3dx9mesh.h.

◆ LPD3DXSKININFO

typedef struct ID3DXSkinInfo* LPD3DXSKININFO

Definition at line 176 of file d3dx9mesh.h.

◆ LPD3DXSPMESH

typedef struct ID3DXSPMesh* LPD3DXSPMESH

Definition at line 175 of file d3dx9mesh.h.

◆ LPD3DXTEXTUREGUTTERHELPER

typedef struct ID3DXTextureGutterHelper* LPD3DXTEXTUREGUTTERHELPER

Definition at line 181 of file d3dx9mesh.h.

◆ LPD3DXUVATLASCB

typedef HRESULT(WINAPI * LPD3DXUVATLASCB) (float complete, void *ctx)

Definition at line 300 of file d3dx9mesh.h.

◆ LPD3DXWELDEPSILONS

◆ XFILECOMPRESSEDANIMATIONSET

Enumeration Type Documentation

◆ _D3DXEFFECTDEFAULTTYPE

Enumerator
D3DXEDT_STRING 
D3DXEDT_FLOATS 
D3DXEDT_DWORD 
D3DXEDT_FORCEDWORD 

Definition at line 139 of file d3dx9mesh.h.

140{
141 D3DXEDT_STRING = 1,
142 D3DXEDT_FLOATS = 2,
143 D3DXEDT_DWORD = 3,
144 D3DXEDT_FORCEDWORD = 0x7fffffff,
@ D3DXEDT_FORCEDWORD
Definition: d3dx9mesh.h:144
@ D3DXEDT_FLOATS
Definition: d3dx9mesh.h:142
@ D3DXEDT_STRING
Definition: d3dx9mesh.h:141
@ D3DXEDT_DWORD
Definition: d3dx9mesh.h:143
enum _D3DXEFFECTDEFAULTTYPE D3DXEFFECTDEFAULTTYPE

◆ _D3DXIMT

Enumerator
D3DXIMT_WRAP_U 
D3DXIMT_WRAP_V 
D3DXIMT_WRAP_UV 

Definition at line 125 of file d3dx9mesh.h.

126{
127 D3DXIMT_WRAP_U = 0x01,
128 D3DXIMT_WRAP_V = 0x02,
129 D3DXIMT_WRAP_UV = 0x03,
130} D3DXIMT;
@ D3DXIMT_WRAP_U
Definition: d3dx9mesh.h:127
@ D3DXIMT_WRAP_V
Definition: d3dx9mesh.h:128
@ D3DXIMT_WRAP_UV
Definition: d3dx9mesh.h:129
enum _D3DXIMT D3DXIMT

◆ _D3DXMESH

Enumerator
D3DXMESH_32BIT 
D3DXMESH_DONOTCLIP 
D3DXMESH_POINTS 
D3DXMESH_RTPATCHES 
D3DXMESH_NPATCHES 
D3DXMESH_VB_SYSTEMMEM 
D3DXMESH_VB_MANAGED 
D3DXMESH_VB_WRITEONLY 
D3DXMESH_VB_DYNAMIC 
D3DXMESH_VB_SOFTWAREPROCESSING 
D3DXMESH_IB_SYSTEMMEM 
D3DXMESH_IB_MANAGED 
D3DXMESH_IB_WRITEONLY 
D3DXMESH_IB_DYNAMIC 
D3DXMESH_IB_SOFTWAREPROCESSING 
D3DXMESH_VB_SHARE 
D3DXMESH_USEHWONLY 
D3DXMESH_SYSTEMMEM 
D3DXMESH_MANAGED 
D3DXMESH_WRITEONLY 
D3DXMESH_DYNAMIC 
D3DXMESH_SOFTWAREPROCESSING 

Definition at line 44 of file d3dx9mesh.h.

45{
46 D3DXMESH_32BIT = 0x001,
47 D3DXMESH_DONOTCLIP = 0x002,
48 D3DXMESH_POINTS = 0x004,
49 D3DXMESH_RTPATCHES = 0x008,
50 D3DXMESH_NPATCHES = 0x4000,
52 D3DXMESH_VB_MANAGED = 0x020,
54 D3DXMESH_VB_DYNAMIC = 0x080,
57 D3DXMESH_IB_MANAGED = 0x200,
59 D3DXMESH_IB_DYNAMIC = 0x800,
61 D3DXMESH_VB_SHARE = 0x1000,
62 D3DXMESH_USEHWONLY = 0x2000,
63 D3DXMESH_SYSTEMMEM = 0x110,
64 D3DXMESH_MANAGED = 0x220,
65 D3DXMESH_WRITEONLY = 0x440,
66 D3DXMESH_DYNAMIC = 0x880,
68};
@ D3DXMESH_NPATCHES
Definition: d3dx9mesh.h:50
@ D3DXMESH_VB_MANAGED
Definition: d3dx9mesh.h:52
@ D3DXMESH_USEHWONLY
Definition: d3dx9mesh.h:62
@ D3DXMESH_32BIT
Definition: d3dx9mesh.h:46
@ D3DXMESH_DONOTCLIP
Definition: d3dx9mesh.h:47
@ D3DXMESH_DYNAMIC
Definition: d3dx9mesh.h:66
@ D3DXMESH_VB_SOFTWAREPROCESSING
Definition: d3dx9mesh.h:55
@ D3DXMESH_VB_WRITEONLY
Definition: d3dx9mesh.h:53
@ D3DXMESH_POINTS
Definition: d3dx9mesh.h:48
@ D3DXMESH_SYSTEMMEM
Definition: d3dx9mesh.h:63
@ D3DXMESH_WRITEONLY
Definition: d3dx9mesh.h:65
@ D3DXMESH_IB_MANAGED
Definition: d3dx9mesh.h:57
@ D3DXMESH_IB_WRITEONLY
Definition: d3dx9mesh.h:58
@ D3DXMESH_VB_SYSTEMMEM
Definition: d3dx9mesh.h:51
@ D3DXMESH_RTPATCHES
Definition: d3dx9mesh.h:49
@ D3DXMESH_IB_SYSTEMMEM
Definition: d3dx9mesh.h:56
@ D3DXMESH_SOFTWAREPROCESSING
Definition: d3dx9mesh.h:67
@ D3DXMESH_IB_SOFTWAREPROCESSING
Definition: d3dx9mesh.h:60
@ D3DXMESH_MANAGED
Definition: d3dx9mesh.h:64
@ D3DXMESH_VB_SHARE
Definition: d3dx9mesh.h:61
@ D3DXMESH_IB_DYNAMIC
Definition: d3dx9mesh.h:59
@ D3DXMESH_VB_DYNAMIC
Definition: d3dx9mesh.h:54

◆ _D3DXMESHOPT

Enumerator
D3DXMESHOPT_DEVICEINDEPENDENT 
D3DXMESHOPT_COMPACT 
D3DXMESHOPT_ATTRSORT 
D3DXMESHOPT_VERTEXCACHE 
D3DXMESHOPT_STRIPREORDER 
D3DXMESHOPT_IGNOREVERTS 
D3DXMESHOPT_DONOTSPLIT 

Definition at line 70 of file d3dx9mesh.h.

71{
73 D3DXMESHOPT_COMPACT = 0x01000000,
74 D3DXMESHOPT_ATTRSORT = 0x02000000,
75 D3DXMESHOPT_VERTEXCACHE = 0x04000000,
76 D3DXMESHOPT_STRIPREORDER = 0x08000000,
77 D3DXMESHOPT_IGNOREVERTS = 0x10000000,
78 D3DXMESHOPT_DONOTSPLIT = 0x20000000,
79};
@ D3DXMESHOPT_DONOTSPLIT
Definition: d3dx9mesh.h:78
@ D3DXMESHOPT_STRIPREORDER
Definition: d3dx9mesh.h:76
@ D3DXMESHOPT_IGNOREVERTS
Definition: d3dx9mesh.h:77
@ D3DXMESHOPT_ATTRSORT
Definition: d3dx9mesh.h:74
@ D3DXMESHOPT_VERTEXCACHE
Definition: d3dx9mesh.h:75
@ D3DXMESHOPT_DEVICEINDEPENDENT
Definition: d3dx9mesh.h:72
@ D3DXMESHOPT_COMPACT
Definition: d3dx9mesh.h:73

◆ _D3DXMESHSIMP

Enumerator
D3DXMESHSIMP_VERTEX 
D3DXMESHSIMP_FACE 

Definition at line 94 of file d3dx9mesh.h.

95{
98};
@ D3DXMESHSIMP_FACE
Definition: d3dx9mesh.h:97
@ D3DXMESHSIMP_VERTEX
Definition: d3dx9mesh.h:96

◆ _D3DXPATCHMESH

Enumerator
D3DXPATCHMESH_DEFAULT 

Definition at line 89 of file d3dx9mesh.h.

90{
92};
@ D3DXPATCHMESH_DEFAULT
Definition: d3dx9mesh.h:91

◆ _D3DXPATCHMESHTYPE

Enumerator
D3DXPATCHMESH_RECT 
D3DXPATCHMESH_TRI 
D3DXPATCHMESH_NPATCH 
D3DXPATCHMESH_FORCE_DWORD 

Definition at line 81 of file d3dx9mesh.h.

82{
86 D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff,
enum _D3DXPATCHMESHTYPE D3DXPATCHMESHTYPE
@ D3DXPATCHMESH_RECT
Definition: d3dx9mesh.h:83
@ D3DXPATCHMESH_TRI
Definition: d3dx9mesh.h:84
@ D3DXPATCHMESH_FORCE_DWORD
Definition: d3dx9mesh.h:86
@ D3DXPATCHMESH_NPATCH
Definition: d3dx9mesh.h:85

◆ _D3DXSHCOMPRESSQUALITYTYPE

Enumerator
D3DXSHCQUAL_FASTLOWQUALITY 
D3DXSHCQUAL_SLOWHIGHQUALITY 
D3DXSHCQUAL_FORCE_DWORD 

Definition at line 155 of file d3dx9mesh.h.

156{
159 D3DXSHCQUAL_FORCE_DWORD = 0x7fffffff,
enum _D3DXSHCOMPRESSQUALITYTYPE D3DXSHCOMPRESSQUALITYTYPE
@ D3DXSHCQUAL_FASTLOWQUALITY
Definition: d3dx9mesh.h:157
@ D3DXSHCQUAL_FORCE_DWORD
Definition: d3dx9mesh.h:159
@ D3DXSHCQUAL_SLOWHIGHQUALITY
Definition: d3dx9mesh.h:158

◆ _D3DXSHGPUSIMOPT

Enumerator
D3DXSHGPUSIMOPT_SHADOWRES256 
D3DXSHGPUSIMOPT_SHADOWRES512 
D3DXSHGPUSIMOPT_SHADOWRES1024 
D3DXSHGPUSIMOPT_SHADOWRES2048 
D3DXSHGPUSIMOPT_HIGHQUALITY 
D3DXSHGPUSIMOPT_FORCE_DWORD 

Definition at line 162 of file d3dx9mesh.h.

163{
169 D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff,
@ D3DXSHGPUSIMOPT_SHADOWRES2048
Definition: d3dx9mesh.h:167
@ D3DXSHGPUSIMOPT_SHADOWRES512
Definition: d3dx9mesh.h:165
@ D3DXSHGPUSIMOPT_HIGHQUALITY
Definition: d3dx9mesh.h:168
@ D3DXSHGPUSIMOPT_SHADOWRES256
Definition: d3dx9mesh.h:164
@ D3DXSHGPUSIMOPT_FORCE_DWORD
Definition: d3dx9mesh.h:169
@ D3DXSHGPUSIMOPT_SHADOWRES1024
Definition: d3dx9mesh.h:166
enum _D3DXSHGPUSIMOPT D3DXSHGPUSIMOPT

◆ _D3DXTANGENT

Enumerator
D3DXTANGENT_WRAP_U 
D3DXTANGENT_WRAP_V 
D3DXTANGENT_WRAP_UV 
D3DXTANGENT_DONT_NORMALIZE_PARTIALS 
D3DXTANGENT_DONT_ORTHOGONALIZE 
D3DXTANGENT_ORTHOGONALIZE_FROM_V 
D3DXTANGENT_ORTHOGONALIZE_FROM_U 
D3DXTANGENT_WEIGHT_BY_AREA 
D3DXTANGENT_WEIGHT_EQUAL 
D3DXTANGENT_WIND_CW 
D3DXTANGENT_CALCULATE_NORMALS 
D3DXTANGENT_GENERATE_IN_PLACE 

Definition at line 109 of file d3dx9mesh.h.

110{
111 D3DXTANGENT_WRAP_U = 0x0001,
112 D3DXTANGENT_WRAP_V = 0x0002,
113 D3DXTANGENT_WRAP_UV = 0x0003,
120 D3DXTANGENT_WIND_CW = 0x0100,
@ D3DXTANGENT_WEIGHT_BY_AREA
Definition: d3dx9mesh.h:118
@ D3DXTANGENT_CALCULATE_NORMALS
Definition: d3dx9mesh.h:121
@ D3DXTANGENT_WRAP_V
Definition: d3dx9mesh.h:112
@ D3DXTANGENT_WEIGHT_EQUAL
Definition: d3dx9mesh.h:119
@ D3DXTANGENT_GENERATE_IN_PLACE
Definition: d3dx9mesh.h:122
@ D3DXTANGENT_ORTHOGONALIZE_FROM_V
Definition: d3dx9mesh.h:116
@ D3DXTANGENT_WIND_CW
Definition: d3dx9mesh.h:120
@ D3DXTANGENT_ORTHOGONALIZE_FROM_U
Definition: d3dx9mesh.h:117
@ D3DXTANGENT_DONT_ORTHOGONALIZE
Definition: d3dx9mesh.h:115
@ D3DXTANGENT_WRAP_U
Definition: d3dx9mesh.h:111
@ D3DXTANGENT_DONT_NORMALIZE_PARTIALS
Definition: d3dx9mesh.h:114
@ D3DXTANGENT_WRAP_UV
Definition: d3dx9mesh.h:113
enum _D3DXTANGENT D3DXTANGENT

◆ _D3DXUVATLAS

Enumerator
D3DXUVATLAS_DEFAULT 
D3DXUVATLAS_GEODESIC_FAST 
D3DXUVATLAS_GEODESIC_QUALITY 

Definition at line 132 of file d3dx9mesh.h.

133{
134 D3DXUVATLAS_DEFAULT = 0x00,
@ D3DXUVATLAS_GEODESIC_FAST
Definition: d3dx9mesh.h:135
@ D3DXUVATLAS_GEODESIC_QUALITY
Definition: d3dx9mesh.h:136
@ D3DXUVATLAS_DEFAULT
Definition: d3dx9mesh.h:134
enum _D3DXUVATLAS D3DXUVATLAS

◆ _D3DXWELDEPSILONSFLAGS

Enumerator
D3DXWELDEPSILONS_WELDALL 
D3DXWELDEPSILONS_WELDPARTIALMATCHES 
D3DXWELDEPSILONS_DONOTREMOVEVERTICES 
D3DXWELDEPSILONS_DONOTSPLIT 

Definition at line 147 of file d3dx9mesh.h.

148{
153};
@ D3DXWELDEPSILONS_DONOTREMOVEVERTICES
Definition: d3dx9mesh.h:151
@ D3DXWELDEPSILONS_DONOTSPLIT
Definition: d3dx9mesh.h:152
@ D3DXWELDEPSILONS_WELDALL
Definition: d3dx9mesh.h:149
@ D3DXWELDEPSILONS_WELDPARTIALMATCHES
Definition: d3dx9mesh.h:150

◆ _MAX_FVF_DECL_SIZE

Enumerator
MAX_FVF_DECL_SIZE 

Definition at line 39 of file d3dx9mesh.h.

40{
42};
#define MAXD3DDECLLENGTH
Definition: d3d9types.h:186
@ MAX_FVF_DECL_SIZE
Definition: d3dx9mesh.h:41

◆ D3DXCLEANTYPE

Enumerator
D3DXCLEAN_BACKFACING 
D3DXCLEAN_BOWTIES 
D3DXCLEAN_SKINNING 
D3DXCLEAN_OPTIMIZATION 
D3DXCLEAN_SIMPLIFICATION 

Definition at line 100 of file d3dx9mesh.h.

100 {
101 D3DXCLEAN_BACKFACING = 0x00000001,
102 D3DXCLEAN_BOWTIES = 0x00000002,
103
D3DXCLEANTYPE
Definition: d3dx9mesh.h:100
@ D3DXCLEAN_BOWTIES
Definition: d3dx9mesh.h:102
@ D3DXCLEAN_SIMPLIFICATION
Definition: d3dx9mesh.h:106
@ D3DXCLEAN_BACKFACING
Definition: d3dx9mesh.h:101
@ D3DXCLEAN_SKINNING
Definition: d3dx9mesh.h:104
@ D3DXCLEAN_OPTIMIZATION
Definition: d3dx9mesh.h:105

Function Documentation

◆ D3DXBoxBoundProbe()

BOOL WINAPI D3DXBoxBoundProbe ( const D3DXVECTOR3 vmin,
const D3DXVECTOR3 vmax,
const D3DXVECTOR3 ray_pos,
const D3DXVECTOR3 ray_dir 
)

Definition at line 1911 of file mesh.c.

1913{
1914 FLOAT div, tmin, tmax, tymin, tymax, tzmin, tzmax;
1915
1916 div = 1.0f / praydirection->x;
1917 if ( div >= 0.0f )
1918 {
1919 tmin = ( pmin->x - prayposition->x ) * div;
1920 tmax = ( pmax->x - prayposition->x ) * div;
1921 }
1922 else
1923 {
1924 tmin = ( pmax->x - prayposition->x ) * div;
1925 tmax = ( pmin->x - prayposition->x ) * div;
1926 }
1927
1928 if ( tmax < 0.0f ) return FALSE;
1929
1930 div = 1.0f / praydirection->y;
1931 if ( div >= 0.0f )
1932 {
1933 tymin = ( pmin->y - prayposition->y ) * div;
1934 tymax = ( pmax->y - prayposition->y ) * div;
1935 }
1936 else
1937 {
1938 tymin = ( pmax->y - prayposition->y ) * div;
1939 tymax = ( pmin->y - prayposition->y ) * div;
1940 }
1941
1942 if ( ( tymax < 0.0f ) || ( tmin > tymax ) || ( tymin > tmax ) ) return FALSE;
1943
1944 if ( tymin > tmin ) tmin = tymin;
1945 if ( tymax < tmax ) tmax = tymax;
1946
1947 div = 1.0f / praydirection->z;
1948 if ( div >= 0.0f )
1949 {
1950 tzmin = ( pmin->z - prayposition->z ) * div;
1951 tzmax = ( pmax->z - prayposition->z ) * div;
1952 }
1953 else
1954 {
1955 tzmin = ( pmax->z - prayposition->z ) * div;
1956 tzmax = ( pmin->z - prayposition->z ) * div;
1957 }
1958
1959 if ( (tzmax < 0.0f ) || ( tmin > tzmax ) || ( tzmin > tmax ) ) return FALSE;
1960
1961 return TRUE;
1962}
_STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y)
Definition: _cstdlib.h:137
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
float FLOAT
Definition: typedefs.h:69

Referenced by D3DXBoundProbeTest().

◆ D3DXCleanMesh()

HRESULT WINAPI D3DXCleanMesh ( D3DXCLEANTYPE  clean_type,
ID3DXMesh *  mesh_in,
const DWORD adjacency_in,
ID3DXMesh **  mesh_out,
DWORD adjacency_out,
ID3DXBuffer **  errors 
)

Definition at line 4002 of file mesh.c.

4004{
4005 FIXME("(%u, %p, %p, %p, %p, %p)\n", clean_type, mesh_in, adjacency_in, mesh_out, adjacency_out, errors_and_warnings);
4006
4007 return E_NOTIMPL;
4008}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXComputeBoundingBox()

HRESULT WINAPI D3DXComputeBoundingBox ( const D3DXVECTOR3 first_pos,
DWORD  num_vertices,
DWORD  stride,
D3DXVECTOR3 vmin,
D3DXVECTOR3 vmax 
)

Definition at line 1964 of file mesh.c.

1966{
1968 unsigned int i;
1969
1970 if( !pfirstposition || !pmin || !pmax ) return D3DERR_INVALIDCALL;
1971
1972 *pmin = *pfirstposition;
1973 *pmax = *pmin;
1974
1975 for(i=0; i<numvertices; i++)
1976 {
1977 vec = *( (const D3DXVECTOR3*)((const char*)pfirstposition + dwstride * i) );
1978
1979 if ( vec.x < pmin->x ) pmin->x = vec.x;
1980 if ( vec.x > pmax->x ) pmax->x = vec.x;
1981
1982 if ( vec.y < pmin->y ) pmin->y = vec.y;
1983 if ( vec.y > pmax->y ) pmax->y = vec.y;
1984
1985 if ( vec.z < pmin->z ) pmin->z = vec.z;
1986 if ( vec.z > pmax->z ) pmax->z = vec.z;
1987 }
1988
1989 return D3D_OK;
1990}
#define D3D_OK
Definition: d3d.h:106
#define D3DERR_INVALIDCALL
FT_Vector * vec
Definition: ftbbox.c:448
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
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77

Referenced by D3DXComputeBoundingBoxTest().

◆ D3DXComputeBoundingSphere()

HRESULT WINAPI D3DXComputeBoundingSphere ( const D3DXVECTOR3 first_pos,
DWORD  num_vertices,
DWORD  stride,
D3DXVECTOR3 center,
FLOAT radius 
)

Definition at line 1992 of file mesh.c.

1994{
1996 FLOAT d;
1997 unsigned int i;
1998
1999 if( !pfirstposition || !pcenter || !pradius ) return D3DERR_INVALIDCALL;
2000
2001 temp.x = 0.0f;
2002 temp.y = 0.0f;
2003 temp.z = 0.0f;
2004 *pradius = 0.0f;
2005
2006 for(i=0; i<numvertices; i++)
2007 D3DXVec3Add(&temp, &temp, (const D3DXVECTOR3*)((const char*)pfirstposition + dwstride * i));
2008
2009 D3DXVec3Scale(pcenter, &temp, 1.0f / numvertices);
2010
2011 for(i=0; i<numvertices; i++)
2012 {
2013 d = D3DXVec3Length(D3DXVec3Subtract(&temp, (const D3DXVECTOR3*)((const char*)pfirstposition + dwstride * i), pcenter));
2014 if ( d > *pradius ) *pradius = d;
2015 }
2016 return D3D_OK;
2017}
#define d
Definition: ke_i.h:81
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by D3DXComputeBoundingSphereTest().

◆ D3DXComputeIMTFromPerTexelSignal()

HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal ( ID3DXMesh *  mesh,
DWORD  texture_idx,
float texel_signal,
UINT  width,
UINT  height,
UINT  signal_dimension,
UINT  component_count,
DWORD  flags,
LPD3DXUVATLASCB  cb,
void ctx,
ID3DXBuffer **  buffer 
)

◆ D3DXComputeIMTFromPerVertexSignal()

HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal ( ID3DXMesh *  mesh,
const float vertex_signal,
UINT  signal_dimension,
UINT  signal_stride,
DWORD  flags,
LPD3DXUVATLASCB  cb,
void ctx,
ID3DXBuffer **  buffer 
)

◆ D3DXComputeIMTFromSignal()

HRESULT WINAPI D3DXComputeIMTFromSignal ( ID3DXMesh *  mesh,
DWORD  texture_idx,
UINT  signal_dimension,
float  max_uv_distance,
DWORD  flags,
LPD3DXIMTSIGNALCALLBACK  signal_cb,
void signal_ctx,
LPD3DXUVATLASCB  status_cb,
void status_ctx,
ID3DXBuffer **  buffer 
)

◆ D3DXComputeIMTFromTexture()

HRESULT WINAPI D3DXComputeIMTFromTexture ( struct ID3DXMesh *  mesh,
struct IDirect3DTexture9 *  texture,
DWORD  texture_idx,
DWORD  options,
LPD3DXUVATLASCB  cb,
void ctx,
struct ID3DXBuffer **  out 
)

◆ D3DXComputeNormals()

HRESULT WINAPI D3DXComputeNormals ( ID3DXBaseMesh *  mesh,
const DWORD adjacency 
)

Definition at line 7563 of file mesh.c.

7564{
7565 TRACE("mesh %p, adjacency %p\n", mesh, adjacency);
7566
7567 if (mesh && (ID3DXMeshVtbl *)mesh->lpVtbl != &D3DXMesh_Vtbl)
7568 {
7569 ERR("Invalid virtual table\n");
7570 return D3DERR_INVALIDCALL;
7571 }
7572
7573 return D3DXComputeTangentFrameEx((ID3DXMesh *)mesh, D3DX_DEFAULT, 0,
7576 adjacency, -1.01f, -0.01f, -1.01f, NULL, NULL);
7577}
#define ERR(fmt,...)
Definition: debug.h:113
@ D3DDECLUSAGE_NORMAL
Definition: d3d9types.h:223
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *mesh, DWORD texture_in_semantic, DWORD texture_in_index, DWORD u_partial_out_semantic, DWORD u_partial_out_index, DWORD v_partial_out_semantic, DWORD v_partial_out_index, DWORD normal_out_semantic, DWORD normal_out_index, DWORD options, const DWORD *adjacency, float partial_edge_threshold, float singular_point_threshold, float normal_edge_threshold, ID3DXMesh **mesh_out, ID3DXBuffer **vertex_mapping)
Definition: mesh.c:7320
static const struct ID3DXMeshVtbl D3DXMesh_Vtbl
Definition: mesh.c:1862
#define TRACE(s)
Definition: solgame.cpp:4
Definition: mesh.c:198

Referenced by compute_normals_D3DXComputeNormals().

◆ D3DXComputeTangent()

HRESULT WINAPI D3DXComputeTangent ( ID3DXMesh *  mesh,
DWORD  stage,
DWORD  tangent_idx,
DWORD  binorm_idx,
DWORD  wrap,
const DWORD adjacency 
)

Definition at line 7545 of file mesh.c.

7547{
7548 TRACE("mesh %p, stage_idx %d, tangent_idx %d, binorm_idx %d, wrap %d, adjacency %p.\n",
7549 mesh, stage_idx, tangent_idx, binorm_idx, wrap, adjacency);
7550
7552 ( binorm_idx == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_BINORMAL,
7553 binorm_idx,
7554 ( tangent_idx == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_TANGENT,
7555 tangent_idx, D3DX_DEFAULT, 0,
7557 adjacency, -1.01f, -0.01f, -1.01f, NULL, NULL);
7558}
@ D3DDECLUSAGE_TANGENT
Definition: d3d9types.h:226
@ D3DDECLUSAGE_BINORMAL
Definition: d3d9types.h:227
@ D3DDECLUSAGE_TEXCOORD
Definition: d3d9types.h:225
#define wrap(journal, var)
Definition: recovery.c:207

◆ D3DXComputeTangentFrameEx()

HRESULT WINAPI D3DXComputeTangentFrameEx ( ID3DXMesh *  mesh_in,
DWORD  texture_in_semantic,
DWORD  texture_in_idx,
DWORD  u_partial_out_semantic,
DWORD  u_partial_out_idx,
DWORD  v_partial_out_semantic,
DWORD  v_partial_out_idx,
DWORD  normal_out_semantic,
DWORD  normal_out_idx,
DWORD  flags,
const DWORD adjacency,
float  partial_edge_threshold,
float  singular_point_threshold,
float  normal_edge_threshold,
ID3DXMesh **  mesh_out,
ID3DXBuffer **  buffer 
)

Definition at line 7320 of file mesh.c.

7325{
7326 HRESULT hr;
7327 void *indices = NULL;
7328 BYTE *vertices = NULL;
7329 DWORD *point_reps = NULL;
7330 size_t normal_size;
7331 BOOL indices_are_32bit;
7332 DWORD i, j, num_faces, num_vertices, vertex_stride;
7334 D3DVERTEXELEMENT9 *position_declaration = NULL, *normal_declaration = NULL;
7336
7337 TRACE("mesh %p, texture_in_semantic %u, texture_in_index %u, u_partial_out_semantic %u, u_partial_out_index %u, "
7338 "v_partial_out_semantic %u, v_partial_out_index %u, normal_out_semantic %u, normal_out_index %u, "
7339 "options %#x, adjacency %p, partial_edge_threshold %f, singular_point_threshold %f, "
7340 "normal_edge_threshold %f, mesh_out %p, vertex_mapping %p\n",
7341 mesh, texture_in_semantic, texture_in_index, u_partial_out_semantic, u_partial_out_index,
7342 v_partial_out_semantic, v_partial_out_index, normal_out_semantic, normal_out_index, options, adjacency,
7343 partial_edge_threshold, singular_point_threshold, normal_edge_threshold, mesh_out, vertex_mapping);
7344
7345 if (!mesh)
7346 {
7347 WARN("mesh is NULL\n");
7348 return D3DERR_INVALIDCALL;
7349 }
7350
7351 if (weighting_method == (D3DXTANGENT_WEIGHT_EQUAL | D3DXTANGENT_WEIGHT_BY_AREA))
7352 {
7353 WARN("D3DXTANGENT_WEIGHT_BY_AREA and D3DXTANGENT_WEIGHT_EQUAL are mutally exclusive\n");
7354 return D3DERR_INVALIDCALL;
7355 }
7356
7357 if (u_partial_out_semantic != D3DX_DEFAULT)
7358 {
7359 FIXME("tangent vectors computation is not supported\n");
7360 return E_NOTIMPL;
7361 }
7362
7363 if (v_partial_out_semantic != D3DX_DEFAULT)
7364 {
7365 FIXME("binormal vectors computation is not supported\n");
7366 return E_NOTIMPL;
7367 }
7368
7370 {
7371 FIXME("unsupported options %#x\n", options);
7372 return E_NOTIMPL;
7373 }
7374
7376 {
7377 FIXME("only normals computation is supported\n");
7378 return E_NOTIMPL;
7379 }
7380
7381 if (!(options & D3DXTANGENT_GENERATE_IN_PLACE) || mesh_out || vertex_mapping)
7382 {
7383 FIXME("only D3DXTANGENT_GENERATE_IN_PLACE is supported\n");
7384 return E_NOTIMPL;
7385 }
7386
7387 if (FAILED(hr = mesh->lpVtbl->GetDeclaration(mesh, declaration)))
7388 return hr;
7389
7390 for (i = 0; declaration[i].Stream != 0xff; i++)
7391 {
7392 if (declaration[i].Usage == D3DDECLUSAGE_POSITION && !declaration[i].UsageIndex)
7393 position_declaration = &declaration[i];
7394 if (declaration[i].Usage == normal_out_semantic && declaration[i].UsageIndex == normal_out_index)
7395 normal_declaration = &declaration[i];
7396 }
7397
7398 if (!position_declaration || !normal_declaration)
7399 return D3DERR_INVALIDCALL;
7400
7401 if (normal_declaration->Type == D3DDECLTYPE_FLOAT3)
7402 {
7403 normal_size = sizeof(D3DXVECTOR3);
7404 }
7405 else if (normal_declaration->Type == D3DDECLTYPE_FLOAT4)
7406 {
7407 normal_size = sizeof(D3DXVECTOR4);
7408 }
7409 else
7410 {
7411 WARN("unsupported normals type %u\n", normal_declaration->Type);
7412 return D3DERR_INVALIDCALL;
7413 }
7414
7415 num_faces = mesh->lpVtbl->GetNumFaces(mesh);
7416 num_vertices = mesh->lpVtbl->GetNumVertices(mesh);
7417 vertex_stride = mesh->lpVtbl->GetNumBytesPerVertex(mesh);
7418 indices_are_32bit = mesh->lpVtbl->GetOptions(mesh) & D3DXMESH_32BIT;
7419
7420 point_reps = HeapAlloc(GetProcessHeap(), 0, num_vertices * sizeof(*point_reps));
7421 if (!point_reps)
7422 {
7423 hr = E_OUTOFMEMORY;
7424 goto done;
7425 }
7426
7427 if (adjacency)
7428 {
7429 if (FAILED(hr = mesh->lpVtbl->ConvertAdjacencyToPointReps(mesh, adjacency, point_reps)))
7430 goto done;
7431 }
7432 else
7433 {
7434 for (i = 0; i < num_vertices; i++)
7435 point_reps[i] = i;
7436 }
7437
7438 if (FAILED(hr = mesh->lpVtbl->LockIndexBuffer(mesh, 0, &indices)))
7439 goto done;
7440
7441 if (FAILED(hr = mesh->lpVtbl->LockVertexBuffer(mesh, 0, (void **)&vertices)))
7442 goto done;
7443
7444 for (i = 0; i < num_vertices; i++)
7445 {
7446 static const D3DXVECTOR4 default_vector = {0.0f, 0.0f, 0.0f, 1.0f};
7447 void *normal = vertices + normal_declaration->Offset + i * vertex_stride;
7448
7449 memcpy(normal, &default_vector, normal_size);
7450 }
7451
7452 for (i = 0; i < num_faces; i++)
7453 {
7454 float denominator, weights[3];
7455 D3DXVECTOR3 a, b, cross, face_normal;
7456 const DWORD face_indices[3] =
7457 {
7458 read_ib(indices, indices_are_32bit, 3 * i + 0),
7459 read_ib(indices, indices_are_32bit, 3 * i + 1),
7460 read_ib(indices, indices_are_32bit, 3 * i + 2)
7461 };
7462 const D3DXVECTOR3 v0 = read_vec3(vertices, position_declaration, vertex_stride, face_indices[0]);
7463 const D3DXVECTOR3 v1 = read_vec3(vertices, position_declaration, vertex_stride, face_indices[1]);
7464 const D3DXVECTOR3 v2 = read_vec3(vertices, position_declaration, vertex_stride, face_indices[2]);
7465
7466 D3DXVec3Cross(&cross, D3DXVec3Subtract(&a, &v0, &v1), D3DXVec3Subtract(&b, &v0, &v2));
7467
7468 switch (weighting_method)
7469 {
7471 weights[0] = weights[1] = weights[2] = 1.0f;
7472 break;
7474 weights[0] = weights[1] = weights[2] = D3DXVec3Length(&cross);
7475 break;
7476 default:
7477 /* weight by angle */
7478 denominator = D3DXVec3Length(&a) * D3DXVec3Length(&b);
7479 if (!denominator)
7480 weights[0] = 0.0f;
7481 else
7482 weights[0] = acosf(D3DXVec3Dot(&a, &b) / denominator);
7483
7484 D3DXVec3Subtract(&a, &v1, &v0);
7485 D3DXVec3Subtract(&b, &v1, &v2);
7486 denominator = D3DXVec3Length(&a) * D3DXVec3Length(&b);
7487 if (!denominator)
7488 weights[1] = 0.0f;
7489 else
7490 weights[1] = acosf(D3DXVec3Dot(&a, &b) / denominator);
7491
7492 D3DXVec3Subtract(&a, &v2, &v0);
7493 D3DXVec3Subtract(&b, &v2, &v1);
7494 denominator = D3DXVec3Length(&a) * D3DXVec3Length(&b);
7495 if (!denominator)
7496 weights[2] = 0.0f;
7497 else
7498 weights[2] = acosf(D3DXVec3Dot(&a, &b) / denominator);
7499
7500 break;
7501 }
7502
7503 D3DXVec3Normalize(&face_normal, &cross);
7504
7505 for (j = 0; j < 3; j++)
7506 {
7508 DWORD rep_index = point_reps[face_indices[j]];
7509 D3DXVECTOR3 *rep_normal = vertex_element_vec3(vertices, normal_declaration, vertex_stride, rep_index);
7510
7511 D3DXVec3Scale(&normal, &face_normal, weights[j]);
7512 D3DXVec3Add(rep_normal, rep_normal, &normal);
7513 }
7514 }
7515
7516 for (i = 0; i < num_vertices; i++)
7517 {
7518 DWORD rep_index = point_reps[i];
7519 D3DXVECTOR3 *normal = vertex_element_vec3(vertices, normal_declaration, vertex_stride, i);
7520 D3DXVECTOR3 *rep_normal = vertex_element_vec3(vertices, normal_declaration, vertex_stride, rep_index);
7521
7522 if (i == rep_index)
7523 D3DXVec3Normalize(rep_normal, rep_normal);
7524 else
7525 *normal = *rep_normal;
7526 }
7527
7528 hr = D3D_OK;
7529
7530done:
7531 if (vertices)
7532 mesh->lpVtbl->UnlockVertexBuffer(mesh);
7533
7534 if (indices)
7535 mesh->lpVtbl->UnlockIndexBuffer(mesh);
7536
7537 HeapFree(GetProcessHeap(), 0, point_reps);
7538
7539 return hr;
7540}
#define WARN(fmt,...)
Definition: debug.h:115
@ D3DDECLUSAGE_POSITION
Definition: d3d9types.h:220
@ D3DDECLTYPE_FLOAT3
Definition: d3d9types.h:257
@ D3DDECLTYPE_FLOAT4
Definition: d3d9types.h:258
#define D3DDECL_END()
Definition: d3d9types.h:311
struct _D3DVECTOR D3DXVECTOR3
Definition: d3dx9math.h:97
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
D3DXVECTOR3 *WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv)
Definition: math.c:1805
static D3DXVECTOR3 read_vec3(BYTE *vertices, const D3DVERTEXELEMENT9 *declaration, DWORD vertex_stride, DWORD index)
Definition: mesh.c:7290
static DWORD read_ib(void *index_buffer, BOOL indices_are_32bit, DWORD index)
Definition: mesh.c:6951
static D3DXVECTOR3 * vertex_element_vec3(BYTE *vertices, const D3DVERTEXELEMENT9 *declaration, DWORD vertex_stride, DWORD index)
Definition: mesh.c:7284
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLfloat v0
Definition: glext.h:6061
const GLbyte * weights
Definition: glext.h:6523
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
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
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
_Check_return_ float __cdecl acosf(_In_ float x)
Definition: math.h:219
#define FAILED(hr)
Definition: intsafe.h:51
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
@ normal
Definition: optimize.h:166
static void cross(float v1[3], float v2[3], float result[3])
Definition: project.c:100
HRESULT hr
Definition: shlfolder.c:183
unsigned char BYTE
Definition: xxhash.c:193

Referenced by compute_normals_D3DXComputeTangentFrameEx(), D3DXComputeNormals(), D3DXComputeTangent(), and test_compute_normals().

◆ D3DXConcatenateMeshes()

HRESULT WINAPI D3DXConcatenateMeshes ( struct ID3DXMesh **  meshes,
UINT  mesh_count,
DWORD  flags,
const D3DXMATRIX geometry_matrices,
const D3DXMATRIX texture_matrices,
const D3DVERTEXELEMENT9 declaration,
struct IDirect3DDevice9 *  device,
struct ID3DXMesh **  mesh 
)

◆ D3DXConvertMeshSubsetToSingleStrip()

HRESULT WINAPI D3DXConvertMeshSubsetToSingleStrip ( struct ID3DXBaseMesh *  mesh_in,
DWORD  attribute_id,
DWORD  ib_flags,
struct IDirect3DIndexBuffer9 **  index_buffer,
DWORD index_count 
)

Definition at line 7600 of file mesh.c.

7602{
7603 FIXME("mesh_in %p, attribute_id %u, ib_flags %u, index_buffer %p, index_count %p stub.\n",
7604 mesh_in, attribute_id, ib_flags, index_buffer, index_count);
7605
7606 return E_NOTIMPL;
7607}

◆ D3DXConvertMeshSubsetToStrips()

HRESULT WINAPI D3DXConvertMeshSubsetToStrips ( struct ID3DXBaseMesh *  mesh_in,
DWORD  attribute_id,
DWORD  ib_flags,
struct IDirect3DIndexBuffer9 **  index_buffer,
DWORD index_count,
struct ID3DXBuffer **  strip_lengths,
DWORD strip_count 
)

◆ D3DXCreateBuffer()

HRESULT WINAPI D3DXCreateBuffer ( DWORD  size,
ID3DXBuffer **  buffer 
)

Definition at line 131 of file core.c.

132{
133 struct ID3DXBufferImpl *object;
134 HRESULT hr;
135
136 TRACE("size %u, buffer %p.\n", size, buffer);
137
138 if (!buffer)
139 {
140 WARN("Invalid buffer specified.\n");
141 return D3DERR_INVALIDCALL;
142 }
143
144 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
145 if (!object)
146 return E_OUTOFMEMORY;
147
148 hr = d3dx9_buffer_init(object, size);
149 if (FAILED(hr))
150 {
151 WARN("Failed to initialize buffer, hr %#x.\n", hr);
152 HeapFree(GetProcessHeap(), 0, object);
153 return hr;
154 }
155
156 *buffer = &object->ID3DXBuffer_iface;
157
158 TRACE("Created ID3DXBuffer %p.\n", *buffer);
159
160 return D3D_OK;
161}
static HRESULT d3dx9_buffer_init(struct ID3DXBufferImpl *buffer, DWORD size)
Definition: core.c:115
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915

◆ D3DXCreateMesh()

HRESULT WINAPI D3DXCreateMesh ( DWORD  face_count,
DWORD  vertex_count,
DWORD  flags,
const D3DVERTEXELEMENT9 declaration,
struct IDirect3DDevice9 *  device,
struct ID3DXMesh **  mesh 
)

Definition at line 2433 of file mesh.c.

2435{
2436 HRESULT hr;
2437 DWORD fvf;
2438 IDirect3DVertexDeclaration9 *vertex_declaration;
2439 UINT vertex_declaration_size;
2440 UINT num_elem;
2441 IDirect3DVertexBuffer9 *vertex_buffer;
2442 IDirect3DIndexBuffer9 *index_buffer;
2443 DWORD *attrib_buffer;
2444 struct d3dx9_mesh *object;
2445 DWORD index_usage = 0;
2446 D3DPOOL index_pool = D3DPOOL_DEFAULT;
2447 D3DFORMAT index_format = D3DFMT_INDEX16;
2448 DWORD vertex_usage = 0;
2449 D3DPOOL vertex_pool = D3DPOOL_DEFAULT;
2450 int i;
2451
2452 TRACE("numfaces %u, numvertices %u, options %#x, declaration %p, device %p, mesh %p.\n",
2454
2455 if (numfaces == 0 || numvertices == 0 || declaration == NULL || device == NULL || mesh == NULL ||
2456 /* D3DXMESH_VB_SHARE is for cloning, and D3DXMESH_USEHWONLY is for ConvertToBlendedMesh */
2457 (options & (D3DXMESH_VB_SHARE | D3DXMESH_USEHWONLY | 0xfffe0000)))
2458 {
2459 return D3DERR_INVALIDCALL;
2460 }
2461 for (i = 0; declaration[i].Stream != 0xff; i++)
2462 if (declaration[i].Stream != 0)
2463 return D3DERR_INVALIDCALL;
2464 num_elem = i + 1;
2465
2466 if (options & D3DXMESH_32BIT)
2467 index_format = D3DFMT_INDEX32;
2468
2470 index_usage |= D3DUSAGE_DONOTCLIP;
2471 vertex_usage |= D3DUSAGE_DONOTCLIP;
2472 }
2473 if (options & D3DXMESH_POINTS) {
2474 index_usage |= D3DUSAGE_POINTS;
2475 vertex_usage |= D3DUSAGE_POINTS;
2476 }
2478 index_usage |= D3DUSAGE_RTPATCHES;
2479 vertex_usage |= D3DUSAGE_RTPATCHES;
2480 }
2481 if (options & D3DXMESH_NPATCHES) {
2482 index_usage |= D3DUSAGE_NPATCHES;
2483 vertex_usage |= D3DUSAGE_NPATCHES;
2484 }
2485
2487 vertex_pool = D3DPOOL_SYSTEMMEM;
2488 else if (options & D3DXMESH_VB_MANAGED)
2489 vertex_pool = D3DPOOL_MANAGED;
2490
2492 vertex_usage |= D3DUSAGE_WRITEONLY;
2494 vertex_usage |= D3DUSAGE_DYNAMIC;
2496 vertex_usage |= D3DUSAGE_SOFTWAREPROCESSING;
2497
2499 index_pool = D3DPOOL_SYSTEMMEM;
2500 else if (options & D3DXMESH_IB_MANAGED)
2501 index_pool = D3DPOOL_MANAGED;
2502
2504 index_usage |= D3DUSAGE_WRITEONLY;
2506 index_usage |= D3DUSAGE_DYNAMIC;
2508 index_usage |= D3DUSAGE_SOFTWAREPROCESSING;
2509
2511 if (hr != D3D_OK)
2512 {
2513 fvf = 0;
2514 }
2515
2516 /* Create vertex declaration */
2520 if (FAILED(hr))
2521 {
2522 WARN("Unexpected return value %x from IDirect3DDevice9_CreateVertexDeclaration.\n",hr);
2523 return hr;
2524 }
2526
2527 /* Create vertex buffer */
2530 vertex_usage,
2531 fvf,
2532 vertex_pool,
2534 NULL);
2535 if (FAILED(hr))
2536 {
2537 WARN("Unexpected return value %x from IDirect3DDevice9_CreateVertexBuffer.\n",hr);
2539 return hr;
2540 }
2541
2542 /* Create index buffer */
2544 numfaces * 3 * ((index_format == D3DFMT_INDEX16) ? 2 : 4),
2545 index_usage,
2546 index_format,
2547 index_pool,
2548 &index_buffer,
2549 NULL);
2550 if (FAILED(hr))
2551 {
2552 WARN("Unexpected return value %x from IDirect3DDevice9_CreateVertexBuffer.\n",hr);
2555 return hr;
2556 }
2557
2559 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2560 if (object == NULL || attrib_buffer == NULL)
2561 {
2562 HeapFree(GetProcessHeap(), 0, object);
2567 *mesh = NULL;
2568 return E_OUTOFMEMORY;
2569 }
2570 object->ID3DXMesh_iface.lpVtbl = &D3DXMesh_Vtbl;
2571 object->ref = 1;
2572
2573 object->numfaces = numfaces;
2574 object->numvertices = numvertices;
2575 object->options = options;
2576 object->fvf = fvf;
2577 object->device = device;
2579
2580 copy_declaration(object->cached_declaration, declaration, num_elem);
2581 object->vertex_declaration = vertex_declaration;
2582 object->vertex_declaration_size = vertex_declaration_size;
2583 object->num_elem = num_elem;
2584 object->vertex_buffer = vertex_buffer;
2585 object->index_buffer = index_buffer;
2586 object->attrib_buffer = attrib_buffer;
2587
2588 *mesh = &object->ID3DXMesh_iface;
2589
2590 return D3D_OK;
2591}
#define D3DUSAGE_NPATCHES
Definition: d3d8types.h:98
#define D3DUSAGE_POINTS
Definition: d3d8types.h:96
#define D3DUSAGE_DONOTCLIP
Definition: d3d8types.h:95
@ D3DFMT_INDEX16
Definition: d3d8types.h:649
@ D3DFMT_INDEX32
Definition: d3d8types.h:650
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
#define D3DUSAGE_WRITEONLY
Definition: d3d8types.h:93
enum _D3DPOOL D3DPOOL
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
@ D3DPOOL_SYSTEMMEM
Definition: d3d8types.h:711
@ D3DPOOL_MANAGED
Definition: d3d8types.h:710
enum _D3DFORMAT D3DFORMAT
#define D3DUSAGE_SOFTWAREPROCESSING
Definition: d3d8types.h:94
#define D3DUSAGE_RTPATCHES
Definition: d3d8types.h:97
#define IDirect3DDevice9_CreateIndexBuffer(p, a, b, c, d, e, f)
Definition: d3d9.h:1534
#define IDirect3DDevice9_CreateVertexDeclaration(p, a, b)
Definition: d3d9.h:1593
#define IDirect3DVertexBuffer9_Release(p)
Definition: d3d9.h:696
#define IDirect3DVertexDeclaration9_Release(p)
Definition: d3d9.h:1185
#define IDirect3DDevice9_CreateVertexBuffer(p, a, b, c, d, e, f)
Definition: d3d9.h:1533
#define IDirect3DIndexBuffer9_Release(p)
Definition: d3d9.h:764
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
static void copy_declaration(D3DVERTEXELEMENT9 *dst, const D3DVERTEXELEMENT9 *src, UINT num_elem)
Definition: mesh.c:218
HRESULT WINAPI D3DXFVFFromDeclarator(const D3DVERTEXELEMENT9 *declaration, DWORD *fvf)
Definition: mesh.c:2134
UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_idx)
Definition: mesh.c:2323
static IStream Stream
Definition: htmldoc.c:1115
unsigned int UINT
Definition: ndis.h:50
DWORD fvf
Definition: mesh.c:53
DWORD numfaces
Definition: mesh.c:50
UINT num_elem
Definition: mesh.c:58
DWORD numvertices
Definition: mesh.c:51
UINT vertex_declaration_size
Definition: mesh.c:57
IDirect3DDevice9 * device
Definition: mesh.c:54
IDirect3DVertexBuffer9 * vertex_buffer
Definition: mesh.c:59
DWORD options
Definition: mesh.c:52
DWORD * attrib_buffer
Definition: mesh.c:61
IDirect3DIndexBuffer9 * index_buffer
Definition: mesh.c:60
IDirect3DVertexDeclaration9 * vertex_declaration
Definition: mesh.c:56
Definition: devices.h:37

Referenced by d3dx9_mesh_CloneMesh(), D3DXCreateMeshFVF(), D3DXCreateMeshTest(), init_test_mesh(), test_convert_adjacency_to_point_reps(), test_convert_point_reps_to_adjacency(), and test_update_semantics().

◆ D3DXCreateMeshFVF()

HRESULT WINAPI D3DXCreateMeshFVF ( DWORD  face_count,
DWORD  vertex_count,
DWORD  flags,
DWORD  fvf,
struct IDirect3DDevice9 *  device,
struct ID3DXMesh **  mesh 
)

Definition at line 2596 of file mesh.c.

2598{
2599 HRESULT hr;
2601
2602 TRACE("(%u, %u, %u, %u, %p, %p)\n", numfaces, numvertices, options, fvf, device, mesh);
2603
2605 if (FAILED(hr)) return hr;
2606
2607 return D3DXCreateMesh(numfaces, numvertices, options, declaration, device, mesh);
2608}
HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD fvf, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE])
Definition: mesh.c:2036
HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
Definition: mesh.c:2433

Referenced by D3DXCreateBox(), D3DXCreateCylinder(), D3DXCreateMeshFVFTest(), D3DXCreatePolygon(), D3DXCreateSphere(), D3DXCreateTextW(), D3DXCreateTorus(), D3DXGenerateAdjacencyTest(), D3DXLoadMeshFromXInMemory(), and D3DXLoadSkinMeshFromXof().

◆ D3DXCreatePatchMesh()

HRESULT WINAPI D3DXCreatePatchMesh ( const D3DXPATCHINFO patch_info,
DWORD  patch_count,
DWORD  vertex_count,
DWORD  flags,
const D3DVERTEXELEMENT9 declaration,
struct IDirect3DDevice9 *  device,
struct ID3DXPatchMesh **  mesh 
)

◆ D3DXCreatePMeshFromStream()

HRESULT WINAPI D3DXCreatePMeshFromStream ( struct IStream stream,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXPMesh **  mesh 
)

◆ D3DXCreatePRTBuffer()

HRESULT WINAPI D3DXCreatePRTBuffer ( UINT  sample_count,
UINT  coeff_count,
UINT  channel_count,
ID3DXPRTBuffer **  buffer 
)

◆ D3DXCreatePRTBufferTex()

HRESULT WINAPI D3DXCreatePRTBufferTex ( UINT  width,
UINT  height,
UINT  coeff_count,
UINT  channel_count,
ID3DXPRTBuffer **  buffer 
)

◆ D3DXCreatePRTCompBuffer()

HRESULT WINAPI D3DXCreatePRTCompBuffer ( D3DXSHCOMPRESSQUALITYTYPE  quality,
UINT  cluster_count,
UINT  pca_count,
LPD3DXSHPRTSIMCB  cb,
void ctx,
ID3DXPRTBuffer *  input,
ID3DXPRTCompBuffer **  buffer 
)

◆ D3DXCreatePRTEngine()

HRESULT WINAPI D3DXCreatePRTEngine ( ID3DXMesh *  mesh,
DWORD adjacency,
BOOL  extract_uv,
ID3DXMesh *  blocker_mesh,
ID3DXPRTEngine **  engine 
)

◆ D3DXCreateSkinInfo()

HRESULT WINAPI D3DXCreateSkinInfo ( DWORD  vertex_count,
const D3DVERTEXELEMENT9 declaration,
DWORD  bone_count,
ID3DXSkinInfo **  skin_info 
)

Definition at line 549 of file skin.c.

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) {
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;
585error:
586 HeapFree(GetProcessHeap(), 0, object->bones);
587 HeapFree(GetProcessHeap(), 0, object);
588 return hr;
589}
#define error(str)
Definition: mkdosfs.c:1605
static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
Definition: skin.c:518
static HRESULT WINAPI d3dx9_skin_info_SetDeclaration(ID3DXSkinInfo *iface, const D3DVERTEXELEMENT9 *declaration)
Definition: skin.c:355
DWORD num_vertices
Definition: skin.c:47
DWORD num_bones
Definition: skin.c:48

Referenced by d3dx9_skin_info_Clone(), D3DXCreateSkinInfoFVF(), and test_create_skin_info().

◆ D3DXCreateSkinInfoFromBlendedMesh()

HRESULT WINAPI D3DXCreateSkinInfoFromBlendedMesh ( ID3DXBaseMesh *  mesh,
DWORD  bone_count,
const D3DXBONECOMBINATION bone_combination_table,
ID3DXSkinInfo **  skin_info 
)

◆ D3DXCreateSkinInfoFVF()

HRESULT WINAPI D3DXCreateSkinInfoFVF ( DWORD  vertex_count,
DWORD  fvf,
DWORD  bone_count,
ID3DXSkinInfo **  skin_info 
)

Definition at line 591 of file skin.c.

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
602 return D3DXCreateSkinInfo(num_vertices, declaration, num_bones, skin_info);
603}
HRESULT WINAPI D3DXCreateSkinInfo(DWORD num_vertices, const D3DVERTEXELEMENT9 *declaration, DWORD num_bones, ID3DXSkinInfo **skin_info)
Definition: skin.c:549

Referenced by parse_mesh(), parse_skin_mesh_info(), test_create_skin_info(), and test_update_skinned_mesh().

◆ D3DXCreateSPMesh()

HRESULT WINAPI D3DXCreateSPMesh ( ID3DXMesh *  mesh,
const DWORD adjacency,
const D3DXATTRIBUTEWEIGHTS attribute_weights,
const float vertex_weights,
ID3DXSPMesh **  spmesh 
)

◆ D3DXCreateTextureGutterHelper()

HRESULT WINAPI D3DXCreateTextureGutterHelper ( UINT  width,
UINT  height,
ID3DXMesh *  mesh,
float  gutter_size,
ID3DXTextureGutterHelper **  gh 
)

◆ D3DXDeclaratorFromFVF()

HRESULT WINAPI D3DXDeclaratorFromFVF ( DWORD  fvf,
D3DVERTEXELEMENT9  declaration[MAX_FVF_DECL_SIZE] 
)

Definition at line 2036 of file mesh.c.

2037{
2038 static const D3DVERTEXELEMENT9 end_element = D3DDECL_END();
2039 DWORD tex_count = (fvf & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT;
2040 unsigned int offset = 0;
2041 unsigned int idx = 0;
2042 unsigned int i;
2043
2044 TRACE("fvf %#x, declaration %p.\n", fvf, declaration);
2045
2047
2048 if (fvf & D3DFVF_POSITION_MASK)
2049 {
2050 BOOL has_blend = (fvf & D3DFVF_XYZB5) >= D3DFVF_XYZB1;
2051 DWORD blend_count = 1 + (((fvf & D3DFVF_XYZB5) - D3DFVF_XYZB1) >> 1);
2052 BOOL has_blend_idx = (fvf & D3DFVF_LASTBETA_D3DCOLOR) || (fvf & D3DFVF_LASTBETA_UBYTE4);
2053
2054 if (has_blend_idx) --blend_count;
2055
2056 if ((fvf & D3DFVF_POSITION_MASK) == D3DFVF_XYZW
2057 || (has_blend && blend_count > 4))
2058 return D3DERR_INVALIDCALL;
2059
2060 if ((fvf & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW)
2062 else
2064
2065 if (has_blend)
2066 {
2067 switch (blend_count)
2068 {
2069 case 0:
2070 break;
2071 case 1:
2073 break;
2074 case 2:
2076 break;
2077 case 3:
2079 break;
2080 case 4:
2082 break;
2083 default:
2084 ERR("Invalid blend count %u.\n", blend_count);
2085 break;
2086 }
2087
2088 if (has_blend_idx)
2089 {
2090 if (fvf & D3DFVF_LASTBETA_UBYTE4)
2092 else if (fvf & D3DFVF_LASTBETA_D3DCOLOR)
2094 }
2095 }
2096 }
2097
2098 if (fvf & D3DFVF_NORMAL)
2100 if (fvf & D3DFVF_PSIZE)
2102 if (fvf & D3DFVF_DIFFUSE)
2104 if (fvf & D3DFVF_SPECULAR)
2106
2107 for (i = 0; i < tex_count; ++i)
2108 {
2109 switch ((fvf >> (16 + 2 * i)) & 0x03)
2110 {
2113 break;
2116 break;
2119 break;
2122 break;
2123 }
2124 }
2125
2126 declaration[idx] = end_element;
2127
2128 return D3D_OK;
2129}
#define D3DFVF_DIFFUSE
Definition: d3d8types.h:122
#define D3DFVF_RESERVED2
Definition: d3d8types.h:136
#define D3DFVF_TEXCOUNT_SHIFT
Definition: d3d8types.h:125
#define D3DFVF_XYZB1
Definition: d3d8types.h:115
#define D3DFVF_LASTBETA_UBYTE4
Definition: d3d8types.h:135
#define D3DFVF_XYZB5
Definition: d3d8types.h:119
#define D3DFVF_XYZRHW
Definition: d3d8types.h:114
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
#define D3DFVF_TEXTUREFORMAT4
Definition: d3d8types.h:63
#define D3DFVF_TEXTUREFORMAT3
Definition: d3d8types.h:62
#define D3DFVF_TEXCOUNT_MASK
Definition: d3d8types.h:124
#define D3DFVF_TEXTUREFORMAT1
Definition: d3d8types.h:60
#define D3DFVF_PSIZE
Definition: d3d8types.h:121
#define D3DFVF_TEXTUREFORMAT2
Definition: d3d8types.h:61
#define D3DFVF_SPECULAR
Definition: d3d8types.h:123
#define D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
#define D3DFVF_RESERVED0
Definition: d3d8types.h:111
@ D3DDECLUSAGE_BLENDWEIGHT
Definition: d3d9types.h:221
@ D3DDECLUSAGE_BLENDINDICES
Definition: d3d9types.h:222
@ D3DDECLUSAGE_POSITIONT
Definition: d3d9types.h:229
@ D3DDECLUSAGE_PSIZE
Definition: d3d9types.h:224
@ D3DDECLUSAGE_COLOR
Definition: d3d9types.h:230
#define D3DFVF_LASTBETA_D3DCOLOR
Definition: d3d9types.h:160
@ D3DDECLTYPE_UBYTE4
Definition: d3d9types.h:260
@ D3DDECLTYPE_FLOAT1
Definition: d3d9types.h:255
@ D3DDECLTYPE_D3DCOLOR
Definition: d3d9types.h:259
@ D3DDECLTYPE_FLOAT2
Definition: d3d9types.h:256
#define D3DFVF_XYZW
Definition: d3d9types.h:143
static void append_decl_element(D3DVERTEXELEMENT9 *declaration, UINT *idx, UINT *offset, D3DDECLTYPE type, D3DDECLUSAGE usage, UINT usage_idx)
Definition: mesh.c:2019
unsigned int idx
Definition: utils.c:41
GLintptr offset
Definition: glext.h:5920

Referenced by d3dx9_mesh_CloneMeshFVF(), d3dx9_skin_info_SetFVF(), D3DXCreateMeshFVF(), D3DXCreateSkinInfoFVF(), test_create_skin_info(), and test_fvf_to_decl().

◆ D3DXFVFFromDeclarator()

HRESULT WINAPI D3DXFVFFromDeclarator ( const D3DVERTEXELEMENT9 decl,
DWORD fvf 
)

Definition at line 2134 of file mesh.c.

2135{
2136 unsigned int i = 0, texture, offset;
2137
2138 TRACE("(%p, %p)\n", declaration, fvf);
2139
2140 *fvf = 0;
2142 {
2144 declaration[1].UsageIndex == 0) &&
2146 declaration[2].UsageIndex == 0))
2147 {
2148 return D3DERR_INVALIDCALL;
2149 }
2151 declaration[1].Usage == D3DDECLUSAGE_BLENDINDICES && declaration[1].UsageIndex == 0)
2152 {
2154 {
2156 }
2157 else
2158 {
2160 }
2161 i = 2;
2162 }
2164 declaration[1].UsageIndex == 0)
2165 {
2167 declaration[2].Usage == D3DDECLUSAGE_BLENDINDICES && declaration[2].UsageIndex == 0)
2168 {
2170 {
2171 *fvf |= D3DFVF_LASTBETA_UBYTE4;
2172 }
2173 else
2174 {
2176 }
2177 switch (declaration[1].Type)
2178 {
2179 case D3DDECLTYPE_FLOAT1: *fvf |= D3DFVF_XYZB2; break;
2180 case D3DDECLTYPE_FLOAT2: *fvf |= D3DFVF_XYZB3; break;
2181 case D3DDECLTYPE_FLOAT3: *fvf |= D3DFVF_XYZB4; break;
2182 case D3DDECLTYPE_FLOAT4: *fvf |= D3DFVF_XYZB5; break;
2183 }
2184 i = 3;
2185 }
2186 else
2187 {
2188 switch (declaration[1].Type)
2189 {
2190 case D3DDECLTYPE_FLOAT1: *fvf |= D3DFVF_XYZB1; break;
2191 case D3DDECLTYPE_FLOAT2: *fvf |= D3DFVF_XYZB2; break;
2192 case D3DDECLTYPE_FLOAT3: *fvf |= D3DFVF_XYZB3; break;
2193 case D3DDECLTYPE_FLOAT4: *fvf |= D3DFVF_XYZB4; break;
2194 }
2195 i = 2;
2196 }
2197 }
2198 else
2199 {
2200 *fvf |= D3DFVF_XYZ;
2201 i = 1;
2202 }
2203 }
2205 declaration[0].UsageIndex == 0)
2206 {
2207 *fvf |= D3DFVF_XYZRHW;
2208 i = 1;
2209 }
2210
2212 {
2213 *fvf |= D3DFVF_NORMAL;
2214 i++;
2215 }
2217 declaration[i].UsageIndex == 0)
2218 {
2219 *fvf |= D3DFVF_PSIZE;
2220 i++;
2221 }
2223 declaration[i].UsageIndex == 0)
2224 {
2225 *fvf |= D3DFVF_DIFFUSE;
2226 i++;
2227 }
2229 declaration[i].UsageIndex == 1)
2230 {
2231 *fvf |= D3DFVF_SPECULAR;
2232 i++;
2233 }
2234
2235 for (texture = 0; texture < D3DDP_MAXTEXCOORD; i++, texture++)
2236 {
2237 if (declaration[i].Stream == 0xFF)
2238 {
2239 break;
2240 }
2242 declaration[i].UsageIndex == texture)
2243 {
2244 *fvf |= D3DFVF_TEXCOORDSIZE1(declaration[i].UsageIndex);
2245 }
2247 declaration[i].UsageIndex == texture)
2248 {
2249 *fvf |= D3DFVF_TEXCOORDSIZE2(declaration[i].UsageIndex);
2250 }
2252 declaration[i].UsageIndex == texture)
2253 {
2254 *fvf |= D3DFVF_TEXCOORDSIZE3(declaration[i].UsageIndex);
2255 }
2257 declaration[i].UsageIndex == texture)
2258 {
2259 *fvf |= D3DFVF_TEXCOORDSIZE4(declaration[i].UsageIndex);
2260 }
2261 else
2262 {
2263 return D3DERR_INVALIDCALL;
2264 }
2265 }
2266
2267 *fvf |= (texture << D3DFVF_TEXCOUNT_SHIFT);
2268
2269 for (offset = 0, i = 0; declaration[i].Stream != 0xFF;
2271 {
2272 if (declaration[i].Offset != offset)
2273 {
2274 return D3DERR_INVALIDCALL;
2275 }
2276 }
2277
2278 return D3D_OK;
2279}
Type
Definition: Type.h:7
#define D3DFVF_XYZ
Definition: d3d8types.h:113
#define D3DFVF_XYZB4
Definition: d3d8types.h:118
#define D3DFVF_XYZB3
Definition: d3d8types.h:117
#define D3DDP_MAXTEXCOORD
Definition: d3d8types.h:303
#define D3DFVF_XYZB2
Definition: d3d8types.h:116
#define D3DFVF_TEXCOORDSIZE4(CoordIndex)
Definition: d3d8types.h:67
#define D3DFVF_TEXCOORDSIZE3(CoordIndex)
Definition: d3d8types.h:66
#define D3DFVF_TEXCOORDSIZE2(CoordIndex)
Definition: d3d8types.h:65
#define D3DFVF_TEXCOORDSIZE1(CoordIndex)
Definition: d3d8types.h:64
static const UINT d3dx_decltype_size[]
Definition: mesh.c:67
GLenum GLuint texture
Definition: glext.h:6295
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101

Referenced by d3dx9_skin_info_SetDeclaration(), D3DXCreateMesh(), test_create_skin_info(), and test_decl_to_fvf().

◆ D3DXGenerateOutputDecl()

HRESULT WINAPI D3DXGenerateOutputDecl ( D3DVERTEXELEMENT9 decl_out,
const D3DVERTEXELEMENT9 decl_in 
)

◆ D3DXGeneratePMesh()

HRESULT WINAPI D3DXGeneratePMesh ( ID3DXMesh *  mesh,
const DWORD adjacency,
const D3DXATTRIBUTEWEIGHTS attribute_weights,
const float vertex_weights,
DWORD  min_value,
DWORD  flags,
ID3DXPMesh **  pmesh 
)

◆ D3DXGetDeclLength()

UINT WINAPI D3DXGetDeclLength ( const D3DVERTEXELEMENT9 decl)

Definition at line 2354 of file mesh.c.

2355{
2357
2358 TRACE("decl %p\n", decl);
2359
2360 /* null decl results in exception on Windows XP */
2361
2362 for (element = decl; element->Stream != 0xff; ++element);
2363
2364 return element - decl;
2365}

Referenced by test_clone_mesh(), and test_get_decl_length().

◆ D3DXGetDeclVertexSize()

UINT WINAPI D3DXGetDeclVertexSize ( const D3DVERTEXELEMENT9 decl,
DWORD  stream_idx 
)

Definition at line 2323 of file mesh.c.

2324{
2326 UINT size = 0;
2327
2328 TRACE("decl %p, stream_idx %u\n", decl, stream_idx);
2329
2330 if (!decl) return 0;
2331
2332 for (element = decl; element->Stream != 0xff; ++element)
2333 {
2334 UINT type_size;
2335
2336 if (element->Stream != stream_idx) continue;
2337
2339 {
2340 FIXME("Unhandled element type %#x, size will be incorrect.\n", element->Type);
2341 continue;
2342 }
2343
2344 type_size = d3dx_decltype_size[element->Type];
2345 if (element->Offset + type_size > size) size = element->Offset + type_size;
2346 }
2347
2348 return size;
2349}
#define ARRAY_SIZE(A)
Definition: main.h:33

Referenced by d3dx9_mesh_UpdateSemantics(), D3DXCreateMesh(), D3DXLoadMeshFromXInMemory(), test_clone_mesh(), and test_get_decl_vertex_size().

◆ D3DXGetFVFVertexSize()

UINT WINAPI D3DXGetFVFVertexSize ( DWORD  FVF)

Definition at line 2289 of file mesh.c.

2290{
2291 DWORD size = 0;
2292 UINT i;
2293 UINT numTextures = (FVF & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT;
2294
2295 if (FVF & D3DFVF_NORMAL) size += sizeof(D3DXVECTOR3);
2296 if (FVF & D3DFVF_DIFFUSE) size += sizeof(DWORD);
2297 if (FVF & D3DFVF_SPECULAR) size += sizeof(DWORD);
2298 if (FVF & D3DFVF_PSIZE) size += sizeof(DWORD);
2299
2300 switch (FVF & D3DFVF_POSITION_MASK)
2301 {
2302 case D3DFVF_XYZ: size += sizeof(D3DXVECTOR3); break;
2303 case D3DFVF_XYZRHW: size += 4 * sizeof(FLOAT); break;
2304 case D3DFVF_XYZB1: size += 4 * sizeof(FLOAT); break;
2305 case D3DFVF_XYZB2: size += 5 * sizeof(FLOAT); break;
2306 case D3DFVF_XYZB3: size += 6 * sizeof(FLOAT); break;
2307 case D3DFVF_XYZB4: size += 7 * sizeof(FLOAT); break;
2308 case D3DFVF_XYZB5: size += 8 * sizeof(FLOAT); break;
2309 case D3DFVF_XYZW: size += 4 * sizeof(FLOAT); break;
2310 }
2311
2312 for (i = 0; i < numTextures; i++)
2313 {
2314 size += Get_TexCoord_Size_From_FVF(FVF, i) * sizeof(FLOAT);
2315 }
2316
2317 return size;
2318}
static UINT Get_TexCoord_Size_From_FVF(DWORD FVF, int tex_num)
Definition: mesh.c:2284
#define FLOAT
Definition: i386-dis.c:525
#define DWORD
Definition: nt_native.h:44

◆ D3DXIntersect()

HRESULT WINAPI D3DXIntersect ( ID3DXBaseMesh *  mesh,
const D3DXVECTOR3 ray_position,
const D3DXVECTOR3 ray_direction,
BOOL hit,
DWORD face_idx,
float u,
float v,
float distance,
ID3DXBuffer **  hits,
DWORD hit_count 
)

Definition at line 7582 of file mesh.c.

7584{
7585 FIXME("mesh %p, ray_pos %p, ray_dir %p, hit %p, face_index %p, u %p, v %p, distance %p, all_hits %p, "
7586 "count_of_hits %p stub!\n", mesh, ray_pos, ray_dir, hit, face_index, u, v, distance, all_hits, count_of_hits);
7587
7588 return E_NOTIMPL;
7589}
const GLdouble * v
Definition: gl.h:2040
GLsizei GLsizei GLfloat distance
Definition: glext.h:11755
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 * u
Definition: glfuncs.h:240

◆ D3DXIntersectSubset()

HRESULT WINAPI D3DXIntersectSubset ( ID3DXBaseMesh *  mesh,
DWORD  attribute_id,
const D3DXVECTOR3 ray_position,
const D3DXVECTOR3 ray_direction,
BOOL hit,
DWORD face_idx,
float u,
float v,
float distance,
ID3DXBuffer **  hits,
DWORD hit_count 
)

◆ D3DXIntersectTri()

BOOL WINAPI D3DXIntersectTri ( const D3DXVECTOR3 vtx0,
const D3DXVECTOR3 vtx1,
const D3DXVECTOR3 vtx2,
const D3DXVECTOR3 ray_pos,
const D3DXVECTOR3 ray_dir,
FLOAT u,
FLOAT v,
FLOAT dist 
)

Definition at line 2367 of file mesh.c.

2369{
2370 D3DXMATRIX m;
2372
2373 TRACE("p0 %p, p1 %p, p2 %p, praypos %p, praydir %p, pu %p, pv %p, pdist %p.\n",
2374 p0, p1, p2, praypos, praydir, pu, pv, pdist);
2375
2376 m.u.m[0][0] = p1->x - p0->x;
2377 m.u.m[1][0] = p2->x - p0->x;
2378 m.u.m[2][0] = -praydir->x;
2379 m.u.m[3][0] = 0.0f;
2380 m.u.m[0][1] = p1->y - p0->y;
2381 m.u.m[1][1] = p2->y - p0->y;
2382 m.u.m[2][1] = -praydir->y;
2383 m.u.m[3][1] = 0.0f;
2384 m.u.m[0][2] = p1->z - p0->z;
2385 m.u.m[1][2] = p2->z - p0->z;
2386 m.u.m[2][2] = -praydir->z;
2387 m.u.m[3][2] = 0.0f;
2388 m.u.m[0][3] = 0.0f;
2389 m.u.m[1][3] = 0.0f;
2390 m.u.m[2][3] = 0.0f;
2391 m.u.m[3][3] = 1.0f;
2392
2393 vec.x = praypos->x - p0->x;
2394 vec.y = praypos->y - p0->y;
2395 vec.z = praypos->z - p0->z;
2396 vec.w = 0.0f;
2397
2398 if ( D3DXMatrixInverse(&m, NULL, &m) )
2399 {
2400 D3DXVec4Transform(&vec, &vec, &m);
2401 if ( (vec.x >= 0.0f) && (vec.y >= 0.0f) && (vec.x + vec.y <= 1.0f) && (vec.z >= 0.0f) )
2402 {
2403 if (pu) *pu = vec.x;
2404 if (pv) *pv = vec.y;
2405 if (pdist) *pdist = fabsf( vec.z );
2406 return TRUE;
2407 }
2408 }
2409
2410 return FALSE;
2411}
D3DXVECTOR4 *WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, const D3DXMATRIX *pm)
Definition: math.c:2073
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
Definition: math.c:258
const GLfloat * m
Definition: glext.h:10848
_Check_return_ __CRT_INLINE float __CRTDECL fabsf(_In_ float x)
Definition: math.h:179

Referenced by D3DXIntersectTriTest().

◆ D3DXLoadMeshFromXA()

HRESULT WINAPI D3DXLoadMeshFromXA ( const char filename,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXMesh **  mesh 
)

Definition at line 4052 of file mesh.c.

4055{
4057 HRESULT hr;
4058 int len;
4059
4060 TRACE("filename %s, options %#x, device %p, adjacency %p, materials %p, "
4061 "effect_instances %p, num_materials %p, mesh %p.\n",
4062 debugstr_a(filename), options, device, adjacency, materials,
4063 effect_instances, num_materials, mesh);
4064
4065 if (!filename)
4066 return D3DERR_INVALIDCALL;
4067
4069 filenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
4070 if (!filenameW) return E_OUTOFMEMORY;
4072
4073 hr = D3DXLoadMeshFromXW(filenameW, options, device, adjacency, materials,
4074 effect_instances, num_materials, mesh);
4076
4077 return hr;
4078}
HRESULT WINAPI D3DXLoadMeshFromXW(const WCHAR *filename, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *num_materials, struct ID3DXMesh **mesh)
Definition: mesh.c:4080
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLenum GLsizei len
Definition: glext.h:6722
const char * filename
Definition: ioapi.h:137
#define debugstr_a
Definition: kernel32.h:31
static const WCHAR filenameW[]
Definition: amstream.c:41
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ D3DXLoadMeshFromXInMemory()

HRESULT WINAPI D3DXLoadMeshFromXInMemory ( const void data,
DWORD  data_size,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXMesh **  mesh 
)

Definition at line 4198 of file mesh.c.

4201{
4202 HRESULT hr;
4203 ID3DXFile *d3dxfile = NULL;
4204 ID3DXFileEnumObject *enumobj = NULL;
4205 ID3DXFileData *filedata = NULL;
4207 ID3DXBuffer *materials = NULL;
4208 ID3DXBuffer *effects = NULL;
4209 ID3DXBuffer *adjacency = NULL;
4210 struct list container_list = LIST_INIT(container_list);
4211 struct mesh_container *container_ptr, *next_container_ptr;
4213 DWORD num_faces, num_vertices;
4215 DWORD provide_flags = 0;
4216 DWORD fvf;
4217 ID3DXMesh *concat_mesh = NULL;
4219 BYTE *concat_vertices = NULL;
4220 void *concat_indices = NULL;
4221 DWORD index_offset;
4222 DWORD concat_vertex_size;
4223 SIZE_T i, nb_children;
4224 GUID guid;
4225
4226 TRACE("(%p, %u, %x, %p, %p, %p, %p, %p, %p)\n", memory, memory_size, options,
4227 device, adjacency_out, materials_out, effects_out, num_materials_out, mesh_out);
4228
4229 if (!memory || !memory_size || !device || !mesh_out)
4230 return D3DERR_INVALIDCALL;
4231
4232 hr = D3DXFileCreate(&d3dxfile);
4233 if (FAILED(hr)) goto cleanup;
4234
4235 hr = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, D3DRM_XTEMPLATES, D3DRM_XTEMPLATE_BYTES);
4236 if (FAILED(hr)) goto cleanup;
4237
4238 source.lpMemory = (void*)memory;
4239 source.dSize = memory_size;
4240 hr = d3dxfile->lpVtbl->CreateEnumObject(d3dxfile, &source, D3DXF_FILELOAD_FROMMEMORY, &enumobj);
4241 if (FAILED(hr)) goto cleanup;
4242
4243 D3DXMatrixIdentity(&identity);
4244 if (adjacency_out) provide_flags |= PROVIDE_ADJACENCY;
4245 if (materials_out || effects_out) provide_flags |= PROVIDE_MATERIALS;
4246
4247 hr = enumobj->lpVtbl->GetChildren(enumobj, &nb_children);
4248 if (FAILED(hr))
4249 goto cleanup;
4250
4251 for (i = 0; i < nb_children; i++)
4252 {
4253 hr = enumobj->lpVtbl->GetChild(enumobj, i, &filedata);
4254 if (FAILED(hr))
4255 goto cleanup;
4256
4257 hr = filedata->lpVtbl->GetType(filedata, &guid);
4258 if (SUCCEEDED(hr)) {
4259 if (IsEqualGUID(&guid, &TID_D3DRMMesh)) {
4260 container_ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*container_ptr));
4261 if (!container_ptr) {
4262 hr = E_OUTOFMEMORY;
4263 goto cleanup;
4264 }
4265 list_add_tail(&container_list, &container_ptr->entry);
4266 D3DXMatrixIdentity(&container_ptr->transform);
4267
4269 (provide_flags & PROVIDE_ADJACENCY) ? &container_ptr->adjacency : NULL,
4270 (provide_flags & PROVIDE_MATERIALS) ? &container_ptr->materials : NULL,
4271 NULL, &container_ptr->num_materials, NULL, &container_ptr->mesh);
4272 } else if (IsEqualGUID(&guid, &TID_D3DRMFrame)) {
4273 hr = parse_frame(filedata, options, device, &identity, &container_list, provide_flags);
4274 }
4275 if (FAILED(hr)) goto cleanup;
4276 }
4277 filedata->lpVtbl->Release(filedata);
4278 filedata = NULL;
4279 if (FAILED(hr))
4280 goto cleanup;
4281 }
4282
4283 enumobj->lpVtbl->Release(enumobj);
4284 enumobj = NULL;
4285 d3dxfile->lpVtbl->Release(d3dxfile);
4286 d3dxfile = NULL;
4287
4288 if (list_empty(&container_list)) {
4289 hr = E_FAIL;
4290 goto cleanup;
4291 }
4292
4293 fvf = D3DFVF_XYZ;
4294 num_faces = 0;
4295 num_vertices = 0;
4296 num_materials = 0;
4297 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4298 {
4299 ID3DXMesh *mesh = container_ptr->mesh;
4300 fvf |= mesh->lpVtbl->GetFVF(mesh);
4301 num_faces += mesh->lpVtbl->GetNumFaces(mesh);
4302 num_vertices += mesh->lpVtbl->GetNumVertices(mesh);
4303 num_materials += container_ptr->num_materials;
4304 }
4305
4306 hr = D3DXCreateMeshFVF(num_faces, num_vertices, options, fvf, device, &concat_mesh);
4307 if (FAILED(hr)) goto cleanup;
4308
4309 hr = concat_mesh->lpVtbl->GetDeclaration(concat_mesh, concat_decl);
4310 if (FAILED(hr)) goto cleanup;
4311
4312 concat_vertex_size = D3DXGetDeclVertexSize(concat_decl, 0);
4313
4314 hr = concat_mesh->lpVtbl->LockVertexBuffer(concat_mesh, 0, (void**)&concat_vertices);
4315 if (FAILED(hr)) goto cleanup;
4316
4317 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4318 {
4320 ID3DXMesh *mesh = container_ptr->mesh;
4321 DWORD num_mesh_vertices = mesh->lpVtbl->GetNumVertices(mesh);
4322 DWORD mesh_vertex_size;
4323 const BYTE *mesh_vertices;
4324 DWORD i;
4325
4326 hr = mesh->lpVtbl->GetDeclaration(mesh, mesh_decl);
4327 if (FAILED(hr)) goto cleanup;
4328
4329 mesh_vertex_size = D3DXGetDeclVertexSize(mesh_decl, 0);
4330
4331 hr = mesh->lpVtbl->LockVertexBuffer(mesh, D3DLOCK_READONLY, (void**)&mesh_vertices);
4332 if (FAILED(hr)) goto cleanup;
4333
4334 for (i = 0; i < num_mesh_vertices; i++) {
4335 int j;
4336 int k = 1;
4337
4338 D3DXVec3TransformCoord((D3DXVECTOR3*)concat_vertices,
4339 (D3DXVECTOR3*)mesh_vertices,
4340 &container_ptr->transform);
4341 for (j = 1; concat_decl[j].Stream != 0xff; j++)
4342 {
4343 if (concat_decl[j].Usage == mesh_decl[k].Usage &&
4344 concat_decl[j].UsageIndex == mesh_decl[k].UsageIndex)
4345 {
4346 if (concat_decl[j].Usage == D3DDECLUSAGE_NORMAL) {
4347 D3DXVec3TransformCoord((D3DXVECTOR3*)(concat_vertices + concat_decl[j].Offset),
4348 (D3DXVECTOR3*)(mesh_vertices + mesh_decl[k].Offset),
4349 &container_ptr->transform);
4350 } else {
4351 memcpy(concat_vertices + concat_decl[j].Offset,
4352 mesh_vertices + mesh_decl[k].Offset,
4353 d3dx_decltype_size[mesh_decl[k].Type]);
4354 }
4355 k++;
4356 }
4357 }
4358 mesh_vertices += mesh_vertex_size;
4359 concat_vertices += concat_vertex_size;
4360 }
4361
4362 mesh->lpVtbl->UnlockVertexBuffer(mesh);
4363 }
4364
4365 concat_mesh->lpVtbl->UnlockVertexBuffer(concat_mesh);
4366 concat_vertices = NULL;
4367
4368 hr = concat_mesh->lpVtbl->LockIndexBuffer(concat_mesh, 0, &concat_indices);
4369 if (FAILED(hr)) goto cleanup;
4370
4371 index_offset = 0;
4372 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4373 {
4374 ID3DXMesh *mesh = container_ptr->mesh;
4375 const void *mesh_indices;
4376 DWORD num_mesh_faces = mesh->lpVtbl->GetNumFaces(mesh);
4377 DWORD i;
4378
4379 hr = mesh->lpVtbl->LockIndexBuffer(mesh, D3DLOCK_READONLY, (void**)&mesh_indices);
4380 if (FAILED(hr)) goto cleanup;
4381
4382 if (options & D3DXMESH_32BIT) {
4383 DWORD *dest = concat_indices;
4384 const DWORD *src = mesh_indices;
4385 for (i = 0; i < num_mesh_faces * 3; i++)
4386 *dest++ = index_offset + *src++;
4387 concat_indices = dest;
4388 } else {
4389 WORD *dest = concat_indices;
4390 const WORD *src = mesh_indices;
4391 for (i = 0; i < num_mesh_faces * 3; i++)
4392 *dest++ = index_offset + *src++;
4393 concat_indices = dest;
4394 }
4395 mesh->lpVtbl->UnlockIndexBuffer(mesh);
4396
4397 index_offset += num_mesh_faces * 3;
4398 }
4399
4400 concat_mesh->lpVtbl->UnlockIndexBuffer(concat_mesh);
4401 concat_indices = NULL;
4402
4403 if (num_materials) {
4404 DWORD *concat_attrib_buffer = NULL;
4405 DWORD offset = 0;
4406
4407 hr = concat_mesh->lpVtbl->LockAttributeBuffer(concat_mesh, 0, &concat_attrib_buffer);
4408 if (FAILED(hr)) goto cleanup;
4409
4410 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4411 {
4412 ID3DXMesh *mesh = container_ptr->mesh;
4413 const DWORD *mesh_attrib_buffer = NULL;
4414 DWORD count = mesh->lpVtbl->GetNumFaces(mesh);
4415
4416 hr = mesh->lpVtbl->LockAttributeBuffer(mesh, D3DLOCK_READONLY, (DWORD**)&mesh_attrib_buffer);
4417 if (FAILED(hr)) {
4418 concat_mesh->lpVtbl->UnlockAttributeBuffer(concat_mesh);
4419 goto cleanup;
4420 }
4421
4422 while (count--)
4423 *concat_attrib_buffer++ = offset + *mesh_attrib_buffer++;
4424
4425 mesh->lpVtbl->UnlockAttributeBuffer(mesh);
4426 offset += container_ptr->num_materials;
4427 }
4428 concat_mesh->lpVtbl->UnlockAttributeBuffer(concat_mesh);
4429 }
4430
4431 if (materials_out || effects_out) {
4432 D3DXMATERIAL *out_ptr;
4433 if (!num_materials) {
4434 /* create default material */
4436 if (FAILED(hr)) goto cleanup;
4437
4439 out_ptr->MatD3D.Diffuse.r = 0.5f;
4440 out_ptr->MatD3D.Diffuse.g = 0.5f;
4441 out_ptr->MatD3D.Diffuse.b = 0.5f;
4442 out_ptr->MatD3D.Specular.r = 0.5f;
4443 out_ptr->MatD3D.Specular.g = 0.5f;
4444 out_ptr->MatD3D.Specular.b = 0.5f;
4445 /* D3DXCreateBuffer initializes the rest to zero */
4446 } else {
4448 char *strings_out_ptr;
4449
4450 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4451 {
4452 if (container_ptr->materials) {
4453 DWORD i;
4454 const D3DXMATERIAL *in_ptr = ID3DXBuffer_GetBufferPointer(container_ptr->materials);
4455 for (i = 0; i < container_ptr->num_materials; i++)
4456 {
4457 if (in_ptr->pTextureFilename)
4458 buffer_size += strlen(in_ptr->pTextureFilename) + 1;
4459 in_ptr++;
4460 }
4461 }
4462 }
4463
4465 if (FAILED(hr)) goto cleanup;
4467 strings_out_ptr = (char*)(out_ptr + num_materials);
4468
4469 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4470 {
4471 if (container_ptr->materials) {
4472 DWORD i;
4473 const D3DXMATERIAL *in_ptr = ID3DXBuffer_GetBufferPointer(container_ptr->materials);
4474 for (i = 0; i < container_ptr->num_materials; i++)
4475 {
4476 out_ptr->MatD3D = in_ptr->MatD3D;
4477 if (in_ptr->pTextureFilename) {
4478 out_ptr->pTextureFilename = strings_out_ptr;
4479 strcpy(out_ptr->pTextureFilename, in_ptr->pTextureFilename);
4480 strings_out_ptr += strlen(in_ptr->pTextureFilename) + 1;
4481 }
4482 in_ptr++;
4483 out_ptr++;
4484 }
4485 }
4486 }
4487 }
4488 }
4489 if (!num_materials)
4490 num_materials = 1;
4491
4492 if (effects_out) {
4494 if (!materials_out) {
4496 materials = NULL;
4497 }
4498 }
4499
4500 if (adjacency_out) {
4501 if (!list_next(&container_list, list_head(&container_list))) {
4502 container_ptr = LIST_ENTRY(list_head(&container_list), struct mesh_container, entry);
4503 adjacency = container_ptr->adjacency;
4504 container_ptr->adjacency = NULL;
4505 } else {
4506 DWORD offset = 0;
4507 DWORD *out_ptr;
4508
4509 hr = D3DXCreateBuffer(num_faces * 3 * sizeof(DWORD), &adjacency);
4510 if (FAILED(hr)) goto cleanup;
4511
4513 LIST_FOR_EACH_ENTRY(container_ptr, &container_list, struct mesh_container, entry)
4514 {
4515 DWORD i;
4516 DWORD count = 3 * container_ptr->mesh->lpVtbl->GetNumFaces(container_ptr->mesh);
4517 DWORD *in_ptr = ID3DXBuffer_GetBufferPointer(container_ptr->adjacency);
4518
4519 for (i = 0; i < count; i++)
4520 *out_ptr++ = offset + *in_ptr++;
4521
4522 offset += count;
4523 }
4524 }
4525 }
4526
4527 *mesh_out = concat_mesh;
4528 if (adjacency_out) *adjacency_out = adjacency;
4529 if (materials_out) *materials_out = materials;
4530 if (effects_out) *effects_out = effects;
4531 if (num_materials_out) *num_materials_out = num_materials;
4532
4533 hr = D3D_OK;
4534cleanup:
4535 if (concat_indices) concat_mesh->lpVtbl->UnlockIndexBuffer(concat_mesh);
4536 if (concat_vertices) concat_mesh->lpVtbl->UnlockVertexBuffer(concat_mesh);
4537 if (filedata) filedata->lpVtbl->Release(filedata);
4538 if (enumobj) enumobj->lpVtbl->Release(enumobj);
4539 if (d3dxfile) d3dxfile->lpVtbl->Release(d3dxfile);
4540 if (FAILED(hr)) {
4541 if (concat_mesh) IUnknown_Release(concat_mesh);
4545 }
4546 LIST_FOR_EACH_ENTRY_SAFE(container_ptr, next_container_ptr, &container_list, struct mesh_container, entry)
4547 {
4548 if (container_ptr->mesh) IUnknown_Release(container_ptr->mesh);
4549 if (container_ptr->adjacency) ID3DXBuffer_Release(container_ptr->adjacency);
4550 if (container_ptr->materials) ID3DXBuffer_Release(container_ptr->materials);
4551 if (container_ptr->effects) ID3DXBuffer_Release(container_ptr->effects);
4552 HeapFree(GetProcessHeap(), 0, container_ptr);
4553 }
4554 return hr;
4555}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
Definition: list.h:37
#define D3DLOCK_READONLY
Definition: d3d8types.h:69
struct ID3DXBuffer ID3DXBuffer
Definition: d3dx8core.h:51
#define ID3DXBuffer_GetBufferPointer(p)
Definition: d3dx9core.h:85
#define ID3DXBuffer_Release(p)
Definition: d3dx9core.h:83
struct _D3DXMATERIAL D3DXMATERIAL
#define D3DXF_FILELOAD_FROMMEMORY
Definition: d3dx9xof.h:41
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI D3DXCreateBuffer(DWORD size, ID3DXBuffer **buffer)
Definition: core.c:131
D3DXVECTOR3 *WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1895
#define PROVIDE_MATERIALS
Definition: mesh.c:3163
HRESULT WINAPI D3DXLoadSkinMeshFromXof(struct ID3DXFileData *filedata, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency_out, struct ID3DXBuffer **materials_out, struct ID3DXBuffer **effects_out, DWORD *num_materials_out, struct ID3DXSkinInfo **skin_info_out, struct ID3DXMesh **mesh_out)
Definition: mesh.c:3445
#define PROVIDE_ADJACENCY
Definition: mesh.c:3165
static HRESULT parse_frame(struct ID3DXFileData *filedata, DWORD options, struct IDirect3DDevice9 *device, const D3DXMATRIX *parent_transform, struct list *container_list, DWORD provide_flags)
Definition: mesh.c:4143
HRESULT WINAPI D3DXCreateMeshFVF(DWORD numfaces, DWORD numvertices, DWORD options, DWORD fvf, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh)
Definition: mesh.c:2596
static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials, ID3DXBuffer **effects)
Definition: mesh.c:3347
HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
Definition: xfile.c:717
static void cleanup(void)
Definition: main.c:1335
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
nsrefcnt Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
uint32_t entry
Definition: isohybrid.c:63
const GUID * guid
static char memory[1024 *256]
Definition: process.c:116
static char * dest
Definition: rtl.c:135
int k
Definition: mpi.c:3369
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define D3DRM_XTEMPLATE_BYTES
Definition: rmxftmpl.h:283
unsigned char D3DRM_XTEMPLATES[]
Definition: rmxftmpl.h:6
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115
D3DCOLORVALUE Diffuse
Definition: d3d9types.h:1407
D3DCOLORVALUE Specular
Definition: d3d9types.h:1409
D3DMATERIAL9 MatD3D
Definition: d3dx9mesh.h:195
char * pTextureFilename
Definition: d3dx9mesh.h:196
Definition: list.h:15
ID3DXBuffer * materials
Definition: mesh.c:4137
ID3DXMesh * mesh
Definition: mesh.c:4135
struct list entry
Definition: mesh.c:4134
ID3DXBuffer * adjacency
Definition: mesh.c:4136
ID3DXBuffer * effects
Definition: mesh.c:4138
D3DXMATRIX transform
Definition: mesh.c:4140
DWORD num_materials
Definition: mesh.c:4139
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
#define LIST_INIT(head)
Definition: queue.h:197
#define LIST_ENTRY(type)
Definition: queue.h:175
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by D3DXLoadMeshFromXResource(), D3DXLoadMeshFromXW(), D3DXLoadMeshTest(), and test_LoadMeshFromX_().

◆ D3DXLoadMeshFromXof()

HRESULT WINAPI D3DXLoadMeshFromXof ( struct ID3DXFileData *  file_data,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXMesh **  mesh 
)

◆ D3DXLoadMeshFromXResource()

HRESULT WINAPI D3DXLoadMeshFromXResource ( HMODULE  module,
const char resource,
const char resource_type,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXMesh **  mesh 
)

Definition at line 4108 of file mesh.c.

4111{
4112 HRESULT hr;
4113 HRSRC resinfo;
4114 void *buffer;
4115 DWORD size;
4116
4117 TRACE("module %p, name %s, type %s, options %#x, device %p, adjacency %p, "
4118 "materials %p, effect_instances %p, num_materials %p, mesh %p.\n",
4120 materials, effect_instances, num_materials, mesh);
4121
4122 resinfo = FindResourceA(module, name, type);
4123 if (!resinfo) return D3DXERR_INVALIDDATA;
4124
4126 if (FAILED(hr)) return D3DXERR_INVALIDDATA;
4127
4128 return D3DXLoadMeshFromXInMemory(buffer, size, options, device, adjacency,
4129 materials, effect_instances, num_materials, mesh);
4130}
#define D3DXERR_INVALIDDATA
Definition: compiler.c:30
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
HRESULT WINAPI D3DXLoadMeshFromXInMemory(const void *memory, DWORD memory_size, DWORD options, struct IDirect3DDevice9 *device, struct ID3DXBuffer **adjacency_out, struct ID3DXBuffer **materials_out, struct ID3DXBuffer **effects_out, DWORD *num_materials_out, struct ID3DXMesh **mesh_out)
Definition: mesh.c:4198
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: name.c:39

◆ D3DXLoadMeshFromXW()

HRESULT WINAPI D3DXLoadMeshFromXW ( const WCHAR filename,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXMesh **  mesh 
)

Definition at line 4080 of file mesh.c.

4083{
4084 void *buffer;
4085 HRESULT hr;
4086 DWORD size;
4087
4088 TRACE("filename %s, options %#x, device %p, adjacency %p, materials %p, "
4089 "effect_instances %p, num_materials %p, mesh %p.\n",
4090 debugstr_w(filename), options, device, adjacency, materials,
4091 effect_instances, num_materials, mesh);
4092
4093 if (!filename)
4094 return D3DERR_INVALIDCALL;
4095
4097 if (FAILED(hr))
4098 return D3DXERR_INVALIDDATA;
4099
4101 materials, effect_instances, num_materials, mesh);
4102
4104
4105 return hr;
4106}
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
#define UnmapViewOfFile
Definition: compat.h:746
#define debugstr_w
Definition: kernel32.h:32

Referenced by D3DXLoadMeshFromXA().

◆ D3DXLoadPatchMeshFromXof()

HRESULT WINAPI D3DXLoadPatchMeshFromXof ( struct ID3DXFileData *  file_data,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXPatchMesh **  mesh 
)

◆ D3DXLoadPRTBufferFromFileA()

HRESULT WINAPI D3DXLoadPRTBufferFromFileA ( const char filename,
ID3DXPRTBuffer **  buffer 
)

◆ D3DXLoadPRTBufferFromFileW()

HRESULT WINAPI D3DXLoadPRTBufferFromFileW ( const WCHAR filename,
ID3DXPRTBuffer **  buffer 
)

◆ D3DXLoadPRTCompBufferFromFileA()

HRESULT WINAPI D3DXLoadPRTCompBufferFromFileA ( const char filename,
ID3DXPRTCompBuffer **  buffer 
)

◆ D3DXLoadPRTCompBufferFromFileW()

HRESULT WINAPI D3DXLoadPRTCompBufferFromFileW ( const WCHAR filename,
ID3DXPRTCompBuffer **  buffer 
)

◆ D3DXLoadSkinMeshFromXof()

HRESULT WINAPI D3DXLoadSkinMeshFromXof ( struct ID3DXFileData *  file_data,
DWORD  flags,
struct IDirect3DDevice9 *  device,
struct ID3DXBuffer **  adjacency,
struct ID3DXBuffer **  materials,
struct ID3DXBuffer **  effect_instances,
DWORD material_count,
struct ID3DXSkinInfo **  skin_info,
struct ID3DXMesh **  mesh 
)

Definition at line 3445 of file mesh.c.

3449{
3450 HRESULT hr;
3451 DWORD *index_in_ptr;
3452 struct mesh_data mesh_data;
3453 DWORD total_vertices;
3454 ID3DXMesh *d3dxmesh = NULL;
3455 ID3DXBuffer *adjacency = NULL;
3457 ID3DXBuffer *effects = NULL;
3458 struct vertex_duplication {
3459 DWORD normal_index;
3460 struct list entry;
3461 } *duplications = NULL;
3462 DWORD i;
3463 void *vertices = NULL;
3464 void *indices = NULL;
3465 BYTE *out_ptr;
3466 DWORD provide_flags = 0;
3467
3468 TRACE("(%p, %x, %p, %p, %p, %p, %p, %p, %p)\n", filedata, options, device, adjacency_out, materials_out,
3469 effects_out, num_materials_out, skin_info_out, mesh_out);
3470
3471 ZeroMemory(&mesh_data, sizeof(mesh_data));
3472
3473 if (num_materials_out || materials_out || effects_out)
3474 provide_flags |= PROVIDE_MATERIALS;
3475 if (skin_info_out)
3476 provide_flags |= PROVIDE_SKININFO;
3477
3478 hr = parse_mesh(filedata, &mesh_data, provide_flags);
3479 if (FAILED(hr)) goto cleanup;
3480
3481 total_vertices = mesh_data.num_vertices;
3482 if (mesh_data.fvf & D3DFVF_NORMAL) {
3483 /* duplicate vertices with multiple normals */
3484 DWORD num_face_indices = mesh_data.num_poly_faces * 2 + mesh_data.num_tri_faces;
3485 duplications = HeapAlloc(GetProcessHeap(), 0, (mesh_data.num_vertices + num_face_indices) * sizeof(*duplications));
3486 if (!duplications) {
3487 hr = E_OUTOFMEMORY;
3488 goto cleanup;
3489 }
3490 for (i = 0; i < total_vertices; i++)
3491 {
3492 duplications[i].normal_index = -1;
3493 list_init(&duplications[i].entry);
3494 }
3495 for (i = 0; i < num_face_indices; i++) {
3497 DWORD normal_index = mesh_data.normal_indices[i];
3498 struct vertex_duplication *dup_ptr = &duplications[vertex_index];
3499
3500 if (dup_ptr->normal_index == -1) {
3501 dup_ptr->normal_index = normal_index;
3502 } else {
3503 D3DXVECTOR3 *new_normal = &mesh_data.normals[normal_index];
3504 struct list *dup_list = &dup_ptr->entry;
3505 while (TRUE) {
3506 D3DXVECTOR3 *cur_normal = &mesh_data.normals[dup_ptr->normal_index];
3507 if (new_normal->x == cur_normal->x &&
3508 new_normal->y == cur_normal->y &&
3509 new_normal->z == cur_normal->z)
3510 {
3511 mesh_data.indices[i] = dup_ptr - duplications;
3512 break;
3513 } else if (!list_next(dup_list, &dup_ptr->entry)) {
3514 dup_ptr = &duplications[total_vertices++];
3515 dup_ptr->normal_index = normal_index;
3516 list_add_tail(dup_list, &dup_ptr->entry);
3517 mesh_data.indices[i] = dup_ptr - duplications;
3518 break;
3519 } else {
3520 dup_ptr = LIST_ENTRY(list_next(dup_list, &dup_ptr->entry),
3521 struct vertex_duplication, entry);
3522 }
3523 }
3524 }
3525 }
3526 }
3527
3528 hr = D3DXCreateMeshFVF(mesh_data.num_tri_faces, total_vertices, options, mesh_data.fvf, device, &d3dxmesh);
3529 if (FAILED(hr)) goto cleanup;
3530
3531 hr = d3dxmesh->lpVtbl->LockVertexBuffer(d3dxmesh, 0, &vertices);
3532 if (FAILED(hr)) goto cleanup;
3533
3534 out_ptr = vertices;
3535 for (i = 0; i < mesh_data.num_vertices; i++) {
3536 *(D3DXVECTOR3*)out_ptr = mesh_data.vertices[i];
3537 out_ptr += sizeof(D3DXVECTOR3);
3538 if (mesh_data.fvf & D3DFVF_NORMAL) {
3539 if (duplications[i].normal_index == -1)
3540 ZeroMemory(out_ptr, sizeof(D3DXVECTOR3));
3541 else
3542 *(D3DXVECTOR3*)out_ptr = mesh_data.normals[duplications[i].normal_index];
3543 out_ptr += sizeof(D3DXVECTOR3);
3544 }
3546 *(DWORD*)out_ptr = mesh_data.vertex_colors[i];
3547 out_ptr += sizeof(DWORD);
3548 }
3549 if (mesh_data.fvf & D3DFVF_TEX1) {
3550 *(D3DXVECTOR2*)out_ptr = mesh_data.tex_coords[i];
3551 out_ptr += sizeof(D3DXVECTOR2);
3552 }
3553 }
3554 if (mesh_data.fvf & D3DFVF_NORMAL) {
3555 DWORD vertex_size = D3DXGetFVFVertexSize(mesh_data.fvf);
3556 out_ptr = vertices;
3557 for (i = 0; i < mesh_data.num_vertices; i++) {
3558 struct vertex_duplication *dup_ptr;
3559 LIST_FOR_EACH_ENTRY(dup_ptr, &duplications[i].entry, struct vertex_duplication, entry)
3560 {
3561 int j = dup_ptr - duplications;
3562 BYTE *dest_vertex = (BYTE*)vertices + j * vertex_size;
3563
3564 memcpy(dest_vertex, out_ptr, vertex_size);
3565 dest_vertex += sizeof(D3DXVECTOR3);
3566 *(D3DXVECTOR3*)dest_vertex = mesh_data.normals[dup_ptr->normal_index];
3567 }
3568 out_ptr += vertex_size;
3569 }
3570 }
3571 d3dxmesh->lpVtbl->UnlockVertexBuffer(d3dxmesh);
3572
3573 hr = d3dxmesh->lpVtbl->LockIndexBuffer(d3dxmesh, 0, &indices);
3574 if (FAILED(hr)) goto cleanup;
3575
3576 index_in_ptr = mesh_data.indices;
3577#define FILL_INDEX_BUFFER(indices_var) \
3578 for (i = 0; i < mesh_data.num_poly_faces; i++) \
3579 { \
3580 DWORD count = mesh_data.num_tri_per_face[i]; \
3581 WORD first_index = *index_in_ptr++; \
3582 while (count--) { \
3583 *indices_var++ = first_index; \
3584 *indices_var++ = *index_in_ptr; \
3585 index_in_ptr++; \
3586 *indices_var++ = *index_in_ptr; \
3587 } \
3588 index_in_ptr++; \
3589 }
3590 if (options & D3DXMESH_32BIT) {
3591 DWORD *dword_indices = indices;
3592 FILL_INDEX_BUFFER(dword_indices)
3593 } else {
3594 WORD *word_indices = indices;
3595 FILL_INDEX_BUFFER(word_indices)
3596 }
3597#undef FILL_INDEX_BUFFER
3598 d3dxmesh->lpVtbl->UnlockIndexBuffer(d3dxmesh);
3599
3601 DWORD *attrib_buffer = NULL;
3602 hr = d3dxmesh->lpVtbl->LockAttributeBuffer(d3dxmesh, 0, &attrib_buffer);
3603 if (FAILED(hr)) goto cleanup;
3604 for (i = 0; i < mesh_data.num_poly_faces; i++)
3605 {
3607 while (count--)
3608 *attrib_buffer++ = mesh_data.material_indices[i];
3609 }
3610 d3dxmesh->lpVtbl->UnlockAttributeBuffer(d3dxmesh);
3611
3612 hr = d3dxmesh->lpVtbl->OptimizeInplace(d3dxmesh,
3614 NULL, NULL, NULL, NULL);
3615 if (FAILED(hr)) goto cleanup;
3616 }
3617
3618 if (mesh_data.num_materials && (materials_out || effects_out)) {
3620 char *strings_out_ptr;
3621 D3DXMATERIAL *materials_ptr;
3622
3623 for (i = 0; i < mesh_data.num_materials; i++) {
3626 }
3627
3628 hr = D3DXCreateBuffer(buffer_size, &materials);
3629 if (FAILED(hr)) goto cleanup;
3630
3631 materials_ptr = ID3DXBuffer_GetBufferPointer(materials);
3632 memcpy(materials_ptr, mesh_data.materials, mesh_data.num_materials * sizeof(D3DXMATERIAL));
3633 strings_out_ptr = (char*)(materials_ptr + mesh_data.num_materials);
3634 for (i = 0; i < mesh_data.num_materials; i++) {
3635 if (materials_ptr[i].pTextureFilename) {
3636 strcpy(strings_out_ptr, mesh_data.materials[i].pTextureFilename);
3637 materials_ptr[i].pTextureFilename = strings_out_ptr;
3638 strings_out_ptr += strlen(mesh_data.materials[i].pTextureFilename) + 1;
3639 }
3640 }
3641 }
3642
3643 if (mesh_data.num_materials && effects_out) {
3644 hr = generate_effects(materials, mesh_data.num_materials, &effects);
3645 if (FAILED(hr)) goto cleanup;
3646
3647 if (!materials_out) {
3648 ID3DXBuffer_Release(materials);
3649 materials = NULL;
3650 }
3651 }
3652
3653 if (adjacency_out) {
3654 hr = D3DXCreateBuffer(mesh_data.num_tri_faces * 3 * sizeof(DWORD), &adjacency);
3655 if (FAILED(hr)) goto cleanup;
3656 hr = d3dxmesh->lpVtbl->GenerateAdjacency(d3dxmesh, 0.0f, ID3DXBuffer_GetBufferPointer(adjacency));
3657 if (FAILED(hr)) goto cleanup;
3658 }
3659
3660 *mesh_out = d3dxmesh;
3661 if (adjacency_out) *adjacency_out = adjacency;
3662 if (num_materials_out) *num_materials_out = mesh_data.num_materials;
3663 if (materials_out) *materials_out = materials;
3664 if (effects_out) *effects_out = effects;
3665 if (skin_info_out) *skin_info_out = mesh_data.skin_info;
3666
3667 hr = D3D_OK;
3668cleanup:
3669 if (FAILED(hr)) {
3670 if (d3dxmesh) IUnknown_Release(d3dxmesh);
3671 if (adjacency) ID3DXBuffer_Release(adjacency);
3672 if (materials) ID3DXBuffer_Release(materials);
3673 if (effects) ID3DXBuffer_Release(effects);
3675 if (skin_info_out) *skin_info_out = NULL;
3676 }
3685 HeapFree(GetProcessHeap(), 0, duplications);
3686 return hr;
3687}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define D3DFVF_TEX1
Definition: d3d8types.h:127
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF)
Definition: mesh.c:2289
#define PROVIDE_SKININFO
Definition: mesh.c:3164
static HRESULT parse_mesh(ID3DXFileData *filedata, struct mesh_data *mesh_data, DWORD provide_flags)
Definition: mesh.c:3167
#define FILL_INDEX_BUFFER(indices_var)
static WORD vertex_index(UINT slices, int slice, int stack)
Definition: mesh.c:4790
static void destroy_materials(struct mesh_data *mesh)
Definition: mesh.c:2764
ULONG Release()
DWORD * vertex_colors
Definition: mesh.c:2629
DWORD * normal_indices
Definition: mesh.c:2625
D3DXVECTOR3 * vertices
Definition: mesh.c:2615
struct ID3DXSkinInfo * skin_info
Definition: mesh.c:2635
DWORD * material_indices
Definition: mesh.c:2633
DWORD fvf
Definition: mesh.c:2619
D3DXVECTOR2 * tex_coords
Definition: mesh.c:2627
DWORD num_poly_faces
Definition: mesh.c:2613
DWORD * num_tri_per_face
Definition: mesh.c:2616
D3DXMATERIAL * materials
Definition: mesh.c:2632
DWORD num_materials
Definition: mesh.c:2631
DWORD num_tri_faces
Definition: mesh.c:2614
D3DXVECTOR3 * normals
Definition: mesh.c:2624
DWORD * indices
Definition: mesh.c:2617
DWORD num_vertices
Definition: mesh.c:2612
#define ZeroMemory
Definition: winbase.h:1712

Referenced by D3DXLoadMeshFromXInMemory(), load_mesh_container(), parse_frame(), and test_load_skin_mesh_from_xof().

◆ D3DXOptimizeFaces()

HRESULT WINAPI D3DXOptimizeFaces ( const void indices,
UINT  face_count,
UINT  vertex_count,
BOOL  idx_32bit,
DWORD face_remap 
)

Definition at line 7239 of file mesh.c.

7241{
7242 UINT i;
7243 UINT j = num_faces - 1;
7244 UINT limit_16_bit = 2 << 15; /* According to MSDN */
7245 HRESULT hr = D3D_OK;
7246
7247 FIXME("indices %p, num_faces %u, num_vertices %u, indices_are_32bit %#x, face_remap %p semi-stub. "
7248 "Face order will not be optimal.\n",
7249 indices, num_faces, num_vertices, indices_are_32bit, face_remap);
7250
7251 if (!indices_are_32bit && num_faces >= limit_16_bit)
7252 {
7253 WARN("Number of faces must be less than %d when using 16-bit indices.\n",
7254 limit_16_bit);
7256 goto error;
7257 }
7258
7259 if (!face_remap)
7260 {
7261 WARN("Face remap pointer is NULL.\n");
7263 goto error;
7264 }
7265
7266 /* The faces are drawn in reverse order for simple meshes. This ordering
7267 * is not optimal for complicated meshes, but will not break anything
7268 * either. The ordering should be changed to take advantage of the vertex
7269 * cache on the graphics card.
7270 *
7271 * TODO Re-order to take advantage of vertex cache.
7272 */
7273 for (i = 0; i < num_faces; i++)
7274 {
7275 face_remap[i] = j--;
7276 }
7277
7278 return D3D_OK;
7279
7280error:
7281 return hr;
7282}

Referenced by test_optimize_faces().

◆ D3DXOptimizeVertices()

HRESULT WINAPI D3DXOptimizeVertices ( const void indices,
UINT  face_count,
UINT  vertex_count,
BOOL  idx_32bit,
DWORD vertex_remap 
)

Definition at line 7196 of file mesh.c.

7198{
7199 UINT i;
7200
7201 FIXME("indices %p, num_faces %u, num_vertices %u, indices_are_32bit %#x, vertex_remap %p semi-stub.\n",
7202 indices, num_faces, num_vertices, indices_are_32bit, vertex_remap);
7203
7204 if (!vertex_remap)
7205 {
7206 WARN("vertex remap pointer is NULL.\n");
7207 return D3DERR_INVALIDCALL;
7208 }
7209
7210 for (i = 0; i < num_vertices; i++)
7211 {
7212 vertex_remap[i] = i;
7213 }
7214
7215 return D3D_OK;
7216}

Referenced by test_optimize_vertices().

◆ D3DXRectPatchSize()

HRESULT WINAPI D3DXRectPatchSize ( const FLOAT segment_count,
DWORD num_triangles,
DWORD num_vertices 
)

◆ D3DXSaveMeshToXA()

HRESULT WINAPI D3DXSaveMeshToXA ( const char filename,
ID3DXMesh *  mesh,
const