Показать сообщение отдельно
Старый 15.03.2007, 11:48   #14
johnk
Легенда
 
Регистрация: 01.10.2006
Сообщений: 3,705
Написано 296 полезных сообщений
(для 568 пользователей)
Re: Деформация сферы

Нашел что-то похожее на Noise:
;set up
Graphics3D 640,480,16,2
camera=CreateCamera()
PositionEntity camera,0,0,-3
light=CreateLight()
RotateEntity light,45,45,0

;any mesh with enough verts
mymesh = CreateSphere(12)
EntityShininess mymesh,1

While Not KeyHit(1)
    RippleMesh(mymesh,1,20,0.01)
    UpdateWorld
    RenderWorld
    Flip
Wend
End

;mesh is your mesh
;speed is how fast it ripples
;density is how fine the effect is (experiment to see how much of the mesh you affect)
;depth is how much it ripples

Function ripplemesh(mesh,speed#,density#,depth#)
    count=MilliSecs()*speed
    For scount=1 To CountSurfaces(mesh)
        surface = GetSurface(mesh,scount)
        numverts=CountVertices(surface)-1
        For i=0 To numverts
            a#=Cos(count+(i*density))*speed
            b#=Sin(count+(i*density))*speed
            c#=-b;Sin(count+(i*density))*speed
            nx#=VertexNX(surface,i)*depth
            ny#=VertexNY(surface,i)*depth
            nz#=VertexNZ(surface,i)*depth            
            x#=VertexX(surface,i)
            y#=VertexY(surface,i)
            z#=VertexZ(surface,i)        
            VertexCoords surface,i,x#+(a*nx),y#+(b*ny),z#+(c*nz)
        Next
    Next
End Function
Если поймешь принцип, камень тебе обеспечен!
(Offline)
 
Ответить с цитированием