Why is this code so slow

Blitz3D Forums/Blitz3D Programming/Why is this code so slow

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The following code is some ive been playing with to wiggle some verticies up n down. Even with just one quad 32x32 'water' type it slows down real bad. Anyone know why? or is it because the vertexcoords command is slow?


For wa.water=Each water
wa\phase=wa\phase+wa\speed
mesh=wa\h
la=0
n_surf = CountSurfaces(mesh)
For s = 1 To n_surf
surf = GetSurface(mesh,s)
n_vert = CountVertices(surf)-1
For v = 0 To n_vert
la=la+wa\speed
VertexCoords surf,v,VertexX(surf,v),(Sin(wa\phase+la)*wa\amplitude),VertexZ(surf,v)
Next
Next
UpdateNormals mesh
Next