|
|
最近在学习D3D中Morphing by vs1.1代码写好了,所有函数都成功执行
可结果什么也看不到,郁闷啊,哪为朋友这方面知识,可否指点下,关键信息代码如下:
//////////////////////////////////////////////////////////////////
DWORD Decl[] =
{
D3DVSD_STREAM( 0 ),
D3DVSD_REG( 0, D3DVSDT_FLOAT3 ), // Position of first mesh
D3DVSD_REG( 3, D3DVSDT_FLOAT3 ), // Normal
D3DVSD_REG( 7, D3DVSDT_FLOAT2 ), // Tex coords
D3DVSD_STREAM( 1 ),
D3DVSD_REG( 1, D3DVSDT_FLOAT3 ), // Position of second mesh
D3DVSD_REG( 4, D3DVSDT_FLOAT3 ), // Normal
D3DVSD_REG( 8, D3DVSDT_FLOAT2 ), // Tex coords
D3DVSD_END()
};
//////////////////////////////////////////////////////////////////
; Inputs: v0 = Posizione
; v3 = Normali
; c0 = (0,0.5,xxx,xxx) costanti
; c1-4 = WorldView matrix
; c5-9 = WorldViewProjection matrix
; c9 = Light/material color
; c10 = Light direction (in view space)
vs.1.1 ; Shader version 1.0
mul r1 , v0 ,c0.z
mul r2 , v1 ,c0.w
add r3 , r1 ,r2
m4x4 oPos, r3, c5 ; Compute projected position
mul r1 , v3 , c0.z
mul r2 , v4 , c0.w
add r3 , r1 , r2
m3x3 r1 , r3 , c1 ; r1 = View space normal
dp3 r2 ,-r1 , c10 ; r2 = Diffuse lighting calc
max oT0.x, r2, c0.x ; Clamp r2 to 0,; Tex coord 0 is (r2,0.5)
;mul r1 , v7 ,c0.z
;mul r2 , v8 ,c0.w
;add r3 , r1 ,r2
mov oT1.xy , v8
mov oD0 , c9 ; Diffuse color = c9
//////////////////////////////////////////////////////////////////
g_pD3DDevice->SetTexture( 0, g_pMeshTextures);
g_pD3DDevice->SetVertexShader( hShader );
g_pD3DDevice->SetStreamSource( 0, g_pVertexBuffer, sizeof(CUSTOMVERTEX) );
g_pD3DDevice->SetStreamSource( 1, g_pVertexBuffer_A, sizeof(CUSTOMVERTEX) );
g_pD3DDevice->SetIndices( g_pIndexBuffer, 0 );
g_pD3DDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST,0,g_FacesCount*3,0,g_FacesCount);
// ------以下是整个程序运行的调试信息,表明每个函数运行正常----------------------------
[10:18:58] Support VS1.1
[10:18:58] Basic Initialize Ok!
[10:18:58] Load Second Textures Fair!
[10:18:58] Value of FVF is 274:.
[10:18:58] Load First Mesh Ok!
[10:18:58] Load Second Mesh Ok!
[10:18:58] Constant Set Over!
[10:18:58] LoadShader Run Here(Line 171 in Main.cpp)!
[10:18:58] All Data Ok!
// - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - -- - - - - - - - -
g_pVertexBuffer和g_pVertexBuffer_A的数据也确定符合要求的,就是不知道哪里出了什么问题
请高手一定指点啊,为了这个技术我整整耗了一个月了,我太需要这个技术了,在此我谢了! |
|