luboslenco 2 tygodni temu
rodzic
commit
cf2daabc21

BIN
base/assets/Scene.arm


+ 0 - 1
base/assets/locale/fr.json

@@ -372,7 +372,6 @@
     "Rotate Z": "Rotation Z",
     "Roughness": "Rugosité",
     "Round": "Arrondi",
-    "rounded_cube": "cube_arrondi",
     "Run": "Exécuter",
     "SSAO": "SSAO",
     "Saturation": "Saturation",

+ 1 - 2
base/sources/ts/context.ts

@@ -64,7 +64,7 @@ type context_t = {
 	clone_delta_y?: f32;
 
 	show_compass?: bool;
-	project_type?: project_model_t;
+	project_type?: i32;
 	project_aspect_ratio?: i32;
 	project_objects?: mesh_object_t[];
 
@@ -316,7 +316,6 @@ function context_create(): context_t {
 	c.clone_delta_x = 0.0;
 	c.clone_delta_y = 0.0;
 	c.show_compass = true;
-	c.project_type = project_model_t.ROUNDED_CUBE;
 	c.project_aspect_ratio = 0; // 1:1, 2:1, 1:2
 	c.last_paint_vec_x = -1.0;
 	c.last_paint_vec_y = -1.0;

+ 0 - 7
base/sources/ts/enums.ts

@@ -210,13 +210,6 @@ enum paint_tex_t {
 	HEIGHT = 6,
 }
 
-enum project_model_t {
-	ROUNDED_CUBE = 0,
-	SPHERE = 1,
-	TESSELLATED_PLANE = 2,
-	CUSTOM = 3,
-}
-
 enum zoom_direction_t {
 	VERTICAL = 0,
 	VERTICAL_INVERTED = 1,

+ 1 - 0
base/sources/ts/iron/mesh_data.ts

@@ -32,6 +32,7 @@ function mesh_data_create(raw: mesh_data_t): mesh_data_t {
 		raw.scale_tex = 1.0;
 	}
 	raw._.structure = mesh_data_get_vertex_struct(raw.vertex_arrays);
+	mesh_data_build(raw);
 	return raw;
 }
 

+ 0 - 4
base/sources/ts/iron/mesh_object.ts

@@ -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) {
 	raw.data = data;
-	if (data._.vertex_buffer == null) {
-		mesh_data_build(data);
-	}
-
 	// Scale-up packed (-1,1) mesh coords
 	raw.base.transform.scale_world = data.scale_pos;
 }

+ 23 - 29
base/sources/ts/project.ts

@@ -109,9 +109,8 @@ function project_new_box() {
 					let s: string = project_mesh_list[i];
 					project_mesh_list[i] = substring(project_mesh_list[i], 0, s.length - 4); // Trim .arm
 				}
-				array_insert(project_mesh_list, 0, "plane");
-				array_insert(project_mesh_list, 0, "sphere");
-				array_insert(project_mesh_list, 0, "rounded_cube");
+				array_push(project_mesh_list, "plane");
+				array_push(project_mesh_list, "sphere");
 			}
 
 			ui_row2();
@@ -150,7 +149,7 @@ function project_new_box() {
 
 function project_new(reset_layers: bool = true) {
 	///if (arm_windows || arm_linux || arm_macos)
-	sys_title_set(manifest_title);
+	// sys_title_set(manifest_title);
 	///end
 	project_filepath = "";
 
@@ -192,31 +191,29 @@ function project_new(reset_layers: bool = true) {
 		data_delete_mesh(handle);
 	}
 
-	if (context_raw.project_type != project_model_t.ROUNDED_CUBE) {
-		let raw: mesh_data_t = null;
-		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 ?
-				geom_make_uv_sphere(1, 512, 256) :
-				geom_make_plane(1, 1, 512, 512);
-			mesh.name = "Tessellated";
-			raw = import_mesh_raw_mesh(mesh);
-		}
-		else {
-			let b: buffer_t = data_get_blob("meshes/" + project_mesh_list[context_raw.project_type] + ".arm");
-			_project_scene_mesh_gc = armpack_decode(b);
-			raw = _project_scene_mesh_gc.mesh_datas[0];
-		}
+	let raw: mesh_data_t = null;
+	// 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 ?
+	// 		geom_make_uv_sphere(1, 512, 256) :
+	// 		geom_make_plane(1, 1, 512, 512);
+	// 	mesh.name = "Tessellated";
+	// 	raw = import_mesh_raw_mesh(mesh);
+	// }
+	// else {
+		let b: buffer_t = data_get_blob("meshes/" + project_mesh_list[context_raw.project_type] + ".arm");
+		_project_scene_mesh_gc = armpack_decode(b);
+		raw = _project_scene_mesh_gc.mesh_datas[0];
+	// }
 
-		let md: mesh_data_t = mesh_data_create(raw);
-		map_set(data_cached_meshes, "SceneTessellated", md);
+	let md: mesh_data_t = mesh_data_create(raw);
+	map_set(data_cached_meshes, "SceneTessellated", md);
 
-		if (context_raw.project_type == project_model_t.TESSELLATED_PLANE) {
-			viewport_set_view(0, 0, 0.75, 0, 0, 0); // Top
-		}
-	}
+	// if (context_raw.project_type == project_model_t.TESSELLATED_PLANE) {
+	// 	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 md: mesh_data_t = data_get_mesh("Scene", n);
+	let n: string = "Tessellated";
+	// let md: mesh_data_t = data_get_mesh("Scene", n);
 
 	let current: gpu_texture_t = _draw_current;
 	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) {
-
 	_project_import_mesh_box_path = path;
 	_project_import_mesh_box_replace_existing = replace_existing;
 	_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
 
 	ui_box_show_custom(function () {
-
 		let path: string = _project_import_mesh_box_path;
 		let replace_existing: bool = _project_import_mesh_box_replace_existing;
 		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) {
-
 	_project_unwrap_mesh_box_mesh = mesh;
 	_project_unwrap_mesh_box_done = done;
 

+ 0 - 19
base/sources/ts/tab_meshes.ts

@@ -33,25 +33,6 @@ function tab_meshes_draw(htab: ui_handle_t) {
 
 			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"))) {
 					util_mesh_flip_normals();
 					context_raw.ddirty = 2;

+ 3 - 1
base/sources/ts/ui_base.ts

@@ -185,7 +185,9 @@ function ui_base_init() {
 		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];
 
 	if (project_filepath == "") {