|
Public Sub Render3D()
Dim helpMatrix(2) As D3DMATRIX
Dim i As Integer, j As Integer
'Hilfsmatrix initialisieren
For i = 0 To 2
DX7.IdentityMatrix helpMatrix(i)
Next
Device.Clear 1, ClearRec(), _
D3DCLEAR_TARGET Or D3DCLEAR_ZBUFFER, _
DX7.CreateColorRGBA(0.04, 0.04, 0.07, 1), 1, 0
Device.BeginScene
'Restliche Welt "normal" rendern
Device.SetTransform D3DTRANSFORMSTATE_WORLD, helpMatrix(0)
Call Device.SetTexture(0, texTextur)
'TexturKoordinaten ausserhalb der Textur werden nicht
' gespiegelt
Call Device.SetTextureStageState( _
0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)
'Bilinearen Texturfilter verwenden damit die Textur
' nicht so grob gerastert wird
Call Device.SetTextureStageState( _
0, D3DTSS_MAGFILTER, D3DTFG_LINEAR)
Call Device.DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_LVERTEX, _
vxSkyBox(0), 36, D3DDP_WAIT)
'XFile entsprechend drehen
RotateYMatrix helpMatrix(1), RotateY * PI / 180
RotateXMatrix helpMatrix(2), RotateX * PI / 180
'Hilfsmatrizen miteinander multiplizieren
helpMatrix(1) = RetMatrixMult(helpMatrix(1), helpMatrix(0))
helpMatrix(1) = RetMatrixMult(helpMatrix(2), helpMatrix(1))
'Änderungen der World-Matrix vom XFile durchführen
Device.MultiplyTransform D3DTRANSFORMSTATE_WORLD, helpMatrix(1)
'Alle Meshes vom XFile rendern
For i = 0 To GroupCount - 1
Call Device.SetTexture(0, Groups(i).Texture)
Call Device.SetTextureStageState( _
0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)
Call Device.SetTextureStageState( _
0, D3DTSS_MAGFILTER, D3DTFG_LINEAR)
Call Device.DrawPrimitive(D3DPT_TRIANGLELIST, _
D3DFVF_LVERTEX, Groups(i).RenderVertexList(0), _
UBound(Groups(i).RenderVertexList) + 1, D3DDP_WAIT)
Next
Device.EndScene
End Sub
|
|