d3d_draw_cone

Draws a simple 3D cone.

Syntax:

d3d_draw_cone(x1, y1, z1, x2, y2, z2, tex, hrepeat, vrepeat, closed, steps)


Argument Description
x1 The initial x coordinate of the cone.
y1 The initial y coordinate of the cone.
z1 The initial z coordinate of the cone.
x2 The opposite x coordinate of the cone.
y2 The opposite y coordinate of the cone.
z2 The opposite z coordinate of the cone.
tex The id of the texture to use (-1 for no texture)
hrepeat Amount of horizontal repetitions for the texture.
vrepeat Amount of vertical repetitions for the texture.
closed Sets whether to close (true) the bottom of the cone or not (false).
steps How many steps are used to make the cone "round" (typically 24)


Returns: N/A


Description

This function draws a simple cone in 3D space. You set the first bounding corner coordinates (x1,y1,z1) and then the bounding coordinates for the opposite corner, with the final cone being drawn inside this defined rectangular area. You then specify a texture for the cone and the amount of times that you wish this texture to be repeated vertically and horizontally (1 for no repeat). If you do not wish to use a texture you can set this to -1 and the hrepeat and vrepeat values will be ignored. Finally you have to set whether you want to close the base of the cone or not (set to true for closed, and false for open) as well as how many "steps" should be used to make the cone look "round", with a value of 24 being the average.

Note:If the texture has to repeat over the cone, the source texture must be a power of 2 in size (eg: 8x8, 128x128, 256x256 etc...), otherwise you can use any size texture.


Example:

var tex;
tex = background_get_texture(bck_Wall);
d3d_draw_cone(20, 20, 20, 80, 40, 200, tex, 1, 1, true, 24);
d3d_draw_cone(200, 300, -10, 240, 340, 100, tex, 1, 1, false, 24);

The above code stores a texture in the variable "tex" and then uses it to texture two cones (one open and one closed) that have been drawn at different positions.


Back: 3D Drawing
Next: d3d_draw_ellipsoid
© Copyright YoYo Games Ltd. 2018 All Rights Reserved