Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_d3d_model_cylinder

(view raw script w/o annotations or w/e)
1
function d3d_model_cylinder(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9, argument10) //gml_Script_d3d_model_cylinder
2
{
3
    var __ind = argument0
4
    var __x1 = argument1
5
    var __y1 = argument2
6
    var __z1 = argument3
7
    var __x2 = argument4
8
    var __y2 = argument5
9
    var __z2 = 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
    if (__closed == true)
31
    {
32
        d3d_model_primitive_begin(__ind, 6)
33
        d3d_model_vertex_normal_texture(__ind, __mx, __my, __z2, 0, 0, 1, 0, __vrepeat)
34
        for (__i = 0; __i <= __steps; __i++)
35
            d3d_model_vertex_normal_texture(__ind, (__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z2, 0, 0, 1, 0, __vrepeat)
36
        d3d_model_primitive_end(__ind)
37
    }
38
    d3d_model_primitive_begin(__ind, 5)
39
    for (__i = 0; __i <= __steps; __i++)
40
    {
41
        d3d_model_vertex_normal_texture(__ind, (__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z2, __cc[__i], __ss[__i], 0, (__hrepeat * __i / __steps), __vrepeat)
42
        d3d_model_vertex_normal_texture(__ind, (__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z1, __cc[__i], __ss[__i], 0, (__hrepeat * __i / __steps), 0)
43
    }
44
    d3d_model_primitive_end(__ind)
45
    if (__closed == true)
46
    {
47
        d3d_model_primitive_begin(__ind, 6)
48
        d3d_model_vertex_normal_texture(__ind, __mx, __my, __z1, 0, 0, -1, 0, 0)
49
        for (__i = __steps; __i >= 0; __i--)
50
            d3d_model_vertex_normal_texture(__ind, (__mx + __cc[__i] * __rx), (__my + __ss[__i] * __ry), __z1, 0, 0, -1, 0, 0)
51
        d3d_model_primitive_end(__ind)
52
    }
53
}