Hello, EveryOne!
First of all. I'm from Russia. Thats why forgive me my english if i miss something.
I have a Code that i need to visualise. Code generates the data pixel by pixel and it need to be visualise some how.
By the way, this is my code:
sync on
DIM frame(1024, 768)
DIM SourceParameters#(9,7)
Global Var AviW, AviH
`setup for *avi file
AviW=1024 : AviH=768 : ` set size video in pxl
make memblock 1,10 : delete memblock 1 : ` DBPorAvi plug-in work with memblocks
if file exist("test.avi") then delete file "test.avi" : ` delete old file
make avi "test.avi",25,AviW,AviH : ` create empty avi-file in same dir
rem Parametrs
rem A0 - max Source Amplitude
SourceParameters#(1,1)=10
SourceParameters#(1,2)=10
SourceParameters#(1,3)=10
SourceParameters#(1,4)=10
SourceParameters#(1,5)=10
SourceParameters#(1,6)=10
SourceParameters#(1,7)=10
rem Beta - coefficient of Environmental Attenuation
SourceParameters#(2,1)=0.01
SourceParameters#(2,2)=0.01
SourceParameters#(2,3)=0.01
SourceParameters#(2,4)=0.01
SourceParameters#(2,5)=0.01
SourceParameters#(2,6)=0.01
SourceParameters#(2,7)=0.01
rem Lambda - Wave length
SourceParameters#(3,1)=1
SourceParameters#(3,2)=2
SourceParameters#(3,3)=3
SourceParameters#(3,4)=1
SourceParameters#(3,5)=2
SourceParameters#(3,6)=3
SourceParameters#(3,7)=4
rem Fi - Phase shift
SourceParameters#(4,1)=0
SourceParameters#(4,2)=0
SourceParameters#(4,3)=0
SourceParameters#(4,4)=0
SourceParameters#(4,5)=0
SourceParameters#(4,6)=0
SourceParameters#(4,7)=0
rem V - Wave Velocity
SourceParameters#(5,1)=10
SourceParameters#(5,2)=10
SourceParameters#(5,3)=10
SourceParameters#(5,4)=10
SourceParameters#(5,5)=10
SourceParameters#(5,6)=10
SourceParameters#(5,7)=10
rem X position of Source
SourceParameters#(6,1)=231
SourceParameters#(6,2)=512
SourceParameters#(6,3)=792
SourceParameters#(6,4)=792
SourceParameters#(6,5)=512
SourceParameters#(6,6)=231
SourceParameters#(6,7)=512
rem Y position of Source
SourceParameters#(7,1)=222
SourceParameters#(7,2)=708
SourceParameters#(7,3)=222
SourceParameters#(7,4)=546
SourceParameters#(7,5)=60
SourceParameters#(7,6)=546
SourceParameters#(7,7)=384
rem Yes(1)/No(0) Geometric Attenuation
SourceParameters#(8,1)=0
SourceParameters#(8,2)=0
SourceParameters#(8,3)=0
SourceParameters#(8,4)=0
SourceParameters#(8,5)=0
SourceParameters#(8,6)=0
SourceParameters#(8,7)=0
rem Yes(1)/No(0) Environmental Attenuation
SourceParameters#(9,1)=0
SourceParameters#(9,2)=0
SourceParameters#(9,3)=0
SourceParameters#(9,4)=0
SourceParameters#(9,5)=0
SourceParameters#(9,6)=0
SourceParameters#(9,7)=0
rem Variables
rem calc amplitude
Amplitude#=0
rem distance from source to current pixel
Distance#=0
rem Attenuation in space because of spherical propagation of waves
GeometricAttenuation#=0
rem Attenuation because of Environment resistance
EnvironmentalAttenuation#=0
rem Calc Current time
Currenttime#=0
rem step of Current time
Steptime#=0.1
rem Number of All frames
Allframe=10
rem Draw(1)/NotDraw(0) Front
DrawFront=1
rem Pixel Color
PixColor=0
rem Number Of Sources
NumberOfSource=7
rem Sum of Amplitude from all sources in one pixel
SUM#=0
rem Flag Of Calc Front(1)/Not Calc Front(0)
FlagOfCalcFront=0
rem Max possible value of Amplitude
MAMP#=0
rem frame size
rem AviW=1024 - width (X)
rem AviH=768 - height (Y)
FOR G=1 TO NumberOfSource
MAMP#=MAMP#+SourceParameters#(1,G)
NEXT G
set window layout 0,0,0
set window position 1,1
maximize window
set display mode 1024,768,32
FOR I=1 TO Allframe
Currenttime#=I*Steptime#
for x=1 to AviW
for y=1 to AviH
SUM#=0
FlagOfCalcFront=0
FOR Q=1 TO NumberOfSource
Distance#=SQRT ((SourceParameters#(6,Q)-x)^2+(SourceParameters#(7,Q)-y)^2)
if DrawFront=1 Then GOTO FRONT ELSE GOTO NOFRONT
FRONT:
if SourceParameters#(5,Q)*Currenttime#<=Distance# Then GoTO PROLONG
NOFRONT:
if SourceParameters#(8,Q)=0 THEN GeometricAttenuation#=1
if SourceParameters#(8,Q)=1 THEN GeometricAttenuation#= (1/(4*3.14*(Distance#)^2))
if SourceParameters#(9,Q)=0 THEN EnvironmentalAttenuation#=1
if SourceParameters#(9,Q)=1 THEN
EnvironmentalAttenuation#=EXP(-SourceParameters#(2,Q)*Currenttime#)
Amplitude#=SourceParameters#(1,Q)*EnvironmentalAttenuation#*GeometricAttenuation#*sin((2*3.1
4/SourceParameters#(3,Q))*(Distance#-(SourceParameters#(3,Q)*SourceParameters#(4,Q)/360)-Sou
rceParameters#(5,Q)*Currenttime#))
SUM#=SUM#+Amplitude#
FlagOfCalcFront=1
PROLONG:
NEXT Q
if FlagOfCalcFront=1 Then GoTO AMP Else GoTO TFRONT
AMP:
if SUM#>=0 Then PixColor= (155 + INT (SUM#*100/MAMP#))
if SUM#<0 Then PixColor= (100 + INT (SUM#*100/MAMP#))
frame(x, y)=PixColor
GoTO EXITT
TFRONT:
frame(x, y)=1000
EXITT:
next y
next x
sync
for x=1 to AviW
for y=1 to AviH
if frame(x, y)=1000 Then a2Dot x, y, RGB(200,0,0)
if frame(x, y)<1000 Then a2Dot x, y, RGB(frame(x, y),frame(x, y),frame(x, y))
next y
next x
sync
`get evry frame to *avi
get image 1,0,0,AviW,AviH,1
add image to avi 1
NEXT I
`Stop record and close *avi
close avi
wait key
I try to solve this problem by wrighing data to AVI with DBProAVI.dll wich I find here: http://forum.thegamecreators.com/?m=forum_view&t=75027&b=5
Very-Very Useful! It's a Great Start, but it requires a screen to be rendering, thats slow. And I find this dll: http://forum.thegamecreators.com/?m=forum_view&t=179096&b=5
Advanced2D.dll it provides command a2Dot that draw pixel a little faster then dot, but it's still slow...
I already contact with CJB by mail, and if it possible to make DBProAVI.dll create avi pixel by pixel it will be best solution i think. But if it is not possible I need another solution, thats why I open this topic. Help me if you know some way to visualize this data whithout delays with good fps.
Some words about my code...
It makes the superposition picture of 7 waves source's. Calculation is based on formula see FIG. It shows the Amplitude on distance X from the sorce, so it can be calculated in all points of the screen from one source, then add from another source, and so on... Array SourceParameters# contains the parameters of all source's that need in formula. The interpretation of amplitude after final rendering in avi - see FIG. Why I need this? All this need to simulate UFO (see FIG.) and try to see what happen's then all lightsource's make superposition of lightwaves.
If it wil not show something special, in any case it can be useful for students to show superposition of waves.