1 |
function d3d_model_ellipsoid(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9) //gml_Script_d3d_model_ellipsoid |
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 __steps = argument9 |
13 |
if (__steps < 3) |
14 |
__steps = 3 |
15 |
if (__steps > 128) |
16 |
__steps = 128 |
17 |
__cc[__steps] = 0 |
18 |
__ss[__steps] = 0 |
19 |
for (var __i = 0; __i <= __steps; __i++) |
20 |
{ |
21 |
var __rad = __i * 2 * pi / __steps |
22 |
__cc[__i] = cos(__rad) |
23 |
__ss[__i] = sin(__rad) |
24 |
} |
25 |
var __mx = (__x2 + __x1) / 2 |
26 |
var __my = (__y2 + __y1) / 2 |
27 |
var __mz = (__z2 + __z1) / 2 |
28 |
var __rx = (__x2 - __x1) / 2 |
29 |
var __ry = (__y2 - __y1) / 2 |
30 |
var __rz = (__z2 - __z1) / 2 |
31 |
var __rows = (__steps + 1) / 2 |
32 |
for (var __j = 0; __j <= (__rows - 1); __j++) |
33 |
{ |
34 |
var __row1rad = __j * pi / __rows |
35 |
var __row2rad = (__j + 1) * pi / __rows |
36 |
var __rh1 = cos(__row1rad) |
37 |
var __rd1 = sin(__row1rad) |
38 |
var __rh2 = cos(__row2rad) |
39 |
var __rd2 = sin(__row2rad) |
40 |
d3d_model_primitive_begin(__ind, 5) |
41 |
for (__i = 0; __i <= __steps; __i++) |
42 |
{ |
43 |
d3d_model_vertex_normal_texture(__ind, (__mx + __rx * __rd1 * __cc[__i]), (__my + __ry * __rd1 * __ss[__i]), (__mz + __rz * __rh1), (__rd1 * __cc[__i]), (__rd1 * __ss[__i]), __rh1, (__hrepeat * __i / __steps), (__j * __vrepeat / __rows)) |
44 |
d3d_model_vertex_normal_texture(__ind, (__mx + __rx * __rd2 * __cc[__i]), (__my + __ry * __rd2 * __ss[__i]), (__mz + __rz * __rh2), (__rd2 * __cc[__i]), (__rd2 * __ss[__i]), __rh2, (__hrepeat * __i / __steps), ((__j + 1) * __vrepeat / __rows)) |
45 |
} |
46 |
d3d_model_primitive_end(__ind) |
47 |
} |
48 |
} |