New 3D Path Shape node.

This commit is contained in:
Tanasart 2025-02-10 14:42:01 +07:00
parent e516c37f4e
commit 5b0f6382b2
31 changed files with 635 additions and 33 deletions

View file

@ -1013,33 +1013,34 @@
{"name":"node_particle","order":10,"path":"scripts/node_particle/node_particle.yy",},
{"name":"node_path_3d_camera","order":2,"path":"scripts/node_path_3d_camera/node_path_3d_camera.yy",},
{"name":"node_path_3d","order":1,"path":"scripts/node_path_3d/node_path_3d.yy",},
{"name":"node_path_anchor","order":17,"path":"scripts/node_path_anchor/node_path_anchor.yy",},
{"name":"node_path_array","order":15,"path":"scripts/node_path_array/node_path_array.yy",},
{"name":"node_path_bake","order":20,"path":"scripts/node_path_bake/node_path_bake.yy",},
{"name":"node_path_blend","order":6,"path":"scripts/node_path_blend/node_path_blend.yy",},
{"name":"node_path_bridge","order":21,"path":"scripts/node_path_bridge/node_path_bridge.yy",},
{"name":"node_path_builder","order":13,"path":"scripts/node_path_builder/node_path_builder.yy",},
{"name":"node_path_fill","order":7,"path":"scripts/node_path_fill/node_path_fill.yy",},
{"name":"node_path_from_mask","order":18,"path":"scripts/node_path_from_mask/node_path_from_mask.yy",},
{"name":"node_path_l_system","order":14,"path":"scripts/node_path_l_system/node_path_l_system.yy",},
{"name":"node_path_map_area","order":5,"path":"scripts/node_path_map_area/node_path_map_area.yy",},
{"name":"node_path_map","order":22,"path":"scripts/node_path_map/node_path_map.yy",},
{"name":"node_path_morph","order":23,"path":"scripts/node_path_morph/node_path_morph.yy",},
{"name":"node_path_plot","order":16,"path":"scripts/node_path_plot/node_path_plot.yy",},
{"name":"node_path_anchor","order":18,"path":"scripts/node_path_anchor/node_path_anchor.yy",},
{"name":"node_path_array","order":16,"path":"scripts/node_path_array/node_path_array.yy",},
{"name":"node_path_bake","order":21,"path":"scripts/node_path_bake/node_path_bake.yy",},
{"name":"node_path_blend","order":7,"path":"scripts/node_path_blend/node_path_blend.yy",},
{"name":"node_path_bridge","order":22,"path":"scripts/node_path_bridge/node_path_bridge.yy",},
{"name":"node_path_builder","order":14,"path":"scripts/node_path_builder/node_path_builder.yy",},
{"name":"node_path_fill","order":8,"path":"scripts/node_path_fill/node_path_fill.yy",},
{"name":"node_path_from_mask","order":19,"path":"scripts/node_path_from_mask/node_path_from_mask.yy",},
{"name":"node_path_l_system","order":15,"path":"scripts/node_path_l_system/node_path_l_system.yy",},
{"name":"node_path_map_area","order":6,"path":"scripts/node_path_map_area/node_path_map_area.yy",},
{"name":"node_path_map","order":23,"path":"scripts/node_path_map/node_path_map.yy",},
{"name":"node_path_morph","order":24,"path":"scripts/node_path_morph/node_path_morph.yy",},
{"name":"node_path_plot","order":17,"path":"scripts/node_path_plot/node_path_plot.yy",},
{"name":"node_path_profile","order":15,"path":"scripts/node_path_profile/node_path_profile.yy",},
{"name":"node_path_repeat","order":27,"path":"scripts/node_path_repeat/node_path_repeat.yy",},
{"name":"node_path_reverse","order":12,"path":"scripts/node_path_reverse/node_path_reverse.yy",},
{"name":"node_path_sample","order":8,"path":"scripts/node_path_sample/node_path_sample.yy",},
{"name":"node_path_scatter","order":26,"path":"scripts/node_path_scatter/node_path_scatter.yy",},
{"name":"node_path_sdf","order":28,"path":"scripts/node_path_sdf/node_path_sdf.yy",},
{"name":"node_path_repeat","order":28,"path":"scripts/node_path_repeat/node_path_repeat.yy",},
{"name":"node_path_reverse","order":13,"path":"scripts/node_path_reverse/node_path_reverse.yy",},
{"name":"node_path_sample","order":9,"path":"scripts/node_path_sample/node_path_sample.yy",},
{"name":"node_path_scatter","order":27,"path":"scripts/node_path_scatter/node_path_scatter.yy",},
{"name":"node_path_sdf","order":29,"path":"scripts/node_path_sdf/node_path_sdf.yy",},
{"name":"node_path_separate_folder","order":12,"path":"scripts/node_path_separate_folder/node_path_separate_folder.yy",},
{"name":"node_path_shape_3d","order":4,"path":"scripts/node_path_shape_3d/node_path_shape_3d.yy",},
{"name":"node_path_shape","order":3,"path":"scripts/node_path_shape/node_path_shape.yy",},
{"name":"node_path_shift","order":9,"path":"scripts/node_path_shift/node_path_shift.yy",},
{"name":"node_path_smooth","order":25,"path":"scripts/node_path_smooth/node_path_smooth.yy",},
{"name":"node_path_transform","order":4,"path":"scripts/node_path_transform/node_path_transform.yy",},
{"name":"node_path_trim","order":10,"path":"scripts/node_path_trim/node_path_trim.yy",},
{"name":"node_path_wave","order":11,"path":"scripts/node_path_wave/node_path_wave.yy",},
{"name":"node_path_weight_adjust","order":31,"path":"scripts/node_path_weight_adjust/node_path_weight_adjust.yy",},
{"name":"node_path_shift","order":10,"path":"scripts/node_path_shift/node_path_shift.yy",},
{"name":"node_path_smooth","order":26,"path":"scripts/node_path_smooth/node_path_smooth.yy",},
{"name":"node_path_transform","order":5,"path":"scripts/node_path_transform/node_path_transform.yy",},
{"name":"node_path_trim","order":11,"path":"scripts/node_path_trim/node_path_trim.yy",},
{"name":"node_path_wave","order":12,"path":"scripts/node_path_wave/node_path_wave.yy",},
{"name":"node_path_weight_adjust","order":32,"path":"scripts/node_path_weight_adjust/node_path_weight_adjust.yy",},
{"name":"node_pb_box_contract","order":8,"path":"scripts/node_pb_box_contract/node_pb_box_contract.yy",},
{"name":"node_pb_box_divide_grid","order":7,"path":"scripts/node_pb_box_divide_grid/node_pb_box_divide_grid.yy",},
{"name":"node_pb_box_divide","order":5,"path":"scripts/node_pb_box_divide/node_pb_box_divide.yy",},
@ -1129,7 +1130,7 @@
{"name":"node_scale","order":12,"path":"scripts/node_scale/node_scale.yy",},
{"name":"node_scatter_points","order":7,"path":"scripts/node_scatter_points/node_scatter_points.yy",},
{"name":"node_scatter","order":13,"path":"scripts/node_scatter/node_scatter.yy",},
{"name":"node_segment_filter","order":30,"path":"scripts/node_segment_filter/node_segment_filter.yy",},
{"name":"node_segment_filter","order":31,"path":"scripts/node_segment_filter/node_segment_filter.yy",},
{"name":"node_separate_color","order":42,"path":"scripts/node_separate_color/node_separate_color.yy",},
{"name":"node_sequence_anim","order":6,"path":"scripts/node_sequence_anim/node_sequence_anim.yy",},
{"name":"node_shadow_cast","order":28,"path":"scripts/node_shadow_cast/node_shadow_cast.yy",},
@ -1669,7 +1670,7 @@
{"name":"sh_grid","order":3,"path":"shaders/sh_grid/sh_grid.yy",},
{"name":"sh_herringbone_tile","order":15,"path":"shaders/sh_herringbone_tile/sh_herringbone_tile.yy",},
{"name":"sh_high_pass","order":32,"path":"shaders/sh_high_pass/sh_high_pass.yy",},
{"name":"sh_image_trace","order":19,"path":"shaders/sh_image_trace/sh_image_trace.yy",},
{"name":"sh_image_trace","order":20,"path":"shaders/sh_image_trace/sh_image_trace.yy",},
{"name":"sh_interlaced","order":51,"path":"shaders/sh_interlaced/sh_interlaced.yy",},
{"name":"sh_interpret_number","order":9,"path":"shaders/sh_interpret_number/sh_interpret_number.yy",},
{"name":"sh_invert","order":17,"path":"shaders/sh_invert/sh_invert.yy",},
@ -1746,8 +1747,8 @@
{"name":"sh_palette_replace","order":9,"path":"shaders/sh_palette_replace/sh_palette_replace.yy",},
{"name":"sh_palette_shift","order":31,"path":"shaders/sh_palette_shift/sh_palette_shift.yy",},
{"name":"sh_path_fill_profile","order":16,"path":"shaders/sh_path_fill_profile/sh_path_fill_profile.yy",},
{"name":"sh_path_morph","order":24,"path":"shaders/sh_path_morph/sh_path_morph.yy",},
{"name":"sh_path_sdf","order":29,"path":"shaders/sh_path_sdf/sh_path_sdf.yy",},
{"name":"sh_path_morph","order":25,"path":"shaders/sh_path_morph/sh_path_morph.yy",},
{"name":"sh_path_sdf","order":30,"path":"shaders/sh_path_sdf/sh_path_sdf.yy",},
{"name":"sh_pb_blob","order":1,"path":"shaders/sh_pb_blob/sh_pb_blob.yy",},
{"name":"sh_pb_brick","order":9,"path":"shaders/sh_pb_brick/sh_pb_brick.yy",},
{"name":"sh_pb_draw_mask","order":8,"path":"shaders/sh_pb_draw_mask/sh_pb_draw_mask.yy",},
@ -2231,6 +2232,7 @@
{"name":"s_node_particle_effector","order":13,"path":"sprites/s_node_particle_effector/s_node_particle_effector.yy",},
{"name":"s_node_particle","order":12,"path":"sprites/s_node_particle/s_node_particle.yy",},
{"name":"s_node_path_3d_camera","order":28,"path":"sprites/s_node_path_3d_camera/s_node_path_3d_camera.yy",},
{"name":"s_node_path_3d_shape","order":36,"path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},
{"name":"s_node_path_3d","order":20,"path":"sprites/s_node_path_3d/s_node_path_3d.yy",},
{"name":"s_node_path_anchor","order":1,"path":"sprites/s_node_path_anchor/s_node_path_anchor.yy",},
{"name":"s_node_path_array","order":2,"path":"sprites/s_node_path_array/s_node_path_array.yy",},
@ -2252,6 +2254,7 @@
{"name":"s_node_path_scatter","order":19,"path":"sprites/s_node_path_scatter/s_node_path_scatter.yy",},
{"name":"s_node_path_sdf","order":26,"path":"sprites/s_node_path_sdf/s_node_path_sdf.yy",},
{"name":"s_node_path_separate_folder","order":14,"path":"sprites/s_node_path_separate_folder/s_node_path_separate_folder.yy",},
{"name":"s_node_path_shape_3d","order":29,"path":"sprites/s_node_path_shape_3d/s_node_path_shape_3d.yy",},
{"name":"s_node_path_shape","order":22,"path":"sprites/s_node_path_shape/s_node_path_shape.yy",},
{"name":"s_node_path_shift","order":14,"path":"sprites/s_node_path_shift/s_node_path_shift.yy",},
{"name":"s_node_path_smooth","order":15,"path":"sprites/s_node_path_smooth/s_node_path_smooth.yy",},

View file

@ -1182,6 +1182,7 @@
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_Scatter","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_SDF","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_Separate_Folder","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_Shape_3D","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_Shape","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_Shift","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Path/Node_Path_Smooth","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -2235,6 +2236,7 @@
{"id":{"name":"node_path_scatter","path":"scripts/node_path_scatter/node_path_scatter.yy",},},
{"id":{"name":"node_path_sdf","path":"scripts/node_path_sdf/node_path_sdf.yy",},},
{"id":{"name":"node_path_separate_folder","path":"scripts/node_path_separate_folder/node_path_separate_folder.yy",},},
{"id":{"name":"node_path_shape_3d","path":"scripts/node_path_shape_3d/node_path_shape_3d.yy",},},
{"id":{"name":"node_path_shape","path":"scripts/node_path_shape/node_path_shape.yy",},},
{"id":{"name":"node_path_shift","path":"scripts/node_path_shift/node_path_shift.yy",},},
{"id":{"name":"node_path_smooth","path":"scripts/node_path_smooth/node_path_smooth.yy",},},
@ -3581,6 +3583,7 @@
{"id":{"name":"s_node_particle_effector","path":"sprites/s_node_particle_effector/s_node_particle_effector.yy",},},
{"id":{"name":"s_node_particle","path":"sprites/s_node_particle/s_node_particle.yy",},},
{"id":{"name":"s_node_path_3d_camera","path":"sprites/s_node_path_3d_camera/s_node_path_3d_camera.yy",},},
{"id":{"name":"s_node_path_3d_shape","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},},
{"id":{"name":"s_node_path_3d","path":"sprites/s_node_path_3d/s_node_path_3d.yy",},},
{"id":{"name":"s_node_path_anchor","path":"sprites/s_node_path_anchor/s_node_path_anchor.yy",},},
{"id":{"name":"s_node_path_array","path":"sprites/s_node_path_array/s_node_path_array.yy",},},
@ -3602,6 +3605,7 @@
{"id":{"name":"s_node_path_scatter","path":"sprites/s_node_path_scatter/s_node_path_scatter.yy",},},
{"id":{"name":"s_node_path_sdf","path":"sprites/s_node_path_sdf/s_node_path_sdf.yy",},},
{"id":{"name":"s_node_path_separate_folder","path":"sprites/s_node_path_separate_folder/s_node_path_separate_folder.yy",},},
{"id":{"name":"s_node_path_shape_3d","path":"sprites/s_node_path_shape_3d/s_node_path_shape_3d.yy",},},
{"id":{"name":"s_node_path_shape","path":"sprites/s_node_path_shape/s_node_path_shape.yy",},},
{"id":{"name":"s_node_path_shift","path":"sprites/s_node_path_shift/s_node_path_shift.yy",},},
{"id":{"name":"s_node_path_smooth","path":"sprites/s_node_path_smooth/s_node_path_smooth.yy",},},

Binary file not shown.

View file

@ -0,0 +1,10 @@
{
"name":"3D Path Shape",
"baseNode":"Node_Path_Shape_3D",
"tooltip":"Create 3D path in predefined shape.",
"spr":"s_node_path_shape_3d",
"pxc_version":118090,
"io":[
"pathnode"
],
}

View file

@ -1,5 +1,5 @@
{
"name":"Bitmap Font",
"name":"Surfaces to Font",
"tooltip":"Create font from surface array.",
"spr":"s_node_font_bitmap",
"baseNode":"Node_Font_Bitmap",

View file

@ -770,6 +770,7 @@
"Node_Path_From_Mask",
"Node_Path_Plot",
"Node_Path_3D",
"Node_Path_Shape_3D",
"Node_Path_3D_Camera",
"Node_Path_Anchor",
{ "label": "/Modifiers" },

Binary file not shown.

View file

@ -1,5 +1,5 @@
function Node_Font_Bitmap(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Bitmap Font";
name = "Surfaces to Font";
newInput(0, nodeValue_Surface("Font Surfaces", self, []))
.setArrayDepth(1);

View file

@ -734,8 +734,8 @@ function Node_Path_3D(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_sprite_bbox_uniform(s_node_path_3d, 0, bbox);
}
static getPreviewObject = function() { return noone; }
static getPreviewObjects = function() { return []; }
static getPreviewObjectOutline = function() { return []; }
static getPreviewObject = function() /*=>*/ {return noone};
static getPreviewObjects = function() /*=>*/ {return []};
static getPreviewObjectOutline = function() /*=>*/ {return []};
}

View file

@ -0,0 +1,362 @@
function Node_Path_Shape_3D(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "3D Path Shape";
is_3D = NODE_3D.polygon;
setDimension(96, 48);
newInput(0, nodeValue_Vec3("Position", self, [ 0, 0, 0 ]));
newInput(1, nodeValue_Vec3("Half Size", self, [ .5, .5, .5 ]));
shapeScroll = [
new scrollItem("Rectangle", s_node_path_3d_shape, 0),
new scrollItem("Ellipse", s_node_path_3d_shape, 1),
new scrollItem("Regular Polygon", s_node_path_3d_shape, 2),
-1,
new scrollItem("Star", s_node_path_3d_shape, 3),
-1,
new scrollItem("Spring", s_node_path_3d_shape, 4),
new scrollItem("Spring Sphere", s_node_path_3d_shape, 5),
new scrollItem("Spiral", s_node_path_3d_shape, 6),
];
newInput(2, nodeValue_Enum_Scroll("Shape", self, 0, { data: shapeScroll, horizontal: true, text_pad: ui(8) }));
newInput(3, nodeValue_Enum_Button("Up Axis", self, 2, [ "X", "Y", "Z" ]));
newInput(4, nodeValue_Rotation("Rotation", self, 0));
newInput(5, nodeValue_Int("Sides", self, 6));
newInput(6, nodeValue_Float("Revolution", self, 4));
newInput(7, nodeValue_Float("Pitch", self, .2));
newInput(8, nodeValue_Float("Inner Radius", self, .5))
.setDisplay(VALUE_DISPLAY.slider);
newOutput(0, nodeValue_Output("Path data", self, VALUE_TYPE.pathnode, self));
input_display_list = [
["Transform", false], 0, 1, 3, 4,
["Shape", false], 2, 5, 6, 7, 8,
];
points = [];
lengths = [];
lengthAccs = [];
lengthTotal = 0;
boundary = new BoundingBox();
cached_pos = ds_map_create();
loop = true;
shape = 0;
posx = 0; posy = 0; posz = 0;
scax = 1; scay = 1; scaz = 1;
preview_surf = noone;
static getLineCount = function() /*=>*/ {return 1};
static getSegmentCount = function() /*=>*/ {return array_length(lengths)};
static getBoundary = function() /*=>*/ {return boundary};
static getLength = function() /*=>*/ {return lengthTotal};
static getAccuLength = function() /*=>*/ {return lengthAccs};
static getPointRatio = function(_rat, _ind = 0, out = undefined) {
out ??= new __vec3P();
_rat = frac(_rat);
switch(shapeScroll[shape].name) {
default : return getPointDistance(_rat * lengthTotal, _ind, out);
}
return out;
}
static getPointDistance = function(_dist, _ind = 0, out = undefined) {
out ??= new __vec3P();
_dist = safe_mod(_dist, lengthTotal);
var _d = _dist, l;
var np = array_length(points);
for( var i = 0, n = array_length(lengths); i < n; i++ ) {
l = lengths[i];
if(_d > l) { _d -= l; continue; }
var p0 = points[(i + 0) % np];
var p1 = points[(i + 1) % np];
out.x = lerp(p0[0], p1[0], _d / l);
out.y = lerp(p0[1], p1[1], _d / l);
out.z = lerp(p0[2], p1[2], _d / l);
break;
}
return out;
}
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
var _camera = params.camera;
var _v3 = new __vec3();
var _ox = 0, _oy = 0;
var _nx = 0, _ny = 0;
draw_set_color(COLORS._main_accent);
for( var j = 0, m = array_length(points); j < m; j++ ) {
_v3.x = points[j][0];
_v3.y = points[j][1];
_v3.z = points[j][2];
var _posView = _camera.worldPointToViewPoint(_v3);
_nx = _posView.x;
_ny = _posView.y;
if(j) draw_line(_ox, _oy, _nx, _ny);
_ox = _nx;
_oy = _ny;
}
}
static update = function(frame = CURRENT_FRAME) {
var _pos = getInputData(0);
var _sca = getInputData(1);
var _up = getInputData(3);
var _rot = getInputData(4);
shape = getInputData(2);
posx = _pos[0]; posy = _pos[1]; posz = _pos[2];
scax = _sca[0]; scay = _sca[1]; scaz = _sca[2];
var ox, oy, oz, nx, ny, nz;
var x0, y0, z0;
var x1, y1, z1;
inputs[5].setVisible(false);
inputs[6].setVisible(false);
inputs[7].setVisible(false);
inputs[8].setVisible(false);
switch(shapeScroll[shape].name) {
case "Rectangle" :
loop = true;
x0 = posx - scax;
y0 = posy - scay;
x1 = posx + scax;
y1 = posy + scay;
var p = [
[ x0, y0, posz ],
[ x1, y0, posz ],
[ x1, y1, posz ],
[ x0, y1, posz ]
];
points = p;
break;
case "Ellipse" :
loop = true;
var _st = 64;
var _as = 360 / _st;
points = array_create(_st);
for( var i = 0; i < _st; i++ ) {
nx = posx + lengthdir_x(scax, _as * i);
ny = posy + lengthdir_y(scay, _as * i);
points[i] = [ nx, ny, posz ];
}
break;
case "Regular Polygon" :
inputs[5].setVisible(true);
var _sid = getInputData(5);
loop = true;
var _st = max(3, _sid);
var _as = 360 / _st;
points = array_create(_st);
for( var i = 0; i < _st; i++ ) {
nx = posx + lengthdir_x(scax, _as * i);
ny = posy + lengthdir_y(scay, _as * i);
points[i] = [ nx, ny, posz ];
}
break;
case "Star" :
inputs[5].setVisible(true);
inputs[8].setVisible(true);
var _sid = getInputData(5);
var _inn = getInputData(8);
loop = true;
var _st = max(3, _sid);
var _as = 360 / _st;
points = array_create(_st * 2);
for( var i = 0; i < _st; i++ ) {
points[i * 2 + 0] = [ posx + lengthdir_x(scax, _as * i), posy + lengthdir_y(scay, _as * i), posz ];
points[i * 2 + 1] = [ posx + lengthdir_x(scax * _inn, _as * (i + .5)), posy + lengthdir_y(scay * _inn, _as * (i + .5)), posz ];
}
break;
case "Spring" :
inputs[6].setVisible(true);
inputs[7].setVisible(true);
var _rev = getInputData(6);
var _pit = getInputData(7);
loop = false;
var _st = 64 * _rev;
var _as = 360 / 64;
points = array_create(_st);
for( var i = 0; i < _st; i++ ) {
nx = posx + lengthdir_x(scax, _as * i);
ny = posy + lengthdir_y(scay, _as * i);
nz = posz + i / 64 * _pit;
points[i] = [ nx, ny, nz ];
}
break;
case "Spring Sphere" :
inputs[6].setVisible(true);
var _rev = getInputData(6);
z0 = posz - scaz;
z1 = posz + scaz;
loop = false;
var _st = 64 * _rev;
var _as = 360 / 64;
points = array_create(_st);
for( var i = 0; i < _st; i++ ) {
var t = i / _st;
var r = t * 2 - 1;
r = sqrt(1 - r * r);
nx = posx + lengthdir_x(scax * r, _as * i);
ny = posy + lengthdir_y(scay * r, _as * i);
nz = lerp(z0, z1, t);
points[i] = [ nx, ny, nz ];
}
break;
case "Spiral" :
inputs[6].setVisible(true);
inputs[7].setVisible(true);
var _rev = getInputData(6);
var _pit = getInputData(7);
loop = false;
var _st = 64 * _rev;
var _as = 360 / 64;
var _pp = 1 / 64 * _pit;
points = array_create(_st);
for( var i = 0; i < _st; i++ ) {
nx = posx + lengthdir_x(scax * i * _pp, _as * i);
ny = posy + lengthdir_y(scay * i * _pp, _as * i);
points[i] = [ nx, ny, posz ];
}
break;
}
if(array_empty(points)) return;
if(loop) array_push(points, [ points[0][0], points[0][1], points[0][2] ]);
#region preview
preview_surf = surface_verify(preview_surf, 128, 128);
surface_set_target(preview_surf);
DRAW_CLEAR
var ox, x0;
var oy, y0;
var nx, ny;
var xx = posx - scax;
var yy = posy - scay;
var ww = scax * 2;
var hh = scay * 2;
draw_set_color(COLORS._main_accent);
if(array_length(points)) {
for( var i = 0, n = array_length(points); i < n; i++ ) {
nx = 4 + (points[i][0] - xx) / ww * 120;
ny = 4 + (points[i][1] - yy) / hh * 120;
if(i) draw_line_width(ox, oy, nx, ny, 8);
else { x0 = nx; y0 = ny; }
ox = nx;
oy = ny;
}
}
surface_reset_target();
#endregion
for( var i = 0, n = array_length(points); i < n; i++ ) {
var p = points[i];
point_rotate(p[0], p[1], posx, posy, -_rot, p);
var _x = p[0];
var _y = p[1];
var _z = p[2];
switch(_up) {
case 0 : points[i] = [ _z, _y, _x ]; break;
case 1 : points[i] = [ _x, _z, _y ]; break;
}
}
var n = array_length(points);
lengths = array_create(n);
for( var i = 0; i < n; i++ ) {
nx = points[i][0];
ny = points[i][1];
nz = points[i][2];
if(i) lengths[i - 1] = point_distance_3d(ox, oy, oz, nx, ny, nz);
else { x0 = nx; y0 = ny; z0 = nz; }
ox = nx;
oy = ny;
oz = nz;
}
var _len = array_length(lengths);
lengthTotal = 0;
lengthAccs = array_create(_len);
for( var i = 0; i < _len; i++ ) {
lengthTotal += lengths[i];
lengthAccs[i] = lengthTotal;
}
boundary = new BoundingBox(posx - scax, posy - scay, posx + scax, posy + scay);
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_surface_bbox(preview_surf, bbox);
}
static getPreviewObject = function() /*=>*/ {return noone};
static getPreviewObjects = function() /*=>*/ {return []};
static getPreviewObjectOutline = function() /*=>*/ {return []};
static getPreviewBoundingBox = function() /*=>*/ {return BBOX().fromBoundingBox(boundary)};
}

View file

@ -0,0 +1,14 @@
{
"$GMScript":"v1",
"%Name":"node_path_shape_3d",
"isCompatibility":false,
"isDnD":false,
"name":"node_path_shape_3d",
"parent":{
"name":"path",
"path":"folders/nodes/data/value/path.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
"tags":[],
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,118 @@
{
"$GMSprite":"",
"%Name":"s_node_path_3d_shape",
"bboxMode":0,
"bbox_bottom":22,
"bbox_left":0,
"bbox_right":22,
"bbox_top":0,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"c5b1c47b-9872-4728-b8c2-2d537df31cdb","name":"c5b1c47b-9872-4728-b8c2-2d537df31cdb","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"cf9785f8-0132-4bc4-b60f-4f82e9909397","name":"cf9785f8-0132-4bc4-b60f-4f82e9909397","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"f1a1dea2-a9ab-4cff-91ae-680f5e48adbf","name":"f1a1dea2-a9ab-4cff-91ae-680f5e48adbf","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"d3160afc-883e-4d60-bc56-b3981d1a6a12","name":"d3160afc-883e-4d60-bc56-b3981d1a6a12","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"25f36ac2-c33f-4892-ac78-9a934855945e","name":"25f36ac2-c33f-4892-ac78-9a934855945e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"4f78ab59-4541-406f-a953-7862d0178ba6","name":"4f78ab59-4541-406f-a953-7862d0178ba6","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"da3ef262-5818-43e1-a0a2-9035fa134665","name":"da3ef262-5818-43e1-a0a2-9035fa134665","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"3bb0d1e9-1476-4358-ab03-b376faef2599","name":"3bb0d1e9-1476-4358-ab03-b376faef2599","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"d2f503cb-8e8c-4c22-bdcd-69e59922705b","blendMode":0,"displayName":"default","isLocked":false,"name":"d2f503cb-8e8c-4c22-bdcd-69e59922705b","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_path_3d_shape",
"nineSlice":null,
"origin":4,
"parent":{
"name":"nodes",
"path":"folders/sprites/nodes.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_path_3d_shape",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":8.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_node_path_3d_shape",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"c5b1c47b-9872-4728-b8c2-2d537df31cdb","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"5b468180-ce35-48ad-b069-a7de506e1cda","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"cf9785f8-0132-4bc4-b60f-4f82e9909397","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"e718e9bc-0c74-4051-a89d-475044bc7d79","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f1a1dea2-a9ab-4cff-91ae-680f5e48adbf","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"b6c83017-2a2c-4482-9bd0-a6e2482ca9a3","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"d3160afc-883e-4d60-bc56-b3981d1a6a12","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"9e56636a-2da2-4e99-a231-46e385821531","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"25f36ac2-c33f-4892-ac78-9a934855945e","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"a25f74d0-e6ea-47a5-8626-b22f58e4c3d0","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"4f78ab59-4541-406f-a953-7862d0178ba6","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"f5c5e1a4-b87b-4f33-ba6c-2159713e08d8","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"da3ef262-5818-43e1-a0a2-9035fa134665","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"f931d2ba-2a22-41d1-b577-f159ad5ec24b","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3bb0d1e9-1476-4358-ab03-b376faef2599","path":"sprites/s_node_path_3d_shape/s_node_path_3d_shape.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"b86217ea-849c-461d-aadc-8c4223ed377e","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":12,
"yorigin":12,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":24,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_path_shape_3d",
"bboxMode":0,
"bbox_bottom":62,
"bbox_left":4,
"bbox_right":62,
"bbox_top":3,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"3b8b3aec-a8ef-49ef-9aac-2d8ffca7505e","name":"3b8b3aec-a8ef-49ef-9aac-2d8ffca7505e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"80fe2f24-d609-4697-8b4c-c4cbb9a9b724","blendMode":0,"displayName":"default","isLocked":false,"name":"80fe2f24-d609-4697-8b4c-c4cbb9a9b724","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_path_shape_3d",
"nineSlice":null,
"origin":4,
"parent":{
"name":"path",
"path":"folders/nodes/icons/value/path.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_path_shape_3d",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_node_path_shape_3d",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3b8b3aec-a8ef-49ef-9aac-2d8ffca7505e","path":"sprites/s_node_path_shape_3d/s_node_path_shape_3d.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"bd1ed358-de2f-46d3-8606-268c912c284e","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":32,
"yorigin":32,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":64,
}