Fix text rendering bug.

This commit is contained in:
MakhamDev 2023-10-24 07:09:04 +07:00
parent 7d401a25d4
commit 78ca7fbb37
19 changed files with 133 additions and 33 deletions

View file

@ -86,6 +86,7 @@
{"name":"d3d compose","order":17,"path":"folders/nodes/data/3D/d3d compose.yy",},
{"name":"d3d light","order":14,"path":"folders/nodes/data/3D/d3d light.yy",},
{"name":"d3d mesh","order":12,"path":"folders/nodes/data/3D/d3d mesh.yy",},
{"name":"d3d modifier","order":18,"path":"folders/nodes/data/3D/d3d modifier.yy",},
{"name":"animation","order":6,"path":"folders/nodes/data/animation.yy",},
{"name":"compose","order":11,"path":"folders/nodes/data/compose.yy",},
{"name":"armature","order":5,"path":"folders/nodes/data/compose/armature.yy",},
@ -819,7 +820,6 @@
{"name":"fd_rectangle_set_material_size","order":7,"path":"scripts/fd_rectangle_set_material_size/fd_rectangle_set_material_size.yy",},
{"name":"fd_rectangle_shift_content","order":19,"path":"scripts/fd_rectangle_shift_content/fd_rectangle_shift_content.yy",},
{"name":"sh_texture_remap","order":24,"path":"shaders/sh_texture_remap/sh_texture_remap.yy",},
{"name":"__node_3d_mesh_modifier","order":11,"path":"scripts/__node_3d_mesh_modifier/__node_3d_mesh_modifier.yy",},
{"name":"obj_fd_rectangle","order":1,"path":"objects/obj_fd_rectangle/obj_fd_rectangle.yy",},
{"name":"node_noise_simplex","order":7,"path":"scripts/node_noise_simplex/node_noise_simplex.yy",},
{"name":"sh_fd_visualize_velocity_divergence_glsl","order":18,"path":"shaders/sh_fd_visualize_velocity_divergence_glsl/sh_fd_visualize_velocity_divergence_glsl.yy",},
@ -1411,6 +1411,7 @@
{"name":"s_node_posterize","order":33,"path":"sprites/s_node_posterize/s_node_posterize.yy",},
{"name":"s_node_struct_get","order":1,"path":"sprites/s_node_struct_get/s_node_struct_get.yy",},
{"name":"s_node_vfx_vortex","order":4,"path":"sprites/s_node_vfx_vortex/s_node_vfx_vortex.yy",},
{"name":"node_3d_modify_round","order":1,"path":"scripts/node_3d_modify_round/node_3d_modify_round.yy",},
{"name":"s_node_array_add","order":1,"path":"sprites/s_node_array_add/s_node_array_add.yy",},
{"name":"s_node_image_sequence_to_anim","order":6,"path":"sprites/s_node_image_sequence_to_anim/s_node_image_sequence_to_anim.yy",},
{"name":"_node_VFX_spawner","order":13,"path":"scripts/_node_VFX_spawner/_node_VFX_spawner.yy",},

View file

@ -110,6 +110,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d compose","folderPath":"folders/nodes/data/3D/d3d compose.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d light","folderPath":"folders/nodes/data/3D/d3d light.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d mesh","folderPath":"folders/nodes/data/3D/d3d mesh.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"d3d modifier","folderPath":"folders/nodes/data/3D/d3d modifier.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/nodes/data/animation.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"compose","folderPath":"folders/nodes/data/compose.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"armature","folderPath":"folders/nodes/data/compose/armature.yy",},
@ -1456,7 +1457,7 @@
{"id":{"name":"fd_rectangle_shift_content","path":"scripts/fd_rectangle_shift_content/fd_rectangle_shift_content.yy",},},
{"id":{"name":"sh_texture_remap","path":"shaders/sh_texture_remap/sh_texture_remap.yy",},},
{"id":{"name":"sh_fluid_bleach","path":"shaders/sh_fluid_bleach/sh_fluid_bleach.yy",},},
{"id":{"name":"__node_3d_mesh_modifier","path":"scripts/__node_3d_mesh_modifier/__node_3d_mesh_modifier.yy",},},
{"id":{"name":"__node_3d_modifier","path":"scripts/__node_3d_modifier/__node_3d_modifier.yy",},},
{"id":{"name":"obj_fd_rectangle","path":"objects/obj_fd_rectangle/obj_fd_rectangle.yy",},},
{"id":{"name":"node_noise_simplex","path":"scripts/node_noise_simplex/node_noise_simplex.yy",},},
{"id":{"name":"sh_fd_visualize_velocity_divergence_glsl","path":"shaders/sh_fd_visualize_velocity_divergence_glsl/sh_fd_visualize_velocity_divergence_glsl.yy",},},
@ -2132,6 +2133,7 @@
{"id":{"name":"s_node_posterize","path":"sprites/s_node_posterize/s_node_posterize.yy",},},
{"id":{"name":"s_node_struct_get","path":"sprites/s_node_struct_get/s_node_struct_get.yy",},},
{"id":{"name":"s_node_vfx_vortex","path":"sprites/s_node_vfx_vortex/s_node_vfx_vortex.yy",},},
{"id":{"name":"node_3d_modify_round","path":"scripts/node_3d_modify_round/node_3d_modify_round.yy",},},
{"id":{"name":"s_node_array_add","path":"sprites/s_node_array_add/s_node_array_add.yy",},},
{"id":{"name":"s_node_counter","path":"sprites/s_node_counter/s_node_counter.yy",},},
{"id":{"name":"s_node_image_sequence_to_anim","path":"sprites/s_node_image_sequence_to_anim/s_node_image_sequence_to_anim.yy",},},

View file

@ -64,12 +64,10 @@
log_message("DIRECTORY", DIRECTORY);
PREF_APPLY();
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
log_message("SESSION", "> init Theme"); __initTheme();
log_message("SESSION", "> init Locale"); __initLocale();
log_message("SESSION", "> init Font"); loadFonts();
log_message("SESSION", "> init Theme"); __initTheme();
log_message("SESSION", "> init Project"); __initProject();
log_message("SESSION", "> init Action"); __initAction();
log_message("SESSION", "> init SurfaceFormat"); __initSurfaceFormat();

View file

@ -1,11 +0,0 @@
function Node_3D_Mesh_Modifier(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constructor {
name = "3D Mesh Modifier";
static processData = function(_output, _data, _output_index, _array_index = 0) {
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
}
}

View file

@ -0,0 +1,11 @@
function Node_3D_Modifier(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constructor {
name = "3D Mesh Modifier";
inputs[| 0] = nodeValue("Mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Mesh, noone)
.setVisible(true, true);
in_mesh = ds_list_size(inputs);
outputs[| 0] = nodeValue("Mesh", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3Mesh, noone);
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "__node_3d_modifier",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "d3d modifier",
"path": "folders/nodes/data/3D/d3d modifier.yy",
},
}

View file

@ -194,7 +194,22 @@ function __3dObject() constructor {
} #endregion
static clone = function() { #region
var _obj = variable_clone(self);
var _obj = new __3dObject();
_obj.vertex = array_create(array_length(vertex));
for( var i = 0, n = array_length(vertex); i < n; i++ ) {
_obj.vertex[i] = array_create(array_length(vertex[i]));
for( var j = 0, m = array_length(vertex[i]); j < m; j++ )
_obj.vertex[i][j] = vertex[i][j].clone();
}
_obj.transform = transform.clone();
_obj.size = size.clone();
_obj.materials = array_clone(materials);
_obj.material_index = array_clone(material_index);
_obj.texture_flip = texture_flip;
return _obj;
} #endregion

View file

@ -42,7 +42,7 @@ function __3dTerrain() : __3dObject() constructor {
_vt[_in + 0] = new __vertex(x0, y0, _h0).setNormal(_n.x, _n.y, _n.z).setUV(u0, v0);
_vt[_in + 1] = new __vertex(x1, y1, _h3).setNormal(_n.x, _n.y, _n.z).setUV(u1, v1);
_vt[_in + 2] = new __vertex(x1, y0, _h1).setNormal(_n.x, _n.y, _n.z).setUV(u1, v0);
_vt[_in + 2] = new __vertex(x1, y0, _h1).setNormal(_n.x, _n.y, _n.z).setUV(u1, v0);
_vt[_in + 3] = new __vertex(x0, y0, _h0).setNormal(_n.x, _n.y, _n.z).setUV(u0, v0);
_vt[_in + 4] = new __vertex(x0, y1, _h2).setNormal(_n.x, _n.y, _n.z).setUV(u0, v1);

View file

@ -32,4 +32,16 @@ function __transform() constructor {
matrix_stack_pop();
matrix_stack_pop();
}
static clone = function() {
var _res = new __transform();
_res.parent = parent;
_res.position = position.clone();
_res.anchor = anchor.clone();
_res.rotation = rotation.Clone();
_res.scale = scale.clone();
return _res;
}
}

View file

@ -36,6 +36,15 @@ function __vertex(_x = 0, _y = _x, _z = _x, color = c_white, alpha = 1) construc
static clone = function() {
gml_pragma("forceinline");
return new __vertex(x, y, z, color, alpha);
var _v = new __vertex(x, y, z, color, alpha);
_v.nx = nx;
_v.ny = ny;
_v.nz = nz;
_v.u = u;
_v.v = v;
return _v;
}
}

View file

@ -26,10 +26,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11560;
VERSION = 11553;
SAVE_VERSION = 11550;
VERSION_STRING = "1.15.6";
BUILD_NUMBER = 11560;
VERSION_STRING = "1.15.5.3";
BUILD_NUMBER = 11553;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -47,7 +47,7 @@ function Node_3D_Mesh_Terrain(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
for( var i = 0; i < _sub + 1; i++ )
for( var j = 0; j < _sub + 1; j++ ) {
var cc = surface_getpixel(_his, i * _pxw, j * _pxh);
var cc = surface_getpixel(_his, j * _pxw, i * _pxh);
_h[_ind] = color_get_brightness(cc);
_ind++;
}

View file

@ -0,0 +1,35 @@
function Node_3D_Round_Vertex(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _group) constructor {
name = "Discretize vertex";
static processData = function(_output, _data, _output_index, _array_index = 0) {
var _obj = _data[0];
if(!is_instanceof(_obj, __3dObject)) return noone;
var _res = new __3dObject();
_res.vertex = array_create(array_length(_obj.vertex));
for( var i = 0, n = array_length(_obj.vertex); i < n; i++ ) {
_res.vertex[i] = array_create(array_length(_obj.vertex[i]));
for( var j = 0, m = array_length(_obj.vertex[i]); j < m; j++ ) {
var _v = _obj.vertex[i][j].clone();
//_v.x = value_snap(_v.x, 0);
//_v.y = value_snap(_v.y, 0);
//_v.z = value_snap(_v.z, 0);
_res.vertex[i][j] = _v;
}
}
_res.object_counts = _obj.object_counts;
_res.transform = _obj.transform.clone();
_res.size = _obj.size.clone();
_res.materials = array_clone(_obj.materials);
_res.material_index = array_clone(_obj.material_index);
_res.texture_flip = _obj.texture_flip;
_res.build();
return _res;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_3d_modify_round",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "d3d modifier",
"path": "folders/nodes/data/3D/d3d modifier.yy",
},
}

View file

@ -1,11 +1,12 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "__node_3d_mesh_modifier",
"isCompatibility": false,
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "3D",
"path": "folders/nodes/data/3D.yy",
"name": "variable",
"path": "folders/nodes/data/variable.yy",
},
"resourceVersion": "1.0",
"name": "node_counter",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -408,13 +408,16 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
addNodeObject(d3d, "3D UV Sphere", s_node_3d_sphere_uv, "Node_3D_Mesh_Sphere_UV", [1, Node_3D_Mesh_Sphere_UV]).setVersion(11510);
addNodeObject(d3d, "3D Icosphere", s_node_3d_sphere_ico, "Node_3D_Mesh_Sphere_Ico", [1, Node_3D_Mesh_Sphere_Ico]).setVersion(11510);
addNodeObject(d3d, "3D Cone", s_node_3d_cone, "Node_3D_Mesh_Cone", [1, Node_3D_Mesh_Cone]).setVersion(11510);
addNodeObject(d3d, "3D Terrain", s_node_3d_displace, "Node_3D_Mesh_Terrain", [1, Node_3D_Mesh_Terrain]).setVersion(11552);
addNodeObject(d3d, "3D Terrain", s_node_3d_displace, "Node_3D_Mesh_Terrain", [1, Node_3D_Mesh_Terrain]).setVersion(11560);
addNodeObject(d3d, "Surface Extrude", s_node_3d_extrude, "Node_3D_Mesh_Extrude", [1, Node_3D_Mesh_Extrude],, "Extrude 2D image into 3D object.").setVersion(11510);
ds_list_add(d3d, "Light");
addNodeObject(d3d, "Directional Light", s_node_3d_light_directi, "Node_3D_Light_Directional", [1, Node_3D_Light_Directional]).setVersion(11510);
addNodeObject(d3d, "Point Light", s_node_3d_light_point, "Node_3D_Light_Point", [1, Node_3D_Light_Point]).setVersion(11510);
ds_list_add(d3d, "Modify");
/**/ addNodeObject(d3d, "Discretize vertex", s_node_3d_light_directi, "Node_3D_Round_Vertex", [1, Node_3D_Round_Vertex]).setVersion(11560);
ds_list_add(d3d, "Legacy"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////
addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated();
addNodeObject(d3d, "3D Cube", s_node_3d_cube, "__Node_3D_Cube", [1, __Node_3D_Cube]).isDeprecated();

View file

@ -10,6 +10,9 @@ function __initTheme() {
log_message("THEME", $"unzipping default theme to {root}.");
zip_unzip("data/themes/default.zip", root);
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
}
function _sprite_path(rel, theme) {
@ -49,7 +52,7 @@ function __getGraphicList() {
return json_try_parse(s);
}
function loadGraphic(theme = "default") {
function loadGraphic(theme = "default") {
var sprDef = __getGraphicList();
var path = _sprite_path("./graphics.json", theme);

View file

@ -2,8 +2,7 @@ function value_snap(val, snap = 1) {
gml_pragma("forceinline")
if(!is_array(val)) {
if(snap == 0)
return val;
if(snap == 0) return val;
return round(val / snap) * snap;
}