GLBasic User Manual

Main sections

X_LOADOBJ

X_LOADOBJ file$, num#



Loads a 3D object into memory. The object is associated with reference id: num#.
The object can contain animations. Only .ddd, .dda or .ddw files can be loaded.

A .ddd file is a special 3D object file. In order to convert a MD2 or 3DS file into a compressed .ddd file, use the 3DConvert program from the tools menu in the IDE.

A .dda file is an ASCII text file describing a 3D object. The 3DConvert program can turn this into a .ddd file. Using .ddd files instead of .dda files will decrease loading times.

A .ddw files is an .ini file describing a "world".

The file format (.ddw) looks like:
;DDW1.0
[objects]
count=3 ; Number of objects
1=House.ddd
ta1=1 ; Material.bmp
tb1=-1; No 2. Texture (e.g. Bump Mapping)

2=Garden.ddd
ta2=2 ; Nature.bmp
tb2=-1

3=Tree.ddd
ta3=2
tb1=-1

[textures]
count=2
1=Material.bmp
2=Nature.bmp


The file format for a .dda file looks like this:
DDDA 1.0 # DDA file, version=1.0
# this must be the first bytes of the file
# a # indicates a comment for the
# rest of the line

6 # tex count - number of texture coordinates
1.000 0.004 # uv 0
0.996 0.992 # uv 1
0.000 0.992 # uv 2
1.008 0.000 # uv 3
0.000 0.988 # uv 4
0.176 0.281 # uv 5

2 # number of faces

# face description
142 142 142 # rgb for this face

# now the vertices
# n p1 p2 px ... t1 t2 tx ...
# n = number of points for surface
# px = index of position vertex (see below)
# tx = index of texture coordinate (see above)
3 0 0 3 1 2 2 # nxyz nuv ...

# next face
142 142 142 #col
3 0 3 2 4 1 5 # nxyz nuv ...

2 #number of keyframes

# keyframe description
4 # number of position vertices for keyframe
-0.988 3.000 0.000 # x y z 0
-2.017 1.966 -0.724 # x y z 1
-2.988 1.000 0.000 # x y z 2
-0.988 1.000 0.000 # x y z 3

# next keyframe
4
0 1 0 # x y z 0
-1 1 0 # x y z 1
-1 0 0 # x y z 2
0 0 0 # x y z 3


Example:
file$ = "robot.ddd"
X_LOADOBJ file$, 1
X_DRAWOBJ 1, 0

See also...