3D Point affectors

This commit is contained in:
Tanasart 2023-11-09 13:59:03 +07:00
parent 6b564b56c3
commit 8c978903ac
18 changed files with 317 additions and 54 deletions

View file

@ -80,14 +80,13 @@
{"name":"nodes","order":3,"path":"folders/nodes.yy",},
{"name":"data","order":1,"path":"folders/nodes/data.yy",},
{"name":"3D","order":20,"path":"folders/nodes/data/3D.yy",},
{"name":"__legacy","order":5,"path":"folders/nodes/data/3D/__legacy.yy",},
{"name":"primitive","order":9,"path":"folders/nodes/data/3D/__legacy/primitive.yy",},
{"name":"2d effects","order":7,"path":"folders/nodes/data/3D/2d effects.yy",},
{"name":"d3d compose","order":17,"path":"folders/nodes/data/3D/d3d compose.yy",},
{"name":"d3d light","order":14,"path":"folders/nodes/data/3D/d3d light.yy",},
{"name":"d3d mesh","order":12,"path":"folders/nodes/data/3D/d3d mesh.yy",},
{"name":"d3d modifier","order":18,"path":"folders/nodes/data/3D/d3d modifier.yy",},
{"name":"d3d particle","order":19,"path":"folders/nodes/data/3D/d3d particle.yy",},
{"name":"2d effects","order":1,"path":"folders/nodes/data/3D/2d effects.yy",},
{"name":"d3d compose","order":8,"path":"folders/nodes/data/3D/d3d compose.yy",},
{"name":"d3d light","order":6,"path":"folders/nodes/data/3D/d3d light.yy",},
{"name":"d3d mesh","order":4,"path":"folders/nodes/data/3D/d3d mesh.yy",},
{"name":"d3d modifier","order":9,"path":"folders/nodes/data/3D/d3d modifier.yy",},
{"name":"d3d particle","order":10,"path":"folders/nodes/data/3D/d3d particle.yy",},
{"name":"animation","order":6,"path":"folders/nodes/data/animation.yy",},
{"name":"compose","order":11,"path":"folders/nodes/data/compose.yy",},
{"name":"armature","order":3,"path":"folders/nodes/data/compose/armature.yy",},
@ -236,11 +235,11 @@
{"name":"node_tool","order":9,"path":"scripts/node_tool/node_tool.yy",},
{"name":"sh_find_pixel","order":3,"path":"shaders/sh_find_pixel/sh_find_pixel.yy",},
{"name":"d3d_light_point","order":2,"path":"scripts/d3d_light_point/d3d_light_point.yy",},
{"name":"node_3d_camera","order":10,"path":"scripts/node_3d_camera/node_3d_camera.yy",},
{"name":"node_3d_camera","order":3,"path":"scripts/node_3d_camera/node_3d_camera.yy",},
{"name":"panel_preview_window","order":1,"path":"scripts/panel_preview_window/panel_preview_window.yy",},
{"name":"node_PCX_equation","order":5,"path":"scripts/node_PCX_equation/node_PCX_equation.yy",},
{"name":"sh_scale3x","order":29,"path":"shaders/sh_scale3x/sh_scale3x.yy",},
{"name":"__node_3d","order":8,"path":"scripts/__node_3d/__node_3d.yy",},
{"name":"__node_3d","order":2,"path":"scripts/__node_3d/__node_3d.yy",},
{"name":"node_csv_file_write","order":12,"path":"scripts/node_csv_file_write/node_csv_file_write.yy",},
{"name":"surface_functions","order":5,"path":"scripts/surface_functions/surface_functions.yy",},
{"name":"dynaSurf_iso","order":1,"path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",},
@ -259,6 +258,7 @@
{"name":"__node_process_template","order":18,"path":"scripts/__node_process_template/__node_process_template.yy",},
{"name":"__node_3d_obj","order":4,"path":"scripts/__node_3d_obj/__node_3d_obj.yy",},
{"name":"__path","order":1,"path":"scripts/__path/__path.yy",},
{"name":"node_3d_point_affector","order":11,"path":"scripts/node_3d_point_affector/node_3d_point_affector.yy",},
{"name":"draw_text_path","order":25,"path":"scripts/draw_text_path/draw_text_path.yy",},
{"name":"sh_brush_outline","order":7,"path":"shaders/sh_brush_outline/sh_brush_outline.yy",},
{"name":"s_node_grid_tri_noise","order":22,"path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",},
@ -458,7 +458,7 @@
{"name":"byte_writer","order":8,"path":"scripts/byte_writer/byte_writer.yy",},
{"name":"checkboxGroup","order":28,"path":"scripts/checkboxGroup/checkboxGroup.yy",},
{"name":"node_FXAA","order":8,"path":"scripts/node_FXAA/node_FXAA.yy",},
{"name":"__node_3d_object","order":13,"path":"scripts/__node_3d_object/__node_3d_object.yy",},
{"name":"__node_3d_object","order":5,"path":"scripts/__node_3d_object/__node_3d_object.yy",},
{"name":"s_node_pixel_find","order":13,"path":"sprites/s_node_pixel_find/s_node_pixel_find.yy",},
{"name":"s_biterator_canvas_cover","order":16,"path":"sprites/s_biterator_canvas_cover/s_biterator_canvas_cover.yy",},
{"name":"sh_noise_grid_tri","order":3,"path":"shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy",},
@ -744,7 +744,7 @@
{"name":"draw_sprite_ext_override","order":9,"path":"scripts/draw_sprite_ext_override/draw_sprite_ext_override.yy",},
{"name":"node_array_add","order":6,"path":"scripts/node_array_add/node_array_add.yy",},
{"name":"o_dialog_textbox_function_guide","order":8,"path":"objects/o_dialog_textbox_function_guide/o_dialog_textbox_function_guide.yy",},
{"name":"node_3d_material","order":16,"path":"scripts/node_3d_material/node_3d_material.yy",},
{"name":"node_3d_material","order":7,"path":"scripts/node_3d_material/node_3d_material.yy",},
{"name":"pcx_server","order":2,"path":"scripts/pcx_server/pcx_server.yy",},
{"name":"s_node_array_set","order":9,"path":"sprites/s_node_array_set/s_node_array_set.yy",},
{"name":"node_dust","order":19,"path":"scripts/node_dust/node_dust.yy",},
@ -802,6 +802,7 @@
{"name":"s_node_grid_noise","order":5,"path":"sprites/s_node_grid_noise/s_node_grid_noise.yy",},
{"name":"fd_rectangle_set_velocity_size","order":16,"path":"scripts/fd_rectangle_set_velocity_size/fd_rectangle_set_velocity_size.yy",},
{"name":"node_image_gif","order":5,"path":"scripts/node_image_gif/node_image_gif.yy",},
{"name":"d3d_gizmo_plane_falloff","order":6,"path":"scripts/d3d_gizmo_plane_falloff/d3d_gizmo_plane_falloff.yy",},
{"name":"node_iterator_each_output","order":2,"path":"scripts/node_iterator_each_output/node_iterator_each_output.yy",},
{"name":"s_node_strandSim_render_texture","order":5,"path":"sprites/s_node_strandSim_render_texture/s_node_strandSim_render_texture.yy",},
{"name":"node_3d_set_material","order":2,"path":"scripts/node_3d_set_material/node_3d_set_material.yy",},
@ -849,6 +850,7 @@
{"name":"s_node_pb_draw_rectangle","order":13,"path":"sprites/s_node_pb_draw_rectangle/s_node_pb_draw_rectangle.yy",},
{"name":"panel_animation","order":1,"path":"scripts/panel_animation/panel_animation.yy",},
{"name":"sh_pb_to_mask","order":7,"path":"shaders/sh_pb_to_mask/sh_pb_to_mask.yy",},
{"name":"d3d_gizmo_plane","order":5,"path":"scripts/d3d_gizmo_plane/d3d_gizmo_plane.yy",},
{"name":"node_surface_replace","order":11,"path":"scripts/node_surface_replace/node_surface_replace.yy",},
{"name":"node_strand_create","order":1,"path":"scripts/node_strand_create/node_strand_create.yy",},
{"name":"sh_gradient","order":17,"path":"shaders/sh_gradient/sh_gradient.yy",},

View file

@ -826,6 +826,7 @@
{"id":{"name":"__node_process_template","path":"scripts/__node_process_template/__node_process_template.yy",},},
{"id":{"name":"__node_3d_obj","path":"scripts/__node_3d_obj/__node_3d_obj.yy",},},
{"id":{"name":"__path","path":"scripts/__path/__path.yy",},},
{"id":{"name":"node_3d_point_affector","path":"scripts/node_3d_point_affector/node_3d_point_affector.yy",},},
{"id":{"name":"draw_text_path","path":"scripts/draw_text_path/draw_text_path.yy",},},
{"id":{"name":"sh_brush_outline","path":"shaders/sh_brush_outline/sh_brush_outline.yy",},},
{"id":{"name":"s_node_grid_tri_noise","path":"sprites/s_node_grid_tri_noise/s_node_grid_tri_noise.yy",},},
@ -1449,6 +1450,7 @@
{"id":{"name":"s_node_grid_noise","path":"sprites/s_node_grid_noise/s_node_grid_noise.yy",},},
{"id":{"name":"fd_rectangle_set_velocity_size","path":"scripts/fd_rectangle_set_velocity_size/fd_rectangle_set_velocity_size.yy",},},
{"id":{"name":"node_image_gif","path":"scripts/node_image_gif/node_image_gif.yy",},},
{"id":{"name":"d3d_gizmo_plane_falloff","path":"scripts/d3d_gizmo_plane_falloff/d3d_gizmo_plane_falloff.yy",},},
{"id":{"name":"node_iterator_each_output","path":"scripts/node_iterator_each_output/node_iterator_each_output.yy",},},
{"id":{"name":"node_VCT","path":"scripts/node_VCT/node_VCT.yy",},},
{"id":{"name":"boneObject","path":"scripts/boneObject/boneObject.yy",},},
@ -1506,6 +1508,7 @@
{"id":{"name":"s_node_pb_draw_rectangle","path":"sprites/s_node_pb_draw_rectangle/s_node_pb_draw_rectangle.yy",},},
{"id":{"name":"panel_animation","path":"scripts/panel_animation/panel_animation.yy",},},
{"id":{"name":"sh_pb_to_mask","path":"shaders/sh_pb_to_mask/sh_pb_to_mask.yy",},},
{"id":{"name":"d3d_gizmo_plane","path":"scripts/d3d_gizmo_plane/d3d_gizmo_plane.yy",},},
{"id":{"name":"node_surface_replace","path":"scripts/node_surface_replace/node_surface_replace.yy",},},
{"id":{"name":"node_strand_create","path":"scripts/node_strand_create/node_strand_create.yy",},},
{"id":{"name":"sh_gradient","path":"shaders/sh_gradient/sh_gradient.yy",},},

View file

@ -2,10 +2,6 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
name = "3D";
is_3D = true;
w = 64;
h = 64;
min_h = h;
mesh_prev_surface = surface_create(64, 64);
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {}

View file

@ -17,7 +17,7 @@ function Node_3D_Light(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
#macro __d3d_input_list_light ["Light", false], in_d3d + 0, in_d3d + 1, in_d3d + 2
static setLight = function(light, _data) {
static setLight = function(light, _data) { #region
var _col = _data[in_d3d + 1];
var _int = _data[in_d3d + 2];
@ -25,11 +25,11 @@ function Node_3D_Light(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
light.intensity = _int;
return light;
}
} #endregion
static processData = function(_output, _data, _output_index, _array_index = 0) { }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var _colr = current_data[in_d3d + 1];
var bbox = drawGetBbox(xx, yy, _s);
draw_set_color(_colr);
@ -37,5 +37,5 @@ function Node_3D_Light(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
draw_set_circle_precision(32);
draw_circle(bbox.xc, bbox.yc, 8 * _s, false);
draw_circle(bbox.xc, bbox.yc, 12 * _s, true);
}
} #endregion
}

View file

@ -0,0 +1,15 @@
function __3dGizmoPlane(radius = 0.5, color = c_white, alpha = 1) : __3dGizmo() constructor {
vertex = [
[
new __vertex( -radius, -radius, 0, color, alpha ),
new __vertex( -radius, radius, 0, color, alpha ),
new __vertex( radius, radius, 0, color, alpha ),
new __vertex( radius, -radius, 0, color, alpha ),
],
[
new __vertex( 0, 0, 0, color, alpha ),
new __vertex( 0, 0, 1, color, alpha ),
]
];
VB = build();
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "d3d_gizmo_plane",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "gizmo",
"path": "folders/functions/3d/gizmo.yy",
},
}

View file

@ -0,0 +1,34 @@
function __3dGizmoPlaneFalloff(radius = 0.5, color = c_white, alpha = 1) : __3dGizmo() constructor {
distance = 0;
self.radius = radius;
self.color = color;
self.alpha = alpha;
static initModel = function() {
vertex = [];
object_counts = 3;
var _d = distance / 2;
vertex = [
[
new __vertex( -radius, -radius, -_d, color, alpha ),
new __vertex( -radius, radius, -_d, color, alpha ),
new __vertex( radius, radius, -_d, color, alpha ),
new __vertex( radius, -radius, -_d, color, alpha ),
],
[
new __vertex( -radius, -radius, _d, color, alpha ),
new __vertex( -radius, radius, _d, color, alpha ),
new __vertex( radius, radius, _d, color, alpha ),
new __vertex( radius, -radius, _d, color, alpha ),
],
[
new __vertex( 0, 0, _d + 0, color, alpha ),
new __vertex( 0, 0, _d + 1, color, alpha ),
]
];
VB = build();
} initModel();
onParameterUpdate = initModel;
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "d3d_gizmo_plane_falloff",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "gizmo",
"path": "folders/functions/3d/gizmo.yy",
},
}

View file

@ -17,4 +17,16 @@ function __plane(origin, normal) constructor {
return ray.sampleDistance(t);
}
function d3d_point_to_plane(plane_origin, plane_normal, point) {
var plane_to_point = [
point[0] - plane_origin[0],
point[1] - plane_origin[1],
point[2] - plane_origin[2],
];
var _dot = dot_product_3d(plane_to_point[0], plane_to_point[1], plane_to_point[2], plane_normal[0], plane_normal[1], plane_normal[2]);
var _distance = _dot / point_distance_3d(0, 0, 0, plane_normal[0], plane_normal[1], plane_normal[2]);
return _distance;
}
#endregion

View file

@ -5,11 +5,16 @@ function __3dPlane() : __3dObject() constructor {
self.side = 0.5;
self.normal = 0;
two_side = false;
static initModel = function() {
var _nor = [ 0, 0, 1 ];
vertex = [];
object_counts = 1 + two_side;
switch(normal) {
case 0 :
vertex = [[
vertex[0] = [
new __vertex(0, -side, -side).setNormal(1, 0, 0).setUV(0, 0),
new __vertex(0, side, side).setNormal(1, 0, 0).setUV(1, 1),
new __vertex(0, side, -side).setNormal(1, 0, 0).setUV(1, 0),
@ -17,10 +22,10 @@ function __3dPlane() : __3dObject() constructor {
new __vertex(0, -side, -side).setNormal(1, 0, 0).setUV(0, 0),
new __vertex(0, -side, side).setNormal(1, 0, 0).setUV(0, 1),
new __vertex(0, side, side).setNormal(1, 0, 0).setUV(1, 1),
]];
];
break;
case 1 :
vertex = [[
vertex[0] = [
new __vertex(-side, 0, -side).setNormal(0, 1, 0).setUV(0, 0),
new __vertex( side, 0, -side).setNormal(0, 1, 0).setUV(1, 0),
new __vertex( side, 0, side).setNormal(0, 1, 0).setUV(1, 1),
@ -28,10 +33,10 @@ function __3dPlane() : __3dObject() constructor {
new __vertex(-side, 0, -side).setNormal(0, 1, 0).setUV(0, 0),
new __vertex( side, 0, side).setNormal(0, 1, 0).setUV(1, 1),
new __vertex(-side, 0, side).setNormal(0, 1, 0).setUV(0, 1),
]];
];
break;
case 2 :
vertex = [[
vertex[0] = [
new __vertex(-side, -side, 0).setNormal(0, 0, 1).setUV(0, 0),
new __vertex( side, side, 0).setNormal(0, 0, 1).setUV(1, 1),
new __vertex( side, -side, 0).setNormal(0, 0, 1).setUV(1, 0),
@ -39,10 +44,18 @@ function __3dPlane() : __3dObject() constructor {
new __vertex(-side, -side, 0).setNormal(0, 0, 1).setUV(0, 0),
new __vertex(-side, side, 0).setNormal(0, 0, 1).setUV(0, 1),
new __vertex( side, side, 0).setNormal(0, 0, 1).setUV(1, 1),
]];
];
break;
}
if(two_side) {
vertex[1] = array_create(6);
for( var i = 0; i < 6; i++ ) {
var _v0 = vertex[0][5 - i];
vertex[1][i] = new __vertex(_v0.x, _v0.y, _v0.z).setNormal(-_v0.nx, -_v0.ny, -_v0.nz).setUV(_v0.u, _v0.v);
}
}
VB = build();
} initModel();

View file

@ -9,19 +9,30 @@ function Node_3D_Mesh_Plane(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _grou
inputs[| in_mesh + 1] = nodeValue("Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2 )
.setDisplay(VALUE_DISPLAY.enum_button, [ "X", "Y", "Z" ]);
inputs[| in_mesh + 2] = nodeValue("Both side", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
inputs[| in_mesh + 3] = nodeValue("Back Material", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone )
input_display_list = [
__d3d_input_list_mesh, in_mesh + 1,
__d3d_input_list_transform,
["Material", false], in_mesh + 0,
["Material", false], in_mesh + 2, in_mesh + 0, in_mesh + 3,
]
static step = function() {
var _both = getSingleValue(in_mesh + 2);
inputs[| in_mesh + 3].setVisible(_both, _both);
}
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
var _mat = _data[in_mesh + 0];
var _axs = _data[in_mesh + 1];
var _mat = _data[in_mesh + 0];
var _axs = _data[in_mesh + 1];
var _both = _data[in_mesh + 2];
var _bmat = _data[in_mesh + 3];
var object = getObject(_array_index);
object.checkParameter({ normal: _axs });
object.materials = [ _mat ];
object.checkParameter({ normal: _axs, two_side: _both });
object.materials = _both? [ _mat, _bmat ] : [ _mat ];
setTransform(object, _data);

View file

@ -0,0 +1,106 @@
function Node_3D_Point_Affector(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) constructor {
name = "Point Affector";
previewable = false;
gizmo_sphere = [ new __3dGizmoSphere(,, 0.75), new __3dGizmoSphere(,, 0.5) ];
gizmo_plane = [ new __3dGizmoPlaneFalloff(,, 0.75) ];
gizmo_object = noone;
inputs[| in_d3d + 0] = nodeValue("Points", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setVisible(true, true)
.setDisplay(VALUE_DISPLAY.vector);
inputs[| in_d3d + 1] = nodeValue("Initial value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| in_d3d + 2] = nodeValue("Final value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| in_d3d + 3] = nodeValue("Falloff distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5);
inputs[| in_d3d + 4] = nodeValue("Falloff curve", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_01);
inputs[| in_d3d + 5] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Sphere", "Plane" ]);
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
input_display_list = [
["Affectors", false], in_d3d + 5, 0, 1, 2, in_d3d + 3, in_d3d + 4,
["Points", false], in_d3d + 0, in_d3d + 1, in_d3d + 2,
];
curve_falloff = noone;
plane_normal = [ 0, 0, 1 ];
static step = function() {}
static processData = function(_outSurf, _data, _output_index, _array_index = 0) { #region
var _pos = _data[0];
var _rot = _data[1];
var _sca = _data[2];
var _maxs = max(_sca[0], _sca[1], _sca[2]);
var _p = _data[in_d3d + 0];
var _iVal = _data[in_d3d + 1];
var _fVal = _data[in_d3d + 2];
var _fald = _data[in_d3d + 3];
var _fcrv = _data[in_d3d + 4];
var _ftyp = _data[in_d3d + 5];
if(_array_index == 0) {
if(_ftyp == 0) {
gizmo_object = gizmo_sphere;
setTransform(gizmo_sphere[0], _data);
setTransform(gizmo_sphere[1], _data);
gizmo_sphere[0].transform.scale.set(_maxs + _fald, _maxs + _fald, _maxs + _fald);
gizmo_sphere[1].transform.scale.set(_maxs - _fald, _maxs - _fald, _maxs - _fald);
} else if(_ftyp == 1) {
gizmo_object = gizmo_plane;
setTransform(gizmo_plane[0], _data);
gizmo_plane[0].transform.scale.set(1, 1, 1);
gizmo_plane[0].checkParameter({ distance: _fald });
var _prot = new BBMOD_Quaternion(_rot[0], _rot[1], _rot[2], _rot[3]);
plane_normal = _prot.Rotate(new BBMOD_Vec3(0, 0, 1));
}
if(CURRENT_FRAME == 0)
curve_falloff = new curveMap(_fcrv, 100);
}
var _res = array_create(array_length(_iVal));
var _dis = 0, _inR = 0, _ouR = 1;
if(_ftyp == 0) {
_dis = point_distance_3d(_pos[0], _pos[1], _pos[2], _p[0], _p[1], _p[2]);
_inR = (_maxs - _fald) / 2;
_ouR = (_maxs + _fald) / 2;
} else if(_ftyp == 1) {
_dis = d3d_point_to_plane(_pos, plane_normal, _p);
_inR = -_fald / 2;
_ouR = _fald / 2;
}
if(_dis >= _ouR) _res = _iVal;
else if(_dis <= _inR) _res = _fVal;
else {
var _inf = (_dis - _inR) / (_fald);
_inf = curve_falloff == noone? _inf : curve_falloff.get(_inf);
for( var i = 0, n = array_length(_res); i < n; i++ )
_res[i] = lerp(_fVal[i], _iVal[i], _inf);
}
return _res;
} #endregion
static getPreviewObject = function() { return noone; }
static getPreviewObjects = function() { return gizmo_object; }
static getPreviewObjectOutline = function() { return gizmo_object; }
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_3d_point_affector",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "3D",
"path": "folders/nodes/data/3D.yy",
},
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "process",
"path": "folders/nodes/data/process.yy",
},
"resourceVersion": "1.0",
"name": "node_outline",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -83,7 +83,7 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
var _asca = array_safe_get(_Asca, i);
if(!is_array(_apos) || array_length(_apos) != 3) _apos = [ 0, 0, 0 ];
if(!is_array(_arot) || array_length(_arot) != 4) _arot = [ 0, 0, 0, 1 ];
if(!is_array(_arot) || array_length(_arot) != 3) _arot = [ 0, 0, 0 ];
if(!is_array(_asca) || array_length(_asca) != 3) _asca = [ 0, 0, 0 ];
var _subScene = new __3dGroup();
@ -96,16 +96,14 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
_Ssca[2] + _asca[2] + _Rsca[2] * i ];
var _sRot = new BBMOD_Quaternion(_Srot[0], _Srot[1], _Srot[2], _Srot[3]);
var _aRot = new BBMOD_Quaternion(_arot[0], _arot[1], _arot[2], _arot[3]);
var _rRot = new BBMOD_Quaternion(_Rrot[0], _Rrot[1], _Rrot[2], _Rrot[3]);
var _sRotE = _sRot.ToEuler();
var _aRotE = _aRot.ToEuler();
var _rRotE = _rRot.ToEuler();
var _fRotE = [ _sRotE.x + _aRotE.x + _rRotE.x * i,
_sRotE.y + _aRotE.y + _rRotE.y * i,
_sRotE.z + _aRotE.z + _rRotE.z * i ];
var _fRotE = [ _sRotE.x + _arot[0] + _rRotE.x * i,
_sRotE.y + _arot[1] + _rRotE.y * i,
_sRotE.z + _arot[2] + _rRotE.z * i ];
var _fRot = new BBMOD_Quaternion().FromEuler(_fRotE[0], _fRotE[1], _fRotE[2]);

View file

@ -402,8 +402,6 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
ds_list_add(d3d, "3D");
addNodeObject(d3d, "3D Camera", s_node_3d_camera, "Node_3D_Camera", [1, Node_3D_Camera]).setVersion(11510);
addNodeObject(d3d, "3D Material", s_node_3d_meterial, "Node_3D_Material", [1, Node_3D_Material]).setVersion(11510);
ds_list_add(d3d, "Compose");
addNodeObject(d3d, "3D Scene", s_node_3d_scene, "Node_3D_Scene", [1, Node_3D_Scene]).setVersion(11510);
addNodeObject(d3d, "3D Repeat", s_node_3d_array, "Node_3D_Repeat", [1, Node_3D_Repeat]).setVersion(11510);
@ -428,6 +426,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
///**/ addNodeObject(d3d, "3D Instancer", s_node_3d_set_material, "Node_3D_Instancer", [1, Node_3D_Instancer]).setVersion(11560);
///**/ addNodeObject(d3d, "3D Particle", s_node_3d_set_material, "Node_3D_Particle", [1, Node_3D_Particle]).setVersion(11560);
ds_list_add(d3d, "Points");
addNodeObject(d3d, "Point Affector", s_node_3d_discretize, "Node_3D_Point_Affector", [1, Node_3D_Point_Affector]).setVersion(11570);
//ds_list_add(d3d, "Legacy"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////
//addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated();
//addNodeObject(d3d, "3D Cube", s_node_3d_cube, "__Node_3D_Cube", [1, __Node_3D_Cube]).isDeprecated();

View file

@ -1,5 +1,5 @@
function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Scatter Points";
name = "Scatter Points";
color = COLORS.node_blend_number;
previewable = false;
@ -31,30 +31,38 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
inputs[| 7] = nodeValue("Reference dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 8] = nodeValue("Reference value", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
inputs[| 9] = nodeValue("Output 3D", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 10] = nodeValue("Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "X", "Y", "Z" ]);
inputs[| 11] = nodeValue("Plane position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
input_display_list = [
["Base", false], 5, 6, 7,
["Scatter", false], 0, 1, 4, 2, 3,
["3D", true], 9, 10, 11
];
outputs[| 0] = nodeValue("Points", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ ])
.setDisplay(VALUE_DISPLAY.vector);
refVal = nodeValue("Reference value", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
static step = function() {
static step = function() { #region
var _dist = getInputData(1);
inputs[| 2].setVisible(_dist != 2);
inputs[| 4].setVisible(_dist == 2, _dist == 2);
}
} #endregion
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
inputs[| 0].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
}
} #endregion
static getPreviewValues = function() { return refVal.getValue(); }
static getPreviewValues = function() { return inputs[| 8].getValue(); }
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
var _area = getInputData(0);
var _dist = getInputData(1);
var _scat = getInputData(2);
@ -64,13 +72,17 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
var _fix = getInputData(6);
var _fixRef = getInputData(7);
var _3d = getInputData( 9);
__temp_3dNorm = getInputData(10);
__temp_3dPos = getInputData(11);
inputs[| 7].setVisible(_fix);
var pos = [];
if(_fix) {
var ref = refVal.getValue();
var ref = getInputData(8);
ref = surface_verify(ref, _fixRef[0], _fixRef[1]);
refVal.setValue(ref);
inputs[| 8].setValue(ref);
}
var aBox = area_get_bbox(_area);
@ -102,11 +114,24 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
}
}
if(_3d)
pos = array_map(pos, function(value, index) {
var val = value;
switch(__temp_3dNorm) {
case 0 : val = [ __temp_3dPos, value[0], value[1] ]; break;
case 1 : val = [ value[0], __temp_3dPos, value[1] ]; break;
case 2 : val = [ value[0], value[1], __temp_3dPos ]; break;
}
return val;
});
outputs[| 0].setValue(pos);
}
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_scatter_point, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
}
} #endregion
}

View file

@ -117,8 +117,10 @@ function timelineItemNode(node) : timelineItem() constructor {
show = struct_try_get(_map, "show", true);
var _node_id = _map.node_id;
node = PROJECT.nodeMap[? _node_id];
node.timeline_item = self;
if(ds_map_exists(PROJECT.nodeMap, _node_id)) {
node = PROJECT.nodeMap[? _node_id];
node.timeline_item = self;
}
return self;
} #endregion