Here's an experiment with Cobra, which is the plasma routine adapted and featured in the Gravity Dimenisons series. Thanks go to Alan MacDonald for the inspiration with the method.
//
// Plasma Effect.
// By Clyde January '07
//
program uses pure2d,keyset
Const
XRES=640
YRES=480
Var
cs:Array[ 3000 ] Of Integer
sn:Array[ 3000 ] Of Integer
a,c:Real
Procedure InitializePlasma()
Var a
Begin
For a=0 To 3000
CS[ a ] = Cos( a )*85
SN[ a ] = Sin( a )*85
Next
End
Procedure UpdatePlasma()
var
d,b
red,grn,blu,col
x,y
//
// Update the plasma movement.
//
Begin
a = a + 1
c = c - 2
If a < 0 Then a=a+360
If a > 360 Then a=a-360
If c < 0 Then c=c+360
If c > 360 Then c=c-360
d = a
b = c
//
// Draw the plasma effect on the texture.
//
For y = 0 To YRES-1
d = d + 4
b = b + 2
For x = 0 To XRES-1 //Step 2
Red = Abs(CS[d+x] + SN[y+x] + CS[b])*2
Grn = Abs(CS[d+x] + SN[y+x] + CS[b])*1
Blu = Abs(CS[d+x] + SN[y+x] + CS[b])*3
If Red>255 then Red=255
If Grn>255 then Grn=255
If blu>255 then Blu=255
Col = ( Red Shl 16) Or ( Grn Shl 8 ) Or ( Blu )
PixelFast(x,y, Col )
Next
Next
End
//End
Procedure RunPlasma()
Begin
OpenScreen(XRES,YRES)
While Not KeyDown(VK_Escape)
Cls
UpdatePlasma()
Flip
Wend
End
//End
Begin
InitializePlasma()
RunPlasma()
End
I can't judge what the overal speed is with these snippets, as I am using a demo version - which runs in a window, and seems to have debug mode turned on; so it makes for really slow visuals my end. If anyone has the full version of Cobra, I'd be very interested in seeing the results in a full screen application.
Anyhows I hope these prove a bit useful to anyone who is learning ( like myself ), or thinking about looking into Cobra.
Cheers and all the very best,
Clyde.