This commit is contained in:
luboslenco
2025-09-01 19:17:28 +02:00
parent b879c6895c
commit cf2daabc21
9 changed files with 28 additions and 63 deletions
Binary file not shown.
-1
View File
@@ -372,7 +372,6 @@
"Rotate Z": "Rotation Z", "Rotate Z": "Rotation Z",
"Roughness": "Rugosité", "Roughness": "Rugosité",
"Round": "Arrondi", "Round": "Arrondi",
"rounded_cube": "cube_arrondi",
"Run": "Exécuter", "Run": "Exécuter",
"SSAO": "SSAO", "SSAO": "SSAO",
"Saturation": "Saturation", "Saturation": "Saturation",
+1 -2
View File
@@ -64,7 +64,7 @@ type context_t = {
clone_delta_y?: f32; clone_delta_y?: f32;
show_compass?: bool; show_compass?: bool;
project_type?: project_model_t; project_type?: i32;
project_aspect_ratio?: i32; project_aspect_ratio?: i32;
project_objects?: mesh_object_t[]; project_objects?: mesh_object_t[];
@@ -316,7 +316,6 @@ function context_create(): context_t {
c.clone_delta_x = 0.0; c.clone_delta_x = 0.0;
c.clone_delta_y = 0.0; c.clone_delta_y = 0.0;
c.show_compass = true; c.show_compass = true;
c.project_type = project_model_t.ROUNDED_CUBE;
c.project_aspect_ratio = 0; // 1:1, 2:1, 1:2 c.project_aspect_ratio = 0; // 1:1, 2:1, 1:2
c.last_paint_vec_x = -1.0; c.last_paint_vec_x = -1.0;
c.last_paint_vec_y = -1.0; c.last_paint_vec_y = -1.0;
-7
View File
@@ -210,13 +210,6 @@ enum paint_tex_t {
HEIGHT = 6, HEIGHT = 6,
} }
enum project_model_t {
ROUNDED_CUBE = 0,
SPHERE = 1,
TESSELLATED_PLANE = 2,
CUSTOM = 3,
}
enum zoom_direction_t { enum zoom_direction_t {
VERTICAL = 0, VERTICAL = 0,
VERTICAL_INVERTED = 1, VERTICAL_INVERTED = 1,
+1
View File
@@ -32,6 +32,7 @@ function mesh_data_create(raw: mesh_data_t): mesh_data_t {
raw.scale_tex = 1.0; raw.scale_tex = 1.0;
} }
raw._.structure = mesh_data_get_vertex_struct(raw.vertex_arrays); raw._.structure = mesh_data_get_vertex_struct(raw.vertex_arrays);
mesh_data_build(raw);
return raw; return raw;
} }
-4
View File
@@ -26,10 +26,6 @@ function mesh_object_create(data: mesh_data_t, materials: material_data_t[]): me
function mesh_object_set_data(raw: mesh_object_t, data: mesh_data_t) { function mesh_object_set_data(raw: mesh_object_t, data: mesh_data_t) {
raw.data = data; raw.data = data;
if (data._.vertex_buffer == null) {
mesh_data_build(data);
}
// Scale-up packed (-1,1) mesh coords // Scale-up packed (-1,1) mesh coords
raw.base.transform.scale_world = data.scale_pos; raw.base.transform.scale_world = data.scale_pos;
} }
+17 -23
View File
@@ -109,9 +109,8 @@ function project_new_box() {
let s: string = project_mesh_list[i]; let s: string = project_mesh_list[i];
project_mesh_list[i] = substring(project_mesh_list[i], 0, s.length - 4); // Trim .arm project_mesh_list[i] = substring(project_mesh_list[i], 0, s.length - 4); // Trim .arm
} }
array_insert(project_mesh_list, 0, "plane"); array_push(project_mesh_list, "plane");
array_insert(project_mesh_list, 0, "sphere"); array_push(project_mesh_list, "sphere");
array_insert(project_mesh_list, 0, "rounded_cube");
} }
ui_row2(); ui_row2();
@@ -150,7 +149,7 @@ function project_new_box() {
function project_new(reset_layers: bool = true) { function project_new(reset_layers: bool = true) {
///if (arm_windows || arm_linux || arm_macos) ///if (arm_windows || arm_linux || arm_macos)
sys_title_set(manifest_title); // sys_title_set(manifest_title);
///end ///end
project_filepath = ""; project_filepath = "";
@@ -192,31 +191,29 @@ function project_new(reset_layers: bool = true) {
data_delete_mesh(handle); data_delete_mesh(handle);
} }
if (context_raw.project_type != project_model_t.ROUNDED_CUBE) {
let raw: mesh_data_t = null; let raw: mesh_data_t = null;
if (context_raw.project_type == project_model_t.SPHERE || context_raw.project_type == project_model_t.TESSELLATED_PLANE) { // if (context_raw.project_type == project_model_t.SPHERE || context_raw.project_type == project_model_t.TESSELLATED_PLANE) {
let mesh: raw_mesh_t = context_raw.project_type == project_model_t.SPHERE ? // let mesh: raw_mesh_t = context_raw.project_type == project_model_t.SPHERE ?
geom_make_uv_sphere(1, 512, 256) : // geom_make_uv_sphere(1, 512, 256) :
geom_make_plane(1, 1, 512, 512); // geom_make_plane(1, 1, 512, 512);
mesh.name = "Tessellated"; // mesh.name = "Tessellated";
raw = import_mesh_raw_mesh(mesh); // raw = import_mesh_raw_mesh(mesh);
} // }
else { // else {
let b: buffer_t = data_get_blob("meshes/" + project_mesh_list[context_raw.project_type] + ".arm"); let b: buffer_t = data_get_blob("meshes/" + project_mesh_list[context_raw.project_type] + ".arm");
_project_scene_mesh_gc = armpack_decode(b); _project_scene_mesh_gc = armpack_decode(b);
raw = _project_scene_mesh_gc.mesh_datas[0]; raw = _project_scene_mesh_gc.mesh_datas[0];
} // }
let md: mesh_data_t = mesh_data_create(raw); let md: mesh_data_t = mesh_data_create(raw);
map_set(data_cached_meshes, "SceneTessellated", md); map_set(data_cached_meshes, "SceneTessellated", md);
if (context_raw.project_type == project_model_t.TESSELLATED_PLANE) { // if (context_raw.project_type == project_model_t.TESSELLATED_PLANE) {
viewport_set_view(0, 0, 0.75, 0, 0, 0); // Top // viewport_set_view(0, 0, 0.75, 0, 0, 0); // Top
} // }
}
let n: string = context_raw.project_type == project_model_t.ROUNDED_CUBE ? ".Cube" : "Tessellated"; let n: string = "Tessellated";
let md: mesh_data_t = data_get_mesh("Scene", n); // let md: mesh_data_t = data_get_mesh("Scene", n);
let current: gpu_texture_t = _draw_current; let current: gpu_texture_t = _draw_current;
let in_use: bool = gpu_in_use; let in_use: bool = gpu_in_use;
@@ -408,7 +405,6 @@ function project_append_mesh() {
} }
function project_import_mesh_box(path: string, replace_existing: bool = true, clear_layers: bool = true, done: ()=>void = null) { function project_import_mesh_box(path: string, replace_existing: bool = true, clear_layers: bool = true, done: ()=>void = null) {
_project_import_mesh_box_path = path; _project_import_mesh_box_path = path;
_project_import_mesh_box_replace_existing = replace_existing; _project_import_mesh_box_replace_existing = replace_existing;
_project_import_mesh_box_clear_layers = clear_layers; _project_import_mesh_box_clear_layers = clear_layers;
@@ -420,7 +416,6 @@ function project_import_mesh_box(path: string, replace_existing: bool = true, cl
///end ///end
ui_box_show_custom(function () { ui_box_show_custom(function () {
let path: string = _project_import_mesh_box_path; let path: string = _project_import_mesh_box_path;
let replace_existing: bool = _project_import_mesh_box_replace_existing; let replace_existing: bool = _project_import_mesh_box_replace_existing;
let clear_layers: bool = _project_import_mesh_box_clear_layers; let clear_layers: bool = _project_import_mesh_box_clear_layers;
@@ -510,7 +505,6 @@ function project_get_unwrap_plugins(): string[] {
} }
function project_unwrap_mesh_box(mesh: raw_mesh_t, done: (a: raw_mesh_t)=>void, skip_ui: bool = false) { function project_unwrap_mesh_box(mesh: raw_mesh_t, done: (a: raw_mesh_t)=>void, skip_ui: bool = false) {
_project_unwrap_mesh_box_mesh = mesh; _project_unwrap_mesh_box_mesh = mesh;
_project_unwrap_mesh_box_done = done; _project_unwrap_mesh_box_done = done;
-19
View File
@@ -33,25 +33,6 @@ function tab_meshes_draw(htab: ui_handle_t) {
ui_menu_draw(function () { ui_menu_draw(function () {
///if is_lab
if (ui_menu_button(tr("Set Default"))) {
ui_menu_draw(function () {
if (ui_menu_button(tr("Cube"))) {
tab_meshes_set_default_mesh(".Cube");
}
if (ui_menu_button(tr("Plane"))) {
tab_meshes_set_default_mesh(".Plane");
}
if (ui_menu_button(tr("Sphere"))) {
tab_meshes_set_default_mesh(".Sphere");
}
if (ui_menu_button(tr("Cylinder"))) {
tab_meshes_set_default_mesh(".Cylinder");
}
});
}
///end
if (ui_menu_button(tr("Flip Normals"))) { if (ui_menu_button(tr("Flip Normals"))) {
util_mesh_flip_normals(); util_mesh_flip_normals();
context_raw.ddirty = 2; context_raw.ddirty = 2;
+3 -1
View File
@@ -185,7 +185,9 @@ function ui_base_init() {
ui_base_set_icon_scale(); ui_base_set_icon_scale();
} }
context_raw.paint_object = scene_get_child(".Cube").ext; // context_raw.paint_object = scene_get_child(".Cube").ext;
project_new(false);
project_paint_objects = [context_raw.paint_object]; project_paint_objects = [context_raw.paint_object];
if (project_filepath == "") { if (project_filepath == "") {