13.01.2013 Views

Hands On DarkBASIC Pro - Digital Skills

Hands On DarkBASIC Pro - Digital Skills

Hands On DarkBASIC Pro - Digital Skills

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FIG-31.5<br />

The MAKE OBJECT<br />

BOX Statement<br />

FIG-31.6<br />

MAKE OBJECT BOX objno<br />

, w h d<br />

In the diagram:<br />

objno is an integer value giving the ID to be assigned to the box<br />

being created. No other 3D object in the program can be<br />

assigned the same value.<br />

w is a real value giving the width (x-dimension) of the box.<br />

h is a real value giving the height (y-dimension) of the box.<br />

d is a real value giving the depth (z-dimension) of the<br />

box.<br />

For example, the line<br />

MAKE OBJECT BOX 2, 10, 3.7, 12<br />

would create a box with ID 2 which is 10 units wide, by 3.7 units high, by 12<br />

units deep.<br />

The MAKE OBJECT SPHERE Statement<br />

The MAKE OBJECT SPHERE Statement<br />

The MAKE OBJECT SPHERE statement creates a sphere of a specified diameter<br />

but offers extra options. The statement has the format shown in FIG-31.6.<br />

In the diagram:<br />

objno is an integer value giving the ID assigned to the<br />

sphere being created.<br />

diameter is a real number representing the diameter of the<br />

sphere.<br />

rows is an integer value specifying the number of lines<br />

of latitude making up the sphere.<br />

columns is an integer value specifying the number of lines<br />

of longitude making up the sphere.<br />

The statement<br />

MAKE OBJECT SPHERE 3,40.0<br />

, ,<br />

, ,<br />

,<br />

MAKE OBJECT SPHERE objno diameter<br />

rows<br />

columns<br />

would create a sphere with a diameter of 40 units and assign it the ID number 3.<br />

However, the sphere produced is constructed from a relatively small number of<br />

polygons and hence its curve is not particularly smooth. By using the rows and<br />

columns values, we can control the number of polygons used to construct the sphere<br />

and thereby produce a more realistic effect. For example, the line<br />

758 <strong>DarkBASIC</strong> <strong>Pro</strong>: 3D Primitives

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!