|
Public Sub Render3D()
Dim helpMatrix(1) As D3DMATRIX
Dim i As Integer
'Hilfsmatrix initialisieren
For i = 0 To 1
DX7.IdentityMatrix helpMatrix(i)
Next
Device.Clear 1, ClearRec(), _
D3DCLEAR_TARGET Or D3DCLEAR_ZBUFFER, _
DX7.CreateColorRGBA(0#, 0#, 0#, 1#), 1, 0
Device.BeginScene
'restliche Welt "normal" rendern
Device.SetTransform D3DTRANSFORMSTATE_WORLD, helpMatrix(0)
'Bilinearen Texturfilter verwenden damit die Textur nicht
'so grob gerastert wird
Call Device.SetTextureStageState( _
0, D3DTSS_MAGFILTER, D3DTFG_LINEAR)
Call Device.SetTextureStageState( _
0, D3DTSS_MINFILTER, D3DTFG_LINEAR)
'alle Gruppen (Meshes) aus dem XFile rendern
For i = 0 To GroupCount - 1
Call Device.SetTexture(0, Groups(i).Texture)
Call Device.DrawPrimitive( _
D3DPT_TRIANGLELIST, D3DFVF_LVERTEX, _
Groups(i).RenderVertexList(0), _
UBound(Groups(i).RenderVertexList) + 1, D3DDP_WAIT)
Next
Call Device.SetTexture(0, texFeuer)
Call Device.SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, True)
'Objekt-Koordinaten in der WorldMatrix setzen
For i = 0 To 1
DX7.IdentityMatrix helpMatrix(i)
Next
'die World-Matrix der Planes transformieren
Device.SetTransform D3DTRANSFORMSTATE_WORLD, FeuerWorldMatrix
'HilfsMatrix in den Mittelpunkt der Plane schieben
TranslateMatrix helpMatrix(1), FeuerMittelpunkt
'Planes entsprechend drehen
RotateYMatrix helpMatrix(0), FeuerRotateY * PI / 180
'Hilfsmatrizen miteinander multiplizieren
helpMatrix(1) = RetMatrixMult(helpMatrix(1), helpMatrix(0))
'Änderungen der World-Matrix der Planes durchführen
Device.MultiplyTransform D3DTRANSFORMSTATE_WORLD, helpMatrix(1)
Call Device.DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_LVERTEX, _
vxFeuer(0), 6, D3DDP_WAIT)
Call Device.SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, False)
Device.EndScene
End Sub
Private Sub Feuer()
Dim SrcRect As RECT
Dim intZeile As Integer
intZeile = Int(FeuerAniStep) \ 8
With SrcRect
.Left = 32 * (Int(FeuerAniStep) - (intZeile * 8))
.Right = .Left + 32
.Top = 64 * intZeile: .Bottom = .Top + 64
End With
texFeuer.BltFast 0, 0, texFeuerAnimation, SrcRect, DDBLTFAST_WAIT
FeuerAniStep = FeuerAniStep + 0.2
If Int(FeuerAniStep) > FeuerAniMax Then FeuerAniStep = 0
End Sub
|
|