Pixel-Composer/scripts/node_3dsurf/node_3dsurf.gml

53 lines
1.4 KiB
Text
Raw Normal View History

2023-09-11 16:08:58 +02:00
function Node_3DSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "3DSurf";
cached_object = [];
object_class = dynaSurf_3d;
2024-08-18 09:13:41 +02:00
newInput(0, nodeValue_D3Scene("Scene", self, noone))
2023-09-11 16:08:58 +02:00
.setVisible(true, true);
2024-08-18 06:16:20 +02:00
newInput(1, nodeValue_Vec2("Base Dimension", self, DEF_SURF));
2023-09-11 16:08:58 +02:00
2024-08-18 09:13:41 +02:00
newInput(2, nodeValue_Float("Vertical Angle", self, 45 ))
2024-03-24 04:58:08 +01:00
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] });
2023-09-11 16:08:58 +02:00
2024-08-18 06:16:20 +02:00
newInput(3, nodeValue_Float("Distance", self, 4 ));
2023-09-11 16:08:58 +02:00
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("3DSurf", self, VALUE_TYPE.dynaSurface, noone));
2023-09-11 16:08:58 +02:00
input_display_list = [ 0,
["Camera", false], 1, 2, 3,
];
static getObject = function(index, class = object_class) { #region
2024-03-31 05:36:11 +02:00
var _obj = array_safe_get_fast(cached_object, index, noone);
2023-09-11 16:08:58 +02:00
if(_obj == noone) {
_obj = new class();
} else if(!is_instanceof(_obj, class)) {
_obj.destroy();
_obj = new class();
}
cached_object[index] = _obj;
return _obj;
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _sobj = _data[0];
var _dim = _data[1];
var _vang = _data[2];
var _dist = _data[3];
if(_sobj == noone) return noone;
var _scn = getObject(_array_index);
_scn.object = _sobj;
_scn.w = _dim[0];
_scn.h = _dim[1];
_scn.camera_ay = _vang;
_scn.camera.focus_dist = _dist;
return _scn;
}
}