3D light, SDF fixes

This commit is contained in:
Tanasart 2023-11-15 08:35:30 +07:00
parent 9a76afe6b5
commit 265f7c997e
20 changed files with 81 additions and 57 deletions

View File

@ -460,7 +460,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_inspector.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_preview.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_paste.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_patreon_supporter.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_patreon_supporter_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_patreon.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_pin.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_pixel_builder.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},

View File

@ -6,6 +6,7 @@ function __3dGizmo() : __3dObject() constructor {
static submitSel = function(params = {}) {
shader_set(sh_d3d_wireframe);
shader_set_color("blend", c_white);
submitVertex(params);
shader_reset();
}

View File

@ -36,6 +36,7 @@ function __3dCamera_object() : __3dObject() constructor {
static submitSel = function(params = {}) {
shader_set(sh_d3d_wireframe);
shader_set_color("blend", c_white);
submitVertex(params);
shader_reset();
}

View File

@ -1,7 +1,7 @@
function __3dLight() : __3dObject() constructor {
UI_vertex = [ array_create(33) ];
for( var i = 0; i <= 32; i++ )
UI_vertex[0][i] = new __vertex(0, lengthdir_x(0.5, i / 32 * 360), lengthdir_y(0.5, i / 32 * 360), c_yellow, 0.8);
UI_vertex[0][i] = new __vertex(0, lengthdir_x(0.5, i / 32 * 360), lengthdir_y(0.5, i / 32 * 360), c_white);
VB_UI = build(noone, UI_vertex);
color = c_white;

View File

@ -1,5 +1,5 @@
function __3dLightDirectional() : __3dLight() constructor {
vertex = [[ new __vertex(1, 0, 0, c_yellow, 0.8), new __vertex(3, 0, 0, c_yellow, 0.8) ]];
vertex = [[ new __vertex(1, 0, 0, c_white), new __vertex(3, 0, 0, c_white) ]];
VF = global.VF_POS_COL;
render_type = pr_linelist;
VB = build();
@ -13,6 +13,8 @@ function __3dLightDirectional() : __3dLight() constructor {
static submitSel = function(params = {}) { #region
shader_set(sh_d3d_wireframe);
shader_set_color("blend", color);
preSubmitVertex(params);
shader_reset();
} #endregion

View File

@ -11,6 +11,7 @@ function __3dLightPoint() : __3dLight() constructor {
static submitSel = function(params = {}) {
shader_set(sh_d3d_wireframe);
shader_set_color("blend", color);
preSubmitVertex(params);
shader_reset();
}

View File

@ -181,6 +181,8 @@ function __3dObject() constructor {
if(NVB == noone) generateNormal();
if(NVB != noone) {
shader_set(sh_d3d_wireframe);
shader_set_color("blend", c_white);
for( var i = 0, n = array_length(NVB); i < n; i++ )
vertex_submit(NVB[i], pr_linelist, -1);
shader_reset();

View File

@ -26,7 +26,7 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11571;
SAVE_VERSION = 11560;
SAVE_VERSION = 11570;
VERSION_STRING = "1.15.7.1";
BUILD_NUMBER = 11571;

View File

@ -43,16 +43,9 @@ function Node_SDF(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const
temp_surface[1] = surface_verify(temp_surface[1], _n, _n, cDep);
_outSurf = surface_verify(_outSurf, sw, sh, cDep);
surface_set_target(temp_surface[0]);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(sh_sdf_tex);
surface_set_shader(temp_surface[0], sh_sdf_tex);
draw_surface_safe(inSurf, 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
var _step = ceil(log2(_n));
var stepSize = power(2, _step);
@ -62,33 +55,19 @@ function Node_SDF(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const
stepSize /= 2;
bg = !bg;
surface_set_target(temp_surface[bg]);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(sh_sdf);
surface_set_shader(temp_surface[bg], sh_sdf);
shader_set_uniform_f(uniform_sdf_dim, _n, _n );
shader_set_uniform_f(uniform_sdf_stp, stepSize);
shader_set_uniform_i(uniform_sdf_sid, _side);
draw_surface_safe(temp_surface[!bg], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
}
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(sh_sdf_dist);
surface_set_shader(_outSurf, sh_sdf_dist);
shader_set_uniform_i(uniform_dst_sid, _side);
shader_set_uniform_f(uniform_dst_dst, _dist);
draw_surface_safe(temp_surface[bg], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
} #endregion

View File

@ -645,22 +645,6 @@ function Panel_Menu() : PanelContent() constructor {
}
#endregion
#region patreon
if(IS_PATREON && PREFERENCES.show_supporter_icon) {
_x1 = _x0 - 8;
_x0 -= ui(32);
var _cx = (_x0 + _x1) / 2;
var _cy = (_y0 + _y1) / 2;
if(pHOVER && point_in_rectangle(mx, my, _cx - 16, _y0, _cx + 16, _y1)) {
TOOLTIP = "Verified supporter";
}
draw_sprite_ext(s_patreon_supporter, 0, _cx, _cy, 1, 1, 0, tc, 1);
}
#endregion
#region title
var txt = "";
if(PROJECT.safeMode) txt += "[SAFE MODE] ";
@ -713,7 +697,11 @@ function Panel_Menu() : PanelContent() constructor {
tby0 = ty0;
}
if(buttonInstant(THEME.button_hide_fill, tbx0, tby0, tw, th, [mx, my], pFOCUS, pHOVER) == 2) {
var _b = buttonInstant(THEME.button_hide_fill, tbx0, tby0, tw, th, [mx, my], pFOCUS, pHOVER);
var _hov = _b > 0;
if(_b == 2) {
_hov = true;
var arr = [];
var tip = [];
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) {
@ -734,6 +722,33 @@ function Panel_Menu() : PanelContent() constructor {
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
draw_text(tx0 + ui(8), tby0 + th / 2, tc);
}
if(IS_PATREON && PREFERENCES.show_supporter_icon) {
var _tw = string_width(tc);
var _th = string_height(tc);
var _cx, _cy;
if(hori) {
_cx = tcx + _tw / 2;
_cy = (ty0 + ty1) / 2 - _th / 2;
} else {
_cx = tx0 + ui(8) + _tw;
_cy = tby0 + th / 2 - _th / 2;
}
_cx += ui(2);
_cy += ui(6);
var _ib = COLORS._main_text_sub;
if(pHOVER && point_in_rectangle(mx, my, _cx - 12, _cy - 12, _cx + 12, _cy + 12)) {
TOOLTIP = "Verified supporter";
_ib = COLORS._main_accent;
}
draw_sprite_ext(s_patreon_supporter, 0, _cx, _cy, 1, 1, 0, _hov? COLORS._main_icon_dark : COLORS.panel_bg_clear, 1);
draw_sprite_ext(s_patreon_supporter, 1, _cx, _cy, 1, 1, 0, _ib, 1);
}
#endregion
}
}

View File

@ -81,8 +81,23 @@ function Panel_Patreon() : PanelContent() constructor {
_yy += 100 + 16;
if(IS_PATREON) {
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_value_positive);
draw_text(w / 2, (_yy + h) / 2, "Patreon verified, thank you for supporting Pixel Composer.");
var _y = (_yy + h) / 2;
draw_set_text(f_p0, fa_center, fa_bottom, COLORS._main_value_positive);
draw_text(w / 2, _y - 16, "Patreon verified, thank you for supporting Pixel Composer.");
var _bw = 200;
var _bh = TEXTBOX_HEIGHT + ui(8);
var _bx = w / 2 - _bw / 2;
if(buttonInstant(THEME.button, _bx, _y, _bw, _bh, [ mx, my ], pFOCUS, pHOVER) == 2) {
var path = DIRECTORY + "patreon";
file_delete(path);
IS_PATREON = false;
}
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
draw_text(_bx + _bw / 2, _y + _bh / 2, "Remove verification");
return;
}
@ -117,7 +132,7 @@ function Panel_Patreon() : PanelContent() constructor {
break;
case 1 :
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text_inner);
draw_text(w / 2, _yy, "Enter verification code send to your email:");
draw_text(w / 2, _yy, "Enter verification code:");
tb_code.setInteract(true);
tb_code.setFocusHover(pFOCUS, pHOVER);

View File

@ -1,5 +1,6 @@
varying vec4 v_vColour;
uniform vec4 blend;
void main() {
gl_FragColor = v_vColour;
gl_FragColor = v_vColour * blend;
}

View File

@ -9,6 +9,11 @@ uniform float max_distance;
void main() {
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
if(col.xy == vec2(0.)) {
gl_FragColor = vec4(vec3(0.), 1.);
return;
}
float dist = (max_distance - distance(col.xy, v_vTexcoord)) / max_distance;
if((side == 0 && col.z == 0.) || (side == 1 && col.z == 1.)) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

View File

@ -5,7 +5,7 @@
"bbox_bottom": 21,
"bbox_left": 2,
"bbox_right": 21,
"bbox_top": 3,
"bbox_top": 2,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
@ -13,14 +13,15 @@
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"f82776f7-e95a-4bd4-a32a-d0eabde1a5ea",},
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"a4e13440-b690-4486-a6d4-06d9e199737a",},
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"61b3fd81-17a8-41fd-aa0d-362fc4677ef8",},
],
"gridX": 0,
"gridY": 0,
"height": 24,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"4c192834-2a31-4486-a8a4-f74d1a49b773","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"6b83fa45-aed7-4e4c-b9bf-3db6806971c5","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
@ -43,7 +44,7 @@
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"length": 2.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
@ -54,7 +55,8 @@
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"f82776f7-e95a-4bd4-a32a-d0eabde1a5ea","path":"sprites/s_patreon_supporter/s_patreon_supporter.yy",},},},"Disabled":false,"id":"dfe88e31-2c83-4869-a007-b43251820044","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"a4e13440-b690-4486-a6d4-06d9e199737a","path":"sprites/s_patreon_supporter/s_patreon_supporter.yy",},},},"Disabled":false,"id":"0cd2804e-499c-45e7-aefb-de3d9668945d","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"61b3fd81-17a8-41fd-aa0d-362fc4677ef8","path":"sprites/s_patreon_supporter/s_patreon_supporter.yy",},},},"Disabled":false,"id":"3bb9721a-2641-4870-8576-2075ea8282d2","IsCreationKey":false,"Key":1.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,