mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 12:34:06 +01:00
- [Grid] Add secondary pattern properties.
This commit is contained in:
parent
782e6d8e1a
commit
3bf08a6c73
@ -1650,6 +1650,7 @@
|
||||
{"name":"sh_region_fill_inner_remove","order":8,"path":"shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy",},
|
||||
{"name":"sh_region_fill_inner","order":3,"path":"shaders/sh_region_fill_inner/sh_region_fill_inner.yy",},
|
||||
{"name":"sh_region_fill_map","order":4,"path":"shaders/sh_region_fill_map/sh_region_fill_map.yy",},
|
||||
{"name":"sh_region_fill_rg_coord","order":11,"path":"shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.yy",},
|
||||
{"name":"sh_region_fill_rg_map","order":7,"path":"shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy",},
|
||||
{"name":"sh_remove_black","order":17,"path":"shaders/sh_remove_black/sh_remove_black.yy",},
|
||||
{"name":"sh_replace_color","order":4,"path":"shaders/sh_replace_color/sh_replace_color.yy",},
|
||||
|
@ -2334,6 +2334,7 @@
|
||||
{"id":{"name":"sh_region_fill_inner_remove","path":"shaders/sh_region_fill_inner_remove/sh_region_fill_inner_remove.yy",},},
|
||||
{"id":{"name":"sh_region_fill_inner","path":"shaders/sh_region_fill_inner/sh_region_fill_inner.yy",},},
|
||||
{"id":{"name":"sh_region_fill_map","path":"shaders/sh_region_fill_map/sh_region_fill_map.yy",},},
|
||||
{"id":{"name":"sh_region_fill_rg_coord","path":"shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.yy",},},
|
||||
{"id":{"name":"sh_region_fill_rg_map","path":"shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy",},},
|
||||
{"id":{"name":"sh_remove_black","path":"shaders/sh_remove_black/sh_remove_black.yy",},},
|
||||
{"id":{"name":"sh_replace_color","path":"shaders/sh_replace_color/sh_replace_color.yy",},},
|
||||
|
@ -1,33 +1,38 @@
|
||||
function argumentRenderer(_typeArray = []) {
|
||||
argument_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
argument_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) {
|
||||
argument_renderer.x = _x;
|
||||
argument_renderer.y = _y;
|
||||
argument_renderer.w = _w;
|
||||
|
||||
var tx = _x;
|
||||
var ty = _y + ui(8);
|
||||
var hh = ui(8);
|
||||
var _th = TEXTBOX_HEIGHT + ui(4);
|
||||
var spc = _panel.viewMode == INSP_VIEW_MODE.spacious;
|
||||
var tx = _x;
|
||||
var ty = _y + ui(8);
|
||||
var hh = ui(8);
|
||||
var _fn = f_p1;
|
||||
var _th = line_get_height(f_p0, 12);
|
||||
|
||||
for( var i = input_fix_len; i < array_length(inputs); i += data_length ) {
|
||||
var _jType = inputs[i + 1];
|
||||
var _h = 0;
|
||||
|
||||
_jType.editWidget.setFocusHover(_focus, _hover);
|
||||
_jType.editWidget.font = _fn;
|
||||
_jType.editWidget.draw(tx, ty, ui(128), _th, _jType.display_data.data[_jType.showValue()], _m, argument_renderer.rx, argument_renderer.ry);
|
||||
|
||||
var _jName = inputs[i + 0];
|
||||
_jName.editWidget.setFocusHover(_focus, _hover);
|
||||
_jName.editWidget.font = _fn;
|
||||
_jName.editWidget.draw(tx + ui(128 + 8), ty, _w - ui(128 + 8), _th, _jName.showValue(), _m, _jName.display_type);
|
||||
|
||||
_h += _th + ui(8);
|
||||
|
||||
var _jValue = inputs[i + 2];
|
||||
if(argument_renderer.showValue && _jValue.editWidget != noone) {
|
||||
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_set_text(_fn, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text_add(tx + ui(8), ty + _th + ui(8 + 6), __txt("Value"));
|
||||
|
||||
var params = new widgetParam(tx + ui(64), ty + _th + ui(10), _w - ui(64), TEXTBOX_HEIGHT, _jValue.showValue(), {}, _m, argument_renderer.rx, argument_renderer.ry);
|
||||
params.font = _fn;
|
||||
|
||||
_jValue.editWidget.setFocusHover(_focus, _hover);
|
||||
_h += _jValue.editWidget.drawParam(params) + ui(10);
|
||||
|
@ -70,11 +70,17 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
||||
|
||||
newInput(28, nodeValue_Bool("Uniform height", self, true));
|
||||
|
||||
newInput(29, nodeValue_Float("Secondary Scale", self, 0));
|
||||
|
||||
newInput(30, nodeValue_Float("Secondary Shift", self, 0))
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 15, 2, 13, 28, 3, 26, 27, 14, 9, 8, 16,
|
||||
["Render", false], 10, 11, 5, 20, 6, 7, 25, 12, 24,
|
||||
["Truchet", true, 17], 18, 19, 22, 23,
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 15, 2, 13, 28, 3, 26, 27, 14, 9, 8, 16,
|
||||
["Secondary", false], 30, 29,
|
||||
["Render", false], 10, 11, 5, 20, 6, 7, 25, 12, 24,
|
||||
["Truchet", true, 17], 18, 19, 22, 23,
|
||||
];
|
||||
|
||||
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
||||
@ -93,13 +99,13 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
||||
return hov;
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
static step = function() {
|
||||
inputs[2].mappableStep();
|
||||
inputs[3].mappableStep();
|
||||
inputs[4].mappableStep();
|
||||
inputs[5].mappableStep();
|
||||
inputs[8].mappableStep();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _dim = _data[ 0];
|
||||
@ -150,6 +156,8 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
||||
shader_set_f("gapAcc", _data[26]);
|
||||
shader_set_i("diagonal", _data[27]);
|
||||
shader_set_i("uniformSize", _data[28]);
|
||||
shader_set_f("secScale", _data[29]);
|
||||
shader_set_f("secShift", _data[30]);
|
||||
|
||||
shader_set_color("gapCol", _col_gap);
|
||||
|
||||
|
@ -18,7 +18,7 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
||||
|
||||
newInput(7, nodeValue_Enum_Scroll("Draw original", self, 0, [ "None", "Above", "Behind" ]));
|
||||
|
||||
newInput(8, nodeValue_Enum_Scroll("Fill type", self, 0, [ "Random", "Color map", "Texture map" ]));
|
||||
newInput(8, nodeValue_Enum_Scroll("Fill type", self, 0, [ "Random", "Color map", "Texture map", "Texture Coord" ]));
|
||||
|
||||
newInput(9, nodeValue_Surface("Color map", self));
|
||||
|
||||
@ -29,10 +29,10 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
||||
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 4,
|
||||
["Surfaces", false], 0, 1,
|
||||
["Regions", false, 11], 5, 6,
|
||||
["Fill", false], 8, 2, 9, 10,
|
||||
["Render", false], 7,
|
||||
["Surfaces", false], 0, 1,
|
||||
["Regions Filter", false, 11], 5, 6,
|
||||
["Fill", false], 8, 2, 9, 10,
|
||||
["Render", false], 7,
|
||||
];
|
||||
|
||||
temp_surface = array_create(3);
|
||||
@ -48,7 +48,7 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
||||
inputs[ 5].setVisible(_fclr);
|
||||
inputs[ 6].setVisible(_fclr);
|
||||
}
|
||||
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _surf = _data[0];
|
||||
var _mask = _data[1];
|
||||
@ -200,6 +200,12 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
||||
draw_surface_safe(cmap);
|
||||
shader_reset();
|
||||
break;
|
||||
|
||||
case 3 : // Texture Map
|
||||
shader_set(sh_region_fill_rg_coord);
|
||||
draw_surface_safe(cmap);
|
||||
shader_reset();
|
||||
break;
|
||||
}
|
||||
|
||||
if(_rnbg == 1) draw_surface_safe(_surf); // render original
|
||||
|
@ -2046,6 +2046,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||
for(var i = -1, n = array_length(node_context); i < n; i++) {
|
||||
if(i == -1) {
|
||||
tt = __txt("Global");
|
||||
|
||||
} else {
|
||||
var _cnt = node_context[i];
|
||||
tt = _cnt.renamed? _cnt.display_name : _cnt.name;
|
||||
|
@ -67,9 +67,10 @@
|
||||
#endregion
|
||||
|
||||
function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constructor {
|
||||
h = 64;
|
||||
node = noone;
|
||||
self.draw = drawFn;
|
||||
node = noone;
|
||||
panel = noone;
|
||||
h = 64;
|
||||
|
||||
if(registerFn != noone) register = registerFn;
|
||||
else {
|
||||
@ -775,10 +776,11 @@ function Panel_Inspector() : PanelContent() constructor {
|
||||
|
||||
} else if(is_instanceof(jun, Inspector_Custom_Renderer)) {
|
||||
jun.register(contentPane);
|
||||
jun.panel = self;
|
||||
jun.rx = ui(16) + x;
|
||||
jun.ry = top_bar_h + y;
|
||||
|
||||
var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS) + ui(8);
|
||||
var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS, self) + ui(8);
|
||||
if(!is_undefined(_wdh)) hh += _wdh;
|
||||
continue;
|
||||
|
||||
|
@ -24,6 +24,8 @@ uniform vec2 shift;
|
||||
uniform int shiftUseSurf;
|
||||
uniform sampler2D shiftSurf;
|
||||
|
||||
uniform float secScale;
|
||||
uniform float secShift;
|
||||
uniform float gapAcc;
|
||||
uniform vec4 gapCol;
|
||||
uniform int gradient_use;
|
||||
@ -175,7 +177,7 @@ float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(85.456034, 64.5406
|
||||
|
||||
#endregion //////////////////////////////////// GRADIENT ////////////////////////////////////
|
||||
|
||||
void main() { #region
|
||||
void main() {
|
||||
#region params
|
||||
vec2 sca = scale;
|
||||
if(scaleUseSurf == 1) {
|
||||
@ -247,16 +249,20 @@ void main() { #region
|
||||
shf /= sca.x;
|
||||
|
||||
float cellY = floor(_pos.y * sca.y);
|
||||
float shiftX = mod(cellY, 2.) * shf;
|
||||
float _sec = mod(cellY, 2.);
|
||||
float shiftX = _sec * shf;
|
||||
|
||||
_pos.x += shiftX;
|
||||
_pos.x += shiftX + _sec * secShift;
|
||||
sca.x *= 1. + _sec * secScale;
|
||||
} else {
|
||||
shf /= sca.y;
|
||||
|
||||
float cellX = floor(_pos.x * sca.x);
|
||||
float shiftY = mod(cellX, 2.) * shf;
|
||||
float _sec = mod(cellX, 2.);
|
||||
float shiftY = _sec * shf;
|
||||
|
||||
_pos.y += shiftY;
|
||||
_pos.y += shiftY + _sec * secShift;
|
||||
sca.y *= 1. + _sec * secScale;
|
||||
}
|
||||
|
||||
vec2 sqSt = floor(_pos * sca) / sca;
|
||||
@ -299,4 +305,4 @@ void main() { #region
|
||||
|
||||
float _aa = 4. / max(dimension.x, dimension.y);
|
||||
gl_FragColor = mix(gapCol, colr, aa == 1? smoothstep(wid - _aa, wid, dist) : step(wid, dist));
|
||||
} #endregion
|
||||
}
|
||||
|
14
shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.fsh
Normal file
14
shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.fsh
Normal file
@ -0,0 +1,14 @@
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main() {
|
||||
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
if(c.rgb == vec3(0.)) {
|
||||
gl_FragColor = vec4(0.);
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 t = (v_vTexcoord - c.xy) / (c.zw - c.xy);
|
||||
gl_FragColor = vec4( t, 0., 1. );
|
||||
}
|
19
shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.vsh
Normal file
19
shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.vsh
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
12
shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.yy
Normal file
12
shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"$GMShader":"",
|
||||
"%Name":"sh_region_fill_rg_coord",
|
||||
"name":"sh_region_fill_rg_coord",
|
||||
"parent":{
|
||||
"name":"region",
|
||||
"path":"folders/shader/generator/region.yy",
|
||||
},
|
||||
"resourceType":"GMShader",
|
||||
"resourceVersion":"2.0",
|
||||
"type":1,
|
||||
}
|
Loading…
Reference in New Issue
Block a user