Модератор: Mikle
d3dDevice.SetPixelShader
d3dDevice.SetVertexShader d3dfvf_.....
Option Explicit
Dim m(511) As Single
Private Sub Form_Load()
Me.ScaleMode = vbPixels
Me.Width = 500 * Screen.TwipsPerPixelX
Me.Height = 300 * Screen.TwipsPerPixelY
End Sub
Private Sub Form_Click()
Dim x As Long
Randomize Timer
Me.Cls
For x = 0 To 511 Step 64
m(x) = Rnd * 256
Me.Circle (x, m(x)), 3, RGB(255, 0, 0)
Next x
Filter
End Sub
Private Sub Filter()
Dim x As Long, dx As Long, Ind As Long
dx = 64
Do
Ind = 0
Do
x = Ind * dx + dx \ 2
m(x) = mVal(Ind - 1, dx) * -0.0625 + mVal(Ind, dx) * 0.5625 + mVal(Ind + 1, dx) * 0.5625 + mVal(Ind + 2, dx) * -0.0625
Me.PSet (x, m(x)), RGB(0, 0, 0)
Ind = Ind + 1
If Ind * dx > 511 Then Exit Do
Loop
dx = dx \ 2
If dx < 2 Then Exit Do
Loop
End Sub
Private Function mVal(ByVal Ind As Long, ByVal dx As Long) As Single
If Ind < 0 Then Ind = 0
If Ind * dx > 511 Then Ind = 511 \ dx
mVal = m(Ind * dx)
End Function
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 4