📄 d3dx9mesh.h
字号:
CONST DWORD* pAdjacencyIn,
FLOAT NumSegs,
BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic
LPD3DXMESH *ppMeshOut,
LPD3DXBUFFER *ppAdjacencyOut);
//generates implied outputdecl from input decl
//the decl generated from this should be used to generate the output decl for
//the tessellator subroutines.
HRESULT WINAPI
D3DXGenerateOutputDecl(
D3DVERTEXELEMENT9 *pOutput,
CONST D3DVERTEXELEMENT9 *pInput);
//loads patches from an XFileData
//since an X file can have up to 6 different patch meshes in it,
//returns them in an array - pNumPatches will contain the number of
//meshes in the actual file.
HRESULT WINAPI
D3DXLoadPatchMeshFromXof(
LPD3DXFILEDATA pXofObjMesh,
DWORD Options,
LPDIRECT3DDEVICE9 pD3DDevice,
LPD3DXBUFFER *ppMaterials,
LPD3DXBUFFER *ppEffectInstances,
PDWORD pNumMaterials,
LPD3DXPATCHMESH *ppMesh);
//computes the size a single rect patch.
HRESULT WINAPI
D3DXRectPatchSize(
CONST FLOAT *pfNumSegs, //segments for each edge (4)
DWORD *pdwTriangles, //output number of triangles
DWORD *pdwVertices); //output number of vertices
//computes the size of a single triangle patch
HRESULT WINAPI
D3DXTriPatchSize(
CONST FLOAT *pfNumSegs, //segments for each edge (3)
DWORD *pdwTriangles, //output number of triangles
DWORD *pdwVertices); //output number of vertices
//tessellates a patch into a created mesh
//similar to D3D RT patch
HRESULT WINAPI
D3DXTessellateRectPatch(
LPDIRECT3DVERTEXBUFFER9 pVB,
CONST FLOAT *pNumSegs,
CONST D3DVERTEXELEMENT9 *pdwInDecl,
CONST D3DRECTPATCH_INFO *pRectPatchInfo,
LPD3DXMESH pMesh);
HRESULT WINAPI
D3DXTessellateTriPatch(
LPDIRECT3DVERTEXBUFFER9 pVB,
CONST FLOAT *pNumSegs,
CONST D3DVERTEXELEMENT9 *pInDecl,
CONST D3DTRIPATCH_INFO *pTriPatchInfo,
LPD3DXMESH pMesh);
//creates an NPatch PatchMesh from a D3DXMESH
HRESULT WINAPI
D3DXCreateNPatchMesh(
LPD3DXMESH pMeshSysMem,
LPD3DXPATCHMESH *pPatchMesh);
//creates a patch mesh
HRESULT WINAPI
D3DXCreatePatchMesh(
CONST D3DXPATCHINFO *pInfo, //patch type
DWORD dwNumPatches, //number of patches
DWORD dwNumVertices, //number of control vertices
DWORD dwOptions, //options
CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices
LPDIRECT3DDEVICE9 pD3DDevice,
LPD3DXPATCHMESH *pPatchMesh);
//returns the number of degenerates in a patch mesh -
//text output put in string.
HRESULT WINAPI
D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh,
DWORD *dwcDegenerateVertices,
DWORD *dwcDegeneratePatches,
LPD3DXBUFFER *ppErrorsAndWarnings);
UINT WINAPI
D3DXGetFVFVertexSize(DWORD FVF);
UINT WINAPI
D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream);
UINT WINAPI
D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl);
HRESULT WINAPI
D3DXDeclaratorFromFVF(
DWORD FVF,
D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]);
HRESULT WINAPI
D3DXFVFFromDeclarator(
CONST D3DVERTEXELEMENT9 *pDeclarator,
DWORD *pFVF);
HRESULT WINAPI
D3DXWeldVertices(
LPD3DXMESH pMesh,
DWORD Flags,
CONST D3DXWELDEPSILONS *pEpsilons,
CONST DWORD *pAdjacencyIn,
DWORD *pAdjacencyOut,
DWORD *pFaceRemap,
LPD3DXBUFFER *ppVertexRemap);
typedef struct _D3DXINTERSECTINFO
{
DWORD FaceIndex; // index of face intersected
FLOAT U; // Barycentric Hit Coordinates
FLOAT V; // Barycentric Hit Coordinates
FLOAT Dist; // Ray-Intersection Parameter Distance
} D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO;
HRESULT WINAPI
D3DXIntersect(
LPD3DXBASEMESH pMesh,
CONST D3DXVECTOR3 *pRayPos,
CONST D3DXVECTOR3 *pRayDir,
BOOL *pHit, // True if any faces were intersected
DWORD *pFaceIndex, // index of closest face intersected
FLOAT *pU, // Barycentric Hit Coordinates
FLOAT *pV, // Barycentric Hit Coordinates
FLOAT *pDist, // Ray-Intersection Parameter Distance
LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest)
DWORD *pCountOfHits); // Number of entries in AllHits array
HRESULT WINAPI
D3DXIntersectSubset(
LPD3DXBASEMESH pMesh,
DWORD AttribId,
CONST D3DXVECTOR3 *pRayPos,
CONST D3DXVECTOR3 *pRayDir,
BOOL *pHit, // True if any faces were intersected
DWORD *pFaceIndex, // index of closest face intersected
FLOAT *pU, // Barycentric Hit Coordinates
FLOAT *pV, // Barycentric Hit Coordinates
FLOAT *pDist, // Ray-Intersection Parameter Distance
LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest)
DWORD *pCountOfHits); // Number of entries in AllHits array
HRESULT WINAPI D3DXSplitMesh
(
LPD3DXMESH pMeshIn,
CONST DWORD *pAdjacencyIn,
CONST DWORD MaxSize,
CONST DWORD Options,
DWORD *pMeshesOut,
LPD3DXBUFFER *ppMeshArrayOut,
LPD3DXBUFFER *ppAdjacencyArrayOut,
LPD3DXBUFFER *ppFaceRemapArrayOut,
LPD3DXBUFFER *ppVertRemapArrayOut
);
BOOL WINAPI D3DXIntersectTri
(
CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position
CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position
CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position
CONST D3DXVECTOR3 *pRayPos, // Ray origin
CONST D3DXVECTOR3 *pRayDir, // Ray direction
FLOAT *pU, // Barycentric Hit Coordinates
FLOAT *pV, // Barycentric Hit Coordinates
FLOAT *pDist); // Ray-Intersection Parameter Distance
BOOL WINAPI
D3DXSphereBoundProbe(
CONST D3DXVECTOR3 *pCenter,
FLOAT Radius,
CONST D3DXVECTOR3 *pRayPosition,
CONST D3DXVECTOR3 *pRayDirection);
BOOL WINAPI
D3DXBoxBoundProbe(
CONST D3DXVECTOR3 *pMin,
CONST D3DXVECTOR3 *pMax,
CONST D3DXVECTOR3 *pRayPosition,
CONST D3DXVECTOR3 *pRayDirection);
HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh,
DWORD dwOptions);
HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh,
DWORD dwTextureInSemantic,
DWORD dwTextureInIndex,
DWORD dwUPartialOutSemantic,
DWORD dwUPartialOutIndex,
DWORD dwVPartialOutSemantic,
DWORD dwVPartialOutIndex,
DWORD dwNormalOutSemantic,
DWORD dwNormalOutIndex,
DWORD dwOptions,
CONST DWORD *pdwAdjacency,
FLOAT fPartialEdgeThreshold,
FLOAT fSingularPointThreshold,
FLOAT fNormalEdgeThreshold,
ID3DXMesh **ppMeshOut,
ID3DXBuffer **ppVertexMapping);
//D3DXComputeTangent
//
//Computes the Tangent vectors for the TexStage texture coordinates
//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL
//puts the binorm in BINORM[BinormIndex] also specified in the decl.
//
//If neither the binorm or the tangnet are in the meshes declaration,
//the function will fail.
//
//If a tangent or Binorm field is in the Decl, but the user does not
//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified
//in the TangentIndex or BinormIndex will cause it to ignore the specified
//semantic.
//
//Wrap should be specified if the texture coordinates wrap.
HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh,
DWORD TexStage,
DWORD TangentIndex,
DWORD BinormIndex,
DWORD Wrap,
CONST DWORD *pAdjacency);
//============================================================================
//
// UVAtlas apis
//
//============================================================================
typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext);
// This function creates atlases for meshes. There are two modes of operation,
// either based on the number of charts, or the maximum allowed stretch. If the
// maximum allowed stretch is 0, then each triangle will likely be in its own
// chart.
//
// The parameters are as follows:
// pMesh - Input mesh to calculate an atlas for. This must have a position
// channel and at least a 2-d texture channel.
// uMaxChartNumber - The maximum number of charts required for the atlas.
// If this is 0, it will be parameterized based solely on
// stretch.
// fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed,
// if 1, then any amount of stretching is allowed.
// uWidth - The width of the texture the atlas will be used on.
// uHeight - The height of the texture the atlas will be used on.
// fGutter - The minimum distance, in texels between two charts on the atlas.
// this gets scaled by the width, so if fGutter is 2.5, and it is
// used on a 512x512 texture, then the minimum distance will be
// 2.5 / 512 in u-v space.
// dwTextureIndex - Specifies which texture coordinate to write to in the
// output mesh (which is cloned from the input mesh). Useful
// if your vertex has multiple texture coordinates.
// pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating
// which triangles are adjacent to each other.
// pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating
// at each face, whether an edge is a false edge or not (using
// the same ordering as the adjacency data structure). If this
// is NULL, then it is assumed that there are no false edges. If
// not NULL, then a non-false edge is indicated by -1 and a false
// edge is indicated by any other value (it is not required, but
// it may be useful for the caller to use the original adjacency
// value). This allows you to parameterize a mesh of quads, and
// the edges down the middle of each quad will not be cut when
// parameterizing the mesh.
// pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the
// integrated metric tensor for that face. This lets you control
// the way this triangle may be stretched in the atlas. The IMT
// passed in will be 3 floats (a,b,c) and specify a symmetric
// matrix (a b) that, given a vector (s,t), specifies the
// (b c)
// distance between a vector v1 and a vector v2 = v1 + (s,t) as
// sqrt((s, t) * M * (s, t)^T).
// In other words, this lets one specify the magnitude of the
// stretch in an arbitrary direction in u-v space. For example
// if a = b = c = 1, then this scales the vector (1,1) by 2, and
// the vector (1,-1) by 0. Note that this is multiplying the edge
// length by the square of the matrix, so if you want the face to
// stretch to twice its
// size with no shearing, the IMT value should be (2, 0, 2), which
// is just the identity matrix times 2.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -