Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: rain_storm on January 17, 2008
-
28 lines of code (not including white spaces or comments) fast and interesting. Not a bad effort if I say myself
' Floor Casting
const resX = 640
const resY = 480
const xres = 320
const yres = 240
#include once "tinyptc.bi"
if (ptc_open("FLOOR CASTING", resX, resY) = 0) then end -1
dim shared as integer buffer(resX*resY)
dim as single u, v, w, camX, camY
dim as integer c, b
while (inkey$ = "")
camY += 1
camX = xres*sin(camY*3.14159/180)
b = 0
for y = 1 to resY
w = -yres / y
v = resX*w - camY
u = -xres*w + camX
for x = 1 to resX
c = (u xor v) and 255
buffer(b+x) = rgb(c,c,c)
u = u + w
next
b = b + resX
next
ptc_update@buffer(1)
wend
ptc_close
end 0
-
The requested URL http://dbfinteractive.com/index.php?action=dlattach;topic=2816.0;attach=2749 is infected with Virus.Win32.Virut.av virus
-
False Alert?
-
I hope so maybe there is a virus on my system that infected that program please remove it. I will post only the source
-
It's a great program :)
Have some good karma.
I hope your system is ok.
I use Kaspersky here, Kaspersky detected the threat, I have had flase alerts in the past though especially if the file is crunched with something unusual.
-
Virus alert here, too. Maybe you can post a uncrunched version!
-
AVG claims it's a virus too, one with a built in IRC server for stealing stuff off your PC :( AVG doesn't warn about kkrunchy any more, so this might be the real deal.
Jim
-
I have replaced the zip with an uninfected one - there's definitely something wrong with the original exe 'cos when I rebuild it's 8kB smaller than the original. I've PMd rain_storm.
Jim
-
Kaspersky found a lot of infected files on my system its still runnin but it runs very slow I would be glad if someone could recompile for me and upload
-
I've already replaced the archive in the original post with an uninfected one.
Let us know how you get on with the clean-up operation, or if you need any help!
Jim
-
Kaspersky found a lot of infected files on my system its still runnin but it runs very slow
:(
At least you will have the problem fixed, even if it takes some time to do a full scan it will be well worth it.
Kaspersky is a great virus killer.
-
nifty.. looks like complete shit at the top though due to no interpolation etc, but thats easily fixed by adding a few bytes to the color calculation accordingly: c = (((u xor v) and 255)/resY)*y
and boom, you have something like this: compared to this:
(http://web.bitnet.net/johnny/floor.gif) (http://web.bitnet.net/johnny/floor2.gif)
(wouldnt be too hard to add fog instead though, but i'll leave that up to you)
-
Thanks mind thats a great improvement. Worth some good karma I think
-
glad you liked it :)
i found this to be extremely useful tbh, for testing different procedural functions in realtime.
so, i will be tossing you some karma aswell..
-
@rain_storm:
very great work! Thanks and K++ for sharing this great old skool demo effect source!
Here is the PB converted version available... http://dbfinteractive.com/index.php?topic=2824.0 (http://dbfinteractive.com/index.php?topic=2824.0) ;)
Btw, i did not manged to get this line work in the PB version:
c = (((u xor v) and 255)/resY)*y
[Edited]
@rain_storm:
i am not sure how FreeBasic handles pixel coordinates but i think the first pixel will start at 0 instead of 1... if so, i think you have to change your code, else you probaly write diretly somewhere into memory...
; your source...
for y = 1 to resY
w = -yres / y
v = resX*w - camY
u = -xres*w + camX
for x = 1 to resX
; change to...
for y = 0 to resY -1 ; FIXED
w = -yres / y
v = resX*w - camY
u = -xres*w + camX
for x = 0 to resX -1 ; FIXED
-
@va!n: be careful with division by zero --> w = -yres / y
Variable "y" really should start by 1.
-
not really a problem, the division by zero can be avoided by adding a simple " if y < 1 then w = -yres / (y + 1) else w = -yres / y;"
but pointing it out to him should teach him to read the code more next time :P
-
Or you could simply update ptc at bufer(1) instead of buffer(0) like se
ptc_update@buffer(1)