ripple effect

Blitz3D Forums/Blitz3D Programming/ripple effect

Just knocked this up. It's a bit rough but may be of use?

Graphics3D 640,480

light=CreateLight()
camera=CreateCamera()
Global size=20
Global scale=8
Global grid = make_grid()

PositionEntity camera,0,100,-50
PointEntity camera,grid
ripple# = 0

While Not KeyDown(1)

ripple = (ripple + 5 ) Mod 360

s=GetSurface(grid,1)
For v=0 To CountVertices(s)-1
d#=Sqr(VertexX(s,v)*VertexX(s,v)+VertexZ(s,v)*VertexZ(s,v))
a#=(-d*10)+ripple
VertexCoords s,v,VertexX(s,v),scale*Sin(a),VertexZ(s,v)
Next

UpdateNormals grid

RenderWorld()
Flip


Wend

;============================================================================================
;GRID =======================================================================================
;============================================================================================

Function make_grid()

mesh=CreateMesh():s=CreateSurface(mesh)

For x=0 To size
For z=0 To size
v0=AddVertex(s,(x-size*.5)*scale,0,(z-size*.5)*scale)
c#=100+50*( ( x+z ) Mod 2 )
VertexColor s,v0,0,c*.5,c
Next
Next

For x=0 To size-1
For z=0 To size-1
v0=x+z*(size+1)
v1=v0+1
v2=v1+(size+1)
v3=v0+(size+1)
AddTriangle s,v0,v1,v2
AddTriangle s,v2,v3,v0
Next
Next

EntityFX mesh,2

Return mesh

End Function