minecraft-in-24h-jam/objects/obj_skybox/Create_0.gml

90 lines
3.3 KiB
Plaintext

var s = 1200;
var color = c_white;
//note: inverted normals so light shines on inside
#region bottom face
b_tex = spr_skybox_bottom;
b_face = vertex_create_buffer();
vertex_begin( b_face, global.vertex_format );
vertex_add_point( b_face, -s, -s, -s, 0, 0, 1, 0, 0, color, 1);
vertex_add_point( b_face, s, -s, -s, 0, 0, 1, 1, 0, color, 1);
vertex_add_point( b_face, s, s, -s, 0, 0, 1, 1, 1, color, 1);
vertex_add_point( b_face, s, s, -s, 0, 0, 1, 1, 1, color, 1);
vertex_add_point( b_face, -s, s, -s, 0, 0, 1, 0, 1, color, 1);
vertex_add_point( b_face, -s, -s, -s, 0, 0, 1, 0, 0, color, 1);
vertex_end( b_face );
#endregion
#region top face
t_tex = spr_skybox_top;
t_face = vertex_create_buffer();
vertex_begin( t_face, global.vertex_format );
vertex_add_point( t_face, -s, -s, s, 0, 0, -1, 0, 0, color, 1);
vertex_add_point( t_face, s, -s, s, 0, 0, -1, 1, 0, color, 1);
vertex_add_point( t_face, s, s, s, 0, 0, -1, 1, 1, color, 1);
vertex_add_point( t_face, s, s, s, 0, 0, -1, 1, 1, color, 1);
vertex_add_point( t_face, -s, s, s, 0, 0, -1, 0, 1, color, 1);
vertex_add_point( t_face, -s, -s, s, 0, 0, -1, 0, 0, color, 1);
vertex_end( t_face );
#endregion
#region north face
n_tex = spr_skybox_side;
n_face = vertex_create_buffer();
vertex_begin( n_face, global.vertex_format );
vertex_add_point( n_face, -s, -s, -s, 0, 1, 0, 1, 1, color, 1);
vertex_add_point( n_face, s, -s, -s, 0, 1, 0, 0, 1, color, 1);
vertex_add_point( n_face, s, -s, s, 0, 1, 0, 0, 0, color, 1);
vertex_add_point( n_face, s, -s, s, 0, 1, 0, 0, 0, color, 1);
vertex_add_point( n_face, -s, -s, s, 0, 1, 0, 1, 0, color, 1);
vertex_add_point( n_face, -s, -s, -s, 0, 1, 0, 1, 1, color, 1);
vertex_end( n_face );
#endregion
#region south face
s_tex = spr_skybox_side;
s_face = vertex_create_buffer();
vertex_begin( s_face, global.vertex_format );
vertex_add_point( s_face, -s, s, -s, 0, -1, 0, 1, 1, color, 1);
vertex_add_point( s_face, s, s, -s, 0, -1, 0, 0, 1, color, 1);
vertex_add_point( s_face, s, s, s, 0, -1, 0, 0, 0, color, 1);
vertex_add_point( s_face, s, s, s, 0, -1, 0, 0, 0, color, 1);
vertex_add_point( s_face, -s, s, s, 0, -1, 0, 1, 0, color, 1);
vertex_add_point( s_face, -s, s, -s, 0, -1, 0, 1, 1, color, 1);
vertex_end( s_face );
#endregion
#region west face
w_tex = spr_skybox_side;
w_face = vertex_create_buffer();
vertex_begin( w_face, global.vertex_format );
vertex_add_point( w_face, -s, -s, -s, 1, 0, 0, 1, 1, color, 1);
vertex_add_point( w_face, -s, s, -s, 1, 0, 0, 0, 1, color, 1);
vertex_add_point( w_face, -s, s, s, 1, 0, 0, 0, 0, color, 1);
vertex_add_point( w_face, -s, s, s, 1, 0, 0, 0, 0, color, 1);
vertex_add_point( w_face, -s, -s, s, 1, 0, 0, 1, 0, color, 1);
vertex_add_point( w_face, -s, -s, -s, 1, 0, 0, 1, 1, color, 1);
vertex_end( w_face );
#endregion
#region east face
e_tex = spr_skybox_side;
e_face = vertex_create_buffer();
vertex_begin( e_face, global.vertex_format );
vertex_add_point( e_face, s, -s, -s, -1, 0, 0, 1, 1, color, 1);
vertex_add_point( e_face, s, s, -s, -1, 0, 0, 0, 1, color, 1);
vertex_add_point( e_face, s, s, s, -1, 0, 0, 0, 0, color, 1);
vertex_add_point( e_face, s, s, s, -1, 0, 0, 0, 0, color, 1);
vertex_add_point( e_face, s, -s, s, -1, 0, 0, 1, 0, color, 1);
vertex_add_point( e_face, s, -s, -s, -1, 0, 0, 1, 1, color, 1);
vertex_end( e_face );
#endregion