[TIB] Re: 3-D graphics


[Prev][Next][Index][Thread]

[TIB] Re: 3-D graphics



I realy don't know is what I will say now It's valuable or not, if you
will understand or not.
~Bu I'll try~

;My technique is simple.





I  have 3 main variables:
x= player x position at the map (@ the MATRIX containing the DATA for
tha map)
z=player y position at the map   (I use Z varible because it isn't
reset when you perform a ClrDraw)
w=moving direction (and looking direction too):
        1=Left
        2=Up
        3=Right
        4=Down
                       ^
                       |
                       2
                <-1         3->
                       4
                       |
                       v



Then  I create a getkey routine.

Left Key will do W-1->W ( player moves -90º     eg:if you were looking
UP,now you are looking RIGHT)
Right Key Wil do W+1->W ( player moves 90º      eg:if you were looking
RIGHT, now you are looking UP)

now....

UP key moves you forward IN THE DIRECTION SPECIFIED BY 'W'
DOWN key moves you backward IN THE DIRECTION SPECIFIED BY 'W'

This is done (of course) with all the Screen Redraws/ Conditional
tests in their right place.

Now the draw routine

Its all done with the ZStandard settings. Its easier to understand and
to desing the walls and turns on it.
I started With a simple hall draw.
In the matrix [A] -the map data matrix - I have now:
(the screens are 8x8 , but the limits are only the matrix Sizes...)
[[
                        1 1 1 1 1 1 1 1
                        1 0 0 0 0 0 0 1
                        1 1 1 1 1 1 1 1
                        0 0 0 0 0 0 0 0
                        0 0 0 0 0 0 0 0
                        0 0 0 0 0 0 0 0
                        0 0 0 0 0 0 0 0
                                                                ]]

Now lets imagine W=3 so we are heading RIGHT.

1 1 1 1 1 1 1 1
1 >              1
1 1 1 1 1 1 1 1


the > represents player current position and direction (X=2, Z(Z is
substitute for Y)=2, W(W is the direction...)=3)


An how to draw corectly this hall?
the top view easly tell us:

the player can  only see  5 left walls and 5 right walls + the wall
that terminates the Hall we are drawing.

I used simple walls.
square walls

And to do the perspective viewing, I used var/2

So,, the first wall coordinates would be=

A = -10          x1
B = 10           y1
C = -10          x2
D = 10            y2
ZStandard
              vvvvvv--------------- the  program does this until it
reaches the end if the Hall::::::-----------vvvvvv
for a,1,8
Line(A,B,C,D
Line(C,D,C/2,D/2
Line(A.B,A/2,B/2
A/2->A
B/2->B
C/2->C
D/2->D
end

you can try this routine in yor ti83 and see left walls being
designed.

This applied to the matrices, counting with enemies, items, and
passages, you draw the map in 3D.



If i have the time i may release a commented source code bcause I
didn'd say almost nothing of the techniques I used to do the 3D
environment.
hope you can thake something from here.

 Im now going out for school and i haven't much time to Programming.If
you still want to say something send SMS to  +351 965260023 or MSG my
school ICQ : 117100402

-Cya all next summer. happy coding for you all.








-----Original Message-----
From: ti-basic-bounce@lists.ticalc.org
[mailto:ti-basic-bounce@lists.ticalc.org]On Behalf Of Matthew Waters
Sent: domingo, 16 de Setembro de 2001 0:51
To: ti-basic@lists.ticalc.org
Subject: [TIB] Re: 3-D graphics




It looks a little large, but like you said, only the community can
judge
it'sworthiness. I can't read a lot of the characters, so I can't quite
get
the full spectrum of the program. Right now, I'm working on my own 3-D
engineusing raytracing and a block-based 2D array for the TI-89. A
friend of
mine who's a calculus whiz is helping me out with this one. (e.g.
determiningthe angles for each ray, depths of blocks, eliminating
fisheye
distortion, that sort of thing)




---------- The Fishy One's Infinite Wisdom #10: "Catholic school
religion
class is like mom's home cooking. Both leave a bad aftertaste and give
you
heartburn." New wisdom every week!

----------------------------------------------------------------------
------
Get your FREE download of MSN Explorer at http://explorer.msn.com[1]


--- Links ---
   1 'http://go.msn.com/bql/hmtag_itl_EN.asp'








References: