Тема: Vertex Effects
Показать сообщение отдельно
Старый 20.12.2010, 22:58   #2
L.D.M.T.
Бывалый
 
Аватар для L.D.M.T.
 
Регистрация: 10.06.2006
Сообщений: 808
Написано 354 полезных сообщений
(для 832 пользователей)
Ответ: Vertex Effects

вдогонку...

Graphics3D 640,480,16,2
camera=CreateCamera()
PositionEntity camera,0,0,-3
light=CreateLight()
RotateEntity light,45,45,0

;any mesh with enogh verts
mymesh = Createsphere(15)
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
__________________
Per Aspera Ad Astra...
(Offline)
 
Ответить с цитированием
Эти 3 пользователя(ей) сказали Спасибо L.D.M.T. за это полезное сообщение:
Arton (12.10.2013), BlackOut (21.12.2010), Randomize (20.12.2010)