diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 2af2f5176..774d3f93e 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -77,6 +77,7 @@ {"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":"animation","order":6,"path":"folders/nodes/data/animation.yy",}, @@ -192,7 +193,6 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, - {"name":"d3d compose","order":17,"path":"folders/nodes/data/3D/d3d compose.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -214,7 +214,7 @@ {"name":"s_node_normal","order":30,"path":"sprites/s_node_normal/s_node_normal.yy",}, {"name":"node_pixel_sort","order":12,"path":"scripts/node_pixel_sort/node_pixel_sort.yy",}, {"name":"sh_dither","order":28,"path":"shaders/sh_dither/sh_dither.yy",}, - {"name":"d3d_vec2","order":11,"path":"scripts/d3d_vec2/d3d_vec2.yy",}, + {"name":"__vec2","order":7,"path":"scripts/__vec2/__vec2.yy",}, {"name":"node_region_fill","order":20,"path":"scripts/node_region_fill/node_region_fill.yy",}, {"name":"sh_d3d_normal","order":18,"path":"shaders/sh_d3d_normal/sh_d3d_normal.yy",}, {"name":"s_node_text_file_read","order":13,"path":"sprites/s_node_text_file_read/s_node_text_file_read.yy",}, @@ -326,7 +326,6 @@ {"name":"sh_mesh_generation","order":4,"path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",}, {"name":"math_function","order":7,"path":"scripts/math_function/math_function.yy",}, {"name":"panel_preview_snap_setting","order":5,"path":"scripts/panel_preview_snap_setting/panel_preview_snap_setting.yy",}, - {"name":"__point","order":4,"path":"scripts/__point/__point.yy",}, {"name":"scrollBox","order":13,"path":"scripts/scrollBox/scrollBox.yy",}, {"name":"o_dialog_exit","order":2,"path":"objects/o_dialog_exit/o_dialog_exit.yy",}, {"name":"node_polygonal_shape","order":10,"path":"scripts/node_polygonal_shape/node_polygonal_shape.yy",}, @@ -365,7 +364,7 @@ {"name":"node_pb_fx_strip","order":11,"path":"scripts/node_pb_fx_strip/node_pb_fx_strip.yy",}, {"name":"node_stripe","order":4,"path":"scripts/node_stripe/node_stripe.yy",}, {"name":"sh_texture_atlas","order":39,"path":"shaders/sh_texture_atlas/sh_texture_atlas.yy",}, - {"name":"d3d_vec4","order":5,"path":"scripts/d3d_vec4/d3d_vec4.yy",}, + {"name":"__vec4","order":9,"path":"scripts/__vec4/__vec4.yy",}, {"name":"s_node_fluidSim_domain","order":6,"path":"sprites/s_node_fluidSim_domain/s_node_fluidSim_domain.yy",}, {"name":"s_node_displace","order":20,"path":"sprites/s_node_displace/s_node_displace.yy",}, {"name":"sh_polar","order":1,"path":"shaders/sh_polar/sh_polar.yy",}, @@ -735,7 +734,7 @@ {"name":"s_node_lua_surface","order":18,"path":"sprites/s_node_lua_surface/s_node_lua_surface.yy",}, {"name":"node_data","order":1,"path":"scripts/node_data/node_data.yy",}, {"name":"node_wiggler","order":2,"path":"scripts/node_wiggler/node_wiggler.yy",}, - {"name":"d3d_matrix4","order":1,"path":"scripts/d3d_matrix4/d3d_matrix4.yy",}, + {"name":"__matrix4","order":6,"path":"scripts/__matrix4/__matrix4.yy",}, {"name":"fd_GUIDE","order":5,"path":"scripts/fd_GUIDE/fd_GUIDE.yy",}, {"name":"node_fluid_update","order":3,"path":"scripts/node_fluid_update/node_fluid_update.yy",}, {"name":"s_node_grid_noise","order":5,"path":"sprites/s_node_grid_noise/s_node_grid_noise.yy",}, @@ -950,7 +949,7 @@ {"name":"s_node_fluidSim_domain_queue","order":9,"path":"sprites/s_node_fluidSim_domain_queue/s_node_fluidSim_domain_queue.yy",}, {"name":"sh_d3d_shadow_cube_depth","order":20,"path":"shaders/sh_d3d_shadow_cube_depth/sh_d3d_shadow_cube_depth.yy",}, {"name":"s_node_vfx_spawn","order":2,"path":"sprites/s_node_vfx_spawn/s_node_vfx_spawn.yy",}, - {"name":"d3d_vec3","order":4,"path":"scripts/d3d_vec3/d3d_vec3.yy",}, + {"name":"__vec3","order":8,"path":"scripts/__vec3/__vec3.yy",}, {"name":"texture_set_repeat","order":1,"path":"scripts/texture_set_repeat/texture_set_repeat.yy",}, {"name":"o_dialog_color_quick_pick","order":5,"path":"objects/o_dialog_color_quick_pick/o_dialog_color_quick_pick.yy",}, {"name":"fd_rectangle_update_velocity","order":22,"path":"scripts/fd_rectangle_update_velocity/fd_rectangle_update_velocity.yy",}, @@ -1193,7 +1192,7 @@ {"name":"node_blur_contrast","order":1,"path":"scripts/node_blur_contrast/node_blur_contrast.yy",}, {"name":"sh_trail_filler","order":50,"path":"shaders/sh_trail_filler/sh_trail_filler.yy",}, {"name":"s_node_border","order":12,"path":"sprites/s_node_border/s_node_border.yy",}, - {"name":"d3_vector","order":7,"path":"scripts/d3_vector/d3_vector.yy",}, + {"name":"__vector","order":10,"path":"scripts/__vector/__vector.yy",}, {"name":"s_node_pin","order":2,"path":"sprites/s_node_pin/s_node_pin.yy",}, {"name":"node_local_analyze","order":17,"path":"scripts/node_local_analyze/node_local_analyze.yy",}, {"name":"s_node_blur_contrast","order":10,"path":"sprites/s_node_blur_contrast/s_node_blur_contrast.yy",}, @@ -1437,6 +1436,7 @@ {"name":"__node_value_processor","order":6,"path":"scripts/__node_value_processor/__node_value_processor.yy",}, {"name":"s_node_group_input","order":16,"path":"sprites/s_node_group_input/s_node_group_input.yy",}, {"name":"sample_projects","order":6,"path":"scripts/sample_projects/sample_projects.yy",}, + {"name":"__matrix3","order":5,"path":"scripts/__matrix3/__matrix3.yy",}, {"name":"draw_fit","order":12,"path":"scripts/draw_fit/draw_fit.yy",}, {"name":"node_armature_sample","order":5,"path":"scripts/node_armature_sample/node_armature_sample.yy",}, {"name":"sh_pb_shade","order":3,"path":"shaders/sh_pb_shade/sh_pb_shade.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index ec7f040b9..ff0161ef3 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -101,6 +101,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"__legacy","folderPath":"folders/nodes/data/3D/__legacy.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"primitive","folderPath":"folders/nodes/data/3D/__legacy/primitive.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"2d effects","folderPath":"folders/nodes/data/3D/2d effects.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d compose","folderPath":"folders/nodes/data/3D/d3d compose.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d light","folderPath":"folders/nodes/data/3D/d3d light.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d mesh","folderPath":"folders/nodes/data/3D/d3d mesh.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/nodes/data/animation.yy",}, @@ -230,7 +231,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d compose","folderPath":"folders/nodes/data/3D/d3d compose.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -731,7 +731,7 @@ {"id":{"name":"s_node_normal","path":"sprites/s_node_normal/s_node_normal.yy",},}, {"id":{"name":"node_pixel_sort","path":"scripts/node_pixel_sort/node_pixel_sort.yy",},}, {"id":{"name":"sh_dither","path":"shaders/sh_dither/sh_dither.yy",},}, - {"id":{"name":"d3d_vec2","path":"scripts/d3d_vec2/d3d_vec2.yy",},}, + {"id":{"name":"__vec2","path":"scripts/__vec2/__vec2.yy",},}, {"id":{"name":"control_function","path":"scripts/control_function/control_function.yy",},}, {"id":{"name":"node_region_fill","path":"scripts/node_region_fill/node_region_fill.yy",},}, {"id":{"name":"sh_d3d_normal","path":"shaders/sh_d3d_normal/sh_d3d_normal.yy",},}, @@ -861,7 +861,6 @@ {"id":{"name":"sh_mesh_generation","path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},}, {"id":{"name":"math_function","path":"scripts/math_function/math_function.yy",},}, {"id":{"name":"panel_preview_snap_setting","path":"scripts/panel_preview_snap_setting/panel_preview_snap_setting.yy",},}, - {"id":{"name":"__point","path":"scripts/__point/__point.yy",},}, {"id":{"name":"node_strand_sim","path":"scripts/node_strand_sim/node_strand_sim.yy",},}, {"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},}, {"id":{"name":"o_dialog_exit","path":"objects/o_dialog_exit/o_dialog_exit.yy",},}, @@ -906,7 +905,7 @@ {"id":{"name":"node_pb_fx_strip","path":"scripts/node_pb_fx_strip/node_pb_fx_strip.yy",},}, {"id":{"name":"node_stripe","path":"scripts/node_stripe/node_stripe.yy",},}, {"id":{"name":"sh_texture_atlas","path":"shaders/sh_texture_atlas/sh_texture_atlas.yy",},}, - {"id":{"name":"d3d_vec4","path":"scripts/d3d_vec4/d3d_vec4.yy",},}, + {"id":{"name":"__vec4","path":"scripts/__vec4/__vec4.yy",},}, {"id":{"name":"s_node_fluidSim_domain","path":"sprites/s_node_fluidSim_domain/s_node_fluidSim_domain.yy",},}, {"id":{"name":"s_node_displace","path":"sprites/s_node_displace/s_node_displace.yy",},}, {"id":{"name":"sh_polar","path":"shaders/sh_polar/sh_polar.yy",},}, @@ -1330,7 +1329,7 @@ {"id":{"name":"s_node_lua_surface","path":"sprites/s_node_lua_surface/s_node_lua_surface.yy",},}, {"id":{"name":"node_data","path":"scripts/node_data/node_data.yy",},}, {"id":{"name":"node_wiggler","path":"scripts/node_wiggler/node_wiggler.yy",},}, - {"id":{"name":"d3d_matrix4","path":"scripts/d3d_matrix4/d3d_matrix4.yy",},}, + {"id":{"name":"__matrix4","path":"scripts/__matrix4/__matrix4.yy",},}, {"id":{"name":"fd_GUIDE","path":"scripts/fd_GUIDE/fd_GUIDE.yy",},}, {"id":{"name":"node_fluid_update","path":"scripts/node_fluid_update/node_fluid_update.yy",},}, {"id":{"name":"s_node_checker","path":"sprites/s_node_checker/s_node_checker.yy",},}, @@ -1568,7 +1567,7 @@ {"id":{"name":"sh_d3d_shadow_cube_depth","path":"shaders/sh_d3d_shadow_cube_depth/sh_d3d_shadow_cube_depth.yy",},}, {"id":{"name":"sh_camera","path":"shaders/sh_camera/sh_camera.yy",},}, {"id":{"name":"s_node_vfx_spawn","path":"sprites/s_node_vfx_spawn/s_node_vfx_spawn.yy",},}, - {"id":{"name":"d3d_vec3","path":"scripts/d3d_vec3/d3d_vec3.yy",},}, + {"id":{"name":"__vec3","path":"scripts/__vec3/__vec3.yy",},}, {"id":{"name":"texture_set_repeat","path":"scripts/texture_set_repeat/texture_set_repeat.yy",},}, {"id":{"name":"o_dialog_color_quick_pick","path":"objects/o_dialog_color_quick_pick/o_dialog_color_quick_pick.yy",},}, {"id":{"name":"fd_rectangle_update_velocity","path":"scripts/fd_rectangle_update_velocity/fd_rectangle_update_velocity.yy",},}, @@ -1849,7 +1848,7 @@ {"id":{"name":"s_fx_pixel","path":"sprites/s_fx_pixel/s_fx_pixel.yy",},}, {"id":{"name":"gradients_function","path":"scripts/gradients_function/gradients_function.yy",},}, {"id":{"name":"s_node_border","path":"sprites/s_node_border/s_node_border.yy",},}, - {"id":{"name":"d3_vector","path":"scripts/d3_vector/d3_vector.yy",},}, + {"id":{"name":"__vector","path":"scripts/__vector/__vector.yy",},}, {"id":{"name":"s_node_pin","path":"sprites/s_node_pin/s_node_pin.yy",},}, {"id":{"name":"s_node_9patch","path":"sprites/s_node_9patch/s_node_9patch.yy",},}, {"id":{"name":"node_local_analyze","path":"scripts/node_local_analyze/node_local_analyze.yy",},}, @@ -2131,7 +2130,7 @@ {"id":{"name":"s_node_group_input","path":"sprites/s_node_group_input/s_node_group_input.yy",},}, {"id":{"name":"sample_projects","path":"scripts/sample_projects/sample_projects.yy",},}, {"id":{"name":"load_function","path":"scripts/load_function/load_function.yy",},}, - {"id":{"name":"d3d_matrix3","path":"scripts/d3d_matrix3/d3d_matrix3.yy",},}, + {"id":{"name":"__matrix3","path":"scripts/__matrix3/__matrix3.yy",},}, {"id":{"name":"draw_fit","path":"scripts/draw_fit/draw_fit.yy",},}, {"id":{"name":"node_armature_sample","path":"scripts/node_armature_sample/node_armature_sample.yy",},}, {"id":{"name":"sh_pb_shade","path":"shaders/sh_pb_shade/sh_pb_shade.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index a3e6a9f1f..b3131a5a4 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/scripts/__bone/__bone.gml b/scripts/__bone/__bone.gml index 8c4338fe2..50cf21782 100644 --- a/scripts/__bone/__bone.gml +++ b/scripts/__bone/__bone.gml @@ -105,7 +105,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = var len = _len * progress; if(parent == noone) - return new Point(lengthdir_x(distance, direction), lengthdir_y(distance, direction)) + return new __vec2(lengthdir_x(distance, direction), lengthdir_y(distance, direction)) .add(lengthdir_x(len, _ang), lengthdir_y(len, _ang)); if(parent_anchor) { diff --git a/scripts/d3d_matrix3/d3d_matrix3.gml b/scripts/__matrix3/__matrix3.gml similarity index 100% rename from scripts/d3d_matrix3/d3d_matrix3.gml rename to scripts/__matrix3/__matrix3.gml diff --git a/scripts/__matrix3/__matrix3.yy b/scripts/__matrix3/__matrix3.yy new file mode 100644 index 000000000..e268db1c9 --- /dev/null +++ b/scripts/__matrix3/__matrix3.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "__matrix3", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "vector", + "path": "folders/functions/vector.yy", + }, +} \ No newline at end of file diff --git a/scripts/d3d_matrix4/d3d_matrix4.gml b/scripts/__matrix4/__matrix4.gml similarity index 100% rename from scripts/d3d_matrix4/d3d_matrix4.gml rename to scripts/__matrix4/__matrix4.gml diff --git a/scripts/__matrix4/__matrix4.yy b/scripts/__matrix4/__matrix4.yy new file mode 100644 index 000000000..e7b3a82c7 --- /dev/null +++ b/scripts/__matrix4/__matrix4.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "__matrix4", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "vector", + "path": "folders/functions/vector.yy", + }, +} \ No newline at end of file diff --git a/scripts/__mesh/__mesh.gml b/scripts/__mesh/__mesh.gml index c81a63d7d..f9097ce81 100644 --- a/scripts/__mesh/__mesh.gml +++ b/scripts/__mesh/__mesh.gml @@ -16,7 +16,7 @@ function Mesh() constructor { var _x = (1 - sqrt(a1)) * p0.x + (sqrt(a1) * (1 - a2)) * p1.x + (sqrt(a1) * a2) * p2.x; var _y = (1 - sqrt(a1)) * p0.y + (sqrt(a1) * (1 - a2)) * p1.y + (sqrt(a1) * a2) * p2.y; - return new Point( _x, _y ); + return new __vec2( _x, _y ); } static draw = function(_x, _y, _s) { diff --git a/scripts/__path/__path.gml b/scripts/__path/__path.gml index 635ee0ad9..18824dfc5 100644 --- a/scripts/__path/__path.gml +++ b/scripts/__path/__path.gml @@ -12,9 +12,9 @@ function Path() constructor { static getLineCount = function() { return 1; } static getTangentRatio = function(_rat) { return 0; } - static getPointDistance = function(_seg) { return new Point(0, 0); } - static getPointSegment = function(_seg) { return new Point(0, 0); } - static getPointRatio = function(_rat) { return new Point(0, 0); } + static getPointDistance = function(_seg) { return new __vec2(0, 0); } + static getPointSegment = function(_seg) { return new __vec2(0, 0); } + static getPointRatio = function(_rat) { return new __vec2(0, 0); } } function PathSegment() : Path() constructor { @@ -69,7 +69,7 @@ function PathSegment() : Path() constructor { _dist -= lengths[i]; } - return new Point(0, 0); + return new __vec2(0, 0); } static getPointSegment = function(_seg) { diff --git a/scripts/__point/__point.gml b/scripts/__point/__point.gml deleted file mode 100644 index 2136cfefc..000000000 --- a/scripts/__point/__point.gml +++ /dev/null @@ -1,26 +0,0 @@ -function Point(x = 0, y = 0) constructor { - if(is_array(x)) { - self.x = x[0]; - self.y = x[1]; - } else { - self.x = x; - self.y = y; - } - - u = 0; - v = 0; - - static add = function(x, y) { self.x += x; self.y += y; return self; } - static addPoint = function(p) { self.x += p.x; self.y += p.y; return self; } - - static _add = function(x, y) { return new Point(self.x + x, self.y + y); } - static _addPoint = function(p) { return new Point(self.x + p.x, self.y + p.y); } - - static lerpTo = function(p, rat) { return new Point( lerp(x, p.x, rat), lerp(y, p.y, rat) ); } - static directionTo = function(p) { return point_direction(x, y, p.x, p.y); } - static distanceTo = function(p) { return point_distance(x, y, p.x, p.y); } - - static equal = function(p) { return x == p.x && y == p.y; } - static clone = function(){ return new Point(x, y); } - static toArray = function() { return [ x, y ]; } -} \ No newline at end of file diff --git a/scripts/__point/__point.yy b/scripts/__point/__point.yy deleted file mode 100644 index 02a2f66a2..000000000 --- a/scripts/__point/__point.yy +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resourceType": "GMScript", - "resourceVersion": "1.0", - "name": "__point", - "isCompatibility": false, - "isDnD": false, - "parent": { - "name": "geometry", - "path": "folders/functions/geometry.yy", - }, -} \ No newline at end of file diff --git a/scripts/__polygon/__polygon.gml b/scripts/__polygon/__polygon.gml index 4ecff566a..5e28e1f4d 100644 --- a/scripts/__polygon/__polygon.gml +++ b/scripts/__polygon/__polygon.gml @@ -197,7 +197,7 @@ function polygon_triangulate_convex_fan(points) { cx /= amo; cy /= amo; - var pc = new Point(cx, cy); + var pc = new __vec2(cx, cy); for( var i = 0; i < amo; i++ ) { array_push(triangles, [ points[i], points[(i + 1) % amo], pc ]); } diff --git a/scripts/__shapes/__shapes.gml b/scripts/__shapes/__shapes.gml index fb40985b6..25f0ef24a 100644 --- a/scripts/__shapes/__shapes.gml +++ b/scripts/__shapes/__shapes.gml @@ -8,12 +8,12 @@ function SHAPE_rectangle(_sca) { var triangles = [ - [ new Point(-_sca[0], -_sca[1]), new Point( _sca[0], -_sca[1]), new Point(-_sca[0], _sca[1]) ], - [ new Point( _sca[0], -_sca[1]), new Point(-_sca[0], _sca[1]), new Point( _sca[0], _sca[1]) ], + [ new __vec2(-_sca[0], -_sca[1]), new __vec2( _sca[0], -_sca[1]), new __vec2(-_sca[0], _sca[1]) ], + [ new __vec2( _sca[0], -_sca[1]), new __vec2(-_sca[0], _sca[1]), new __vec2( _sca[0], _sca[1]) ], ]; - var segment = [ new Point(-_sca[0], -_sca[1]), new Point( _sca[0], -_sca[1]), - new Point( _sca[0], _sca[1]), new Point(-_sca[0], _sca[1]), - new Point(-_sca[0], -_sca[1]) ]; + var segment = [ new __vec2(-_sca[0], -_sca[1]), new __vec2( _sca[0], -_sca[1]), + new __vec2( _sca[0], _sca[1]), new __vec2(-_sca[0], _sca[1]), + new __vec2(-_sca[0], -_sca[1]) ]; return [ [{ type: SHAPE_TYPE.triangles, triangles: triangles }], @@ -33,10 +33,10 @@ var x1 = lengthdir_x(0.5, (i + 1) * ang) * _sca[0] * 2; var y1 = lengthdir_y(0.5, (i + 1) * ang) * _sca[1] * 2; - array_push(triangles, [ new Point(0, 0), new Point(x0, y0), new Point(x1, y1) ]); + array_push(triangles, [ new __vec2(0, 0), new __vec2(x0, y0), new __vec2(x1, y1) ]); - if(i == 0) array_push(segment, new Point(x0, y0)); - array_push(segment, new Point(x1, y1)); + if(i == 0) array_push(segment, new __vec2(x0, y0)); + array_push(segment, new __vec2(x1, y1)); } return [ @@ -57,16 +57,16 @@ var inx = lengthdir_x(inner / 2, (i + 0.5) / prec * 360) * _sca[0] * 2; var iny = lengthdir_y(inner / 2, (i + 0.5) / prec * 360) * _sca[1] * 2; - array_push(triangles, [ new Point(0, 0), new Point(otx, oty), new Point(inx, iny) ]); + array_push(triangles, [ new __vec2(0, 0), new __vec2(otx, oty), new __vec2(inx, iny) ]); - var pi0 = new Point(inx, iny); + var pi0 = new __vec2(inx, iny); var inx = lengthdir_x(inner / 2, (i - 0.5) / prec * 360) * _sca[0] * 2; var iny = lengthdir_y(inner / 2, (i - 0.5) / prec * 360) * _sca[1] * 2; - array_push(triangles, [ new Point(0, 0), new Point(otx, oty), new Point(inx, iny) ]); + array_push(triangles, [ new __vec2(0, 0), new __vec2(otx, oty), new __vec2(inx, iny) ]); - array_push(segment, new Point(inx, iny)); - array_push(segment, new Point(otx, oty)); + array_push(segment, new __vec2(inx, iny)); + array_push(segment, new __vec2(otx, oty)); array_push(segment, pi0); } @@ -82,11 +82,11 @@ var hh = _sca[1] * rad; var shapes = []; var segment = []; - array_push(segment, new Point(-_sca[0] + _sca[1], _sca[1]), new Point( _sca[0] - hh, hh)); + array_push(segment, new __vec2(-_sca[0] + _sca[1], _sca[1]), new __vec2( _sca[0] - hh, hh)); var triangles = [ - [ new Point(-_sca[0] + _sca[1], -_sca[1]), new Point( _sca[0] - hh, -hh), new Point(-_sca[0] + _sca[1], _sca[1]) ], - [ new Point( _sca[0] - hh, -hh), new Point(-_sca[0] + _sca[1], _sca[1]), new Point( _sca[0] - hh, hh) ], + [ new __vec2(-_sca[0] + _sca[1], -_sca[1]), new __vec2( _sca[0] - hh, -hh), new __vec2(-_sca[0] + _sca[1], _sca[1]) ], + [ new __vec2( _sca[0] - hh, -hh), new __vec2(-_sca[0] + _sca[1], _sca[1]), new __vec2( _sca[0] - hh, hh) ], ]; shapes[0] = { type: SHAPE_TYPE.triangles, triangles: triangles }; @@ -100,17 +100,17 @@ ny = cy + lengthdir_y(_sca[1], na); if(i) { - array_push(triangles, [ new Point(cx, cy), new Point(ox, oy), new Point(nx, ny) ]); - array_push(segment, new Point(ox, oy)); + array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]); + array_push(segment, new __vec2(ox, oy)); } - array_push(segment, new Point(nx, ny)); + array_push(segment, new __vec2(nx, ny)); oa = na; ox = nx; oy = ny; } - array_push(segment, new Point(-_sca[0] + _sca[1], -_sca[1]), new Point( _sca[0] - hh, -hh)); + array_push(segment, new __vec2(-_sca[0] + _sca[1], -_sca[1]), new __vec2( _sca[0] - hh, -hh)); shapes[1] = { type: SHAPE_TYPE.triangles, triangles: triangles }; var triangles = []; @@ -124,10 +124,10 @@ ny = cy + lengthdir_y(hh, na); if(i) { - array_push(triangles, [ new Point(cx, cy), new Point(ox, oy), new Point(nx, ny) ]); - array_push(_seg, new Point(ox, oy)); + array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]); + array_push(_seg, new __vec2(ox, oy)); } - array_push(_seg, new Point(nx, ny)); + array_push(_seg, new __vec2(nx, ny)); oa = na; ox = nx; @@ -164,12 +164,12 @@ var nx1 = lengthdir_x(0.5, (i + 1) / prec * 360) * _sca[0] * 2; var ny1 = lengthdir_y(0.5, (i + 1) / prec * 360) * _sca[1] * 2; - array_push(triangles, [ new Point(ix0, iy0), new Point(nx0, ny0), new Point(nx1, ny1) ]); - array_push(triangles, [ new Point(ix0, iy0), new Point(nx1, ny1), new Point(ix1, iy1) ]); + array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]); + array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]); if(i == 0) - array_push(segment, new Point(nx0, ny0)); - array_push(segment, new Point(nx1, ny1)); + array_push(segment, new __vec2(nx0, ny0)); + array_push(segment, new __vec2(nx1, ny1)); } return [ @@ -202,11 +202,11 @@ var nx1 = lengthdir_x(body, (i + 1) / prec * 360) * _sca[0] * 2; var ny1 = lengthdir_y(body, (i + 1) / prec * 360) * _sca[1] * 2; - array_push(triangles, [ new Point(ix0, iy0), new Point(nx0, ny0), new Point(nx1, ny1) ]); - array_push(triangles, [ new Point(ix0, iy0), new Point(nx1, ny1), new Point(ix1, iy1) ]); + array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]); + array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]); if(i == 0) - array_push(segment, new Point(nx0, ny0)); + array_push(segment, new __vec2(nx0, ny0)); if(i % 2) { var tx0 = nx0 + lengthdir_x(teth, (i + 0.5 - teethT) / prec * 360) * _sca[0] * 2; @@ -215,14 +215,14 @@ var tx1 = nx1 + lengthdir_x(teth, (i + 0.5 + teethT) / prec * 360) * _sca[0] * 2; var ty1 = ny1 + lengthdir_y(teth, (i + 0.5 + teethT) / prec * 360) * _sca[1] * 2; - array_push(triangles, [ new Point(tx0, ty0), new Point(nx0, ny0), new Point(nx1, ny1) ]); - array_push(triangles, [ new Point(tx0, ty0), new Point(nx1, ny1), new Point(tx1, ty1) ]); + array_push(triangles, [ new __vec2(tx0, ty0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]); + array_push(triangles, [ new __vec2(tx0, ty0), new __vec2(nx1, ny1), new __vec2(tx1, ty1) ]); - array_push(segment, new Point(tx0, ty0)); - array_push(segment, new Point(tx1, ty1)); + array_push(segment, new __vec2(tx0, ty0)); + array_push(segment, new __vec2(tx1, ty1)); } - array_push(segment, new Point(nx1, ny1)); + array_push(segment, new __vec2(nx1, ny1)); } return [ @@ -238,34 +238,34 @@ var side = min(_sca[0], _sca[1]) * inner; array_push(triangles, - [ new Point(-side, -side), new Point( side, -side), new Point(-side, side) ], - [ new Point( side, -side), new Point(-side, side), new Point( side, side) ], + [ new __vec2(-side, -side), new __vec2( side, -side), new __vec2(-side, side) ], + [ new __vec2( side, -side), new __vec2(-side, side), new __vec2( side, side) ], ); array_push(triangles, //top - [ new Point(-side, -side), new Point( side, -side), new Point(-side, -_sca[1]) ], - [ new Point( side, -side), new Point(-side, -_sca[1]), new Point( side, -_sca[1]) ], + [ new __vec2(-side, -side), new __vec2( side, -side), new __vec2(-side, -_sca[1]) ], + [ new __vec2( side, -side), new __vec2(-side, -_sca[1]), new __vec2( side, -_sca[1]) ], ); array_push(triangles, //bottom - [ new Point(-side, _sca[1]), new Point( side, _sca[1]), new Point(-side, side) ], - [ new Point( side, _sca[1]), new Point(-side, side), new Point( side, side) ], + [ new __vec2(-side, _sca[1]), new __vec2( side, _sca[1]), new __vec2(-side, side) ], + [ new __vec2( side, _sca[1]), new __vec2(-side, side), new __vec2( side, side) ], ); array_push(triangles, //left - [ new Point( -side, -side), new Point(-_sca[0], -side), new Point(-side, side) ], - [ new Point(-_sca[0], -side), new Point(-side, side), new Point(-_sca[0], side) ], + [ new __vec2( -side, -side), new __vec2(-_sca[0], -side), new __vec2(-side, side) ], + [ new __vec2(-_sca[0], -side), new __vec2(-side, side), new __vec2(-_sca[0], side) ], ); array_push(triangles, //right - [ new Point(_sca[0], -side), new Point( side, -side), new Point(_sca[0], side) ], - [ new Point( side, -side), new Point(_sca[0], side), new Point( side, side) ], + [ new __vec2(_sca[0], -side), new __vec2( side, -side), new __vec2(_sca[0], side) ], + [ new __vec2( side, -side), new __vec2(_sca[0], side), new __vec2( side, side) ], ); - array_push(segment, new Point(-side, -side), new Point(-side, -_sca[1]), new Point( side, -_sca[1]), new Point(side, -side) ); - array_push(segment, new Point(_sca[0], -side), new Point(_sca[0], side), new Point( side, side)); - array_push(segment, new Point(side, _sca[1]), new Point(-side, _sca[1]), new Point(-side, side)); - array_push(segment, new Point(-_sca[0], side), new Point(-_sca[0], -side), new Point(-side, -side)); + array_push(segment, new __vec2(-side, -side), new __vec2(-side, -_sca[1]), new __vec2( side, -_sca[1]), new __vec2(side, -side) ); + array_push(segment, new __vec2(_sca[0], -side), new __vec2(_sca[0], side), new __vec2( side, side)); + array_push(segment, new __vec2(side, _sca[1]), new __vec2(-side, _sca[1]), new __vec2(-side, side)); + array_push(segment, new __vec2(-_sca[0], side), new __vec2(-_sca[0], -side), new __vec2(-side, -side)); return [ [{ type: SHAPE_TYPE.triangles, triangles: triangles }], @@ -300,12 +300,12 @@ var nx0 = lengthdir_x(0.5, oa) * _sca[0] * 2; var ny0 = lengthdir_y(0.5, oa) * _sca[1] * 2; - array_push(triangles, [ new Point(ix0, iy0), new Point(nx0, ny0), new Point(nx1, ny1) ]); - array_push(triangles, [ new Point(ix0, iy0), new Point(nx1, ny1), new Point(ix1, iy1) ]); + array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx0, ny0), new __vec2(nx1, ny1) ]); + array_push(triangles, [ new __vec2(ix0, iy0), new __vec2(nx1, ny1), new __vec2(ix1, iy1) ]); } - array_push(sgArcI, new Point(ix1, iy1)); - array_push(sgArcO, new Point(nx1, ny1)); + array_push(sgArcI, new __vec2(ix1, iy1)); + array_push(sgArcO, new __vec2(nx1, ny1)); oa = na; } @@ -322,9 +322,9 @@ nx = cx + lengthdir_x((1 - inner) / 2, na) * _sca[0]; ny = cy + lengthdir_y((1 - inner) / 2, na) * _sca[1]; - if(i) array_push(triangles, [ new Point(cx, cy), new Point(ox, oy), new Point(nx, ny) ]); + if(i) array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]); - array_push(sgCapI, new Point(nx, ny)); + array_push(sgCapI, new __vec2(nx, ny)); oa = na; ox = nx; @@ -340,9 +340,9 @@ nx = cx + lengthdir_x((1 - inner) / 2, na) * _sca[0]; ny = cy + lengthdir_y((1 - inner) / 2, na) * _sca[1]; - if(i) array_push(triangles, [ new Point(cx, cy), new Point(ox, oy), new Point(nx, ny) ]); + if(i) array_push(triangles, [ new __vec2(cx, cy), new __vec2(ox, oy), new __vec2(nx, ny) ]); - array_push(sgCapO, new Point(nx, ny)); + array_push(sgCapO, new __vec2(nx, ny)); oa = na; ox = nx; diff --git a/scripts/__strandSim/__strandSim.gml b/scripts/__strandSim/__strandSim.gml index a19170aa7..48a571a95 100644 --- a/scripts/__strandSim/__strandSim.gml +++ b/scripts/__strandSim/__strandSim.gml @@ -409,7 +409,7 @@ function StrandMesh() constructor { } static getPointRatio = function(rat, ind = 0) { - if(array_length(hairs) == 0) return new Point(); + if(array_length(hairs) == 0) return new __vec2(); var h = array_safe_get(hairs, ind); var sg = rat * (array_length(h.points) - 1); @@ -418,7 +418,7 @@ function StrandMesh() constructor { var p0 = array_safe_get(h.points, floor(sg)); var p1 = array_safe_get(h.points, floor(sg) + 1); - return new Point(lerp(p0.x, p1.x, fr), lerp(p0.y, p1.y, fr)); + return new __vec2(lerp(p0.x, p1.x, fr), lerp(p0.y, p1.y, fr)); } static getLineCount = function() { diff --git a/scripts/__vec2/__vec2.gml b/scripts/__vec2/__vec2.gml new file mode 100644 index 000000000..aa933b5e6 --- /dev/null +++ b/scripts/__vec2/__vec2.gml @@ -0,0 +1,181 @@ +function __vec2(_x = 0, _y = _x) constructor { + static set = function(_x = 0, _y = _x) { #region + if(is_struct(_x) && is_instanceof(_x, __vec2)) { + x = _x.x; + y = _x.y; + return self; + } + + if(is_struct(_x) && is_instanceof(_x, BBMOD_Vec2)) { + x = _x.X; + y = _x.Y; + return self; + } + + if(is_array(_x)) { + x = _x[0]; + y = _x[1]; + return self; + } + + x = _x; + y = _y; + return self; + } set(_x, _y); #endregion + + static setIndex = function(index, value) { #region + gml_pragma("forceinline"); + switch(index) { + case 0 : x = value; break; + case 1 : y = value; break; + } + return self; + } #endregion + + static getIndex = function(index) { #region + switch(index) { + case 0 : return x; + case 1 : return y; + } + return 0; + } #endregion + + static addElement = function(_x, _y) { #region + gml_pragma("forceinline"); + return new __vec2(x + _x, y + _y); + } #endregion + static _addElement = function(_x, _y) { #region + gml_pragma("forceinline"); + x += _x; + y += _y; + return self; + } #endregion + + static add = function(_vec2) { #region + gml_pragma("forceinline"); + return new __vec2(x + _vec2.x, y + _vec2.y); + } #endregion + static _add = function(_vec2) { #region + gml_pragma("forceinline"); + x += _vec2.x; + y += _vec2.y; + return self; + } #endregion + + static subtract = function(_vec2) { #region + gml_pragma("forceinline"); + return new __vec2(x - _vec2.x, y - _vec2.y); + } #endregion + static _subtract = function(_vec2) { #region + gml_pragma("forceinline"); + x -= _vec2.x; + y -= _vec2.y; + return self; + } #endregion + + static multiply = function(_scalar) { #region + gml_pragma("forceinline"); + return new __vec2(x * _scalar, y * _scalar); + } #endregion + static _multiply = function(_scalar) { #region + gml_pragma("forceinline"); + x *= _scalar; + y *= _scalar; + return self; + } #endregion + + static multiplyVec = function(_vec) { #region + gml_pragma("forceinline"); + return new __vec2(x * _vec.x, y * _vec.y); + } #endregion + static _multiplyVec = function(_vec) { #region + gml_pragma("forceinline"); + x *= _vec.x; + y *= _vec.y; + return self; + } #endregion + + static divide = function(_scalar) { #region + gml_pragma("forceinline"); + if (_scalar != 0) + return new __vec2(x / _scalar, y / _scalar); + + return new __vec2(x, y, z); // Avoid division by zero + } #endregion + static _divide = function(_scalar) { #region + gml_pragma("forceinline"); + if (_scalar != 0) { + x /= _scalar; + y /= _scalar; + } + return self; + } #endregion + + static dot = function(_vec2) { #region + gml_pragma("forceinline"); + return x * _vec2.x + y * _vec2.y; + } #endregion + + static distance = function(_vec2) { #region + gml_pragma("forceinline"); + var dx = _vec2.x - x; + var dy = _vec2.y - y; + return sqrt(dx * dx + dy * dy); + } #endregion + + static directionTo = function(_vec2) { #region + gml_pragma("forceinline"); + return point_direction(x, y, _vec2.x, _vec2.y); + } #endregion + + static length = function() { #region + gml_pragma("forceinline"); + return sqrt(x * x + y * y); + } #endregion + + static normalize = function() { #region + gml_pragma("forceinline"); + return clone()._normalize(); + } #endregion + static _normalize = function() { #region + gml_pragma("forceinline"); + var _length = length(); + if (_length != 0) { + x /= _length; + y /= _length; + } + return self; + } #endregion + + static lerpTo = function(to, speed = 0.3) { #region + gml_pragma("forceinline"); + return new __vec2(lerp(x, to.x, speed), lerp(y, to.y, speed)); + } #endregion + static _lerpTo = function(to, speed = 0.3) { #region + gml_pragma("forceinline"); + x = lerp(x, to.x, speed); + y = lerp(y, to.y, speed); + } #endregion + + static _lerp_float = function(to, speed = 5, pre = 0.01) { #region + gml_pragma("forceinline"); + x = lerp_float(x, to.x, speed, pre); + y = lerp_float(y, to.y, speed, pre); + } #endregion + + static equal = function(to) { #region + gml_pragma("forceinline"); + return x == to.x && y == to.y; + } #endregion + + static clone = function() { #region + gml_pragma("forceinline"); + return new __vec2(x, y); + } #endregion + + static toString = function() { return $"[{x}, {y}]"; } + + static toBBMOD = function() { return new BBMOD_Vec2(x, y); } + + static toArray = function() { return [ x, y ]; } +} \ No newline at end of file diff --git a/scripts/d3d_vec3/d3d_vec3.yy b/scripts/__vec2/__vec2.yy similarity index 59% rename from scripts/d3d_vec3/d3d_vec3.yy rename to scripts/__vec2/__vec2.yy index ef49e3dd8..e054c3320 100644 --- a/scripts/d3d_vec3/d3d_vec3.yy +++ b/scripts/__vec2/__vec2.yy @@ -1,11 +1,11 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "d3d_vec3", + "name": "__vec2", "isCompatibility": false, "isDnD": false, "parent": { - "name": "util", - "path": "folders/functions/3d/util.yy", + "name": "vector", + "path": "folders/functions/vector.yy", }, } \ No newline at end of file diff --git a/scripts/d3d_vec3/d3d_vec3.gml b/scripts/__vec3/__vec3.gml similarity index 68% rename from scripts/d3d_vec3/d3d_vec3.gml rename to scripts/__vec3/__vec3.gml index c771c41c0..fa082eece 100644 --- a/scripts/d3d_vec3/d3d_vec3.gml +++ b/scripts/__vec3/__vec3.gml @@ -3,7 +3,7 @@ #macro __vec3_up new __vec3(0.0, 0.0, 1.0) function __vec3(_x = 0, _y = _x, _z = _x) constructor { - static set = function(_x = 0, _y = _x, _z = _x) { + static set = function(_x = 0, _y = _x, _z = _x) { #region if(is_struct(_x) && is_instanceof(_x, __vec3)) { x = _x.x; y = _x.y; @@ -29,14 +29,14 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { y = _y; z = _z; return self; - } set(_x, _y, _z); + } set(_x, _y, _z); #endregion - static isZero = function() { + static isZero = function() { #region gml_pragma("forceinline"); return x == 0 && y == 0 && z == 0; - } + } #endregion - static setIndex = function(index, value) { + static setIndex = function(index, value) { #region gml_pragma("forceinline"); switch(index) { case 0 : x = value; break; @@ -44,92 +44,73 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { case 2 : z = value; break; } return self; - } + } #endregion - static getIndex = function(index) { + static getIndex = function(index) { #region switch(index) { case 0 : return x; case 1 : return y; case 2 : return z; } return 0; - } + } #endregion - static add = function(_vec3) { + static add = function(_vec3) { #region gml_pragma("forceinline"); return new __vec3(x + _vec3.x, y + _vec3.y, z + _vec3.z); - } - - static subtract = function(_vec3) { - gml_pragma("forceinline"); - return new __vec3(x - _vec3.x, y - _vec3.y, z - _vec3.z); - } - - static multiply = function(_scalar) { - gml_pragma("forceinline"); - return new __vec3(x * _scalar, y * _scalar, z * _scalar); - } - - static multiplyVec = function(_vec) { - gml_pragma("forceinline"); - return new __vec3(x * _vec.x, y * _vec.y, z * _vec.z); - } - - static divide = function(_scalar) { - gml_pragma("forceinline"); - if (_scalar != 0) - return new __vec3(x / _scalar, y / _scalar, z / _scalar); - - return new __vec3(x, y, z); // Avoid division by zero - } - - static dot = function(_vec3) { - gml_pragma("forceinline"); - return x * _vec3.x + y * _vec3.y + z * _vec3.z; - } - - static cross = function(_vec3) { - gml_pragma("forceinline"); - var cross_x = y * _vec3.z - z * _vec3.y; - var cross_y = z * _vec3.x - x * _vec3.z; - var cross_z = x * _vec3.y - y * _vec3.x; - return new __vec3(cross_x, cross_y, cross_z); - } - - // In-place computation functions - static _add = function(_vec3) { + } #endregion + static _add = function(_vec3) { #region gml_pragma("forceinline"); x += _vec3.x; y += _vec3.y; z += _vec3.z; return self; - } + } #endregion - static _subtract = function(_vec3) { + static subtract = function(_vec3) { #region + gml_pragma("forceinline"); + return new __vec3(x - _vec3.x, y - _vec3.y, z - _vec3.z); + } #endregion + static _subtract = function(_vec3) { #region gml_pragma("forceinline"); x -= _vec3.x; y -= _vec3.y; z -= _vec3.z; return self; - } + } #endregion - static _multiply = function(_scalar) { + static multiply = function(_scalar) { #region + gml_pragma("forceinline"); + return new __vec3(x * _scalar, y * _scalar, z * _scalar); + } #endregion + static _multiply = function(_scalar) { #region gml_pragma("forceinline"); x *= _scalar; y *= _scalar; z *= _scalar; return self; - } + } #endregion - static _multiplyVec = function(_vec) { + static multiplyVec = function(_vec) { #region + gml_pragma("forceinline"); + return new __vec3(x * _vec.x, y * _vec.y, z * _vec.z); + } #endregion + static _multiplyVec = function(_vec) { #region gml_pragma("forceinline"); x *= _vec.x; y *= _vec.y; z *= _vec.z; return self; - } + } #endregion - static _divide = function(_scalar) { + static divide = function(_scalar) { #region + gml_pragma("forceinline"); + if (_scalar != 0) + return new __vec3(x / _scalar, y / _scalar, z / _scalar); + + return new __vec3(x, y, z); // Avoid division by zero + } #endregion + static _divide = function(_scalar) { #region gml_pragma("forceinline"); if (_scalar != 0) { x /= _scalar; @@ -137,27 +118,39 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { z /= _scalar; } return self; - } + } #endregion + + static dot = function(_vec3) { #region + gml_pragma("forceinline"); + return x * _vec3.x + y * _vec3.y + z * _vec3.z; + } #endregion - static distance = function(_vec3) { + static cross = function(_vec3) { #region + gml_pragma("forceinline"); + var cross_x = y * _vec3.z - z * _vec3.y; + var cross_y = z * _vec3.x - x * _vec3.z; + var cross_z = x * _vec3.y - y * _vec3.x; + return new __vec3(cross_x, cross_y, cross_z); + } #endregion + + static distance = function(_vec3) { #region gml_pragma("forceinline"); var dx = _vec3.x - x; var dy = _vec3.y - y; var dz = _vec3.z - z; return sqrt(dx * dx + dy * dy + dz * dz); - } + } #endregion - static length = function() { + static length = function() { #region gml_pragma("forceinline"); return sqrt(x * x + y * y + z * z); - } + } #endregion - static normalize = function() { + static normalize = function() { #region gml_pragma("forceinline"); return clone()._normalize(); - } - - static _normalize = function() { + } #endregion + static _normalize = function() { #region gml_pragma("forceinline"); var _length = length(); if (_length != 0) { @@ -166,49 +159,49 @@ function __vec3(_x = 0, _y = _x, _z = _x) constructor { z /= _length; } return self; - } + } #endregion - static _lerp = function(to, speed = 0.3) { + static _lerpTo = function(to, speed = 0.3) { #region gml_pragma("forceinline"); x = lerp(x, to.x, speed); y = lerp(y, to.y, speed); z = lerp(z, to.z, speed); - } + } #endregion - static _lerp_float = function(to, speed = 5, pre = 0.01) { + static _lerp_float = function(to, speed = 5, pre = 0.01) { #region gml_pragma("forceinline"); x = lerp_float(x, to.x, speed, pre); y = lerp_float(y, to.y, speed, pre); z = lerp_float(z, to.z, speed, pre); - } + } #endregion - static equal = function(to) { + static equal = function(to) { #region gml_pragma("forceinline"); return x == to.x && y == to.y && z == to.z; - } + } #endregion - static minVal = function(vec) { + static minVal = function(vec) { #region gml_pragma("forceinline"); return new __vec3( min(x, vec.x), min(y, vec.y), min(z, vec.z), ); - } + } #endregion - static maxVal = function(vec) { + static maxVal = function(vec) { #region gml_pragma("forceinline"); return new __vec3( max(x, vec.x), max(y, vec.y), max(z, vec.z), ); - } + } #endregion - static clone = function() { + static clone = function() { #region gml_pragma("forceinline"); return new __vec3(x, y, z); - } + } #endregion static toString = function() { return $"[{x}, {y}, {z}]"; } diff --git a/scripts/d3d_vec2/d3d_vec2.yy b/scripts/__vec3/__vec3.yy similarity index 59% rename from scripts/d3d_vec2/d3d_vec2.yy rename to scripts/__vec3/__vec3.yy index dd75f1fab..0ca6b258a 100644 --- a/scripts/d3d_vec2/d3d_vec2.yy +++ b/scripts/__vec3/__vec3.yy @@ -1,11 +1,11 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "d3d_vec2", + "name": "__vec3", "isCompatibility": false, "isDnD": false, "parent": { - "name": "util", - "path": "folders/functions/3d/util.yy", + "name": "vector", + "path": "folders/functions/vector.yy", }, } \ No newline at end of file diff --git a/scripts/d3d_vec4/d3d_vec4.gml b/scripts/__vec4/__vec4.gml similarity index 98% rename from scripts/d3d_vec4/d3d_vec4.gml rename to scripts/__vec4/__vec4.gml index 5a60a0a07..23e138634 100644 --- a/scripts/d3d_vec4/d3d_vec4.gml +++ b/scripts/__vec4/__vec4.gml @@ -145,7 +145,7 @@ function __vec4(_x = 0, _y = _x, _z = _x, _w = _x) constructor { return self; } - static _lerp = function(to, speed = 0.3) { + static _lerpTo = function(to, speed = 0.3) { gml_pragma("forceinline"); x = lerp(x, to.x, speed); y = lerp(y, to.y, speed); diff --git a/scripts/d3d_vec4/d3d_vec4.yy b/scripts/__vec4/__vec4.yy similarity index 59% rename from scripts/d3d_vec4/d3d_vec4.yy rename to scripts/__vec4/__vec4.yy index 848b3df24..1e94aab28 100644 --- a/scripts/d3d_vec4/d3d_vec4.yy +++ b/scripts/__vec4/__vec4.yy @@ -1,11 +1,11 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "d3d_vec4", + "name": "__vec4", "isCompatibility": false, "isDnD": false, "parent": { - "name": "util", - "path": "folders/functions/3d/util.yy", + "name": "vector", + "path": "folders/functions/vector.yy", }, } \ No newline at end of file diff --git a/scripts/d3_vector/d3_vector.gml b/scripts/__vector/__vector.gml similarity index 100% rename from scripts/d3_vector/d3_vector.gml rename to scripts/__vector/__vector.gml diff --git a/scripts/d3_vector/d3_vector.yy b/scripts/__vector/__vector.yy similarity index 59% rename from scripts/d3_vector/d3_vector.yy rename to scripts/__vector/__vector.yy index c225297d6..d768e258d 100644 --- a/scripts/d3_vector/d3_vector.yy +++ b/scripts/__vector/__vector.yy @@ -1,11 +1,11 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "d3_vector", + "name": "__vector", "isCompatibility": false, "isDnD": false, "parent": { - "name": "util", - "path": "folders/functions/3d/util.yy", + "name": "vector", + "path": "folders/functions/vector.yy", }, } \ No newline at end of file diff --git a/scripts/checkboxGroup/checkboxGroup.gml b/scripts/checkboxGroup/checkboxGroup.gml index 6a9ed20b0..82afa8d73 100644 --- a/scripts/checkboxGroup/checkboxGroup.gml +++ b/scripts/checkboxGroup/checkboxGroup.gml @@ -10,7 +10,7 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor { } static drawParam = function(params) { - return draw(params.x, params.y, params.data, params.m); + return draw(params.x, params.y, params.data, params.m, params.s); } static draw = function(_x, _y, _value, _m, ss = ui(28), halign = fa_left, valign = fa_top) { @@ -56,7 +56,7 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor { draw_sprite_stretched_ext(spr, ind, _dx, _dy, ss, ss, c_white, aa); if(_value[i]) draw_sprite_stretched_ext(spr, 3, _dx, _dy, ss, ss, COLORS._main_accent, 1); - draw_sprite_stretched_ext(sprs, i, _dx, _dy, ss, ss, c_white, 0.5 + _value[i] * 0.5); + draw_sprite_ext(sprs, i, _dx + ss / 2, _dy + ss / 2, 1, 1, 0, c_white, 0.5 + _value[i] * 0.5); _dx += ss; } diff --git a/scripts/d3d_matrix3/d3d_matrix3.yy b/scripts/d3d_matrix3/d3d_matrix3.yy deleted file mode 100644 index a417eec8a..000000000 --- a/scripts/d3d_matrix3/d3d_matrix3.yy +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resourceType": "GMScript", - "resourceVersion": "1.0", - "name": "d3d_matrix3", - "isCompatibility": false, - "isDnD": false, - "parent": { - "name": "util", - "path": "folders/functions/3d/util.yy", - }, -} \ No newline at end of file diff --git a/scripts/d3d_matrix4/d3d_matrix4.yy b/scripts/d3d_matrix4/d3d_matrix4.yy deleted file mode 100644 index 0266cfee2..000000000 --- a/scripts/d3d_matrix4/d3d_matrix4.yy +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resourceType": "GMScript", - "resourceVersion": "1.0", - "name": "d3d_matrix4", - "isCompatibility": false, - "isDnD": false, - "parent": { - "name": "util", - "path": "folders/functions/3d/util.yy", - }, -} \ No newline at end of file diff --git a/scripts/d3d_scene/d3d_scene.gml b/scripts/d3d_scene/d3d_scene.gml index 5d79b3ea8..c27000b0d 100644 --- a/scripts/d3d_scene/d3d_scene.gml +++ b/scripts/d3d_scene/d3d_scene.gml @@ -37,9 +37,9 @@ function __3dScene(camera) constructor { lightAmbient = c_black; lightDir_max = 16; - lightDir_shadow_max = 4; + lightDir_shadow_max = 2; lightPnt_max = 16; - lightPnt_shadow_max = 4; + lightPnt_shadow_max = 2; cull_mode = cull_noculling; enviroment_map = noone; @@ -47,7 +47,9 @@ function __3dScene(camera) constructor { draw_background = false; - defer_normal = true; + defer_normal = true; + defer_normal_radius = 0; + show_normal = false; geometry_data = [ noone, noone, noone ]; @@ -156,15 +158,17 @@ function __3dScene(camera) constructor { gpu_set_ztestenable(false); surface_reset_target(); - var _normal_blurred = surface_create_size(geometry_data[2], surface_rgba32float); - surface_set_shader(_normal_blurred, sh_d3d_normal_blur); - shader_set_f("radius", 5); - shader_set_dim("dimension", geometry_data[2]); - draw_surface_safe(geometry_data[2]); - surface_reset_shader(); + if(defer_normal_radius) { + var _normal_blurred = surface_create_size(geometry_data[2], surface_rgba32float); + surface_set_shader(_normal_blurred, sh_d3d_normal_blur); + shader_set_f("radius", defer_normal_radius); + shader_set_dim("dimension", geometry_data[2]); + draw_surface_safe(geometry_data[2]); + surface_reset_shader(); - surface_free(geometry_data[2]); - geometry_data[2] = _normal_blurred; + surface_free(geometry_data[2]); + geometry_data[2] = _normal_blurred; + } } #endregion static ssaoPass = function() { #region diff --git a/scripts/d3d_vec2/d3d_vec2.gml b/scripts/d3d_vec2/d3d_vec2.gml deleted file mode 100644 index 33a1644c9..000000000 --- a/scripts/d3d_vec2/d3d_vec2.gml +++ /dev/null @@ -1,36 +0,0 @@ -function __vec2(_x = 0, _y = _x) constructor { - static set = function(_x = 0, _y = _x) { - if(is_struct(_x) && is_instanceof(_x, __vec2)) { - x = _x.x; - y = _x.y; - return self; - } - - if(is_struct(_x) && is_instanceof(_x, BBMOD_Vec2)) { - x = _x.X; - y = _x.Y; - return self; - } - - if(is_array(_x)) { - x = _x[0]; - y = _x[1]; - return self; - } - - x = _x; - y = _y; - return self; - } set(_x, _y); - - static clone = function() { - gml_pragma("forceinline"); - return new __vec2(x, y); - } - - static toString = function() { return $"[{x}, {y}]"; } - - static toBBMOD = function() { return new BBMOD_Vec2(x, y); } - - static toArray = function() { return [ x, y ]; } -} \ No newline at end of file diff --git a/scripts/delau_helper/delau_helper.gml b/scripts/delau_helper/delau_helper.gml index 4a4663f5b..4bc5b8203 100644 --- a/scripts/delau_helper/delau_helper.gml +++ b/scripts/delau_helper/delau_helper.gml @@ -63,9 +63,9 @@ function _create_super_triangle(points) { var center_x = (min_x + max_x) / 2, center_y = (min_y + max_y) / 2; return [ - new Point(center_x - 2 * d_max, center_y - d_max), - new Point(center_x, center_y + 2 * d_max), - new Point(center_x + 2 * d_max, center_y - d_max) + new __vec2(center_x - 2 * d_max, center_y - d_max), + new __vec2(center_x, center_y + 2 * d_max), + new __vec2(center_x + 2 * d_max, center_y - d_max) ]; } diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 6d245f628..ae3fa9f56 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -101,10 +101,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER; - VERSION = 11506; + VERSION = 11510; SAVE_VERSION = 11500; - VERSION_STRING = "1.15.0.6"; - BUILD_NUMBER = 11506; + VERSION_STRING = "1.15.1.0"; + BUILD_NUMBER = 11510; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/node_3d_camera/node_3d_camera.gml b/scripts/node_3d_camera/node_3d_camera.gml index 6ef4ca36c..ede9d022a 100644 --- a/scripts/node_3d_camera/node_3d_camera.gml +++ b/scripts/node_3d_camera/node_3d_camera.gml @@ -70,6 +70,8 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) inputs[| in_d3d + 20] = nodeValue("AO Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1. ) .setDisplay(VALUE_DISPLAY.slider, [ 0.01, 4, 0.01 ]); + inputs[| in_d3d + 21] = nodeValue("Round Normal", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ); + outputs[| 0] = nodeValue("Rendered", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone ); outputs[| 1] = nodeValue("Normal", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone ) @@ -84,6 +86,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) ["Camera", false], in_d3d + 3, in_d3d + 0, in_d3d + 1, in_d3d + 8, ["Render", false], in_d3d + 5, in_d3d + 16, in_d3d + 6, in_d3d + 7, in_d3d + 15, ["Ambient Occlusion", false], in_d3d + 17, in_d3d + 20, in_d3d + 18, in_d3d + 19, + ["Effects", false], in_d3d + 21, ]; tool_lookat = new NodeTool( "Move Target", THEME.tools_3d_transform_object ); @@ -190,6 +193,8 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) var _aoBi = _data[in_d3d + 19]; var _aoSr = _data[in_d3d + 20]; + var _nrmSmt = _data[in_d3d + 21]; + var _qi1 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(0, 1, 0), 90); var _qi2 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(1, 0, 0), -90); var _qi3 = new BBMOD_Quaternion().FromAxisAngle(new BBMOD_Vec3(1, 0, 0), 90); @@ -255,6 +260,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group) scene.ssao_radius = _aoRa; scene.ssao_bias = _aoBi; scene.ssao_strength = _aoSr; + scene.defer_normal_radius = _nrmSmt; scene.draw_background = _dbg; diff --git a/scripts/node_armature_to_path/node_armature_to_path.gml b/scripts/node_armature_to_path/node_armature_to_path.gml index 703796660..b3d01ef49 100644 --- a/scripts/node_armature_to_path/node_armature_to_path.gml +++ b/scripts/node_armature_to_path/node_armature_to_path.gml @@ -65,13 +65,13 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const var _p0 = lines[_ind][0]; var _p1 = lines[_ind][1]; - if(!is_array(_p0) || array_length(_p0) < 2) return new Point(); - if(!is_array(_p1) || array_length(_p1) < 2) return new Point(); + if(!is_array(_p0) || array_length(_p0) < 2) return new __vec2(); + if(!is_array(_p1) || array_length(_p1) < 2) return new __vec2(); var _x = lerp(_p0[0], _p1[0], _rat); var _y = lerp(_p0[1], _p1[1], _rat); - return new Point( _x, _y ); + return new __vec2( _x, _y ); } function update() { diff --git a/scripts/node_collection/node_collection.gml b/scripts/node_collection/node_collection.gml index 00c8d55ed..2b7e6763a 100644 --- a/scripts/node_collection/node_collection.gml +++ b/scripts/node_collection/node_collection.gml @@ -226,7 +226,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc static exitGroup = function() {} - function add(_node) { + static add = function(_node) { ds_list_add(getNodeList(), _node); var list = _node.group == noone? PANEL_GRAPH.nodes_list : _node.group.getNodeList(); var _pos = ds_list_find_index(list, _node); @@ -236,7 +236,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc _node.group = self; } - function remove(_node) { + static remove = function(_node) { var node_list = getNodeList(); var _pos = ds_list_find_index(node_list, _node); ds_list_delete(node_list, _pos); diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 80ae4757a..7a5015ba4 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -981,6 +981,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static drawActive = function(_x, _y, _s, ind = 0) { active_draw_index = ind; } + static drawPreview = function(_x, _y, _s) {} + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {} static drawAnimationTimeline = function(_w, _h, _s) {} diff --git a/scripts/node_mesh_to_path/node_mesh_to_path.gml b/scripts/node_mesh_to_path/node_mesh_to_path.gml index b1c68824a..431c8a930 100644 --- a/scripts/node_mesh_to_path/node_mesh_to_path.gml +++ b/scripts/node_mesh_to_path/node_mesh_to_path.gml @@ -45,7 +45,7 @@ function Node_Mesh_To_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constr l -= lengths[i]; } - return new Point(0, 0); + return new __vec2(); } function update() { diff --git a/scripts/node_path/node_path.gml b/scripts/node_path/node_path.gml index fc22df1d5..600c37dbb 100644 --- a/scripts/node_path/node_path.gml +++ b/scripts/node_path/node_path.gml @@ -35,27 +35,13 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { setIsDynamicInput(1); - function createAnchor(_x = 0, _y = 0, _dxx = 0, _dxy = 0, _dyx = 0, _dyy = 0) { - var index = ds_list_size(inputs); - - inputs[| index] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ _x, _y, _dxx, _dxy, _dyx, _dyy, false ]) - .setDisplay(VALUE_DISPLAY.vector); - - recordAction(ACTION_TYPE.var_modify, self, [ array_clone(input_display_list), "input_display_list" ]); - recordAction(ACTION_TYPE.list_insert, inputs, [ inputs[| index], index, "add path anchor point" ]); - array_push(input_display_list, index); - - return inputs[| index]; - } - - static createNewInput = function() { createAnchor(0, 0); } - outputs[| 0] = nodeValue("Position out", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ]) .setDisplay(VALUE_DISPLAY.vector); outputs[| 1] = nodeValue("Path data", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self); - outputs[| 2] = nodeValue("Anchors", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []); + outputs[| 2] = nodeValue("Anchors", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, []) + .setArrayDepth(1); tool_pathDrawer = new NodeTool( "Draw path", THEME.path_tools_draw ) .addSetting("Smoothness", VALUE_TYPE.float, function(val) { tool_pathDrawer.attribute.thres = val; }, "thres", 4) @@ -70,30 +56,58 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { new NodeTool( "Circle path", THEME.path_tools_circle ), ]; - anchors = []; - lengths = []; - lengthAccs = []; - boundary = []; - lengthTotal = 0; + #region ---- path ---- + anchors = []; + lengths = []; + lengthAccs = []; + boundary = []; + lengthTotal = 0; - cached_pos = ds_map_create(); + cached_pos = ds_map_create(); + #endregion - drag_point = -1; - drag_points = []; - drag_type = 0; - drag_point_mx = 0; - drag_point_my = 0; - drag_point_sx = 0; - drag_point_sy = 0; + #region ---- editor ---- + drag_point = -1; + drag_points = []; + drag_type = 0; + drag_point_mx = 0; + drag_point_my = 0; + drag_point_sx = 0; + drag_point_sy = 0; - transform_type = 0; - transform_minx = 0; transform_miny = 0; - transform_maxx = 0; transform_maxy = 0; - transform_cx = 0; transform_cy = 0; - transform_sx = 0; transform_sy = 0; - transform_mx = 0; transform_my = 0; + transform_type = 0; + transform_minx = 0; transform_miny = 0; + transform_maxx = 0; transform_maxy = 0; + transform_cx = 0; transform_cy = 0; + transform_sx = 0; transform_sy = 0; + transform_mx = 0; transform_my = 0; + #endregion - static onValueUpdate = function(index = 0) { + static resetDisplayList = function() { + recordAction(ACTION_TYPE.var_modify, self, [ array_clone(input_display_list), "input_display_list" ]); + + input_display_list = [ + ["Path", false], 0, 2, 1, 3, + ["Anchors", false], + ]; + + for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i++ ) + array_push(input_display_list, i); + } + + static createNewInput = function(_x = 0, _y = 0, _dxx = 0, _dxy = 0, _dyx = 0, _dyy = 0) { #region + var index = ds_list_size(inputs); + + inputs[| index] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ _x, _y, _dxx, _dxy, _dyx, _dyy, false ]) + .setDisplay(VALUE_DISPLAY.vector); + + recordAction(ACTION_TYPE.list_insert, inputs, [ inputs[| index], index, "add path anchor point" ]); + resetDisplayList(); + + return inputs[| index]; + } #endregion + + static onValueUpdate = function(index = 0) { #region if(index == 2) { var type = inputs[| 2].getValue(); if(type == 0) @@ -101,9 +115,13 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { else if(type == 1) inputs[| 0].setDisplay(VALUE_DISPLAY._default); } - } + } #endregion - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawPreview = function(_x, _y, _s) { #region + + } #endregion + + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var sample = PREF_MAP[? "path_resolution"]; var loop = inputs[| 1].getValue(); var ansize = ds_list_size(inputs) - input_fix_len; @@ -422,7 +440,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { anc = [_p[_ANCHOR.x], _p[_ANCHOR.y], dxx, dxy, dyx, dyy]; if(input_fix_len + i >= ds_list_size(inputs)) - createAnchor(_p[_ANCHOR.x], _p[_ANCHOR.y], dxx, dxy, dyx, dyy); + createNewInput(_p[_ANCHOR.x], _p[_ANCHOR.y], dxx, dxy, dyx, dyy); else inputs[| input_fix_len + i].setValue(anc); } @@ -680,7 +698,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(replace) { while(ds_list_size(inputs) > input_fix_len) ds_list_delete(inputs, input_fix_len); - array_resize(input_display_list, input_display_len); + resetDisplayList(); } drag_point = 0; @@ -696,7 +714,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(mouse_press(mb_left, active)) { while(ds_list_size(inputs) > input_fix_len) ds_list_delete(inputs, input_fix_len); - array_resize(input_display_list, input_display_len); + resetDisplayList(); drag_point = 0; drag_type = isUsingTool(4)? 3 : 4; @@ -705,7 +723,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { inputs[| 1].setValue(true); repeat(4) - createAnchor(value_snap((_mx - _x) / _s, _snx), value_snap((_my - _y) / _s, _sny)); + createNewInput(value_snap((_mx - _x) / _s, _snx), value_snap((_my - _y) / _s, _sny)); } #endregion } else if(anchor_hover != -1) { #region no tool, dragging existing point @@ -740,11 +758,10 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16); if(mouse_press(mb_left, active)) { - recordAction(ACTION_TYPE.var_modify, self, [ array_clone(input_display_list), "input_display_list" ]); recordAction(ACTION_TYPE.list_delete, inputs, [ inputs[| input_fix_len + anchor_hover], input_fix_len + anchor_hover, "remove path anchor point" ]); ds_list_delete(inputs, input_fix_len + anchor_hover); - array_remove(input_display_list, input_fix_len + anchor_hover); + resetDisplayList(); doUpdate(); } } else { @@ -777,7 +794,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16); if(mouse_press(mb_left, active)) { - var anc = createAnchor(value_snap((_mx - _x) / _s, _snx), value_snap((_my - _y) / _s, _sny)); + var anc = createNewInput(value_snap((_mx - _x) / _s, _snx), value_snap((_my - _y) / _s, _sny)); UNDO_HOLDING = true; if(line_hover == -1) { @@ -798,9 +815,9 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { } #endregion } - } + } #endregion - static updateLength = function() { + static updateLength = function() { #region boundary = new BoundingBox(); lengthTotal = 0; var loop = inputs[| 1].getValue(); @@ -851,7 +868,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { lengthTotal += l; lengthAccs[i] = lengthTotal; } - } + } #endregion static getLineCount = function() { return 1; } static getSegmentCount = function() { return array_length(lengths); } @@ -860,7 +877,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { static getLength = function() { return lengthTotal; } static getAccuLength = function() { return lengthAccs; } - static getPointDistance = function(_dist) { + static getPointDistance = function(_dist) { #region if(ds_map_exists(cached_pos, _dist)) return cached_pos[? _dist]; @@ -871,7 +888,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var ansize = array_length(lengths); var amo = ds_list_size(inputs) - input_fix_len; - if(ansize == 0) return new Point(); + if(ansize == 0) return new __vec2(); var _a0, _a1; @@ -892,23 +909,23 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var _t = _dist / lengths[i]; if(!is_array(_a0) || !is_array(_a1)) - return new Point(); + return new __vec2(); var _p = eval_bezier(_t, _a0[0], _a0[1], _a1[0], _a1[1], _a0[0] + _a0[4], _a0[1] + _a0[5], _a1[0] + _a1[2], _a1[1] + _a1[3]); - var _point = new Point(_p); + var _point = new __vec2(_p); cached_pos[? _dist] = _point; return _point; } - return new Point(); - } + return new __vec2(); + } #endregion - static getPointRatio = function(_rat) { + static getPointRatio = function(_rat) { #region var pix = frac(_rat) * lengthTotal; return getPointDistance(pix); - } + } #endregion - static getPointSegment = function(_rat) { + static getPointSegment = function(_rat) { #region var loop = inputs[| 1].getValue(); var rond = inputs[| 3].getValue(); if(!is_real(rond)) rond = false; @@ -916,12 +933,12 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { var ansize = array_length(lengths); var amo = ds_list_size(inputs) - input_fix_len; - if(amo < 1) return new Point(0, 0); + if(amo < 1) return new __vec2(0, 0); if(_rat < 0) { var _p0 = inputs[| input_fix_len].getValue(); if(rond) - return new Point(round(_p0[0]), round(_p0[1])); - return new Point(_p0[0], _p0[1]); + return new __vec2(round(_p0[0]), round(_p0[1])); + return new __vec2(_p0[0], _p0[1]); } _rat = safe_mod(_rat, ansize); @@ -933,8 +950,8 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { if(!loop) { var _p1 = inputs[| ds_list_size(inputs) - 1].getValue() if(rond) - return new Point(round(_p1[0]), round(_p1[1])); - return new Point(_p1[0], _p1[1]); + return new __vec2(round(_p1[0]), round(_p1[1])); + return new __vec2(_p1[0], _p1[1]); } _i1 = 0; @@ -949,10 +966,10 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { } var p = eval_bezier(_t, _a0[0], _a0[1], _a1[0], _a1[1], _a0[0] + _a0[4], _a0[1] + _a0[5], _a1[0] + _a1[2], _a1[1] + _a1[3]); - return new Point(p[0], p[1]); - } + return new __vec2(p[0], p[1]); + } #endregion - static update = function(frame = PROJECT.animator.current_frame) { + static update = function(frame = PROJECT.animator.current_frame) { #region ds_map_clear(cached_pos); updateLength(); @@ -988,10 +1005,10 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { outputs[| 0].setValue(_out.toArray()); } - } + } #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(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); - } + } #endregion } \ No newline at end of file diff --git a/scripts/node_path_array/node_path_array.gml b/scripts/node_path_array/node_path_array.gml index fadcbd526..10787eff9 100644 --- a/scripts/node_path_array/node_path_array.gml +++ b/scripts/node_path_array/node_path_array.gml @@ -91,28 +91,28 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc return 0; } - static getPointRatio = function(_rat, ind = 0) { + static get__vec2Ratio = function(_rat, ind = 0) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getPointRatio(_rat, ind).clone(); + if(ind < lc) return _path.get__vec2Ratio(_rat, ind).clone(); ind -= lc; } - return new Point(); + return new __vec2(); } - static getPointDistance = function(_dist, ind = 0) { + static get__vec2Distance = function(_dist, ind = 0) { for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) { var _path = inputs[| i].getValue(); var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1; - if(ind < lc) return _path.getPointDistance(_dist, ind).clone(); + if(ind < lc) return _path.get__vec2Distance(_dist, ind).clone(); ind -= lc; } - return new Point(); + return new __vec2(); } static getBoundary = function(ind = 0) { diff --git a/scripts/node_path_blend/node_path_blend.gml b/scripts/node_path_blend/node_path_blend.gml index 84c58665c..c4668a8a8 100644 --- a/scripts/node_path_blend/node_path_blend.gml +++ b/scripts/node_path_blend/node_path_blend.gml @@ -93,13 +93,13 @@ function Node_Path_Blend(_x, _y, _group = noone) : Node(_x, _y, _group) construc var p1 = _path1 != noone && struct_has(_path1, "getPointRatio"); var p2 = _path2 != noone && struct_has(_path2, "getPointRatio"); - if(!p1 && !p2) return new Point(); + if(!p1 && !p2) return new __vec2(); if( p1 && !p2) return _path1.getPointRatio(_rat, ind); if(!p1 && p2) return _path2.getPointRatio(_rat, ind); var _p1 = _path1.getPointRatio(_rat, ind); var _p2 = _path2.getPointRatio(_rat, ind); - var _r = new Point(); + var _r = new __vec2(); _r.x = lerp(_p1.x, _p2.x, _lerp); _r.y = lerp(_p1.y, _p2.y, _lerp); diff --git a/scripts/node_path_builder/node_path_builder.gml b/scripts/node_path_builder/node_path_builder.gml index 491f548e1..70fff2e5a 100644 --- a/scripts/node_path_builder/node_path_builder.gml +++ b/scripts/node_path_builder/node_path_builder.gml @@ -70,24 +70,24 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr _p0 = array_safe_get(_lines, floor(_st) + 0,, ARRAY_OVERFLOW._default); _p1 = array_safe_get(_lines, floor(_st) + 1,, ARRAY_OVERFLOW._default); - if(!is_array(_p0)) return new Point(); - if(!is_array(_p1)) return new Point(); + if(!is_array(_p0)) return new __vec2(); + if(!is_array(_p1)) return new __vec2(); _x = lerp(_p0[0], _p1[0], frac(_st)); _y = lerp(_p0[1], _p1[1], frac(_st)); - return new Point( _x, _y ); + return new __vec2( _x, _y ); } else { _p0 = array_safe_get(_lines, _ind * 2 + 0,, ARRAY_OVERFLOW._default); _p1 = array_safe_get(_lines, _ind * 2 + 1,, ARRAY_OVERFLOW._default); - if(!is_array(_p0)) return new Point(); - if(!is_array(_p1)) return new Point(); + if(!is_array(_p0)) return new __vec2(); + if(!is_array(_p1)) return new __vec2(); _x = lerp(_p0[0], _p1[0], _rat); _y = lerp(_p0[1], _p1[1], _rat); - return new Point( _x, _y ); + return new __vec2( _x, _y ); } } diff --git a/scripts/node_path_l_system/node_path_l_system.gml b/scripts/node_path_l_system/node_path_l_system.gml index c14e06783..d488469a2 100644 --- a/scripts/node_path_l_system/node_path_l_system.gml +++ b/scripts/node_path_l_system/node_path_l_system.gml @@ -164,13 +164,13 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const var _p0 = lines[_ind][0]; var _p1 = lines[_ind][1]; - if(!is_array(_p0) || array_length(_p0) < 2) return new Point(); - if(!is_array(_p1) || array_length(_p1) < 2) return new Point(); + if(!is_array(_p0) || array_length(_p0) < 2) return new __vec2(); + if(!is_array(_p1) || array_length(_p1) < 2) return new __vec2(); var _x = lerp(_p0[0], _p1[0], _rat); var _y = lerp(_p0[1], _p1[1], _rat); - return new Point( _x, _y ); + return new __vec2( _x, _y ); } static getPointDistance = function(_dist, _ind = 0) { diff --git a/scripts/node_path_map_area/node_path_map_area.gml b/scripts/node_path_map_area/node_path_map_area.gml index f5d83a83f..781f04cd8 100644 --- a/scripts/node_path_map_area/node_path_map_area.gml +++ b/scripts/node_path_map_area/node_path_map_area.gml @@ -47,7 +47,7 @@ function Node_Path_Map_Area(_x, _y, _group = noone) : Node(_x, _y, _group) const } if(!is_struct(_path) || !struct_has(_path, "getPointRatio")) - return new Point(); + return new __vec2(); var _b = _path.getBoundary(); var _p = _path.getPointRatio(_rat, ind).clone(); diff --git a/scripts/node_path_plot/node_path_plot.gml b/scripts/node_path_plot/node_path_plot.gml index 5f759ba4d..f309501c7 100644 --- a/scripts/node_path_plot/node_path_plot.gml +++ b/scripts/node_path_plot/node_path_plot.gml @@ -63,7 +63,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct _rat = _ran[0] + (_rat * (_ran[1] - _ran[0])); - var _p = new Point(); + var _p = new __vec2(); switch(_coor) { case 0 : @@ -83,7 +83,7 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct } break; case 1 : - var _a = new Point(); + var _a = new __vec2(); switch(_eqa) { case 0 : _a.x = _rat * _iran[0] + _shf[0]; diff --git a/scripts/node_path_reverse/node_path_reverse.gml b/scripts/node_path_reverse/node_path_reverse.gml index df62871a4..8742b0480 100644 --- a/scripts/node_path_reverse/node_path_reverse.gml +++ b/scripts/node_path_reverse/node_path_reverse.gml @@ -38,7 +38,7 @@ function Node_Path_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _path = inputs[| 0].getValue(); if(!is_struct(_path) || !struct_has(_path, "getPointRatio")) - return new Point(); + return new __vec2(); return _path.getPointRatio(1 - _rat, ind).clone(); } diff --git a/scripts/node_path_shift/node_path_shift.gml b/scripts/node_path_shift/node_path_shift.gml index 8bdcc544f..f073bd4eb 100644 --- a/scripts/node_path_shift/node_path_shift.gml +++ b/scripts/node_path_shift/node_path_shift.gml @@ -41,7 +41,7 @@ function Node_Path_Shift(_x, _y, _group = noone) : Node(_x, _y, _group) construc } if(!is_struct(_path) || !struct_has(_path, "getPointRatio")) - return new Point(); + return new __vec2(); var _p0 = _path.getPointRatio(clamp(_rat - 0.001, 0, 0.999999), ind); var _p = _path.getPointRatio(_rat, ind).clone(); diff --git a/scripts/node_path_transform/node_path_transform.gml b/scripts/node_path_transform/node_path_transform.gml index 34a1b28f8..4f0b72120 100644 --- a/scripts/node_path_transform/node_path_transform.gml +++ b/scripts/node_path_transform/node_path_transform.gml @@ -96,7 +96,7 @@ function Node_Path_Transform(_x, _y, _group = noone) : Node(_x, _y, _group) cons } if(!is_struct(_path) || !struct_has(_path, "getPointRatio")) - return new Point(); + return new __vec2(); var _p = _path.getPointRatio(_rat, ind).clone(); diff --git a/scripts/node_path_trim/node_path_trim.gml b/scripts/node_path_trim/node_path_trim.gml index 590a04596..0c7f5b929 100644 --- a/scripts/node_path_trim/node_path_trim.gml +++ b/scripts/node_path_trim/node_path_trim.gml @@ -42,7 +42,7 @@ function Node_Path_Trim(_x, _y, _group = noone) : Node(_x, _y, _group) construct } if(!is_struct(_path) || !struct_has(_path, "getPointRatio")) - return new Point(); + return new __vec2(); _rat = _rng[0] + _rat * (_rng[1] - _rng[0]); return _path.getPointRatio(_rat, ind).clone(); diff --git a/scripts/node_path_wave/node_path_wave.gml b/scripts/node_path_wave/node_path_wave.gml index af3af1949..0448ef284 100644 --- a/scripts/node_path_wave/node_path_wave.gml +++ b/scripts/node_path_wave/node_path_wave.gml @@ -72,7 +72,7 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct } if(!is_struct(_path) || !struct_has(_path, "getPointRatio")) - return new Point(); + return new __vec2(); var _p0 = _path.getPointRatio(clamp(_rat - 0.001, 0, 0.999999), ind); var _p = _path.getPointRatio(_rat, ind).clone(); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 02a0e53e5..831127f63 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -618,8 +618,13 @@ function Panel_Preview() : PanelContent() constructor { } var _node = getNodePreview(); - if(_node) + if(_node) { title = _node.display_name == ""? _node.name : _node.display_name; + + var cx = canvas_x + _node.preview_x * canvas_s; + var cy = canvas_y + _node.preview_y * canvas_s; + _node.drawPreview(cx, cy, canvas_s); + } if(splitView == 0 && tileMode == 0 && is_surface(preview_surface[0])) { var node = preview_node[0]; @@ -1252,6 +1257,8 @@ function Panel_Preview() : PanelContent() constructor { } var params = new widgetParam(tolx, toly, tolw, tolh, atr[$ key],, [ mx, my ]) + params.s = tolh; + wdg.drawParam(params); tolx += tolw + ui(16);