|
Private Sub Render3D()
On Error GoTo ErrOut
If gD3DDevice8 Is Nothing Then Exit Sub
'Bereinigen des BackBuffers und des ZBuffers
gD3DDevice8.Clear 0, ByVal 0, D3DCLEAR_TARGET Or _
D3DCLEAR_ZBUFFER, 0#, 1#, 0
'Szene beginnen
gD3DDevice8.BeginScene
'Vertex Format setzen
gD3DDevice8.SetVertexShader D3DFVF_LVERTEX
'TexturKoordinaten ausserhalb der Textur werden nicht
'gespiegelt
gD3DDevice8.SetTextureStageState 0, D3DTSS_ADDRESSU, _
D3DTADDRESS_CLAMP
gD3DDevice8.SetTextureStageState 0, D3DTSS_ADDRESSV, _
D3DTADDRESS_CLAMP
'Bilinearen Texturfilter verwenden, damit die Skybox nicht so
'grob gerastert wird
gD3DDevice8.SetTextureStageState 0, D3DTSS_MAGFILTER, _
D3DTEXF_LINEAR
'Textur setzen
gD3DDevice8.SetTexture 0, texSkyBox(0)
'Vertexe rendern
gD3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, _
vxSkyBox(0), Len(vxSkyBox(0))
gD3DDevice8.SetTexture 0, texSkyBox(1)
gD3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, _
vxSkyBox(6), Len(vxSkyBox(0))
gD3DDevice8.SetTexture 0, texSkyBox(2)
gD3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, _
vxSkyBox(12), Len(vxSkyBox(0))
gD3DDevice8.SetTexture 0, texSkyBox(3)
gD3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, _
vxSkyBox(18), Len(vxSkyBox(0))
gD3DDevice8.SetTexture 0, texSkyBox(5)
gD3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, _
vxSkyBox(24), Len(vxSkyBox(0))
gD3DDevice8.SetTexture 0, texSkyBox(4)
gD3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, _
vxSkyBox(30), Len(vxSkyBox(0))
'Mit der Draw-Methode des D3DX8Sprite-Objektes Fadenkreuz
'zeichnen
Call gD3DX8Sprite.Draw(texFadenkreuz, recFadenkreuz, _
vecScalingDummy, vecRotationCenterDummy, 0, _
vecFadenkreuz, lngColorDummy)
'Text zeichnen
myDXFont.DrawTextW strText, Len(strText), recText, _
DT_WORDBREAK, D3DColorMake(1, 1, 1, 1)
'Szene beenden
gD3DDevice8.EndScene
'Kompletten BackBuffer zum FrontBuffer kopieren
gD3DDevice8.Present ByVal 0, ByVal 0, 0, ByVal 0
Exit Sub
ErrOut:
Debug.Print Err.Number & " - " & Err.Description
End Sub
|
|