Pixel-Composer/scripts/d3d_light_directional/d3d_light_directional.gml

46 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-08-14 19:22:04 +02:00
function __3dLightDirectional() : __3dLight() constructor {
2023-08-16 20:16:31 +02:00
vertex = [ [ 1, 0, 0, c_yellow, 0.8 ], [ 3, 0, 0, c_yellow, 0.8 ] ];
VF = global.VF_POS_COL;
2023-08-14 19:22:04 +02:00
render_type = pr_linelist;
2023-08-16 20:16:31 +02:00
VB = build();
2023-08-14 19:22:04 +02:00
2023-08-16 20:16:31 +02:00
color = c_white;
2023-08-14 19:22:04 +02:00
intensity = 1;
2023-08-16 20:16:31 +02:00
position.set(4, 0, 0);
2023-08-14 19:22:04 +02:00
static submitSel = function(params = {}) {
shader_set(sh_d3d_wireframe);
2023-08-16 20:16:31 +02:00
preSubmitVertex(params);
2023-08-14 19:22:04 +02:00
shader_reset();
}
2023-08-16 20:16:31 +02:00
static submitShader = function(params = {}) { params.addLightDirectional(self); }
static preSubmitVertex = function(params = {}) {
var _rot = new __rot3(0, 0, 0).lookAt(position, params.camera.position);
2023-08-14 19:22:04 +02:00
2023-08-16 20:16:31 +02:00
var rot = matrix_build(0, 0, 0,
_rot.x, _rot.y, _rot.z,
1, 1, 1);
var sca = matrix_build(0, 0, 0,
0, 0, 0,
0.6, 0.6, 0.6);
var pos = matrix_build(position.x, position.y, position.z,
0, 0, 0,
1, 1, 1);
2023-08-14 19:22:04 +02:00
2023-08-16 20:16:31 +02:00
matrix_stack_clear();
matrix_stack_push(pos);
matrix_stack_push(rot);
matrix_set(matrix_world, matrix_stack_top());
vertex_submit(VB_UI, pr_linestrip, -1);
matrix_stack_push(sca);
matrix_set(matrix_world, matrix_stack_top());
vertex_submit(VB_UI, pr_linestrip, -1);
matrix_stack_clear();
matrix_set(matrix_world, matrix_build_identity());
2023-08-14 19:22:04 +02:00
}
}