Author Topic: Plasma thing  (Read 5077 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Plasma thing
« on: July 22, 2006 »
Here's a rough draft of a tidier thing I made that may be used in a forthcoming DBF prod. Here's the source to the half working version.
Code: [Select]
'
' RGB PLASMA BY SHOCKWAVE^DBF
' ===========================
'--------------------------------------------------------------------------

            OPTION STATIC
            OPTION EXPLICIT
            print "PRE-CALCULATING PLEASE WAIT"


'-------------------------------------------------------------------------
'Please ditch the defs below, they are for the shit fps counter.
'Benchmark reading when nothing is happening is;
'1876 ++ on my comp.
'
'During runtime it's;
'
'998 - 1038
'-------------------------------------------------------------------------

        declare sub millisecs()
        DIM SHARED AS DOUBLE oldtime,newtime
        dim shared ticks,t as integer


'-------------------------------------------------------------------------
' Colour tables for plasmas!
'-------------------------------------------------------------------------
   
    dim shared ctabler(1024*1096) as ubyte
    dim shared ctableg(1024*1096) as ubyte
    dim shared ctableb(1024*1096) as ubyte
    dim shared as integer pmr,pmg,pmb,pmm
    declare sub plasma_palette ()
    plasma_palette()   
    declare sub plasmoid()   
   

'-------------------------------------------------------------------------
' Includes.
'-------------------------------------------------------------------------
            '#define PTC_WIN
            #Include Once "tinyptc.bi"

'-------------------------------------------------------------------------
' Open Screen;
'-------------------------------------------------------------------------

        If( ptc_open( "FAST RGB PLASMA BY SHOCKWAVE^DBF", 640, 480 ) = 0 ) Then
        End -1
        End If
   
        Dim Shared As uInteger Buffer( 640 * 480 ):' Screen Buffer.

'-------------------------------------------------------------------------
' Main Loop;
'-------------------------------------------------------------------------

    DO
    plasmoid()
    millisecs()
    ptc_update@buffer(0)
   
    ticks=ticks+1 :' <-- Ditch this (FPS Counter)
   
    LOOP UNTIL INKEY$ = CHR$(27)
   

'-------------------------------------------------------------------------
' Renders the plasma onto the screen buffer!
'-------------------------------------------------------------------------

sub plasmoid()
     DIM CC,DD AS UINTEGER
    dim as uinteger a2,a,x,y , pmry,pmgy,pmby     
   
    pmm=pmm+1   
   
    pmr=140+139*sin(pmm/93)
    pmg=140+139*sin(pmm/87)
    pmb=140+139*sin(pmm/79)   
   
    pmry=100+99*sin(pmm/91)
    pmry=(pmry*1024)+pmr   
    pmgy=100+99*sin(pmm/101)
    pmgy=(pmgy*1024)+pmg   
    pmby=100+99*sin(pmm/111)
    pmby=(pmby*1024)+pmb
   
    for y=0 to 479
        CC=640*Y
        DD=1024*Y
        for x=0 to 639                 
        a=CC+x 
        a2=DD+X
        buffer(a)=rgb(ctabler((a2)+pmry),ctableg((a2)+pmgy),ctableb((a2)+pmby))       
        next
    next
end sub

'-------------------------------------------------------------------------
' Shit FPS Counter, discard.
'-------------------------------------------------------------------------

SUB Millisecs()
    dim as double t   
    t=timer
if  t-oldtime >=1 then
    newtime = ticks
    ticks=0
    oldtime=timer
    print "PLASMA ON SPEED FPS:"+str( (newtime) )               
end if   
end sub

'-------------------------------------------------------------------------
' Precalculate some plasma patterns!
'-------------------------------------------------------------------------

sub plasma_palette()
   
    dim as integer l , x , y,cnut   
    for y = 0 to 1096
        cnut=30+29*sin(y/91)
    for x = 0 to 1024
        L=(1024*Y)+X
        ctabler(l)=int(125+(60*sin(((x+y)/33)))+(cnut*cos((y/15))))
        ctableg(l)=int(125+(cnut*sin((x/58)))+(64*cos((y/49))))
        ctableb(l)=int(125+(60*cos((x/27)))+(64*cos(((y-x)/19))))
    next         
    next
end sub
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Plasma thing
« Reply #1 on: October 14, 2007 »
Thats a pretty neat effect Shockwave dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Plasma thing
« Reply #2 on: October 19, 2007 »
Thanks :) It's old old, don't think it was ever used.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Plasma thing
« Reply #3 on: November 01, 2007 »
Yeah I agree with Clyde - nice effect. Nice n fast n colourful!

Drew

ps. Im still here just not producing at the mo - I have several things in the pipeline and struggling with all of them! lol! :whack: Be back soon with something!
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Plasma thing
« Reply #4 on: November 01, 2007 »
slightly off topic - just noticed that the time on here is wrong - it's an hour fast! Im probably not the first to notice this but hey ho - thought I would say something!!

Drew

ps - do I win a prize! lol!
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Plasma thing
« Reply #5 on: November 01, 2007 »
Hi Drew :)

Because we have people from all over the world in many different time zones I do not bother altering the clocks on the forum when the clocks go forward/back.

However....

If it bugs you, everyone can change the time offset individually, check your profile and you will find time offset in look and layout preferences :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Plasma thing
« Reply #6 on: November 01, 2007 »
Thanks Shockwave - I wasn't moaning (honest!)

Cheers Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Plasma thing
« Reply #7 on: November 02, 2007 »
I didn't touch anything and the forum has the right time already.  GMT+10 Sydney seems to have worked it our for itself...
Jim
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Plasma thing
« Reply #8 on: November 02, 2007 »
Thanks Shockwave - I wasn't moaning (honest!)

Cheers Drew

No problem , I didn't think you were moaning anyway :)

I didn't touch anything and the forum has the right time already.  GMT+10 Sydney seems to have worked it our for itself...
Jim

Yay! An accidental success!!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Plasma thing
« Reply #9 on: November 24, 2007 »
is there any executable for non fb users available? ^^ thx
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Plasma thing
« Reply #10 on: November 25, 2007 »
Here, it's really bad though.
Shockwave ^ Codigos
Challenge Trophies Won: