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 (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*
; --------------------------------------------------------------
;
; 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
Cool that you converted it.
Guess you could speed this up using the direct DrawingBuffer access
functions !?
Anyway, nice conversion :clap:
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)
Small modified version with added depth effect...
; --------------------------------------------------------------
;
; 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
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
Quote from: Jim 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
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
Good job with the tranlation Va!n. I really like this effect and you're right it has a lot of potential.