mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- [Square, Tri, Pen, Hex Grid] Add option to use texture dimension.
This commit is contained in:
parent
2aaa206a7a
commit
2ff855332c
6 changed files with 52 additions and 18 deletions
|
@ -70,10 +70,12 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
inputs[| 24] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
inputs[| 25] = nodeValue("Use Texture Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 15, 2, 13, 3, 14, 9, 8, 16,
|
||||
["Render", false], 10, 11, 5, 20, 6, 7, 12, 24,
|
||||
["Render", false], 10, 11, 5, 20, 6, 7, 25, 12, 24,
|
||||
["Truchet", true, 17], 18, 19, 22, 23,
|
||||
];
|
||||
|
||||
|
@ -101,11 +103,17 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _mode = _data[10];
|
||||
|
||||
var _col_gap = _data[6];
|
||||
var _tex_mode = _mode == 2 || _mode == 3;
|
||||
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
inputs[| 6].setVisible(_mode != 1);
|
||||
inputs[| 24].setVisible(_mode == 1);
|
||||
inputs[| 7].setVisible(_mode == 2 || _mode == 3);
|
||||
|
||||
inputs[| 7].setVisible(_tex_mode, _tex_mode);
|
||||
inputs[| 25].setVisible(_tex_mode, _tex_mode);
|
||||
|
||||
var _tex_dim = is_surface(_sam) && _tex_mode && _data[25];
|
||||
if(_tex_dim) _dim = surface_get_dimension(_sam);
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
surface_set_shader(_outSurf, sh_grid);
|
||||
|
|
|
@ -66,10 +66,12 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 20] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
inputs[| 21] = nodeValue("Use Texture Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 3, 12, 2, 11, 4, 13,
|
||||
["Render", false], 7, 8, 5, 17, 6, 9, 10, 20,
|
||||
["Render", false], 7, 8, 5, 17, 6, 9, 21, 10, 20,
|
||||
["Truchet", true, 14], 15, 16, 19,
|
||||
];
|
||||
|
||||
|
@ -96,11 +98,17 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var _mode = _data[7];
|
||||
|
||||
var _col_gap = _data[6];
|
||||
var _tex_mode = _mode == 2 || _mode == 3;
|
||||
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
inputs[| 6].setVisible(_mode != 1);
|
||||
inputs[| 20].setVisible(_mode == 1);
|
||||
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
|
||||
|
||||
inputs[| 9].setVisible(_tex_mode, _tex_mode);
|
||||
inputs[| 21].setVisible(_tex_mode, _tex_mode);
|
||||
|
||||
var _tex_dim = is_surface(_sam) && _tex_mode && _data[21];
|
||||
if(_tex_dim) _dim = surface_get_dimension(_sam);
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
|
|
|
@ -52,10 +52,12 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
|||
inputs[| 16] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
inputs[| 17] = nodeValue("Use Texture Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 13, 2, 11, 3, 12,
|
||||
["Render", false], 8, 9, 5, 14, 6, 7, 10, 16,
|
||||
["Render", false], 8, 9, 5, 14, 6, 7, 17, 10, 16,
|
||||
];
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -81,11 +83,17 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _
|
|||
var _mode = _data[8];
|
||||
|
||||
var _col_gap = _data[6];
|
||||
var _tex_mode = _mode == 2 || _mode == 3;
|
||||
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
inputs[| 6].setVisible(_mode != 1);
|
||||
inputs[| 16].setVisible(_mode == 1);
|
||||
inputs[| 7].setVisible(_mode == 2 || _mode == 3);
|
||||
|
||||
inputs[| 7].setVisible(_tex_mode, _tex_mode);
|
||||
inputs[| 17].setVisible(_tex_mode, _tex_mode);
|
||||
|
||||
var _tex_dim = is_surface(_sam) && _tex_mode && _data[17];
|
||||
if(_tex_dim) _dim = surface_get_dimension(_sam);
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
surface_set_shader(_outSurf, sh_grid_pentagonal);
|
||||
|
|
|
@ -66,10 +66,12 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
inputs[| 20] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.slider_range);
|
||||
|
||||
inputs[| 21] = nodeValue("Use Texture Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
input_display_list = [
|
||||
["Output", false], 0,
|
||||
["Pattern", false], 1, 4, 13, 2, 11, 3, 12,
|
||||
["Render", false], 8, 9, 5, 17, 6, 7, 10, 20,
|
||||
["Render", false], 8, 9, 5, 17, 6, 7, 21, 10, 20,
|
||||
["Truchet", true, 14], 15, 16, 19,
|
||||
];
|
||||
|
||||
|
@ -98,11 +100,17 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var _aa = _data[10];
|
||||
|
||||
var _col_gap = _data[6];
|
||||
var _tex_mode = _mode == 2 || _mode == 3;
|
||||
|
||||
inputs[| 5].setVisible(_mode == 0);
|
||||
inputs[| 6].setVisible(_mode != 1);
|
||||
inputs[| 20].setVisible(_mode == 1);
|
||||
inputs[| 7].setVisible(_mode == 2 || _mode == 3);
|
||||
|
||||
inputs[| 7].setVisible(_tex_mode, _tex_mode);
|
||||
inputs[| 21].setVisible(_tex_mode, _tex_mode);
|
||||
|
||||
var _tex_dim = is_surface(_sam) && _tex_mode && _data[21];
|
||||
if(_tex_dim) _dim = surface_get_dimension(_sam);
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
|
||||
|
||||
|
|
|
@ -265,8 +265,9 @@ void main() { #region
|
|||
}
|
||||
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
|
||||
} else if(mode == 3) {
|
||||
vec2 uv = clamp(abs(hc.zw) / sca, 0., 1.);
|
||||
vec2 uv = clamp(abs(hc.zw) / sca / vec2(dimension.x / dimension.y, 1.), 0., 1.);
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
}
|
||||
|
||||
|
|
|
@ -243,8 +243,9 @@ void main() { #region
|
|||
}
|
||||
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
|
||||
} else if(mode == 3) {
|
||||
vec2 uv = clamp(tri.xy / sca, 0., 1.);
|
||||
vec2 uv = clamp(tri.xy / sca / vec2(dimension.x / dimension.y, c30), 0., 1.);
|
||||
colr = texture2D( gm_BaseTexture, uv );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue