Pixel-Composer/scripts/node_rm_cloud/node_rm_cloud.gml

101 lines
2.7 KiB
Text
Raw Normal View History

2024-07-31 12:24:42 +02:00
function Node_RM_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "RM CLoud";
2024-08-18 06:16:20 +02:00
newInput(0, nodeValue_Dimension(self));
2024-07-31 12:24:42 +02:00
2024-08-18 06:16:20 +02:00
newInput(1, nodeValue_Vec3("Position", self, [ 0, 0, 0 ]));
2024-07-31 12:24:42 +02:00
2024-08-18 06:16:20 +02:00
newInput(2, nodeValue_Vec3("Rotation", self, [ 0, 0, 0 ]));
2024-07-31 12:24:42 +02:00
2024-08-18 09:13:41 +02:00
newInput(3, nodeValue_Float("Scale", self, 1))
2024-07-31 12:24:42 +02:00
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
2024-08-18 09:13:41 +02:00
newInput(4, nodeValue_Float("FOV", self, 30))
2024-07-31 12:24:42 +02:00
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 1 ] });
2024-08-18 06:16:20 +02:00
newInput(5, nodeValue_Vec2("View Range", self, [ 0, 6 ]));
2024-07-31 12:24:42 +02:00
2024-08-18 09:13:41 +02:00
newInput(6, nodeValue_Float("Density", self, 0.5))
2024-07-31 12:24:42 +02:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-18 06:16:20 +02:00
newInput(7, nodeValue_Int("Detail", self, 8));
2024-07-31 12:24:42 +02:00
2024-08-18 09:13:41 +02:00
newInput(8, nodeValue_Float("Threshold", self, 0.4))
2024-07-31 12:24:42 +02:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-18 06:16:20 +02:00
newInput(9, nodeValue_Float("Detail Scaling", self, 2.));
2024-07-31 12:24:42 +02:00
2024-08-18 09:13:41 +02:00
newInput(10, nodeValue_Float("Detail Attenuation", self, 0.5))
2024-07-31 12:24:42 +02:00
.setDisplay(VALUE_DISPLAY.slider);
2024-08-18 06:16:20 +02:00
newInput(11, nodeValue_Enum_Scroll("Shape", self, 0, [ "Volume", "Plane" ]));
2024-08-02 04:57:52 +02:00
2024-08-18 09:13:41 +02:00
newInput(12, nodeValue_Bool("Use Fog", self, 0))
2024-08-02 04:57:52 +02:00
2024-08-18 09:13:41 +02:00
newInput(13, nodeValue_Gradient("Colors", self, new gradientObject([ cola(c_black), cola(c_white) ])))
2024-08-02 04:57:52 +02:00
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Surface Out", self, VALUE_TYPE.surface, noone);
2024-07-31 12:24:42 +02:00
input_display_list = [ 0,
2024-08-02 04:57:52 +02:00
["Transform", false], 1, 2, 3,
["Camera", false], 4, 5,
["Cloud", false], 11, 6, 8,
["Noise", false], 7, 9, 10,
["Render", false], 13, 12,
2024-07-31 12:24:42 +02:00
];
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {}
static step = function() {
}
static processData = function(_outSurf, _data, _output_index, _array_index = 0) {
var _dim = _data[0];
var _pos = _data[1];
var _rot = _data[2];
var _sca = _data[3];
var _fov = _data[4];
var _rng = _data[5];
var _type = _data[11];
var _dens = _data[ 6];
var _thrs = _data[ 8];
var _itrr = _data[ 7];
var _dsca = _data[ 9];
2024-07-31 12:24:42 +02:00
var _datt = _data[10];
2024-08-02 04:57:52 +02:00
var _fogu = _data[12];
var _colr = _data[13];
2024-07-31 12:24:42 +02:00
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
surface_set_shader(_outSurf, sh_rm_cloud);
shader_set_3("position", _pos);
shader_set_3("rotation", _rot);
shader_set_f("objectScale", _sca * 4);
shader_set_f("fov", _fov);
shader_set_2("viewRange", _rng);
shader_set_i("type", _type);
2024-07-31 12:24:42 +02:00
shader_set_f("density", _dens);
shader_set_f("threshold", _thrs);
2024-08-02 04:57:52 +02:00
shader_set_i("fogUse", _fogu);
shader_set_i("iteration", _itrr);
2024-07-31 12:24:42 +02:00
shader_set_f("detailScale", _dsca);
shader_set_f("detailAtten", _datt);
2024-08-02 04:57:52 +02:00
_colr.shader_submit();
2024-07-31 12:24:42 +02:00
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
surface_reset_shader();
return _outSurf;
}
}