2024-06-01 06:38:04 +02:00
|
|
|
function Node_RM_Terrain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
|
|
|
name = "RM Terrain";
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(0, nodeValue_Dimension(self));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(1, nodeValue_Surface("Surface", self));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(2, nodeValue_Vec3("Position", self, [ 0, 0, 0 ]));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(3, nodeValue_Vec3("Rotation", self, [ 30, 45, 0 ]));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(4, nodeValue_Float("Scale", self, 1))
|
2024-06-01 06:38:04 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(5, nodeValue_Float("FOV", self, 30))
|
2024-06-01 06:38:04 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 90, 1 ] });
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(6, nodeValue_Vec2("View Range", self, [ 0, 6 ]));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(7, nodeValue_Float("BG Bleed", self, 1))
|
2024-06-01 06:38:04 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(8, nodeValue_Color("Ambient", self, c_white));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(9, nodeValue_Float("Height", self, 1))
|
2024-06-01 06:38:04 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 4, 0.01 ] });
|
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(10, nodeValue_Bool("Tile", self, true))
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(11, nodeValue_Surface("Texture", self));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(12, nodeValue_Color("Background", self, c_black));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(13, nodeValue_Surface("Reflection", self));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(14, nodeValue_Vec3("Sun Position", self, [ .5, 1, .5 ]));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(15, nodeValue_Float("Shadow", self, 0.2))
|
2024-06-01 06:38:04 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.slider);
|
|
|
|
|
2024-09-04 03:57:11 +02:00
|
|
|
newOutput(0, nodeValue_Output("Surface Out", self, VALUE_TYPE.surface, noone));
|
2024-06-01 06:38:04 +02:00
|
|
|
|
|
|
|
input_display_list = [ 0,
|
|
|
|
["Extrusion", false], 1, 9, 10,
|
|
|
|
["Textures", false], 11, 13,
|
|
|
|
["Transform", false], 2, 3, 4,
|
|
|
|
["Camera", false], 5, 6,
|
|
|
|
["Render", false], 12, 7, 8,
|
|
|
|
["Light", false], 14, 15,
|
|
|
|
];
|
|
|
|
|
|
|
|
temp_surface = [ 0, 0, 0, 0 ];
|
|
|
|
|
|
|
|
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 _surf = _data[1];
|
|
|
|
|
|
|
|
var _pos = _data[2];
|
|
|
|
var _rot = _data[3];
|
|
|
|
var _sca = _data[4];
|
|
|
|
|
|
|
|
var _fov = _data[5];
|
|
|
|
var _rng = _data[6];
|
|
|
|
|
|
|
|
var _dpi = _data[7];
|
|
|
|
var _amb = _data[8];
|
|
|
|
var _thk = _data[9];
|
|
|
|
var _tile = _data[10];
|
|
|
|
var _text = _data[11];
|
|
|
|
var _bgc = _data[12];
|
|
|
|
var _refl = _data[13];
|
|
|
|
var _sun = _data[14];
|
|
|
|
var _sha = _data[15];
|
|
|
|
|
|
|
|
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
|
|
|
|
|
|
|
|
for (var i = 0, n = array_length(temp_surface); i < n; i++)
|
|
|
|
temp_surface[i] = surface_verify(temp_surface[i], 8192, 8192);
|
|
|
|
|
|
|
|
var tx = 1024;
|
|
|
|
surface_set_shader(temp_surface[0]);
|
|
|
|
draw_surface_stretched_safe(_surf, tx * 0, tx * 0, tx, tx);
|
|
|
|
draw_surface_stretched_safe(_text, tx * 1, tx * 0, tx, tx);
|
|
|
|
draw_surface_stretched_safe(_refl, tx * 2, tx * 0, tx, tx);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
gpu_set_texfilter(true);
|
|
|
|
|
|
|
|
surface_set_shader(_outSurf, sh_rm_terrain);
|
|
|
|
|
|
|
|
for (var i = 0, n = array_length(temp_surface); i < n; i++)
|
|
|
|
shader_set_surface($"texture{i}", temp_surface[i]);
|
|
|
|
|
|
|
|
shader_set_i("shape", 1);
|
|
|
|
shader_set_i("tile", _tile);
|
|
|
|
shader_set_i("useTexture", is_surface(_text));
|
2024-06-24 13:49:54 +02:00
|
|
|
shader_set_3("position", _pos);
|
|
|
|
shader_set_3("rotation", _rot);
|
2024-06-01 06:38:04 +02:00
|
|
|
shader_set_f("objectScale", _sca);
|
|
|
|
shader_set_f("thickness", _thk);
|
|
|
|
|
|
|
|
shader_set_f("fov", _fov);
|
2024-06-24 13:49:54 +02:00
|
|
|
shader_set_2("viewRange", _rng);
|
2024-06-01 06:38:04 +02:00
|
|
|
shader_set_f("depthInt", _dpi);
|
|
|
|
|
2024-06-24 13:49:54 +02:00
|
|
|
shader_set_3("sunPosition", _sun);
|
2024-06-01 06:38:04 +02:00
|
|
|
shader_set_f("shadow", _sha);
|
|
|
|
|
|
|
|
shader_set_color("background", _bgc);
|
|
|
|
shader_set_color("ambient", _amb);
|
|
|
|
|
|
|
|
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
|
|
|
|
surface_reset_shader();
|
|
|
|
|
|
|
|
return _outSurf;
|
|
|
|
}
|
|
|
|
}
|