mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- [Inspector Panel] Value in pixel unit now rounded when sliding.
This commit is contained in:
parent
cda5f42f7f
commit
9966fdfdb7
13 changed files with 279 additions and 172 deletions
|
@ -70,17 +70,19 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
|||
|
||||
static postProcess = function() { refreshPreview(); }
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
|
||||
if(!is_surface(mesh_prev_surface)) return;
|
||||
if(!previewable) return;
|
||||
static getGraphPreviewSurface = function() { return mesh_prev_surface; }
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
// static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
|
||||
// if(!is_surface(mesh_prev_surface)) return;
|
||||
// if(!previewable) return;
|
||||
|
||||
draw_surface_bbox(mesh_prev_surface, bbox,, aa);
|
||||
onDrawNodeOver(xx, yy, _mx, _my, _s, _hover, _focus);
|
||||
} #endregion
|
||||
// var bbox = drawGetBbox(xx, yy, _s);
|
||||
// var aa = 0.5 + 0.5 * renderActive;
|
||||
// if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
|
||||
// draw_surface_bbox(mesh_prev_surface, bbox,, aa);
|
||||
// onDrawNodeOver(xx, yy, _mx, _my, _s, _hover, _focus);
|
||||
// } #endregion
|
||||
|
||||
static onDrawNodeOver = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { }
|
||||
}
|
|
@ -7,6 +7,8 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
self.sides = sides;
|
||||
self.smooth = smooth;
|
||||
|
||||
invert = false;
|
||||
loop = false;
|
||||
endCap = true;
|
||||
points = [];
|
||||
uvProg = [];
|
||||
|
@ -31,8 +33,9 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
var _in0 = 0;
|
||||
var _in1 = 0;
|
||||
|
||||
var _u0 = new __vec3(0, 1, 0);
|
||||
var _u1 = new __vec3(0, 0, 1);
|
||||
var _ux = new __vec3(1, 0, 0);
|
||||
var _uy = new __vec3(0, 1, 0);
|
||||
var _uz = new __vec3(0, 0, 1);
|
||||
|
||||
if(_subd < 2) return;
|
||||
|
||||
|
@ -43,6 +46,8 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
var _us = uvScale[0];
|
||||
var _vs = uvScale[1];
|
||||
|
||||
var firstLoop = array_create(sides * 3);
|
||||
|
||||
for(var i = 1; i < _subd; i++) {
|
||||
n.x = points[i * 3 + 0];
|
||||
n.y = points[i * 3 + 1];
|
||||
|
@ -52,10 +57,18 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
v.x = n.x - o.x;
|
||||
v.y = n.y - o.y;
|
||||
v.z = n.z - o.z;
|
||||
|
||||
if(loop) {
|
||||
v.x = n.x - points[(_subd - 2) * 3 + 0];
|
||||
v.y = n.y - points[(_subd - 2) * 3 + 1];
|
||||
v.z = n.z - points[(_subd - 2) * 3 + 2];
|
||||
}
|
||||
|
||||
v._normalize();
|
||||
|
||||
if(v.z == v.z) u = v.cross(_u0);
|
||||
else u = v.cross(_u1);
|
||||
if(v.equal(_ux)) u = v.cross(_uz);
|
||||
else if(v.equal(_uz)) u = v.cross(_uy);
|
||||
else u = v.cross(_uz);
|
||||
|
||||
u._normalize();
|
||||
w = v.cross(u);
|
||||
|
@ -95,9 +108,11 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
v0[_in0++] = new __vertex(cx0, cy0, cz0).setNormal(-v.x, -v.y, -v.z).setUV(__u0, __v0);
|
||||
v0[_in0++] = new __vertex(cx1, cy1, cz1).setNormal(-v.x, -v.y, -v.z).setUV(__u1, __v1);
|
||||
}
|
||||
|
||||
for (var j = 0, m = array_length(prevn); j < m; j++)
|
||||
firstLoop[j] = prevp[j];
|
||||
}
|
||||
|
||||
if(i) {
|
||||
if(i < _subd - 1) {
|
||||
v.x = points[(i + 1) * 3 + 0] - o.x;
|
||||
v.y = points[(i + 1) * 3 + 1] - o.y;
|
||||
|
@ -110,8 +125,9 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
|
||||
v._normalize();
|
||||
|
||||
if(v.z == v.z) u = v.cross(_u0);
|
||||
else u = v.cross(_u1);
|
||||
if(v.equal(_ux)) u = v.cross(_ux);
|
||||
else if(v.equal(_uz)) u = v.cross(_uy);
|
||||
else u = v.cross(_uz);
|
||||
|
||||
u._normalize();
|
||||
w = v.cross(u);
|
||||
|
@ -119,7 +135,6 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
var _rr = radius * radiusOverPath[i];
|
||||
var __v0 = 1. - uvProg[i-1];
|
||||
var __v1 = 1. - uvProg[i ];
|
||||
// print($"{i}: {__v0} - {__v1}")
|
||||
|
||||
for(var j = 0; j <= sides; j++) {
|
||||
var a0 = j / sides * 360;
|
||||
|
@ -132,22 +147,24 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
prevn[j * 3 + 1] = n.y + _pp.y * _rr;
|
||||
prevn[j * 3 + 2] = n.z + _pp.z * _rr;
|
||||
|
||||
var prenn = loop && i == _subd - 1? firstLoop : prevn;
|
||||
|
||||
if(j) {
|
||||
var x0 = prevp[(j - 1) * 3 + 0];
|
||||
var y0 = prevp[(j - 1) * 3 + 1];
|
||||
var z0 = prevp[(j - 1) * 3 + 2];
|
||||
var x0 = prevp[ (j - 1) * 3 + 0 ];
|
||||
var y0 = prevp[ (j - 1) * 3 + 1 ];
|
||||
var z0 = prevp[ (j - 1) * 3 + 2 ];
|
||||
|
||||
var x1 = prevp[j * 3 + 0];
|
||||
var y1 = prevp[j * 3 + 1];
|
||||
var z1 = prevp[j * 3 + 2];
|
||||
var x1 = prevp[ (j ) * 3 + 0 ];
|
||||
var y1 = prevp[ (j ) * 3 + 1 ];
|
||||
var z1 = prevp[ (j ) * 3 + 2 ];
|
||||
|
||||
var x2 = prevn[(j - 1) * 3 + 0];
|
||||
var y2 = prevn[(j - 1) * 3 + 1];
|
||||
var z2 = prevn[(j - 1) * 3 + 2];
|
||||
var x2 = prenn[ (j - 1) * 3 + 0 ];
|
||||
var y2 = prenn[ (j - 1) * 3 + 1 ];
|
||||
var z2 = prenn[ (j - 1) * 3 + 2 ];
|
||||
|
||||
var x3 = prevn[j * 3 + 0];
|
||||
var y3 = prevn[j * 3 + 1];
|
||||
var z3 = prevn[j * 3 + 2];
|
||||
var x3 = prenn[ (j ) * 3 + 0 ];
|
||||
var y3 = prenn[ (j ) * 3 + 1 ];
|
||||
var z3 = prenn[ (j ) * 3 + 2 ];
|
||||
|
||||
var _n0, _n1, _n2, _n3;
|
||||
|
||||
|
@ -167,19 +184,29 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
var __u0 = (j-1) / sides;
|
||||
var __u1 = (j ) / sides;
|
||||
|
||||
vs[_ind++] = new __vertex(x0, y0, z0).setNormal(_n0.x, _n0.y, _n0.z).setUV(__u0 * _us, __v0 * _vs);
|
||||
vs[_ind++] = new __vertex(x2, y2, z2).setNormal(_n2.x, _n2.y, _n2.z).setUV(__u0 * _us, __v1 * _vs);
|
||||
vs[_ind++] = new __vertex(x1, y1, z1).setNormal(_n1.x, _n1.y, _n1.z).setUV(__u1 * _us, __v0 * _vs);
|
||||
if(invert) {
|
||||
vs[_ind++] = new __vertex(x0, y0, z0).setNormal(_n0.x, _n0.y, _n0.z).setUV(__v0 * _vs, 1 - __u0 * _us);
|
||||
vs[_ind++] = new __vertex(x1, y1, z1).setNormal(_n1.x, _n1.y, _n1.z).setUV(__v0 * _vs, 1 - __u1 * _us);
|
||||
vs[_ind++] = new __vertex(x2, y2, z2).setNormal(_n2.x, _n2.y, _n2.z).setUV(__v1 * _vs, 1 - __u0 * _us);
|
||||
|
||||
vs[_ind++] = new __vertex(x1, y1, z1).setNormal(_n1.x, _n1.y, _n1.z).setUV(__u1 * _us, __v0 * _vs);
|
||||
vs[_ind++] = new __vertex(x2, y2, z2).setNormal(_n2.x, _n2.y, _n2.z).setUV(__u0 * _us, __v1 * _vs);
|
||||
vs[_ind++] = new __vertex(x3, y3, z3).setNormal(_n3.x, _n3.y, _n3.z).setUV(__u1 * _us, __v1 * _vs);
|
||||
vs[_ind++] = new __vertex(x1, y1, z1).setNormal(_n1.x, _n1.y, _n1.z).setUV(__v0 * _vs, 1 - __u1 * _us);
|
||||
vs[_ind++] = new __vertex(x3, y3, z3).setNormal(_n3.x, _n3.y, _n3.z).setUV(__v1 * _vs, 1 - __u1 * _us);
|
||||
vs[_ind++] = new __vertex(x2, y2, z2).setNormal(_n2.x, _n2.y, _n2.z).setUV(__v1 * _vs, 1 - __u0 * _us);
|
||||
|
||||
} else {
|
||||
vs[_ind++] = new __vertex(x0, y0, z0).setNormal(_n0.x, _n0.y, _n0.z).setUV(__v0 * _vs, 1 - __u0 * _us);
|
||||
vs[_ind++] = new __vertex(x2, y2, z2).setNormal(_n2.x, _n2.y, _n2.z).setUV(__v1 * _vs, 1 - __u0 * _us);
|
||||
vs[_ind++] = new __vertex(x1, y1, z1).setNormal(_n1.x, _n1.y, _n1.z).setUV(__v0 * _vs, 1 - __u1 * _us);
|
||||
|
||||
vs[_ind++] = new __vertex(x1, y1, z1).setNormal(_n1.x, _n1.y, _n1.z).setUV(__v0 * _vs, 1 - __u1 * _us);
|
||||
vs[_ind++] = new __vertex(x2, y2, z2).setNormal(_n2.x, _n2.y, _n2.z).setUV(__v1 * _vs, 1 - __u0 * _us);
|
||||
vs[_ind++] = new __vertex(x3, y3, z3).setNormal(_n3.x, _n3.y, _n3.z).setUV(__v1 * _vs, 1 - __u1 * _us);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0, m = array_length(prevn); j < m; j++)
|
||||
prevp[j] = prevn[j];
|
||||
}
|
||||
|
||||
if(i == _subd - 1) {
|
||||
for(var j = 0; j < sides; j++) {
|
||||
|
@ -200,8 +227,8 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
var __v1 = 0.5 + lengthdir_y(0.5, a1);
|
||||
|
||||
v1[_in1++] = new __vertex(n.x, n.y, n.z).setNormal(-v.x, -v.y, -v.z).setUV(0.5, 0.5);
|
||||
v1[_in1++] = new __vertex(cx0, cy0, cz0).setNormal(-v.x, -v.y, -v.z).setUV(__u0, __v0);
|
||||
v1[_in1++] = new __vertex(cx1, cy1, cz1).setNormal(-v.x, -v.y, -v.z).setUV(__u1, __v1);
|
||||
v1[_in1++] = new __vertex(cx0, cy0, cz0).setNormal(-v.x, -v.y, -v.z).setUV(__u0, __v0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +237,7 @@ function __3dPathExtrude(radius = 0.5, sides = 8, smooth = false) : __3dObject()
|
|||
o.z = n.z;
|
||||
}
|
||||
|
||||
vertex = endCap? [ vs, v0, v1 ] : [ vs ];
|
||||
vertex = endCap && !loop? [ vs, v0, v1 ] : [ vs ];
|
||||
object_counts = array_length(vertex);
|
||||
VB = build();
|
||||
} initModel();
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
LATEST_VERSION = 11700;
|
||||
VERSION = 11761;
|
||||
SAVE_VERSION = 11700;
|
||||
VERSION_STRING = "1.17.7.004";
|
||||
VERSION_STRING = "1.17.7.005";
|
||||
BUILD_NUMBER = 11761;
|
||||
|
||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||
|
|
|
@ -30,8 +30,13 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y
|
|||
inputs[| in_mesh + 9] = nodeValue("Texture Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| in_mesh + 10] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
inputs[| in_mesh + 11] = nodeValue("Inverted", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
input_display_list = [
|
||||
__d3d_input_list_mesh, in_mesh + 0, in_mesh + 6, in_mesh + 1, in_mesh + 7, in_mesh + 8, in_mesh + 5,
|
||||
["Path", false], in_mesh + 0, in_mesh + 10,
|
||||
__d3d_input_list_mesh, in_mesh + 6, in_mesh + 1, in_mesh + 7, in_mesh + 8, in_mesh + 5, in_mesh + 11,
|
||||
__d3d_input_list_transform,
|
||||
["Material", false], in_mesh + 4, in_mesh + 2, in_mesh + 3, in_mesh + 9,
|
||||
]
|
||||
|
@ -49,10 +54,12 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y
|
|||
var _mat_cap = _data[in_mesh + 3];
|
||||
var _smt = _data[in_mesh + 4];
|
||||
var _caps = _data[in_mesh + 5];
|
||||
var _samp = _data[in_mesh + 6];
|
||||
var _samp = _data[in_mesh + 6] + 1;
|
||||
var _rad = _data[in_mesh + 7];
|
||||
var _radOv = _data[in_mesh + 8];
|
||||
var _uvScale = _data[in_mesh + 9];
|
||||
var _loop = _data[in_mesh + 10];
|
||||
var _invert = _data[in_mesh + 11];
|
||||
|
||||
if(_path == noone) return noone;
|
||||
|
||||
|
@ -94,6 +101,8 @@ function Node_3D_Mesh_Path_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y
|
|||
points : _points,
|
||||
radius : _rad,
|
||||
radiusOverPath: _radPath,
|
||||
loop : _loop,
|
||||
invert : _invert,
|
||||
|
||||
uvProg : _uvProg,
|
||||
uvScale : _uvScale,
|
||||
|
|
|
@ -638,10 +638,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
_ho = name_height;
|
||||
}
|
||||
|
||||
var _prev_surf = previewable && preview_draw &&
|
||||
( is_surface(getGraphPreviewSurface()) ||
|
||||
(preview_channel >= 0 && preview_channel < ds_list_size(outputs) && outputs[| preview_channel].type == VALUE_TYPE.surface)
|
||||
);
|
||||
var _ss = getGraphPreviewSurface();
|
||||
var _ps = is_surface(_ss);
|
||||
var _ou = preview_channel >= 0 && preview_channel < ds_list_size(outputs) && outputs[| preview_channel].type == VALUE_TYPE.surface;
|
||||
|
||||
// print($"{previewable} && {preview_draw} && ([{_ss}] {_ps} || {_ou})");
|
||||
var _prev_surf = previewable && preview_draw && (_ps || _ou);
|
||||
var _p = previewable;
|
||||
|
||||
for( var i = 0; i < ds_list_size(inputs); i++ ) {
|
||||
|
|
|
@ -67,9 +67,20 @@ function Node_Grain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 22] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Additive", "Multiply", "Screen", "Overlay" ])
|
||||
|
||||
inputs[| 23] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Additive", "Multiply", "Screen" ])
|
||||
|
||||
inputs[| 24] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Additive", "Multiply", "Screen" ])
|
||||
|
||||
input_display_list = [ 3, 4, 9,
|
||||
["Surfaces", true], 0, 1, 2, 5, 6,
|
||||
["Grain", false], 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
["Brightness", false], 22, /**/ 7, 8,
|
||||
["RGB", false], 23, /**/ 10, 11, 12, 13, 14, 15,
|
||||
["HSV", false], 24, /**/ 16, 17, 18, 19, 20, 21,
|
||||
]
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -95,6 +106,10 @@ function Node_Grain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
shader_set_f_map("sat", _data[18], _data[19], inputs[| 18]);
|
||||
shader_set_f_map("val", _data[20], _data[21], inputs[| 20]);
|
||||
|
||||
shader_set_i("bmBright", _data[22]);
|
||||
shader_set_i("bmRGB", _data[23]);
|
||||
shader_set_i("bmHSV", _data[24]);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
|
|
|
@ -302,8 +302,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
static setUnitRef = function(ref, mode = VALUE_UNIT.constant) { #region
|
||||
express_edit.side_button = unit.triggerButton;
|
||||
|
||||
if(editWidget) {
|
||||
editWidget.unit = unit;
|
||||
|
||||
if(is_instanceof(editWidget, textBox))
|
||||
editWidget.side_button = unit.triggerButton;
|
||||
}
|
||||
|
||||
unit.reference = ref;
|
||||
unit.mode = mode;
|
||||
|
|
|
@ -80,7 +80,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
|||
onModify(value);
|
||||
} #endregion
|
||||
|
||||
static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) { #region
|
||||
static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) {
|
||||
slidable = true;
|
||||
slide_speed = is_array(slideStep)? slideStep[0] : slideStep;
|
||||
slide_snap = is_array(slideStep)? slideStep[1] : 0;
|
||||
|
@ -88,7 +88,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
|||
slide_range = _slide_range;
|
||||
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setRange = function(_rng_min, _rng_max) { #region
|
||||
use_range = true;
|
||||
|
|
|
@ -48,25 +48,25 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
tb[i].slidable = true;
|
||||
}
|
||||
|
||||
static apply = function() { #region
|
||||
static apply = function() {
|
||||
for( var i = 0; i < size; i++ ) {
|
||||
tb[i].apply();
|
||||
current_value[i] = toNumber(tb[i]._input_text);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setLinkInactiveColor = function(color) { #region
|
||||
static setLinkInactiveColor = function(color) {
|
||||
link_inactive_color = color;
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setSlideSpeed = function(speed) { #region
|
||||
static setSlideSpeed = function(speed) {
|
||||
for(var i = 0; i < size; i++)
|
||||
tb[i].setSlidable(speed);
|
||||
return self;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static setInteract = function(interactable) { #region
|
||||
static setInteract = function(interactable) {
|
||||
self.interactable = interactable;
|
||||
|
||||
if(side_button)
|
||||
|
@ -74,9 +74,9 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
|
||||
for( var i = 0; i < size; i++ )
|
||||
tb[i].interactable = interactable;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static register = function(parent = noone) { #region
|
||||
static register = function(parent = noone) {
|
||||
for( var i = 0; i < size; i++ )
|
||||
tb[i].register(parent);
|
||||
|
||||
|
@ -85,21 +85,21 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
|
||||
if(unit != noone && unit.reference != noone)
|
||||
unit.triggerButton.register(parent);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static isHovering = function() { #region
|
||||
static isHovering = function() {
|
||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||
return false;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static drawParam = function(params) { #region
|
||||
static drawParam = function(params) {
|
||||
setParam(params);
|
||||
for(var i = 0; i < 4; i++) tb[i].setParam(params);
|
||||
|
||||
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region
|
||||
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
|
@ -118,6 +118,8 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
var sz = min(size, array_length(_data));
|
||||
var _bs = min(_h, ui(32));
|
||||
|
||||
if(unit) for(var i = 0; i < sz; i++) tb[i].slide_int = unit.mode == VALUE_UNIT.constant? true : false;
|
||||
|
||||
if((_w - _bs) / sz > ui(48)) {
|
||||
if(side_button) {
|
||||
side_button.setFocusHover(active, hover);
|
||||
|
@ -174,14 +176,14 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
|||
resetFocus();
|
||||
|
||||
return h;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static clone = function() { #region
|
||||
static clone = function() {
|
||||
var cln = new vectorBox(size, onModify, unit);
|
||||
|
||||
cln.linkable = linkable;
|
||||
cln.per_line = per_line;
|
||||
|
||||
return cln;
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"$GMScript":"",
|
||||
"%Name":"vectorBox",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
|
|
|
@ -20,6 +20,7 @@ function widget() constructor {
|
|||
|
||||
font = f_p0;
|
||||
sep_axis = false;
|
||||
unit = noone;
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"$GMScript":"",
|
||||
"%Name":"widget",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
|
|
|
@ -3,6 +3,10 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform float seed;
|
||||
|
||||
uniform int bmBright;
|
||||
uniform int bmRGB;
|
||||
uniform int bmHSV;
|
||||
|
||||
uniform vec2 brightness;
|
||||
uniform int brightnessUseSurf;
|
||||
uniform sampler2D brightnessSurf;
|
||||
|
@ -31,8 +35,28 @@ uniform vec2 val;
|
|||
uniform int valUseSurf;
|
||||
uniform sampler2D valSurf;
|
||||
|
||||
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123); }
|
||||
vec2 random2 (in vec2 st) { float a = random(st); return vec2(cos(a), sin(a)); }
|
||||
vec3 channel_mix(vec3 a, vec3 b, vec3 w) { return vec3(mix(a.r, b.r, w.r), mix(a.g, b.g, w.g), mix(a.b, b.b, w.b)); }
|
||||
vec3 screen( vec3 a, vec3 b, float w) { return mix(a, vec3(1.0) - (vec3(1.0) - a) * (vec3(1.0) - b), w); }
|
||||
vec3 soft_light( vec3 a, vec3 b, float w) { return mix(a, pow(a, pow(vec3(2.0), 2.0 * (vec3(0.5) - b))), w); }
|
||||
|
||||
float screen( float a, float b, float w) { return mix(a, 1. - (1. - a) * (1. - b), w); }
|
||||
|
||||
vec3 overlay(vec3 a, vec3 b, float w) {
|
||||
return mix(a, channel_mix(
|
||||
2.0 * a * b,
|
||||
vec3(1.0) - 2.0 * (vec3(1.0) - a) * (vec3(1.0) - b),
|
||||
step(vec3(0.5), a)
|
||||
), w);
|
||||
}
|
||||
|
||||
// float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(seed / 1000., 0.), vec2(12.9898, 78.233))) * 43758.5453123); }
|
||||
float gaussian( float z, float u, float o) { return (1.0 / (o * sqrt(2.0 * 3.1415))) * exp(-(((z - u) * (z - u)) / (2.0 * (o * o)))); }
|
||||
float grandom (in vec2 st) {
|
||||
float n = fract(sin(dot(st, vec2(12.9898, 78.233))) * 43758.5453 + seed);
|
||||
float r = gaussian(n, 0., .5 * .5);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#region =========================================== COLORS SPACES ===========================================
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
|
@ -123,58 +147,79 @@ vec2 random2 (in vec2 st) { float a = random(st); return vec2(cos(a), sin(a));
|
|||
void main() {
|
||||
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
float bri = brightness.x;
|
||||
if(brightnessUseSurf == 1) {
|
||||
float bri = brightness.x; if(brightnessUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( brightnessSurf, v_vTexcoord );
|
||||
bri = mix(brightness.x, brightness.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} bri *= bri;
|
||||
|
||||
float r = red.x;
|
||||
if(redUseSurf == 1) {
|
||||
float r = red.x; if(redUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( redSurf, v_vTexcoord );
|
||||
r = mix(red.x, red.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} r *= r;
|
||||
|
||||
float g = green.x;
|
||||
if(greenUseSurf == 1) {
|
||||
float g = green.x; if(greenUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( greenSurf, v_vTexcoord );
|
||||
g = mix(green.x, green.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} g *= g;
|
||||
|
||||
float b = blue.x;
|
||||
if(blueUseSurf == 1) {
|
||||
float b = blue.x; if(blueUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( blueSurf, v_vTexcoord );
|
||||
b = mix(blue.x, blue.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} b *= b;
|
||||
|
||||
float h = hue.x;
|
||||
if(hueUseSurf == 1) {
|
||||
float h = hue.x; if(hueUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( hueSurf, v_vTexcoord );
|
||||
h = mix(hue.x, hue.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} h *= h;
|
||||
|
||||
float s = sat.x;
|
||||
if(satUseSurf == 1) {
|
||||
float s = sat.x; if(satUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( satSurf, v_vTexcoord );
|
||||
s = mix(sat.x, sat.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} s *= s;
|
||||
|
||||
float v = val.x;
|
||||
if(valUseSurf == 1) {
|
||||
float v = val.x; if(valUseSurf == 1) {
|
||||
vec4 _vMap = texture2D( valSurf, v_vTexcoord );
|
||||
v = mix(val.x, val.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
} v *= v;
|
||||
|
||||
c.rgb *= 1. + bri * bri * (random(v_vTexcoord + vec2(0.156 + seed / 1000., 0.6169)) * 2. - 1.);
|
||||
c.r += r * r * (random(v_vTexcoord + vec2(0.985 + seed / 1000., 0.3642)) * 2. - 1.);
|
||||
c.g += g * g * (random(v_vTexcoord + vec2(0.653 + seed / 1000., 0.4954)) * 2. - 1.);
|
||||
c.b += b * b * (random(v_vTexcoord + vec2(0.382 + seed / 1000., 0.2967)) * 2. - 1.);
|
||||
float nBri = grandom(v_vTexcoord + vec2(0.156, 0.6169));
|
||||
vec3 grain = vec3(nBri);
|
||||
if(bmBright == 0) c.rgb += nBri * bri;
|
||||
else if(bmBright == 1) c.rgb *= 1. + nBri * bri;
|
||||
else if(bmBright == 2) c.rgb = screen( c.rgb, grain, bri);
|
||||
else if(bmBright == 3) c.rgb = overlay(c.rgb, grain, bri);
|
||||
|
||||
float nr = grandom(v_vTexcoord + vec2(0.985, 0.3642));
|
||||
if(bmRGB == 0) c.r += nr * r;
|
||||
else if(bmRGB == 1) c.r *= 1. + nr * r;
|
||||
else if(bmRGB == 2) c.r = screen( c.r, nr, r);
|
||||
|
||||
float ng = grandom(v_vTexcoord + vec2(0.653, 0.4954));
|
||||
if(bmRGB == 0) c.g += ng * g;
|
||||
else if(bmRGB == 1) c.g *= 1. + ng * g;
|
||||
else if(bmRGB == 2) c.g = screen( c.g, ng, g);
|
||||
|
||||
float nb = grandom(v_vTexcoord + vec2(0.382, 0.2967));
|
||||
if(bmRGB == 0) c.b += nb * b;
|
||||
else if(bmRGB == 1) c.b *= 1. + nb * b;
|
||||
else if(bmRGB == 2) c.b = screen( c.b, nb, b);
|
||||
|
||||
vec3 hsv = rgb2hsv(c.rgb);
|
||||
|
||||
hsv.r += h * h * (random(v_vTexcoord + vec2(0.685 + seed / 1000., 0.5672)) * 2. - 1.);
|
||||
hsv.g += s * s * (random(v_vTexcoord + vec2(0.134 + seed / 1000., 0.8632)) * 2. - 1.);
|
||||
hsv.b += v * v * (random(v_vTexcoord + vec2(0.268 + seed / 1000., 0.1264)) * 2. - 1.);
|
||||
float nh = grandom(v_vTexcoord + vec2(0.685, 0.5672));
|
||||
if(bmHSV == 0) hsv.r += nh * r;
|
||||
else if(bmHSV == 1) hsv.r *= 1. + nh * r;
|
||||
else if(bmHSV == 2) hsv.r = screen( hsv.r, nh, r);
|
||||
|
||||
float ns = grandom(v_vTexcoord + vec2(0.134, 0.8632));
|
||||
if(bmHSV == 0) hsv.g += ns * g;
|
||||
else if(bmHSV == 1) hsv.g *= 1. + ns * g;
|
||||
else if(bmHSV == 2) hsv.g = screen( hsv.g, ns, g);
|
||||
|
||||
float nv = grandom(v_vTexcoord + vec2(0.268, 0.1264));
|
||||
if(bmHSV == 0) hsv.b += nv * b;
|
||||
else if(bmHSV == 1) hsv.b *= 1. + nv * b;
|
||||
else if(bmHSV == 2) hsv.b = screen( hsv.b, nv, b);
|
||||
|
||||
c.rgb = hsv2rgb(hsv);
|
||||
|
||||
|
|
Loading…
Reference in a new issue