mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 19:38:05 +01:00
wave
This commit is contained in:
parent
5e41976907
commit
814b37dc6d
4 changed files with 27 additions and 26 deletions
|
@ -2,7 +2,7 @@ function Mesh() constructor {
|
|||
triangles = [];
|
||||
center = [ 0, 0 ];
|
||||
|
||||
static getRandomPoint = function(seed) { #region
|
||||
static getRandomPoint = function(seed) {
|
||||
random_set_seed(seed);
|
||||
if(array_length(triangles) == 0) return [ 0, 0 ];
|
||||
|
||||
|
@ -18,9 +18,9 @@ function Mesh() constructor {
|
|||
var _y = (1 - sqrt(a1)) * p0.y + (sqrt(a1) * (1 - a2)) * p1.y + (sqrt(a1) * a2) * p2.y;
|
||||
|
||||
return new __vec2( _x, _y );
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _s) { #region
|
||||
static draw = function(_x, _y, _s) {
|
||||
for( var i = 0, n = array_length(triangles); i < n; i++ ) {
|
||||
var t = triangles[i];
|
||||
|
||||
|
@ -28,9 +28,9 @@ function Mesh() constructor {
|
|||
draw_line(_x + t[1].x * _s, _y + t[1].y * _s, _x + t[2].x * _s, _y + t[2].y * _s);
|
||||
draw_line(_x + t[0].x * _s, _y + t[0].y * _s, _x + t[2].x * _s, _y + t[2].y * _s);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static pointIn = function(_x, _y) { #region
|
||||
static pointIn = function(_x, _y) {
|
||||
for( var i = 0, n = array_length(triangles); i < n; i++ ) {
|
||||
var t = triangles[i];
|
||||
|
||||
|
@ -39,9 +39,9 @@ function Mesh() constructor {
|
|||
}
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static mergePath = function() { #region
|
||||
static mergePath = function() {
|
||||
if(array_length(triangles) == 0) return [];
|
||||
|
||||
var segments = [];
|
||||
|
@ -96,9 +96,9 @@ function Mesh() constructor {
|
|||
|
||||
ds_map_destroy(pointsPairs);
|
||||
return path;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static clone = function() { #region
|
||||
static clone = function() {
|
||||
var msh = new Mesh();
|
||||
|
||||
for( var i = 0, n = array_length(triangles); i < n; i++ ) {
|
||||
|
@ -112,9 +112,9 @@ function Mesh() constructor {
|
|||
msh.center = [ center[0], center[1] ];
|
||||
|
||||
return msh;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static calcCoM = function() { #region
|
||||
static calcCoM = function() {
|
||||
var _ax = 0, _ay = 0;
|
||||
var _p = 0;
|
||||
|
||||
|
@ -132,7 +132,7 @@ function Mesh() constructor {
|
|||
if(_p == 0) return;
|
||||
|
||||
center = [ _ax / _p, _ay / _p ];
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static serialize = function() { return ""; }
|
||||
static deserialize = function(s) { return self; }
|
||||
|
|
|
@ -50,14 +50,14 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
|
||||
var amo = _b.childCount();
|
||||
var _hh = ui(28);
|
||||
var bh = ui(32 + 16) + amo * _hh;
|
||||
var _bh = ui(32 + 16) + amo * _hh;
|
||||
var ty = _y;
|
||||
|
||||
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text_add(_x + ui(16), ty + ui(4), __txt("Bones"));
|
||||
ty += ui(28);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, _bh - ui(32), COLORS.node_composite_bg_blend, 1);
|
||||
ty += ui(8);
|
||||
|
||||
var hovering = noone;
|
||||
|
@ -116,7 +116,7 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
|
||||
ds_stack_destroy(_bst);
|
||||
|
||||
layer_renderer.h = bh;
|
||||
layer_renderer.h = _bh;
|
||||
return layer_renderer.h;
|
||||
|
||||
});
|
||||
|
|
|
@ -105,7 +105,7 @@ function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) con
|
|||
draw_set_color(COLORS._main_accent);
|
||||
draw_set_alpha(1);
|
||||
|
||||
var _ind = safe_mod(pattern, _len) / _len * yr;
|
||||
var _ind = safe_mod(abs(pattern), _len) / _len * yr;
|
||||
|
||||
var _crv = wavetable_display_curent;
|
||||
var _gra_y = ys - _gra_l * _ind;
|
||||
|
@ -202,6 +202,7 @@ function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) con
|
|||
function getPattern(_patt, _x) {
|
||||
var _len = array_length(attributes.wavetable);
|
||||
var _ind = safe_mod(_patt, _len);
|
||||
if(_ind < 0) _ind = abs(_ind);
|
||||
|
||||
switch(attributes.wavetable[_ind]) {
|
||||
case WAVETABLE_FN.sine : return sin(_x * pi * 2);
|
||||
|
@ -240,6 +241,8 @@ function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) con
|
|||
} resetDisplayTable();
|
||||
|
||||
static __evalRaw = function(_patt, _x = 0) {
|
||||
_patt = abs(_patt);
|
||||
|
||||
var _p0 = floor(_patt);
|
||||
var _p1 = floor(_patt) + 1;
|
||||
var _fr = frac(_patt);
|
||||
|
|
|
@ -409,10 +409,8 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
}
|
||||
|
||||
if(isUsingTool("Edit control point")) {
|
||||
if(key_mod_press(SHIFT))
|
||||
draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16);
|
||||
else
|
||||
draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16);
|
||||
if(key_mod_press(SHIFT)) draw_sprite_ui_uniform(THEME.cursor_path_remove, 0, _mx + 16, _my + 16);
|
||||
else draw_sprite_ui_uniform(THEME.cursor_path_add, 0, _mx + 16, _my + 16);
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
if(_hover == -1) {
|
||||
|
@ -439,17 +437,17 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
draw_circle_prec(_mx, _my, rad, true);
|
||||
var _xx = (_mx - _x) / _s;
|
||||
var _yy = (_my - _y) / _s;
|
||||
var _rr = rad / _s;
|
||||
|
||||
if(mouse_click(mb_left, active)) {
|
||||
var _pin = !key_mod_press(SHIFT);
|
||||
|
||||
for(var j = 0; j < array_length(mesh_data.tris); j++) {
|
||||
var t = mesh_data.tris[j];
|
||||
|
||||
if(point_in_circle(t.p0.x, t.p0.y, _xx, _yy, rad / _s))
|
||||
t.p0.setPin(!key_mod_press(SHIFT));
|
||||
if(point_in_circle(t.p1.x, t.p1.y, _xx, _yy, rad / _s))
|
||||
t.p1.setPin(!key_mod_press(SHIFT));
|
||||
if(point_in_circle(t.p2.x, t.p2.y, _xx, _yy, rad / _s))
|
||||
t.p2.setPin(!key_mod_press(SHIFT));
|
||||
if(point_in_circle(t.p0.x, t.p0.y, _xx, _yy, _rr)) t.p0.setPin(_pin);
|
||||
if(point_in_circle(t.p1.x, t.p1.y, _xx, _yy, _rr)) t.p1.setPin(_pin);
|
||||
if(point_in_circle(t.p2.x, t.p2.y, _xx, _yy, _rr)) t.p2.setPin(_pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue