|
|
D3DDevice.BeginScene
'All rendering calls go between these two lines
D3DDevice.SetVertexShader FVF
Dim Factor As Long
Factor = VectorToRGBA(vLightPos, 0#)
'Uncomment this next line if you only want to see the bump-mapping
'CanDoBlending = False
If CanDoBlending Then
D3DDevice.SetVertexShader FVF2
D3DDevice.SetTexture 0, BumpMapTex
D3DDevice.SetTexture 1, TextureTex
D3DDevice.SetRenderState D3DRS_TEXTUREFACTOR, Factor
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_DOTPRODUCT3
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG2, D3DTA_TFACTOR
D3DDevice.SetTextureStageState 1, D3DTSS_COLOROP, D3DTOP_MODULATE
D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG1, D3DTA_CURRENT
D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG2, D3DTA_TEXTURE
D3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TriStrip2(0), Len(TriStrip2(0))
Else
D3DDevice.SetVertexShader FVF
D3DDevice.SetRenderState D3DRS_TEXTUREFACTOR, Factor
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_DOTPRODUCT3
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG2, D3DTA_TFACTOR
'uncomment this line to show the normal map (useful for debugging)
'D3DDevice.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1
D3DDevice.SetTexture 0, BumpMapTex 'Texture '//Tell the device which texture we want to use...
D3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TriStrip(0), Len(TriStrip(0))
End If
D3DDevice.SetTexture 0, Nothing
D3DDevice.SetTexture 1, Nothing
D3DDevice.SetVertexShader FVF
D3DDevice.DrawPrimitiveUP D3DPT_POINTLIST, 1, vLightPt, Len(vLightPt)
D3DDevice.EndScene |
-
|