1 /***********************************************************************\ 2 * d3dx10mesh.d * 3 * * 4 * Windows API header module * 5 * * 6 * Placed into public domain * 7 \***********************************************************************/ 8 module win32.directx.d3dx10mesh; 9 version(Windows): 10 11 private import win32.windows; 12 private import win32.directx.d3d10; 13 private import win32.directx.d3dx10; 14 15 extern(C) const GUID IID_ID3DX10BaseMesh = {0x7ed943dd, 0x52e8, 0x40b5, [0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30]}; 16 extern(C) const GUID IID_ID3DX10MeshBuffer = {0x4b0d117, 0x1041, 0x46b1, [0xaa, 0x8a, 0x39, 0x52, 0x84, 0x8b, 0xa2, 0x2e]}; 17 extern(C) const GUID IID_ID3DX10Mesh = {0x4020e5c2, 0x1403, 0x4929, [0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95]}; 18 extern(C) const GUID IID_ID3DX10PMesh = {0x8875769a, 0xd579, 0x4088, [0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96]}; 19 extern(C) const GUID IID_ID3DX10SPMesh = {0x667ea4c7, 0xf1cd, 0x4386, [0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5]}; 20 extern(C) const GUID IID_ID3DX10PatchMesh = {0x3ce6cc22, 0xdbf2, 0x44f4, [0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39]}; 21 22 enum D3DX10_MESH { 23 D3DX10_MESH_32_BIT = 0x001, 24 D3DX10_MESH_GS_ADJACENCY = 0x004 25 } 26 27 struct D3DX10_ATTRIBUTE_RANGE { 28 UINT AttribId; 29 UINT FaceStart; 30 UINT FaceCount; 31 UINT VertexStart; 32 UINT VertexCount; 33 } 34 35 enum D3DX10_MESH_DISCARD_FLAGS { 36 D3DX10_MESH_DISCARD_ATTRIBUTE_BUFFER = 0x01, 37 D3DX10_MESH_DISCARD_ATTRIBUTE_TABLE = 0x02, 38 D3DX10_MESH_DISCARD_POINTREPS = 0x04, 39 D3DX10_MESH_DISCARD_ADJACENCY = 0x08, 40 D3DX10_MESH_DISCARD_DEVICE_BUFFERS = 0x10 41 } 42 43 struct D3DX10_WELD_EPSILONS { 44 FLOAT Position; 45 FLOAT BlendWeights; 46 FLOAT Normal; 47 FLOAT PSize; 48 FLOAT Specular; 49 FLOAT Diffuse; 50 FLOAT[8] Texcoord; 51 FLOAT Tangent; 52 FLOAT Binormal; 53 FLOAT TessFactor; 54 } 55 56 struct D3DX10_INTERSECT_INFO { 57 UINT FaceIndex; 58 FLOAT U; 59 FLOAT V; 60 FLOAT Dist; 61 } 62 63 interface ID3DX10MeshBuffer : IUnknown { 64 extern(Windows) : 65 HRESULT Map(void** ppData, SIZE_T* pSize); 66 HRESULT Unmap(); 67 SIZE_T GetSize(); 68 } 69 70 interface ID3DX10Mesh : IUnknown { 71 extern(Windows) : 72 UINT GetFaceCount(); 73 UINT GetVertexCount(); 74 UINT GetVertexBufferCount(); 75 UINT GetFlags(); 76 HRESULT GetVertexDescription(D3D10_INPUT_ELEMENT_DESC** ppDesc, UINT* pDeclCount); 77 HRESULT SetVertexData(UINT iBuffer, void* pData); 78 HRESULT GetVertexBuffer(UINT iBuffer, ID3DX10MeshBuffer** ppVertexBuffer); 79 HRESULT SetIndexData(void* pData, UINT cIndices); 80 HRESULT GetIndexBuffer(ID3DX10MeshBuffer** ppIndexBuffer); 81 HRESULT SetAttributeData(UINT* pData); 82 HRESULT GetAttributeBuffer(ID3DX10MeshBuffer** ppAttributeBuffer); 83 HRESULT SetAttributeTable(D3DX10_ATTRIBUTE_RANGE* pAttribTable, UINT cAttribTableSize); 84 HRESULT GetAttributeTable(D3DX10_ATTRIBUTE_RANGE* pAttribTable, UINT* pAttribTableSize); 85 HRESULT GenerateAdjacencyAndPointReps(FLOAT Epsilon); 86 HRESULT GenerateGSAdjacency(); 87 HRESULT SetAdjacencyData(UINT* pAdjacency); 88 HRESULT GetAdjacencyBuffer(ID3DX10MeshBuffer** ppAdjacency); 89 HRESULT SetPointRepData(UINT* pPointReps); 90 HRESULT GetPointRepBuffer(ID3DX10MeshBuffer** ppPointReps); 91 HRESULT Discard(D3DX10_MESH_DISCARD_FLAGS dwDiscard); 92 HRESULT CloneMesh(UINT Flags, LPCSTR pPosSemantic, D3D10_INPUT_ELEMENT_DESC* pDesc, UINT DeclCount, ID3DX10Mesh** ppCloneMesh); 93 HRESULT Optimize(UINT Flags, UINT * pFaceRemap, ID3D10Blob* ppVertexRemap); 94 HRESULT GenerateAttributeBufferFromTable(); 95 HRESULT Intersect(D3DXVECTOR3* pRayPos, D3DXVECTOR3* pRayDir, UINT* pHitCount, UINT* pFaceIndex, float* pU, float* pV, float* pDist, ID3D10Blob* ppAllHits); 96 HRESULT IntersectSubset(UINT AttribId, D3DXVECTOR3* pRayPos, D3DXVECTOR3* pRayDir, UINT* pHitCount, UINT* pFaceIndex, float* pU, float* pV, float* pDist, ID3D10Blob* ppAllHits); 97 HRESULT CommitToDevice(); 98 HRESULT DrawSubset(UINT AttribId); 99 HRESULT DrawSubsetInstanced(UINT AttribId, UINT InstanceCount, UINT StartInstanceLocation); 100 HRESULT GetDeviceVertexBuffer(UINT iBuffer, ID3D10Buffer** ppVertexBuffer); 101 HRESULT GetDeviceIndexBuffer(ID3D10Buffer** ppIndexBuffer); 102 } 103 104 HRESULT D3DX10CreateMesh(ID3D10Device* pDevice, D3D10_INPUT_ELEMENT_DESC* pDeclaration, UINT DeclCount, LPCSTR pPositionSemantic, UINT VertexCount, UINT FaceCount, UINT Options, ID3DX10Mesh** ppMesh); 105 106 enum D3DX10_MESHOPT { 107 D3DX10_MESHOPT_COMPACT = 0x01000000, 108 D3DX10_MESHOPT_ATTR_SORT = 0x02000000, 109 D3DX10_MESHOPT_VERTEX_CACHE = 0x04000000, 110 D3DX10_MESHOPT_STRIP_REORDER = 0x08000000, 111 D3DX10_MESHOPT_IGNORE_VERTS = 0x10000000, 112 D3DX10_MESHOPT_DO_NOT_SPLIT = 0x20000000, 113 D3DX10_MESHOPT_DEVICE_INDEPENDENT = 0x00400000 114 } 115 116 extern(C) const GUID IID_ID3DX10SkinInfo = {0x420bd604, 0x1c76, 0x4a34, [0xa4, 0x66, 0xe4, 0x5d, 0x6, 0x58, 0xa3, 0x2c]}; 117 118 const D3DX10_SKININFO_NO_SCALING = 0; 119 const D3DX10_SKININFO_SCALE_TO_1 = 1; 120 const D3DX10_SKININFO_SCALE_TO_TOTAL = 2; 121 122 struct D3DX10_SKINNING_CHANNEL { 123 UINT SrcOffset; 124 UINT DestOffset; 125 BOOL IsNormal; 126 } 127 128 interface ID3DX10SkinInfo : IUnknown { 129 extern(Windows) : 130 HRESULT QueryInterface(REFIID iid, LPVOID* ppv); 131 ULONG AddRef(); 132 ULONG Release(); 133 UINT GetNumVertices(); 134 UINT GetNumBones(); 135 UINT GetMaxBoneInfluences(); 136 HRESULT AddVertices(UINT Count); 137 HRESULT RemapVertices(UINT NewVertexCount, UINT* pVertexRemap); 138 HRESULT AddBones(UINT Count); 139 HRESULT RemoveBone(UINT Index); 140 HRESULT RemapBones(UINT NewBoneCount, UINT* pBoneRemap); 141 HRESULT AddBoneInfluences(UINT BoneIndex, UINT InfluenceCount, UINT* pIndices, float* pWeights); 142 HRESULT ClearBoneInfluences(UINT BoneIndex); 143 UINT GetBoneInfluenceCount(UINT BoneIndex); 144 HRESULT GetBoneInfluences(UINT BoneIndex, UINT Offset, UINT Count, UINT* pDestIndices, float* pDestWeights); 145 HRESULT FindBoneInfluenceIndex(UINT BoneIndex, UINT VertexIndex, UINT* pInfluenceIndex); 146 HRESULT SetBoneInfluence(UINT BoneIndex, UINT InfluenceIndex, float Weight); 147 HRESULT GetBoneInfluence(UINT BoneIndex, UINT InfluenceIndex, float* pWeight); 148 HRESULT Compact(UINT MaxPerVertexInfluences, UINT ScaleMode, float MinWeight); 149 HRESULT DoSoftwareSkinning(UINT StartVertex, UINT VertexCount, void* pSrcVertices, UINT SrcStride, void* pDestVertices, UINT DestStride, D3DXMATRIX* pBoneMatrices, D3DXMATRIX* pInverseTransposeBoneMatrices, D3DX10_SKINNING_CHANNEL* pChannelDescs, UINT NumChannels); 150 } 151 152 HRESULT D3DX10CreateSkinInfo(ID3DX10SkinInfo* ppSkinInfo); 153 154 struct D3DX10_ATTRIBUTE_WEIGHTS { 155 FLOAT Position; 156 FLOAT Boundary; 157 FLOAT Normal; 158 FLOAT Diffuse; 159 FLOAT Specular; 160 FLOAT[8] Texcoord; 161 FLOAT Tangent; 162 FLOAT Binormal; 163 } 164