'
' TBGL Waves
'
Uses "TBGL","math"
Dim hWnd As DWord
Global tot, num, flag, indx, wireframe As Long
num = 1
Global v, ro, y2, x2, z2, part As Single
part = 0.99
hWnd = TBGL_CreateWindowEx("press 'W' for wire/solid Frame .... press ESC to quit", 640, 600, 32, 0)
TBGL_ShowWindow
TBGL_m15InitModelBuffers 1, 2000
'TBGL_PolygonLook %GL_LINE
TBGL_m15LoadModel "womanhead.m15", "", 1, 0, %TBGL_NORMAL_SMOOTH
TBGL_GetAsyncKeyState(-1) ' Resets status of all keys
Dim gFrameTime As Long
TBGL_UseLighting 1
TBGL_UseLightSource %GL_LIGHT0, 1
'tot = TBGL_m15GetModelVertexcount(1)
'MsgBox 0, tot
gFrameTime = GetTickCount
While TBGL_IsWindow(hWnd)
If TBGL_GetWindowKeyOnce( hWnd, %VK_W) Then
If wireframe = 0 Then
TBGL_PolygonLook %GL_LINE
wireframe = 1
Else
TBGL_PolygonLook %GL_FILL
wireframe = 0
End If
End If
gFrameTime = GetTickCount
TBGL_ClearFrame
TBGL_Camera 0,7,16,0,2,0
waves()
If tot = 0 Then
num = 1
part = 0.99
ElseIf tot =100 Then
num = -1
part = 1.01
End If
tot = tot + num
TBGL_m15RecalcNormals 1, %TBGL_NORMAL_SMOOTH
ro+1
TBGL_Rotate ro-90 , 0, 1, 0
TBGL_m15DrawModel 1
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
Sub waves()
Long i, vertex
Local x,y,z, YY, XX, ZZ As Single
vertex = TBGL_m15GetModelVertexcount(1)
YY = y
For i = 1 To vertex
TBGL_m15GetVertexXYZ(1, i, x, y, z)
XX = x*part
ZZ = z*part
YY = y*part
If yy < 2 Then
yy = y
ElseIf yy > 6 Then
yy = y
End If
TBGL_m15SetVertexXYZ(1, i, XX,YY,Z)
TBGL_m15SetVertexRGB( 1, i, 100,160,100)
Next
End Sub
Bookmarks