This commit is contained in:
Tanasart 2024-08-24 17:17:52 +07:00
parent 766f6bd39d
commit 8cf4801f5e
16 changed files with 70 additions and 60 deletions

View file

@ -328,7 +328,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
if(is_instanceof(_s, SurfaceAtlas))
_s = _s.surface.get();
if(!surface_exists(_s))
if(!is_surface(_s))
continue;
surface_cache[$ surfs[i]] = surface_clone(_s);

View file

@ -51,7 +51,6 @@
}
function get_asset(key) {
if(!ds_map_exists(global.ASSET_MAP, key)) return noone;
if(ds_map_exists(global.ASSET_CACHE, key)) {

View file

@ -235,14 +235,14 @@ function DirectoryObject(name, path) constructor { #region
var l_y = _y;
for(var i = 0; i < ds_list_size(subDir); i++) {
var _hg = subDir[| i].draw(parent, _x + ui(16), _y, _m, _w - ui(16), _hover, _focus, _homedir, _params);
draw_set_color(COLORS.collection_tree_line);
draw_line(_x + ui(12), _y + hg / 2, _x + ui(16), _y + hg / 2);
// draw_set_color(COLORS.collection_tree_line);
// draw_line(_x + ui(12), _y + hg / 2, _x + ui(16), _y + hg / 2);
hh += _hg;
_y += _hg;
}
draw_set_color(COLORS.collection_tree_line);
draw_line(_x + ui(12), l_y, _x + ui(12), _y - hg / 2);
draw_line(_x + ui(12), l_y, _x + ui(12), _y - ui(4));
}
return hh;

View file

@ -3,7 +3,7 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
batch_output = false;
preview_channel = 1;
object = new __3dPlane();
object = new __3dPlane();
object.checkParameter({ normal: 2 });
objectPreview = new __3dPlane();
@ -12,19 +12,18 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
objectPreview.materials[0] = materialPreview;
camera = camera_create();
viewMat = matrix_build_lookat(0, 0, 1,
0, 0, 0,
1, 0, 0);
projMat = matrix_build_projection_ortho(1, 1, 0.001, 10);
newInput(in_mesh + 0, nodeValue_Surface("Surface", self))
.setVisible(true, true);
newInput(in_mesh + 1, nodeValue_Enum_Button("Projection", self, 0, [ "Orthographic", "Perspective" ]));
newInput(in_mesh + 2, nodeValue_Float("FOV", self, 45));
input_display_list = [
["Material", false], in_mesh + 0,
["Material", false], in_mesh + 0,
__d3d_input_list_transform,
["Camera", false], in_mesh + 1, in_mesh + 2,
]
outputs[0].setVisible(false);
@ -33,31 +32,31 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
output_display_list = [ 1 ]
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
#region draw result
var _outSurf = outputs[1].getValue();
if(is_array(_outSurf)) _outSurf = array_safe_get_fast(_outSurf, preview_index);
if(!is_surface(_outSurf)) return;
var _w = _panel.w;
var _h = _panel.h - _panel.toolbar_height;
var _pw = surface_get_width_safe(_outSurf);
var _ph = surface_get_height_safe(_outSurf);
var _ps = min(128 / _ph, 160 / _pw);
var _pws = _pw * _ps;
var _phs = _ph * _ps;
var _px = _w - 16 - _pws;
var _py = _h - 16 - _phs;
draw_surface_ext_safe(_outSurf, _px, _py, _ps, _ps);
draw_set_color(COLORS._main_icon);
draw_rectangle(_px, _py, _px + _pws, _py + _phs, true);
#endregion
var _outSurf = outputs[1].getValue();
if(is_array(_outSurf)) _outSurf = array_safe_get_fast(_outSurf, preview_index);
if(!is_surface(_outSurf)) return;
var _w = _panel.w;
var _h = _panel.h - _panel.toolbar_height;
var _pw = surface_get_width_safe(_outSurf);
var _ph = surface_get_height_safe(_outSurf);
var _ps = min(128 / _ph, 160 / _pw);
var _pws = _pw * _ps;
var _phs = _ph * _ps;
var _px = _w - 16 - _pws;
var _py = _h - 16 - _phs;
draw_surface_ext_safe(_outSurf, _px, _py, _ps, _ps);
draw_set_color(COLORS._main_icon);
draw_rectangle(_px, _py, _px + _pws, _py + _phs, true);
}
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
static processData = function(_output, _data, _output_index, _array_index = 0) {
var _surf = _data[in_mesh + 0];
var _proj = _data[in_mesh + 1];
var _fov = _data[in_mesh + 2];
if(!is_surface(_surf)) return 0;
if(_output_index == 0) {
@ -72,7 +71,13 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
}
if(_output_index == 1) {
_output = surface_verify(_output, surface_get_width_safe(_surf), surface_get_height_safe(_surf));
var _dim = surface_get_dimension(_surf);
var projMat = _proj? matrix_build_projection_perspective_fov(_fov, _dim[0] / _dim[1], 0.001, 10) : matrix_build_projection_ortho(1, 1, 0.001, 10);
var viewMat = matrix_build_lookat(0, 0, 1,
0, 0, 0,
1, 0, 0);
_output = surface_verify(_output, _dim[0], _dim[1]);
surface_set_target(_output);
DRAW_CLEAR
camera_set_view_mat(camera, viewMat);
@ -94,13 +99,13 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
}
return 0;
} #endregion
}
static getPreviewObject = function() { return objectPreview; }
static getPreviewValues = function() { return array_safe_get_fast(all_inputs, in_mesh + 0, noone); }
static getPreviewValues = function() { return outputs[1].getValue(); }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) {
if(!previewable) return;
var _surf = outputs[1].getValue();
@ -112,5 +117,5 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
if(!isHighlightingInGraph()) aa *= 0.25;
draw_surface_bbox(_surf, bbox,, aa);
} #endregion
}
}

View file

@ -441,7 +441,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
case VALUE_TYPE.float : return _val;
case VALUE_TYPE.text : return is_string(_val)? _val : string_real(_val);
case VALUE_TYPE.color : return is_real(_val)? cola(_val) : _val;
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
}
return _val;

View file

@ -5,7 +5,7 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(1, nodeValue_Enum_Scroll("Type", self, 0, [ "Hex Disc", "Strip", "Linear Block", "Linear Block offset", "Chevron", "Square", "Square Non-Uniform" ]));
newInput(2, nodeValue_Int("Scale", self, 1));
newInput(2, nodeValue_Int("Density", self, 8));
newInput(3, nodeValue_Float("Size", self, .6))
.setDisplay(VALUE_DISPLAY.slider);
@ -30,8 +30,10 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(11, nodeValue_Bool("Ridge", self, false));
newInput(12, nodeValue_Float("Scene Scale", self, 1));
input_display_list = [ new Inspector_Sprite(s_MKFX), 7,
["Subpixel", false], 1, 2,
["Subpixel", false], 1, 2, 12,
["Effect", false], 3, 4, 8,
["Render", false], 6, 5,
["Ridge", false, 11], 9, 10,
@ -51,6 +53,7 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
var _rgcn = _data[9];
var _rgin = _data[10];
var _ruse = _data[11];
var _scns = _data[12];
var _dim = surface_get_dimension(_surf);
var sh = sh_mk_subpixel_hex_disc;
@ -81,7 +84,12 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
shader_set_f("ridgeCount", _rgcn);
shader_set_f("ridgeIntens", _rgin);
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1]);
var _cx = _dim[0] / 2;
var _cy = _dim[1] / 2;
var _px = _cx - _dim[0] * _scns / 2;
var _py = _cy - _dim[1] * _scns / 2;
draw_surface_ext(_surf, _px, _py, _scns, _scns, 0, c_white, 1);
surface_reset_shader();
return _outSurf;

View file

@ -1408,7 +1408,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
/////============== SET =============
static onValidate = function() { #region
static onValidate = function() {
if(!validateValue) return;
var _val = value_validation, str = "";
value_validation = VALIDATION.pass;
@ -1465,14 +1465,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#endregion
return self;
} #endregion
}
static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { ////Set value
val = unit.invApply(val);
return setValueDirect(val, noone, record, time, _update);
}
static overrideValue = function(_val) { #region
static overrideValue = function(_val) {
animator.values = [];
array_push(animator.values, new valueKey(0, _val, animator));
@ -1480,7 +1480,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
animators[i].values = [];
array_push(animators[i].values, new valueKey(0, array_safe_get_fast(_val, i), animators[i]));
}
} #endregion
}
static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) {
INLINE

View file

@ -14,13 +14,11 @@ function NodeValue_Surface(_name, _node, _value, _tooltip = "") : NodeValue(_nam
draw_junction_index = VALUE_TYPE.surface;
if(is_instanceof(val, SurfaceAtlas) || (array_valid(val) && is_instanceof(val[0], SurfaceAtlas)))
draw_junction_index = VALUE_TYPE.atlas;
return val;
}
static __getAnimValue = function(_time = CURRENT_FRAME) {
return array_empty(animator.values)? noone : animator.values[0].value;
}
static __getAnimValue = function(_time = CURRENT_FRAME) { return array_empty(animator.values)? noone : animator.processValue(animator.values[0].value); }
static arrayLength = arrayLengthSimple;
}

View file

@ -76,7 +76,7 @@ void main() {
else if(indx == 2) clr.b = intensity;
clr *= lig;
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -78,7 +78,7 @@ void main() {
clr *= lig;
vec2 uv = (hex / scs + .5) / vec2(dimension.x / dimension.y, 1.);
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -87,7 +87,7 @@ void main() {
clr *= lig;
vec2 uv = (hex / scs + .5) / vec2(dimension.x / dimension.y, 1.);
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -59,7 +59,7 @@ void main() {
else if(indx == 2) clr.b = intensity;
clr *= lig;
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -66,7 +66,7 @@ void main() {
else if(indx == 2) clr.b = intensity;
clr *= lig;
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -70,7 +70,7 @@ void main() {
else if(indx == 2) clr.b = intensity;
clr *= lig;
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -67,7 +67,7 @@ void main() {
else if(indx == 2) clr.b = intensity;
clr *= lig;
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);

View file

@ -69,7 +69,7 @@ void main() {
else if(indx == 2) clr.b = intensity;
clr *= lig;
vec3 baseC = texture2D( texture, uv ).rgb;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;
baseC.rgb *= clr;
gl_FragColor = vec4(baseC, 1.);