Dark Bit Factory &  Gravity

Dark Bit Factory & Gravity

  • July 30, 2010 *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Pages: [1]   Go Down

Author Topic: Floor Casting with Xor Texture  (Read 754 times)

0 Members and 1 Guest are viewing this topic.

va!n

  • Pentium
  • *****
  • Karma: 102
  • Offline Offline
  • Posts: 1165
    • View Profile
    • WWW
Floor Casting with Xor Texture
« on: January 19, 2008 »
Our board member rain_storm has released his great  source for an so called "floor casting oldskool demo effect with Xor texture" using freebasic. (http://dbfinteractive.com/index.php?topic=2816.0) I really like this old skoolish floor effect since end of the 80th/beginning 90th from amiga scene! So i have tried to convert rain_storm source to pure... Here we go... (there is a lot of optimizing potential). Have fun and again a big thanks to rain_storm for sharing his original source! *thumbs up*

Code: [Select]
; --------------------------------------------------------------
;
; 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
« Last Edit: January 19, 2008 by va!n »
Logged
Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows7 x64
http://www.secretly.de

benny!

  • Senior Member
  • ******
  • Karma: 174
  • Offline Offline
  • Posts: 3424
  • in this place forever!
    • View Profile
    • WWW
Re: Floor Casting with Xor Texture
« Reply #1 on: January 20, 2008 »
Cool that you converted it.

Guess you could speed this up using the direct DrawingBuffer access
functions !?

Anyway, nice conversion  :clap:
Logged
[ microBLOG - PHLOCKS - LABS - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

va!n

  • Pentium
  • *****
  • Karma: 102
  • Offline Offline
  • Posts: 1165
    • View Profile
    • WWW
Re: Floor Casting with Xor Texture
« Reply #2 on: January 20, 2008 »
Thx benny and yes, there are a lot of optimisations possible... like replacing plot with direct screen drawing and some other things (parts with inline asm, where PB generate slow asm output :P)
Logged
Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows7 x64
http://www.secretly.de

va!n

  • Pentium
  • *****
  • Karma: 102
  • Offline Offline
  • Posts: 1165
    • View Profile
    • WWW
Re: Floor Casting with Xor Texture
« Reply #3 on: January 20, 2008 »
Small modified version with added depth effect...

Code: [Select]
; --------------------------------------------------------------
;
; 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
Logged
Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows7 x64
http://www.secretly.de

Jim

  • ADMIN
  • Senior Member
  • ********
  • Karma: 325
  • Offline Offline
  • Posts: 4676
    • View Profile
Re: Floor Casting with Xor Texture
« Reply #4 on: January 20, 2008 »
Someone already pointed out you have a problem when y=0
       w.f = -yres / y
If y=0 what does w.f come out to?

Jim
Logged

mind

  • Texture-San
  • Senior Member
  • ******
  • Karma: 84
  • Offline Offline
  • Posts: 2316
    • View Profile
    • WWW
Re: Floor Casting with Xor Texture
« Reply #5 on: January 21, 2008 »
Someone already pointed out you have a problem when y=0
       w.f = -yres / y
If y=0 what does w.f come out to?

Jim


if y=0 the world ends! divide by zero wins :)

and by all means, dont credit me for the depth effect i suggested! bastard :P
Logged

rain_storm

  • Here comes the Rain
  • Senior Member
  • ******
  • Karma: 157
  • Offline Offline
  • Posts: 2871
  • Rain never hurt nobody
    • View Profile
    • WWW
Re: Floor Casting with Xor Texture
« Reply #6 on: January 23, 2008 »
Good job with the tranlation Va!n. I really like this effect and you're right it has a lot of potential.
Pages: [1]   Go Up
 

 

B l a c k R a i n V.2 by C r i p

Page created in 0.118 seconds with 19 queries.