Video not! Dll, yes ;)
JP The B3D version of the "360 circles agents"
Graphics3D 640,480,32,2
SetBuffer BackBuffer()
;***********************************************************************************
; Author: Krischan
Dim GradientR%(0),GradientG%(0),GradientB%(0),Percent#(0),Red%(0),Green%(0),Blue%(0)
; Create a gradient spectrum for 200 agent
Restore Spectrum
CreateGradient(11,360)
;***********************************************************************************
camera=CreateCamera()
CameraClsColor camera,100,100,100
PositionEntity camera,0,300,0
RotateEntity camera,90,0,0
light=CreateLight()
RotateEntity light,90,0,0
; init the Lib
RVO_open()
; Set time step
RVO_setTimeStep(1.50)
; set default agent param
RVO_setAgentDefaults( 15.0, 10, 10.0, 10.0, 1.0, 2.0 )
; Create agent ********************************
Dim AgtMesh(360)
Dim AgtRVO(360)
For i=0 To 359
AgtMesh(i) = CreateSphere()
EntityColor AgtMesh(i),GradientR(i),GradientG(i),GradientB(i)
;ScaleEntity AgtMesh(i),2,2,2
PosXAgent# = 200*Sin(i)
PosZAgent# = 200*Cos(i)
PosXGoal# = -PosXAgent#
PosZGoal# = -PosZAgent#
PositionEntity AgtMesh(i),PosXAgent,0,PosZAgent
AgtRVO(i) = RVO_addAgent(PosXAgent,PosZAgent ,PosXGoal,PosZGoal)
Next
resutl1%=0
While Not (KeyDown(1)+resutl1)
RenderWorld
; All agent arrived?
; param : radius of the detection
resutl1%= RVO_getReachedGoal(1.5)
; Get X and Z of the agents
For i=0 To 359
PosXAgent# = RVO_getAgentPositionX(AgtRVO(i))
PosZAgent# = RVO_getAgentPositionZ(AgtRVO(i))
PositionEntity AgtMesh(i),PosXAgent#,0,PosZAgent#
Next
; Update the lib
RVO_Update2()
;RVO_Update()
Flip 1
Delay 1
Wend
; clode the lib
RVO_close()
End
;***********************************************************************************
; Author: Krischan
; Date: 2009-02-21 16:56:13
; Title: Color Gradient
; Description: Creates a color gradient between some colors
; Photoshop Gradient Simulation
; by Krischan webmaster(at)jaas.de
;
;***********************************************************************************
Function CreateGradient(colors%,steps%)
Dim GradientR(steps),GradientG(steps),GradientB(steps),Percent(colors),Red(colors),Green(colors),Blue(colors)
Local i%,pos1%,pos2%,pdiff%
Local rdiff%,gdiff%,bdiff%
Local rstep#,gstep#,bstep#
Local counter%=1
; read color codes
For i=1 To colors : Read Percent(i),Red(i),Green(i),Blue(i) : Next
; calculate gradient
While counter<colors
; transform percent value into step position
pos1%=Percent(counter)*steps/100
pos2%=Percent(counter+1)*steps/100
; calculate position difference
pdiff%=pos2-pos1
; calculate color difference
rdiff%=Red(counter)-Red(counter+1)
gdiff%=Green(counter)-Green(counter+1)
bdiff%=Blue(counter)-Blue(counter+1)
; calculate color steps
rstep#=rdiff*1.0/pdiff
gstep#=gdiff*1.0/pdiff
bstep#=bdiff*1.0/pdiff
; calculate "in-between" color codes
For i=0 To pdiff
GradientR(pos1+i)=Int(Red(counter)-(rstep*i))
GradientG(pos1+i)=Int(Green(counter)-(gstep*i))
GradientB(pos1+i)=Int(Blue(counter)-(bstep*i))
Next
; increment counter
counter=counter+1
Wend
End Function
.Spectrum
Data 0.0,255, 0, 0 ; red
Data 10.0,255,128, 0 ; orange
Data 20.0,255,255, 0 ; yellow
Data 30.0,128,255, 0 ; yellow-green
Data 40.0, 0,255, 0 ; green
Data 50.0, 0,255,128 ; green-cyan
Data 60.0, 0,255,255 ; cyan
Data 70.0, 0,128,255 ; light blue
Data 80.0, 0, 0,255 ; blue
Data 90.0,128, 0,255 ; violet blue
Data 100.0,255, 0,255 ; violet
|