Qbasicnews.com
August 16, 2018, 10:34:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: 3D mapping  (Read 3845 times)
Oz
I hold this place together
*****
Posts: 923



« on: April 02, 2004, 08:23:21 PM »

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~
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #1 on: April 03, 2004, 07:59:33 AM »

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. :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Oz
I hold this place together
*****
Posts: 923



« Reply #2 on: April 09, 2004, 02:45:04 PM »

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?
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #3 on: April 09, 2004, 05:42:51 PM »

Quote from: "Alex_at_EverNever"
[...]using nerbs (hehehe Tongue )[...]


I think you mean "nurbs". If so, cool Shocked
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Oz
I hold this place together
*****
Posts: 923



« Reply #4 on: April 09, 2004, 08:52:35 PM »

'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?
Logged
Pieslice Productions
Member
*
Posts: 47


« Reply #5 on: April 10, 2004, 05:35:52 PM »

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
......
Logged

ll formed pragma
Oz
I hold this place together
*****
Posts: 923



« Reply #6 on: April 11, 2004, 09:22:33 PM »

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~
Logged
Pieslice Productions
Member
*
Posts: 47


« Reply #7 on: April 12, 2004, 06:30:37 AM »

most 3d-editors can export OBJ files...
you can use the high end stuff for QB  Cheesy
Logged

ll formed pragma
Oz
I hold this place together
*****
Posts: 923



« Reply #8 on: April 12, 2004, 10:41:33 AM »

Thnx, then.....i'll check it out.....
can u explain it to me slightly clearer?

Alex~
Logged
Pieslice Productions
Member
*
Posts: 47


« Reply #9 on: April 13, 2004, 03:39:25 AM »

here's complete specifications


http://ri-student.rmk.hamk.fi/~rimerilpa1/OBJformat.txt
Logged

ll formed pragma
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!