1 |
function d3d_draw_cylinder(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9, argument10) //gml_Script_d3d_draw_cylinder |
2 |
{ |
3 |
var __x1 = argument0 |
4 |
var __y1 = argument1 |
5 |
var __z1 = argument2 |
6 |
var __x2 = argument3 |
7 |
var __y2 = argument4 |
8 |
var __z2 = argument5 |
9 |
var __tex = argument6 |
10 |
var __hrepeat = argument7 |
11 |
var __vrepeat = argument8 |
12 |
var __closed = argument9 |
13 |
var __steps = argument10 |
14 |
if (__steps < 3) |
15 |
__steps = 3 |
16 |
if (__steps > 128) |
17 |
__steps = 128 |
18 |
__cc[__steps] = 0 |
19 |
__ss[__steps] = 0 |
20 |
for (var __i = 0; __i <= __steps; __i++) |
21 |
{ |
22 |
var __rad = __i * 2 * pi / __steps |
23 |
__cc[__i] = cos(__rad) |
24 |
__ss[__i] = sin(__rad) |
25 |
} |
26 |
var __mx = (__x2 + __x1) / 2 |
27 |
var __my = (__y2 + __y1) / 2 |
28 |
var __rx = (__x2 - __x1) / 2 |
29 |
var __ry = (__y2 - __y1) / 2 |
30 |
var __oldrep = gpu_get_texrepeat() |
31 |
gpu_set_texrepeat(true) |
32 |
if (__closed == true) |
33 |
{ |
34 |
d3d_primitive_begin_texture(6, __tex) |
35 |
d3d_vertex_normal_texture(__mx, __my, __z2, 0, 0, 1, 0, __vrepeat) |
36 |
for (__i = 0; __i <= __steps; __i++) |
37 |
d3d_vertex_normal_texture((__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z2, 0, 0, 1, 0, __vrepeat) |
38 |
d3d_primitive_end() |
39 |
} |
40 |
d3d_primitive_begin_texture(5, __tex) |
41 |
for (__i = 0; __i <= __steps; __i++) |
42 |
{ |
43 |
d3d_vertex_normal_texture((__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z2, __cc[__i], __ss[__i], 0, (__hrepeat * __i / __steps), __vrepeat) |
44 |
d3d_vertex_normal_texture((__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z1, __cc[__i], __ss[__i], 0, (__hrepeat * __i / __steps), 0) |
45 |
} |
46 |
d3d_primitive_end() |
47 |
if (__closed == true) |
48 |
{ |
49 |
d3d_primitive_begin_texture(6, __tex) |
50 |
d3d_vertex_normal_texture(__mx, __my, __z1, 0, 0, -1, 0, 0) |
51 |
for (__i = __steps; __i >= 0; __i--) |
52 |
d3d_vertex_normal_texture((__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z1, 0, 0, -1, 0, 0) |
53 |
d3d_primitive_end() |
54 |
} |
55 |
gpu_set_texrepeat(__oldrep) |
56 |
} |