This commit is contained in:
Tanasart 2024-01-25 14:24:02 +07:00
parent f5c4752056
commit 6fddeedd5f
18 changed files with 52 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -302,6 +302,10 @@
#endregion #endregion
#region 3D #region 3D
globalvar USE_DEPTH;
_use_depth = noone;
USE_DEPTH = false;
set3DGlobalPreview(); set3DGlobalPreview();
#endregion #endregion

View file

@ -201,4 +201,13 @@ _HOVERING_ELEMENT = noone;
MOUSE_WRAP = false; MOUSE_WRAP = false;
#endregion #endregion
#region depth
if(_use_depth != USE_DEPTH) {
_use_depth = USE_DEPTH;
surface_depth_disable(!USE_DEPTH);
}
USE_DEPTH = false;
#endregion
//if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)"); //if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)");

View file

@ -554,6 +554,7 @@ enum CAMERA_PROJ {
var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ]; var lightFor = [ -cos(degtorad(_ldir)), -_lhgt, -sin(degtorad(_ldir)) ];
gpu_set_ztestenable(true); gpu_set_ztestenable(true);
surface_set_target(_outSurf); surface_set_target(_outSurf);
DRAW_CLEAR DRAW_CLEAR
@ -615,6 +616,7 @@ enum CAMERA_PROJ {
matrix_set(matrix_world, MATRIX_IDENTITY); matrix_set(matrix_world, MATRIX_IDENTITY);
gpu_set_ztestenable(false); gpu_set_ztestenable(false);
var cam = camera_get_active(); var cam = camera_get_active();
camera_set_view_mat(cam, matrix_build_lookat(0, 0, 1, 0, 0, 0, 0, 1, 0)); camera_set_view_mat(cam, matrix_build_lookat(0, 0, 1, 0, 0, 0, 0, 1, 0));
camera_set_proj_mat(cam, matrix_build_projection_ortho(1, 1, 0.1, 256)); camera_set_proj_mat(cam, matrix_build_projection_ortho(1, 1, 0.1, 256));

View file

@ -1,6 +1,7 @@
function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "3D"; name = "3D";
is_3D = true; is_3D = true;
surface_depth_disable(false);
mesh_prev_surface = surface_create(64, 64); mesh_prev_surface = surface_create(64, 64);
@ -60,6 +61,7 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
D3D_GLOBAL_PREVIEW.submitUI(_prev); D3D_GLOBAL_PREVIEW.submitUI(_prev);
} }
surface_reset_target(); surface_reset_target();
D3D_GLOBAL_PREVIEW.camera.resetCamera(); D3D_GLOBAL_PREVIEW.camera.resetCamera();

View file

@ -252,14 +252,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _posDist = []; var _posDist = [];
random_set_seed(seed); random_set_seed(seed); seed++;
var _amo = irandom_range(_spawn_amount[0], _spawn_amount[1]); var _amo = irandom_range(_spawn_amount[0], _spawn_amount[1]);
if(_distrib == 2) _posDist = get_points_from_dist(_dist_map, _amo, seed); if(_distrib == 2) _posDist = get_points_from_dist(_dist_map, _amo, seed);
//print($"[{display_name}] Frame {_time}: Spawning {_amo} particles, seed {seed}, at {_pos}");
random_set_seed(seed);
for( var i = 0; i < _amo; i++ ) { for( var i = 0; i < _amo; i++ ) {
parts_runner = clamp(parts_runner, 0, array_length(parts) - 1); parts_runner = clamp(parts_runner, 0, array_length(parts) - 1);
var part = parts[parts_runner]; var part = parts[parts_runner];

View file

@ -61,6 +61,7 @@ function __3dLightDirectional() : __3dLight() constructor {
draw_clear(c_black); draw_clear(c_black);
shader_set(shadow_mapper); shader_set(shadow_mapper);
shader_set_i("use_8bit", OS == os_macosx); shader_set_i("use_8bit", OS == os_macosx);
gpu_set_ztestenable(true); gpu_set_ztestenable(true);
camera_set_view_mat(shadow_map_camera, shadow_map_view); camera_set_view_mat(shadow_map_camera, shadow_map_view);
@ -72,6 +73,7 @@ function __3dLightDirectional() : __3dLight() constructor {
shader_reset(); shader_reset();
surface_reset_target(); surface_reset_target();
camera_apply(0); camera_apply(0);
gpu_set_ztestenable(false); gpu_set_ztestenable(false);
} #endregion } #endregion
} }

View file

@ -75,6 +75,7 @@ function __3dLightPoint() : __3dLight() constructor {
shader_reset(); shader_reset();
surface_reset_target(); surface_reset_target();
camera_apply(0); camera_apply(0);
gpu_set_ztestenable(false); gpu_set_ztestenable(false);
} #endregion } #endregion

View file

@ -136,7 +136,9 @@ function __3dScene(camera, name = "New scene") constructor {
surface_set_target_ext(0, deferData.geometry_data[0]); surface_set_target_ext(0, deferData.geometry_data[0]);
surface_set_target_ext(1, deferData.geometry_data[1]); surface_set_target_ext(1, deferData.geometry_data[1]);
surface_set_target_ext(2, deferData.geometry_data[2]); surface_set_target_ext(2, deferData.geometry_data[2]);
gpu_set_zwriteenable(true); gpu_set_zwriteenable(true);
gpu_set_ztestenable(true); gpu_set_ztestenable(true);
gpu_set_alphatestenable(true); gpu_set_alphatestenable(true);
@ -154,6 +156,7 @@ function __3dScene(camera, name = "New scene") constructor {
submit(object, sh_d3d_geometry); submit(object, sh_d3d_geometry);
shader_reset(); shader_reset();
gpu_set_ztestenable(false); gpu_set_ztestenable(false);
gpu_set_alphatestenable(false); gpu_set_alphatestenable(false);
surface_reset_target(); surface_reset_target();

View file

@ -328,10 +328,11 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
DRAW_CLEAR DRAW_CLEAR
gpu_set_zwriteenable(true); gpu_set_zwriteenable(true);
gpu_set_ztestenable(true);
gpu_set_cullmode(_back); gpu_set_cullmode(_back);
if(_blend == 1) { if(_blend == 0) {
gpu_set_ztestenable(true);
} else {
BLEND_ADD BLEND_ADD
gpu_set_ztestenable(false); gpu_set_ztestenable(false);
} }

View file

@ -338,7 +338,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
var _hi = ui(junction_draw_pad_y); var _hi = ui(junction_draw_pad_y);
var _ho = ui(junction_draw_pad_y); var _ho = ui(junction_draw_pad_y);
var _prev_surf = previewable && preview_draw && is_surface(getGraphPreviewSurface()); 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)
);
for( var i = 0; i < ds_list_size(inputs); i++ ) { for( var i = 0; i < ds_list_size(inputs); i++ ) {
var _inp = inputs[| i]; var _inp = inputs[| i];
@ -511,6 +514,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
will_setHeight = false; will_setHeight = false;
} }
if(is_3D) USE_DEPTH = true;
if(is_simulation) PROJECT.animator.is_simulating = true; if(is_simulation) PROJECT.animator.is_simulating = true;
} #endregion } #endregion

View file

@ -21,7 +21,7 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct
inputs[| 6] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); inputs[| 6] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 7] = nodeValue("Wiggle Amplitude", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -2, 2 ]) inputs[| 7] = nodeValue("Wiggle Amplitude", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ -2, 2 ])
.setDisplay(VALUE_DISPLAY.range, { linked : true }); .setDisplay(VALUE_DISPLAY.range);
inputs[| 8] = nodeValue("Wiggle Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 8); inputs[| 8] = nodeValue("Wiggle Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 8);

View file

@ -109,10 +109,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var grup = getInputData(1); var grup = getInputData(1);
if(grup == SPRITE_ANIM_GROUP.animation) if(grup == SPRITE_ANIM_GROUP.animation) animationInit(clear);
animationInit(clear); else arrayRender();
else
arrayRender();
} #endregion } #endregion
static arrayRender = function() { #region static arrayRender = function() { #region
@ -129,7 +127,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var cDep = attrDepth(); var cDep = attrDepth();
if(!is_array(inpt)) { if(!is_array(inpt)) {
outputs[| 0].setValue(inpt); outputs[| 0].setValue(surface_clone(inpt));
outputs[| 1].setValue([]); outputs[| 1].setValue([]);
return; return;
} }
@ -465,9 +463,6 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _sx = 0; var _sx = 0;
var _sy = 0; var _sy = 0;
surface_set_target(oo);
BLEND_OVERRIDE
switch(pack) { switch(pack) {
case SPRITE_STACK.horizontal : case SPRITE_STACK.horizontal :
px = padd[2] + _frame * _w + max(0, _frame) * spac; px = padd[2] + _frame * _w + max(0, _frame) * spac;
@ -501,14 +496,16 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
break; break;
} }
printIf(log, $" > Drawing frame ({CURRENT_FRAME}) at {_sx}, {_sy}"); surface_set_shader(oo, noone, false, BLEND.over);
array_push(_atli, new SurfaceAtlas(_surfi, _sx, _sy));
draw_surface_safe(inpt[i], _sx, _sy); printIf(log, $" > Drawing frame ({CURRENT_FRAME}) {_surfi} at {_sx}, {_sy}");
_atli[i] = new SurfaceAtlas(_surfi, _sx, _sy);
draw_surface(_surfi, _sx, _sy);
surface_reset_shader();
drawn = true; drawn = true;
BLEND_NORMAL;
surface_reset_target();
} #endregion } #endregion
if(drawn) array_safe_set(anim_drawn, CURRENT_FRAME, true); if(drawn) array_safe_set(anim_drawn, CURRENT_FRAME, true);

View file

@ -150,7 +150,10 @@ void main() { #region
if(gradient_use == 0) { if(gradient_use == 0) {
if(blend == 0) gl_FragColor = _s > rat? color0 : color1; if(blend == 0) gl_FragColor = _s > rat? color0 : color1;
else gl_FragColor = vec4(vec3(sin(_s * 2. * PI) * 0.5 + 0.5), 1.); else {
_s = sin(_s * 2. * PI) * 0.5 + 0.5;
gl_FragColor = mix(color0, color1, _s);
}
} else { } else {
if(_s > rat) gl_FragColor = gradientEval(random(vec2(slot))); if(_s > rat) gl_FragColor = gradientEval(random(vec2(slot)));
else gl_FragColor = gradientEval(random(vec2(slot + 1.))); else gl_FragColor = gradientEval(random(vec2(slot + 1.)));