Move math to c

This commit is contained in:
luboslenco
2024-09-08 21:53:39 +02:00
parent 5332c67ffc
commit 7c4275ea06
37 changed files with 454 additions and 371 deletions
+2 -2
View File
@@ -379,8 +379,8 @@ function make_material_parse_brush() {
}
function make_material_get_displace_strength(): f32 {
let sc: f32 = context_main_object().base.transform.scale.x;
return config_raw.displace_strength * 0.02 * sc;
let sc: vec4_t = context_main_object().base.transform.scale;
return config_raw.displace_strength * 0.02 * sc.x;
}
function make_material_voxelgi_half_extents(): string {
@@ -24,18 +24,18 @@ function brush_output_node_parse_inputs(self: brush_output_node_t) {
let input3: logic_node_value_t = logic_node_input_get(self.base.inputs[3]);
let input4: logic_node_value_t = logic_node_input_get(self.base.inputs[4]);
context_raw.paint_vec = input0._any;
context_raw.paint_vec = input0._vec4;
context_raw.brush_nodes_radius = input1._f32;
let opac: logic_node_value_t = input2; // Float or texture name
if (opac == null) {
opac = { _f32: 1.0 };
}
if (opac._any != null) { // string
context_raw.brush_mask_image_is_alpha = ends_with(opac._any, ".a");
opac._any = substring(opac._any, 0, string_last_index_of(opac._any, "."));
if (opac._str != null) { // string
context_raw.brush_mask_image_is_alpha = ends_with(opac._str, ".a");
opac._str = substring(opac._str, 0, string_last_index_of(opac._str, "."));
context_raw.brush_nodes_opacity = 1.0;
let index: i32 = array_index_of(project_asset_names, opac._any);
let index: i32 = array_index_of(project_asset_names, opac._str);
let asset: asset_t = project_assets[index];
context_raw.brush_mask_image = project_get_image(asset);
}
@@ -50,10 +50,10 @@ function brush_output_node_parse_inputs(self: brush_output_node_t) {
if (stencil == null) {
stencil = { _f32: 1.0 };
}
if (stencil._any != null) { // string
context_raw.brush_stencil_image_is_alpha = ends_with(stencil._any, ".a");
stencil._any = substring(stencil._any, 0, string_last_index_of(stencil._any, "."));
let index: i32 = array_index_of(project_asset_names, stencil._any);
if (stencil._str != null) { // string
context_raw.brush_stencil_image_is_alpha = ends_with(stencil._str, ".a");
stencil._str = substring(stencil._str, 0, string_last_index_of(stencil._str, "."));
let index: i32 = array_index_of(project_asset_names, stencil._str);
let asset: asset_t = project_assets[index];
context_raw.brush_stencil_image = project_get_image(asset);
}