Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wee!!, I did it...
#1
:lol: I was bored one day, found Rel's tuts I printed off,. read the furmula for 3D rots,. and it clicked.... Why I didn't see it b4 beats me, sorta one of those "Ouch, I feel dumb" moments, but, who cares, its 3D in Pur FB with a few things I picked up over the last few weeks to make it nice and smooth (Pixel Per Second Delay, and Double buffering) :wink:

PS: THe PPS delay should be better than a FPS delay,.. Its easier to get a solid running speed with it anyway... This code is locked at 50 PPS... :wink: ... Or at least should be,. I'm trusting the theory of my calculations... heh.. *gulp* :roll:

Code:
SCREENRES 800, 600, 32, 2, 1
DIM SHARED AS INTEGER P1, P2 = 1
DEFSNG A-Z
CONST LENS = 256
CONST PI = 3.14

TYPE CORD3D
    X AS SINGLE
    Y AS SINGLE
    Z AS SINGLE
END TYPE

DIM SHARED AS CORD3D Cam, Points(1000), S(1000), OS(1000), Ang
DIM SHARED CENTX, CENTY
CENTX = 400
CENTY = 300

FOR i = 0 TO (UBOUND(Points))
    Points(i).X = (INT(RND * 200) + 1) - 100
    Points(i).Y = (INT(RND * 200) + 1) - 100
    Points(i).Z = (INT(RND * 200) + 1) - 100
NEXT

Cam.X = 0
Cam.Y = 0
Cam.Z = -200

Ang.X = 0
Ang.Y = 0
Ang.Z = 0

'########################################
'######## SPEED (Pixels Per Second) #####
'########################################
RATE = 50 'Pixels Per Second
'########################################

T! = TIMER
DO
    SCREENSET P2, P1
    SWAP P2, P1
    CLS
    FOR i = 0 TO (UBOUND(Points))
        X = Points(i).X
        Y = Points(i).Y
        Z = Points(i).Z
        
        NY = Y * COS(Ang.X * PI / 180) - Z * SIN(Ang.X * PI / 180)
        NZ = Z * COS(Ang.X * PI / 180) + Y * SIN(Ang.X * PI / 180)
        Y = NY
        Z = NZ
        
        NZ = Z * COS(Ang.Y * PI / 180) - X * SIN(Ang.Y * PI / 180)
        NX = X * COS(Ang.Y * PI / 180) + Z * SIN(Ang.Y * PI / 180)
        X = NX
        
        NX = X * COS(Ang.Z * PI / 180) - Y * SIN(Ang.Z * PI / 180)
        NY = Y * COS(Ang.Z * PI / 180) + X * SIN(Ang.Z * PI / 180)
        
        RX = NX - Cam.X
        RY = NY - Cam.Y
        RZ = NZ - Cam.Z
        
        Dist = LENS - RZ
        IF Dist < 256 AND Dist > 0 THEN
            S(i).X = CENTX + (LENS * RX / Dist)
            S(i).Y = CENTY - (LENS * RY / Dist)
            PSET (S(i).X, S(i).Y), RGB(RZ, RZ, RZ)
        END IF
    NEXT
    IF (TIMER - T!) <> 0 THEN FPS = F / (TIMER - T!)
    IF FPS <> 0 THEN V = RATE / FPS
    F += 1
    
    Ang.X += V
    Ang.Y += V
    Ang.Z += V
LOOP UNTIL INKEY$ = CHR$(27)
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply


Messages In This Thread
Wee!!, I did it... - by Rattrapmax6 - 09-21-2005, 05:38 AM
Wee!!, I did it... - by MystikShadows - 09-21-2005, 05:50 AM
Wee!!, I did it... - by Rattrapmax6 - 09-21-2005, 06:28 AM
Wee!!, I did it... - by d.j.peters - 09-21-2005, 11:29 AM
Wee!!, I did it... - by Sebastian - 09-21-2005, 03:57 PM
Wee!!, I did it... - by relsoft - 09-21-2005, 04:28 PM
Wee!!, I did it... - by TheBlueKeyboard - 09-21-2005, 05:07 PM
Wee!!, I did it... - by Rattrapmax6 - 09-21-2005, 05:16 PM
Wee!!, I did it... - by Rattrapmax6 - 09-21-2005, 06:06 PM
Wee!!, I did it... - by Deleter - 09-21-2005, 06:13 PM
Wee!!, I did it... - by d.j.peters - 09-22-2005, 03:05 AM
Wee!!, I did it... - by Rattrapmax6 - 09-22-2005, 03:52 AM
Wee!!, I did it... - by d.j.peters - 09-22-2005, 03:56 AM
Wee!!, I did it... - by Rattrapmax6 - 09-22-2005, 04:18 AM
Wee!!, I did it... - by Rattrapmax6 - 09-25-2005, 03:05 AM
Wee!!, I did it... - by d.j.peters - 09-25-2005, 05:41 AM
Wee!!, I did it... - by Rattrapmax6 - 09-25-2005, 05:52 AM
Wee!!, I did it... - by d.j.peters - 09-25-2005, 05:59 AM
Wee!!, I did it... - by Rattrapmax6 - 09-25-2005, 06:24 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)