Модератор: Mikle
Select Case D3DDevice.TestCooperativeLevel
Case D3D_OK
D3DDevice.EndScene
D3DDevice.Present ByVal 0&, ByVal 0&, 0&, ByVal 0&
Case D3DERR_DEVICENOTRESET
SetPerspective ' настраиваем перспективу
End Select
Private Sub SetPerspective()
Dim k As Single
If Not D3DDevice Is Nothing Then
If Me.WindowState = 1 Then Exit Sub
D3DDevice.Reset D3DPp
SetDefaultRenderParameters
D3DDevice.GetViewport DefaultViewport
k = Me.ScaleWidth / Me.ScaleHeight
D3DXMatrixPerspectiveLH ProjectionMatrix, k, 1!, 1!, 10000!
3DDevice.SetTransform D3DTS_PROJECTION, ProjectionMatrix
SetupLight
MoveCamera
End If
End Sub
' настройка рендерстейтов
Private Sub SetDefaultRenderParameters()
'D3DDevice.SetRenderState D3DRS_AMBIENT, &H202020
D3DDevice.SetVertexShader D3DFVF_XYZ Or D3DFVF_NORMAL Or D3DFVF_TEX1
D3DDevice.SetRenderState D3DRS_SPECULARENABLE, 1
D3DDevice.SetRenderState D3DRS_ZENABLE, D3DZB_TRUE
D3DDevice.SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA
D3DDevice.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA
D3DDevice.SetRenderState D3DRS_SHADEMODE, D3DSHADE_GOURAUD
D3DDevice.SetRenderState D3DRS_DITHERENABLE, 0
D3DDevice.SetRenderState D3DRS_COLORVERTEX, 1
D3DDevice.SetRenderState D3DRS_ALPHABLENDENABLE, 1
D3DDevice.SetRenderState D3DRS_CLIPPING, 1
D3DDevice.SetRenderState D3DRS_NORMALIZENORMALS, True
D3DDevice.SetRenderState D3DRS_LASTPIXEL, 0&
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 62