Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D mapping
#1
Lets say i was making a 3D environment in QBasic

ok.....lets say i hava a map array
Code:
'This is just a skeleton..there is more in my code
TYPE MAPTYPE
  TextureIndex    as integer        'Index of texture in array (not in this code)
  Polygons           as integer       'Number of polygons in this map position
  Height               as integer
END TYPE


DIM Map(100,100) AS MAPTYPE

so i say that i can only see so far....
Code:
CONST SightRange = 5   '5 grid spaces ahead
CONST SightRangeAngle = 20  'Angle (from center) -20 to 20 degrees

How would i go about displaying the ground tile?

Please assume:

Code:
'Please also note that these are fragments.....only the stuff that
'needs to be there...
TYPE PLAYERTYPE
  x  as integer
  y  as integer
  z  as integer
  vx as single
  vy as single
  vz as single
deg as single     'angle currentally at
rad  as single     'angle in radians
END TYPE


CONST PI = 3.141596#

DIM TileArray(####) AS INTEGER  'My Tile Array
DIM Player AS PlayerType

Any input would be very helpful

Alex~
Reply
#2
You display 3d maps the way you do with any polygon engine. The map is just a big model. For 3d clipping, the easiest would be screen clipping.

The nost common is the pyramidal clipping or Frustum View clip. For that, you need to know how triangles intersect with the six planes that define a pyramid. I have a working model of FVC. I'll try to find it when I get home. 3 days.

For Speed, there's a Portal engine and BSP trees, I haven't delved into these subjects yet, but Blitz did(BSP) and he was able to make an awesome Quake render with perspective correction. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#3
Im making a 3D object creator/editor using nerbs (hehehe Tongue )

How should i do a readable, and easy format?
I was thinking sumthing like this:
"#" is a remark
"s" is size
"p" is point index
"c" is coord in point

Example:
Code:
# 3D Object Creator File <filename>.3DO
# Created <date>
# Author ::Put Your Name Here::

# Size (for array)
s 2,2,2

# Points
p 1
c 1,1,1
p 2
c 2,2,2

# EOF

Thats a really corny example........any suggestions?
Reply
#4
Quote:[...]using nerbs (hehehe Tongue )[...]

I think you mean "nurbs". If so, cool :o
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
'tis wat i ment...thnx 4 the correction

Im changing my save format:
"#" :remark
"nf" :number of faces
"np" :number of points
"p" :point coordinate
"f" :face (link)

Here is a better example (incomplete):

Code:
############################
# 3DO File <filename>.3DO
############################
# NP : Number of Points
# NF : Number of Faces
# P : Coordinates of point
# F : Face Link-to Index (-1 = end of face)
#
# Number of Points:

np 8

# Number of Faces

nf 6

# Point Coords
p x y z
p x y z
p x y z
p x y z
p x y z
p x y z
p x y z
p x y z

# Face link-to Indexs
F 1 2 3 4 -1
F 1 2 3 4 -1
F 1 2 3 4 -1
F 1 2 3 4 -1
F 1 2 3 4 -1
F 1 2 3 4 -1

This is the skeleton of a cube shape, but I'm too lazy :king: to fill everything out (i usually do a 20x20x20 cube....)

What do u think?
Reply
#6
hm. I notice some similarities with an alias wavefront obj format. learn it. it's easy.

it's like this:
Code:
# Object "object01":
# ComRec:
g mesh01
# No. points 1490:
v -8.36833 -55.6 -8.97902
v -14.6923 -55.6 1.97438
v -8.32394 -55.6 13.0046
v 4.36833 -55.6 13.0303
v 10.6923 -55.6 2.02563
.......
# No. faces 1488:
f 373//1861 1117//2636 376//1864 1//1489
f 374//1862 1225//2750 373//1861 1//1489
f 375//1863 1400//2947 374//1862 1//1489
f 376//1864 1222//2746 375//1863 1//1489
f 376//1864 1117//2636 379//1867 2//1490
f 377//1865 1222//2746 376//1864 2//1490
f 378//1866 1399//2944 377//1865 2//1490
f 379//1867 1219//2742 378//1866 2//1490
f 379//1867 1117//2636 382//1870 3//1491
f 380//1868 1219//2742 379//1867 3//1491
f 381//1869 1398//2941 380//1868 3//1491
f 382//1870 1216//2738 381//1869 3//1491
f 382//1870 1117//2636 385//1873 4//1492
f 383//1871 1216//2738 382//1870 4//1492
......
ll formed pragma
Reply
#7
never heard of it.....i got my idea from Duke Nukem 3D Atomic Edition's sound index editor

By the way, im changing the format slightly:

Code:
# Remark...Blah
########
P_4{
x,y,z
x,y,z
x,y,z
x,y,z
}

F_1{
PointIndex1, PointIndex2, ect...
}

Nothing like a little C++ structure to organize it all

The 'P_#' is the Points, and the number of points
Same with the Faces....

Im still thinking of different ways of saying the colour of the face/polygon

maybe sumthing like this:

Code:
F_2{
.colour ##
PointIndex1, PointIndex2, ect...
.colour ##
PointIndex1, PointIndex2, ect...
}

Alex~
Reply
#8
most 3d-editors can export OBJ files...
you can use the high end stuff for QB Big Grin
ll formed pragma
Reply
#9
Thnx, then.....i'll check it out.....
can u explain it to me slightly clearer?

Alex~
Reply
#10
here's complete specifications


http://ri-student.rmk.hamk.fi/~rimerilpa1/OBJformat.txt
ll formed pragma
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)