DemoCoding - OldSkool Floor Casting Effect

Share your advanced PureBasic knowledge/code with the community.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

DemoCoding - OldSkool Floor Casting Effect

Post by va!n »

Maybe some of you here may know me from older days... Here is a small unoptimized oldskool demo effect like seen in many intros, demos and cracktros end of 80th and beginning the 90th on amiga.... So have fun with the source... best regards

Code: Select all

; --------------------------------------------------------------
;
; OldSkool DemoEffect:  Floor Casting
;
; Converted by: Thorsten Will aka Mr.Vain/Secretly!
; Thanks a lot to "rain storm" for his original source! *thumbs up*
;
; --------------------------------------------------------------

resX = 640
resY = 480
xres = 320
yres = 240

InitSprite() 
InitKeyboard()
OpenScreen( resX, resY, 32, "Floor Casting DemoEffect" )

Repeat
    ExamineKeyboard()
    StartDrawing(ScreenOutput())
  
    camY.f = camY  + 2                           ; change for speed
    camX.f = xres * Sin( camY * 3.14159 / 180 )
    b.f = 0
    For y = 0 To resY -1
        w.f = -yres / y
        v.f = (  resX * w - camY )
        u.f = ( -xres * w + camX )
        For x = 0 To resX -1
            c = ( Int(u) ! Int(v) ) & 255 
            Plot( x, y, RGB( c, c, c ))
            u = u + w
        Next
        b = b + resX
    Next

    StopDrawing()
    FlipBuffers()
Until KeyboardPushed( #PB_Key_Escape )
End
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

Hi,

Nice to see here cool demoeffects.
Thanks you for sharing.

Best regards

Wolf
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

An ocean of tile :)
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

thanks for the feedback... here is a better (fixed) and still unoptimized version with depth look...

Code: Select all

; --------------------------------------------------------------
;
; OldSkool DemoEffect:  Floor Casting
;
; Converted by: Thorsten Will aka Mr.Vain/Secretly!
; Thanks a lot to "rain storm" for his original source! *thumbs up*
;
; --------------------------------------------------------------

resX = 640
resY = 480
xres = 320
yres = 240

InitSprite() 
InitKeyboard()
OpenScreen( resX, resY, 32, "Floor Casting DemoEffect" )

Repeat
    ExamineKeyboard()
    StartDrawing(ScreenOutput())
  
    camY.f = camY  + 2                           ; change for speed
    camX.f = xres * Sin( camY * 3.14159 / 180 )
    b.f = 0
    For y = 0 To resY -1
        w.f = -yres / y
        v.f = (  resX * w - camY )
        u.f = ( -xres * w + camX )
        For x = 0 To resX -1
            t =  ((Int(u) ! Int(v) ) & 255 )
            c = Int((t / resY) * y)
            Plot( x, y, RGB( c, c, c ))
            u = u + w
        Next
        b = b + resX
    Next

    StopDrawing()
    FlipBuffers()
Until KeyboardPushed( #PB_Key_Escape )
End
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Post by Blue »

Amazing what a few heavy-loaded programming strings will do...

Thanks a million.

( "Doctor Will, I'm feeling a bit dizzy. The floor seems to be moving right before my very eyes. Is that normal?" )
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

Thanks for your nice feedback guys!
( "Doctor Will, I'm feeling a bit dizzy. The floor seems to be moving right before my very eyes. Is that normal?" )
("Oha... thats not normal... you can solve the problem by moving your head left/right to the movement speed on the screen *grin*")
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Post Reply