D3DX 是一個靜态庫,容易使用在釋出的産品上。D3DX 也提供3D 圖形應用程式公共的操作。D3DX包含下面幾個方面:抽象資料類型,helper對象,triangle meshes,resource function和一些其他函數。
具體類提供了顔色,材質,向量,矩陣,面和quaternion。他們實作為C++類,并且也提供了一些操作在這些類上全局函數。helper對象實作了矩陣堆棧,text rendering,spirites和multi-pass 渲染效果,render target assistance。這些對象是以COM對象實作的。
D3DX的大多數high level的操作都是基于triangle meshes。Meshes包含很多不同的種類,都是用COM來實作的。
Headers and libraries
D3DX 是通過一堆頭檔案和一個靜态庫提供的。這個庫有debug和release兩個版本。對于調試庫,它也提供一個dll版本,但是這個版本不能用在釋出産品。
如果你的應用程式要使用D3DX,你應該包含<d3dx9.h>頭檔案。這個頭檔案包含所有的D3DX頭檔案:<d3dx9core.h>,<d3dxeffect.h>,<d3dx9math.h>,<d3dx9mesh.h>,<d3dx9shape.h>,<d3dx9tex.h>。
d3dx9.lib用在realse的build裡面,d3dx9dt.lib包含一些附加的調試資訊,用在debug版裡面。d3dx9d.lib用在debugging build裡面。
資料類型
D3DX 提供了一些concrete datatypes和一些管理他們的函數。一個concrete dataypes能夠讓程式員了看到所有的成員和實作,而對于抽象的類型,程式員隻能看到接口。D3DX 把colors, vectors,planes, quaternions和matrices實作為concrete datatypes。他們的類分别是D3DXCOLOR, D3DXVECTOR2,D3DXVECTOR3,D3DXVECTOR4, D3DXPLANE, D3DXQUATERNION和D3DXMATRIX(4*4同次轉換矩陣)。
Helper Objects
與C++實作的concrete datatypes相比,D3DX也提供了實作為COM對象的抽象datatypes。ID3DXMatrixStack 提供了scene graph中使用的轉換矩陣的堆棧。ID3DXFont提供了GDI實作的字型渲染. ID3DXSprite提供了簡單的基于2D的Sprites。 ID3DXRenderToSurface提供了渲染到target surface的簡化接口。類似,ID3DXRenderToEnvMap提供了渲染到環境map紋理的簡化接口。
Meshes
D3DX 提供了幾個mesh對象封裝被索引的三角形清單。Mesh simplification 和 progressive 都将會支援。ID3DXMesh把一個形狀封裝成一個三角形mesh。ID3DXPMesh接口封裝progressive mesh refinement。ID3DXBashMesh是ID3DXMesh和ID3DXPMesh的基接口。ID3DXSPMesh封裝了任意的mesh simplication。ID3DXSkinInfo封裝了skinned mesh。 D3DX 也提供了從.x檔案讀寫mesh對象的操作。
資源
圖檔和紋理都是幾乎每個Direct3D應用程式都要使用的資源。D3DX提供了大量的建立,初始化surfaces 以及從檔案,win32 資源,記憶體block裡面讀取紋理的操作。D3DX 也能讀取.bmp,.dds,.dib,.jpg,.png,.ppm和.tga檔案格式。 D3DX能夠将資源資料寫入到 DirectDraw surface(.dds)檔案和windows bitmap format(.bmp)檔案。
Disc上的檔案資料可以通過他們的檔案名引用。記憶體裡面的檔案通過一個指令記憶體塊的指針引用。win32資源檔案可以通過包含資源和資源名稱的子產品句柄所引用。win32資源對.bmp資料可以是RT_BITMAP類型,對其他的檔案格式是RT_RCDATA。注意一定不要把win32 resource和存儲在可執行檔案上的資料混淆了。
Resource Image Information
D3DX支援的最簡單的操作是讀取一個圖檔檔案的次元和格式資訊。 D3DXGetImageInfoFromFile,D3DXGetImageInfoFromFileMemory和 D3DXGetImageInfoFromResource分别從硬碟檔案,記憶體檔案和win32資源形式的檔案裡面擷取圖檔的資訊。
typedef struct _D3DXIMAGE_INFO
{
UINT Width;
UINT Height;
UINT Depth;
UINT MipLevels;
D3DFORMAT Format;
D3DRESOURCETYPE ResourceType;
D3DXIMAGE_FILEFORMAT ImageFileFormat;
} D3DXIMAGE_INFO;
對于圖檔,Depth是1。大部分圖檔的MipLevels為1,但是.dds檔案能存儲整個mipmap chains;ResourceType隻是一個檔案是否包含紋理,volume紋理或者立方體紋理;Format 成員給出了與文聯裡面的資料格式最比對的像素格式;ImageFileFormat訓示了資源資料的檔案格式,它的值包含在 D3DXIMAGEF_FILEFORMAT裡面。
typedef enum _D3DXIMAGE_FILEFORMAT
{
D3DXIFF_BMP = 0,
D3DXIFF_DDS = 4,
D3DXIFF_DJB = 6,
D3DXIFF_JPG = 1,
D3DXIFF_PNG = 3,
D3DXIFF_PPM= 5,
D3DXIFF_TGA = 2
} D3DXIMAGE_FILEFORMAT;
Resource Requirements
裝載資源的公共任務是将檔案的像素次元與裝置requirements的比對。D3DX 提供函數D3DXCheckTextureRequirements,D3DXCheckCubeTextureRequirements和 D3DXCheckVolumeTextureRequirements來調整資源的次元,mipmap levels的數目和像素格式來适應裝置的requirements。
Format Conversion
D3DX 提供了将像素資料從一種格式轉換到另一種格式的方法。它包含color-space的轉換,channel 縮放,壓縮和解壓縮以及過濾。D3DXLoadSurfaceFromSurface執行了surface的格式轉換。 D3DXLoadVolumeFromVolume執行基于volume的轉換。為了執行紋理之間的轉換,GetSurfaceLevel和 GetVolumeLevel方法擷取紋理裡面包含的surface或者volume的接口指針。
HRESULT ::D3DXLoadSurfaceFromSurface(IDirect3DSurface9 * destination,
cost PALETTEENTRY * dest_palette,
const RECT * dest_rect,
IDirect3DSurface9 * source,
const PALETTEENTRY * source_palette,
const RECT * source_rect,
DWORD filter,
D3DCOLOR color_key );
HRESULT ::D3DXLoadVolumeFromVolume(IDirect3DVolume9 *destination,
const PALETTEENTRY * dest_palette,
const D3DBOX* dest_box,
IDirect3DVolume9 * source,
const PALETTEENTRY * source_palette,
const D3DBOX * source_box,
DWORD filter,
D3DCOLOR color_key);
dest_palette和source_palette參數指向包含256個PALETTEENTRY結構體的記憶體,源和目的格式都是 D3DFMT_P8。當源和目的都不是被索引的格式,這些參數将可能是空。dest_rect和source_rect參數在源和目的面上的某個子矩形運作轉換操作。dest_box和source_box參數的操作方式類似于volumes。當這些參數指向源和目的地不同大小的區域時,D3DX在源區域執行filtering來比對目的區域。過濾kernel通過filter參數指定,它的值可能是D3DX_DEFAULT,或者下面的值:
D3DX_FILTER---------textbf
#define D3DX_FILTER_NONE (1<<0)
#define D3DX_FILTER_POINT (2<<0)
#define D3DX_FILTER_LINEAR (3<<0)
#define D3DX_FILTER_TRIANGLE (4<<0)
#define D3DX_FILTER_MIRROR_U (1<<16)
#define D3DX_FILTER_MIRROR_V (2<< 16)
#define D3DX_FILTER_MIRROR_W (4<< 16)
#define D3DX_FILTER_MIRROR (7<<16)
#define D3DX_FILTER_DITHER (8<<16)
D3DX_FILTER_NONE指定超出源區域範圍的目的區域的顔色将是全透明黑,它将不再會有縮放和filtering發生。D3D_DEFAULT 等同于D3DX_FILTER_TRIANGLE和D3DX_FILTER_DITHER的結合體。 D3DX_FILTER_POINT,D3DX_FILTER_LINEAR,D3DX_FILTER_TRIANGLE,D3DX_FILTER_BOX 指定filter kernel将應用到源區域。Point filtering是最快的縮放方法,但是它産生的鋸齒最多。Linear filtering對于surface使用2*2 像素臨近區域,或者對于volume使用2*2*2像素臨近區域,它在源像素的臨近區域線性插值來計算目的像素值。線性過濾的開銷要大于點過濾,但是它能産生更高品質的圖檔。三角形過濾器使用的臨近區域将會與源區域和目的區域的大小成正比,它的開銷最大。box 過濾器将使用2*2的surface臨近區域,或者2*2*2的volume區域,臨近區域像素的平均值将作為目的像素值。Box filter主要是用于計算mipmap levels,但是仍然引起很多鋸齒。
Mirror标志控制了源圖檔x,y,z軸的repetition。D3DX_FILTER_MIRROR标志mirror了源圖檔所有的軸。 D3DX_FILTER_DITHER enalbe 了源像素到目的像素的4*4有序dither。 Dithering 在減少源像素的顔色深度的時候最有用,它能阻止産生banding artifacts。
最後,color_key參數允許應用程式在源區域指定一個像素值,它将在處理過程中被全透明黑取代。
Creating Texture Resources
D3DX提供了兩種形式的函數從磁盤檔案,記憶體檔案以及win32 資源檔案建立紋理資源。第一種使用資源checking和filtering 函數來構造一個資源,可能會resize這個資源以及進行格式轉換。 第二種形式允許應用程式控制資源建立的過程。
- Creating Uninitialized Textures
D3DXCreateTexture, D3DXCreateCubeTexture, D3DXCreateVolumeTexture 建立一個内容為未初始化的紋理資源。你能夠在應用程式裡面初始化紋理資源的内容。
HRESULT ::D3DXCreateTexture(IDirect3DDevice9 * device,
&nbp; UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTexture(IDirect3DDevice9 * device,
UINT Size,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateVolumeTexture(IDirect3DDevice9 * device,
UINT width,
UINT height,
UINT depth,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
IDirect3DVolumeTexture9 ** result);
- Creating Textures from Files
D3DXCreateCubeTextureFromFile, D3DXCreateTextureFromFile, D3DXCreateVolumeTextureFromFile 從磁盤檔案建立紋理資源。這些函數都能從磁盤檔案裡面取到像素的次元和像素格式,并且調整次元和格式來滿足裝置對資源的需求。檔案裡面的像素資料讀進記憶體,并且可能會轉化成資源使用的像素格式。
HRESULT ::D3DXCreateTextureFromFile(IDirect3DDevice9 * device,
LPCTSTR filename,
&nsp; IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTextureFromFIle(IDirect3DDevice9 * device,
LPCTSTR filename,
IDirect3DTexture9 **result);
HRESULT ::D3DXCreateVolumeTextureFromFile(IDirect3DDevice9 * device,
LPCTSTR filename,
IDirect3DTexture9 ** result);
紋理資源可以從任何支援的檔案格式裡面建立。cube 紋理隻能從.dds檔案裡面建立。volume可以從包含整個volume的.dds檔案裡面建立,或者從圖檔檔案裡面建立一個volume,它隻包含一個slice。
擴充的紋理建立函數允許應用程式控制所有的參數。
HRESULT ::D3DXCreateTextureFromFileEx(IDirect3DDevice9 * device,
LPCTSTR filename,
UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY * palette,
IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTextureFromFileEx(IDirect3DDevice9 * device,
LPCTSTR filename,
UINT size,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY * palette,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateVolumeTextureFromFileEx(IDirect3DDevice9 * device,
LPCTSTR filename,
UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
&nbp; DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY * palette,
IDirect3DVolumeTexture9 ** result);
filter 參數控制了圖檔轉換成紋理資源most detailed level的filtering方式,mip_filter參數控制了mipmap levels的建立。當filter為D3DX_DEFAULT時,它将使用dithering和三角形過濾的混合方式。當mip_filter為空 D3DX_DEFAULT時,一個box filter将用于産生mipmap levels。info參數将傳回構造紋理的圖檔檔案的資訊。palette參數傳回資源裝載的palette。
- Creating Textures From Files In Memory
D3DXCreateTextureFromFileInMemory, D3DXCreateCubeTextureFromFileInMemory, D3DXCreateVolumeTextureFromFileInMemory用來通過記憶體檔案建立紋理。
Ex 形式的函數類似于先前讨論的紋理建立函數。
HRESULT ::D3DXCreateTextureFromFileInMemory(IDirect3DDevice9 * device,
const void * data,
UINT size,
IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTextureFromFileInMemory(IDirect3DDevice9 * device,
const void * data,
UINT size,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 * device,
const void * data,
UINT size,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateTextureFromFileInMemoryEx(IDirect3DDevice9 * device,
const void * data,
&nbp; UINT size,
UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY * palette,
IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 * device,
const void * data,
UINT size,
UINT Size,
&nsp; UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY * palette,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateVolumeTextureFromFileInMemoryEx(IDirect3DDevice9 * device,
const void * data,
UINT size,
UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY * palette,
IDirect3DVolumeTexture9 ** result);
- Creating Textures From Resource
HRESULT ::D3DXCreateTextureFromResource(IDirect3DDevice9 * device,
HMODULE module,
LPCTSTR resource ,
IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTextureFromResource(IDirect3DDevice9 * device,
HMODULE module,
LPCTSTR resource ,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateVolumeTextureFromResource(IDirect3DDevice9 * device,
HMODULE module,
LPCTSTR resource ,
IDirect3DVolumeTexture9 ** result);
HRESULT ::D3DXCreateTextureFromResourceEx(IDirect3DDevice9 * device,
&nbs; HMODULE module,
LPCTSTR resource ,
UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY* palette,
IDirect3DTexture9 ** result);
HRESULT ::D3DXCreateCubeTextureFromResourceEx(IDirect3DDevice9 * device,
HMODULE module,
LPCTSTR resource ,
UINT Size,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY* palette,
IDirect3DCubeTexture9 ** result);
HRESULT ::D3DXCreateVolumeTextureFromResourceEx(IDirect3DDevice9 * device,
HMODULE module,
LPCTSTR resource ,
UINT width,
UINT height,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
nbsp; DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info,
PALETTEENTRY* palette,
IDirect3DVolumeTexture9 ** result);
Loading Resource
如果你已經有了一個存在的surface或者紋理資源,并且想要把圖檔裝載到資源裡面,你能夠使用D3DX把内容讀入到surface。對于一個紋理或者 cube紋理資源,你能取到特定level的surface接口指針,然後把資料裝載到surface。對于volume紋理,你能取得特定level的 volume接口指針,然後把資料裝載到volume。surface資料将是一連竄的scanline,從最底部的scanline開始,相鄰兩個 scanline的offset是pitch個位元組。 volume資料将是一連串的slices,slice_pitch和row_pitch分别是volume裡相鄰兩個的slices的距離和slice 裡面相鄰兩行的距離。
HRESULT ::D3DXLoadSurfaceFromMemory(IDirect3DSurface9 * destination,
const PALETTEENTRY * dest_palette,
const RECT * dest_rect,
const void * source,
D3DFORMAT format,
UINT pitch,
const PALETTEENTRY * source_palette,
const RECT * source_rect,
DWORD filter,
D3DCOLOR color_key);
HRESULT ::D3DXLoadSurfaceFromFile(IDirect3DSurface9 * destination,
const PALETTEENTRY * dest_palette,
cost RECT * dest_rect,
const void * data,
UINT size,
const RECT * source_rect,
DWORD filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info);
HRESULT ::D3DXLoadSurfaceFromResource(IDirect3DVolume9 * destination,
const PALETTEENTRY * dest_palette,
const RECT * dest_rect,
HMODULE module,
LPCTSTR resource,
const RECT * source_rect,
DWORD filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info);
HRESULT ::D3DXLoadVolumeFromMemory(IDirect3DVolume9 * destination,
const PALETTEENTRY * dest_palette,
const D3DBOX* dest_box,
const void * source,
D3DFORMAT format,
&nsp; UINT row_pitch,
UINT slice_pitch,
const PALETTEENTRY * source_palette,
const D3DBOX* source_box,
DWORD filter,
D3DCOLOR color_key);
HRESULT ::D3DXLoadVolumeFromFile(IDirect3DVolume9 * destination,
const PALETTEENTRY * dest_palette,
const D3DBOX* dest_box,
const void * data,
UINT size,
const D3DBOX* source_box,
DWORD filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info);
HRESULT ::D3DXLoadVolumeFromResource(IDirect3DVolume9 * destination,
const PALETTEENTRY * dest_palette,
const D3DBOX* dest_box,
HMODULE module
LPCTSTR resource,
const D3DBOX* source_box,
&nsp; DWORD filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO * info);
Saving Resources
D3DX能夠将surface, texture和volume texture資源資料儲存到.bmp和.dds檔案格式。
HRESULT ::D3DXSaveSurfaceToFile(LPCTSTR filename
D3DXIMAGE_FILEFORMAT file_format,
IDirect3DSurface9 * source,
const PALETTEENTRY * palette,
const RECT * rect);
HRESULT ::D3DXSaveTextureToFile(LPCTSTR filename
D3DXIMAGE_FILEFORMAT file_format,
IDirect3DBaseTexture9 * source,
const PALETTEENTRY * palette );
HRESULT ::D3DXSaveVolumeToFile(LPCTSTR filename
D3DXIMAGE_FILEFORMAT file_format,
IDirect3DVolume9 * source,
const PALETTEENTRY * palette ,
const D3DBOX * box);
Filling Textures
除了将資源儲存到檔案外,D3DX提供一種方法來填充紋理資源。
HRESULT ::D3DXFillTexture(IDirect3DTexture9 * texture, LPD3DXFILL2D fill_proc, void * context);
HRESULT ::D3DXFillCubeTexture(IDirect3DCubeTexture9 * texture, LPD3DXFILL3D fill_proc, void * context);
HRESULT ::D3DXFillVolumeTexture(IDirect3DVolumeTexture9 * texture, LPD3DXFILL3D fill_proc, void * context);
typedef void (*LPD3DXFILL2D)(D3DXVECTOR4 * result, D3DXVECTOR2 * coord, D3DXVECTOR2 * size, void * context);
typedef void (*LPD3DXFILL3D)(D3DXVECTOR4 * result, D3DXVECTOR3 * coord, D3DXVECTOR3 * size, void * context);
Filtering Textures
當應用程式改變了一個mipmapped texture的most detailed level時,less detailed level需要重新生成。D3DX提供了單個函數以filtering方式建立mipmap levels。
HRESULT ::D3DXFilterTexture(IDirect3DBaseTexture9 * texture, const PALETTEENTRY * palette, UINT level, DWORD filter);
Creating Normal Maps
D3DX 從一個height field建立一個法線圖。
HRESULT ::D3DXComputeNormalMap(IDirect3DTexture9 * destination,
IDirect3DTexture9 * source,
const PALETTEENTRY * palette,
DWORD flags,
DWORD channel,
float amplitude);
channel參數指定那個height field的那個通道用于elevation。
#define D3DX_CHANNEL_RED (1<<0)
#define D3DX_CHANNEL_BLUE (1<<1)
#define D3DX_CHANNEL_GREEN (1<<2)
#define D3DX_CHANNEL_ALPHA (1<<3)
#define D3DX_CHANNEL_LUMINANCE (1<<4)
flags參數提供了法線圖計算的選項。mirror 标志控制x,y方向height field的repetition。Occlusion計算per-pixel的occlusion值,并且将它存放在法線圖的alpha通道。
#define D3DX_NORMALMAP_MIRROR_U (1<<16)
#define D3DX_NORMALMAP_MIRROR_V (2<<16)
#define D3DX_NORMALMAP_MIRROR (3<<16)
#define D3DX_NORMALMAP_INVERTSIGN (8 << 16)
#define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16)
Miscellaneous
- Macros
const float D3DX_PI;
const float D3DX_1BYPI;
float D3DXToRadian(float degrees);
float D3DXToDegree(float radians);
- Fresnel's Formulas
Error Handling
LPCTSTR ::DXGetErrorString9(HRESULT hr);
LPCTSTR ::DXGetErrorDescription9(HRESULT hr);
HRESULT ::D3DXGetErrorString(HRESULT hr, LPTSTR pBuffer, UINT BufferLen);
ID3DXBuffer
HRESULT ::D3DXCreateBuffer(DWORD size, ID3DXBuffer ** result);
Vertex Declarations
UINT ::D3DXGetFVFVertexSize(DWORD fvf);
HRESULT ::D3DXDeclaratorFromFVF(DWORD fvf, DWORD result[MAX_FVF_DECL_SIZE]);
HRESULT ::D3DXFVFFromDeclarator(const DWORD * declaration, DWORD * size);
Intersection Testing
D3DX 提供函數計算射線與三角形相交。
BOOL ::D3DXIntersectTri(const D3DXVECTOR3 * p0,
const D3DXVECTOR3 * p1,
const D3DXVECTOR3 * p2,
const D3DXVECTOR3 * position,
const D3DXVECTOR3 * direction
float * u,
float * v,
float * distance);
D3DX 也提供了函數D3DXSphereBoundProbe和D3DXBoxBoundProbe來測試射線與bounding volume的相交。
Shader Assembly
D3DX 提供了函數将文本shader指令轉化成shader token 數組。
D3DXAssembleShader,D3DAssembleShaderFromFile,D3DXAssembleShaderFromResource來實作這樣的功能。
聲明:
轉載,from: http://blog.csdn.net/weili_2007