paint: add envmap spheres

This commit is contained in:
luboslenco
2026-05-20 19:26:15 +02:00
parent 81e8a5b2af
commit b3245782d8
9 changed files with 287 additions and 95 deletions
+92 -90
View File
@@ -2,96 +2,98 @@
#include "global.h"
context_t *context_create() {
context_t *c = GC_ALLOC_INIT(context_t, {0});
c->merged_object_is_atlas = false; // Only objects referenced by atlas are merged
c->ddirty = 0; // depth
c->pdirty = 0; // paint
c->rdirty = 0; // render
c->brush_blend_dirty = true;
c->split_view = false;
c->view_index = -1;
c->view_index_last = -1;
c->picked_color = project_make_swatch(0xffffffff);
c->envmap_loaded = false;
c->show_envmap = false;
c->show_envmap_handle = ui_handle_create();
c->show_envmap_blur = false;
c->show_envmap_blur_handle = ui_handle_create();
c->capturing_screenshot = false;
c->capture_background = false;
c->envmap_angle = 0.0;
c->light_angle = 0.0;
c->cull_backfaces = true;
c->texture_filter = true;
c->format_type = TEXTURE_LDR_FORMAT_PNG;
c->format_quality = 100.0;
c->layers_destination = EXPORT_DESTINATION_DISK;
c->split_by = SPLIT_TYPE_OBJECT;
c->select_time = 0.0;
c->viewport_mode = g_config->viewport_mode;
c->hscale_was_changed = false;
c->export_mesh_format = MESH_FORMAT_OBJ;
c->export_mesh_index = 0;
c->pack_assets_on_export = true;
c->pack_assets_on_save = false;
c->paint_vec = (vec4_t){0.0, 0.0, 0.0, 1.0};
c->last_paint_x = -1.0;
c->last_paint_y = -1.0;
c->foreground_event = false;
c->painted = 0;
c->brush_time = 0.0;
c->clone_start_x = -1.0;
c->clone_start_y = -1.0;
c->clone_delta_x = 0.0;
c->clone_delta_y = 0.0;
c->show_compass = true;
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;
c->prev_paint_vec_x = -1.0;
c->prev_paint_vec_y = -1.0;
c->frame = 0;
c->paint2d_view = false;
c->brush_locked = false;
c->camera_type = CAMERA_TYPE_PERSPECTIVE;
c->cam_handle = ui_handle_create();
c->fov_handle = ui_handle_create();
c->texture_export_path = "";
c->last_status_position = 0;
c->camera_pivot = CAMERA_PIVOT_CURSOR;
c->camera_controls = CAMERA_CONTROLS_ORBIT;
c->pen_painting_only = false; // Reject painting with finger when using pen
c->layer_preview_dirty = true;
c->layers_preview_dirty = false;
c->node_preview_name = "";
c->node_preview_socket_map = any_map_create();
c->node_preview_map = any_map_create();
c->selected_node_preview = true;
c->colorid_picked = false;
c->material_preview = false; // Drawing material previews
c->saved_camera = mat4_identity();
c->materialid_picked = 0;
c->uvx_picked = 0.0;
c->uvy_picked = 0.0;
c->picker_select_material = false;
c->picker_mask_handle = ui_handle_create();
c->pick_pos_nor_tex = false;
c->pick_object_id = false;
c->posx_picked = 0.0;
c->posy_picked = 0.0;
c->posz_picked = 0.0;
c->norx_picked = 0.0;
c->nory_picked = 0.0;
c->norz_picked = 0.0;
c->draw_wireframe = false;
c->wireframe_handle = ui_handle_create();
c->draw_texels = false;
c->texels_handle = ui_handle_create();
c->colorid_handle = ui_handle_create();
c->layers_export = EXPORT_MODE_VISIBLE;
c->decal_preview = false;
c->decal_x = 0.0;
c->decal_y = 0.0;
context_t *c = GC_ALLOC_INIT(context_t, {0});
c->merged_object_is_atlas = false; // Only objects referenced by atlas are merged
c->ddirty = 0; // depth
c->pdirty = 0; // paint
c->rdirty = 0; // render
c->brush_blend_dirty = true;
c->split_view = false;
c->view_index = -1;
c->view_index_last = -1;
c->picked_color = project_make_swatch(0xffffffff);
c->envmap_loaded = false;
c->show_envmap = false;
c->show_envmap_handle = ui_handle_create();
c->show_envmap_blur = false;
c->show_envmap_blur_handle = ui_handle_create();
c->show_envmap_spheres = false;
c->show_envmap_spheres_handle = ui_handle_create();
c->capturing_screenshot = false;
c->capture_background = false;
c->envmap_angle = 0.0;
c->light_angle = 0.0;
c->cull_backfaces = true;
c->texture_filter = true;
c->format_type = TEXTURE_LDR_FORMAT_PNG;
c->format_quality = 100.0;
c->layers_destination = EXPORT_DESTINATION_DISK;
c->split_by = SPLIT_TYPE_OBJECT;
c->select_time = 0.0;
c->viewport_mode = g_config->viewport_mode;
c->hscale_was_changed = false;
c->export_mesh_format = MESH_FORMAT_OBJ;
c->export_mesh_index = 0;
c->pack_assets_on_export = true;
c->pack_assets_on_save = false;
c->paint_vec = (vec4_t){0.0, 0.0, 0.0, 1.0};
c->last_paint_x = -1.0;
c->last_paint_y = -1.0;
c->foreground_event = false;
c->painted = 0;
c->brush_time = 0.0;
c->clone_start_x = -1.0;
c->clone_start_y = -1.0;
c->clone_delta_x = 0.0;
c->clone_delta_y = 0.0;
c->show_compass = true;
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;
c->prev_paint_vec_x = -1.0;
c->prev_paint_vec_y = -1.0;
c->frame = 0;
c->paint2d_view = false;
c->brush_locked = false;
c->camera_type = CAMERA_TYPE_PERSPECTIVE;
c->cam_handle = ui_handle_create();
c->fov_handle = ui_handle_create();
c->texture_export_path = "";
c->last_status_position = 0;
c->camera_pivot = CAMERA_PIVOT_CURSOR;
c->camera_controls = CAMERA_CONTROLS_ORBIT;
c->pen_painting_only = false; // Reject painting with finger when using pen
c->layer_preview_dirty = true;
c->layers_preview_dirty = false;
c->node_preview_name = "";
c->node_preview_socket_map = any_map_create();
c->node_preview_map = any_map_create();
c->selected_node_preview = true;
c->colorid_picked = false;
c->material_preview = false; // Drawing material previews
c->saved_camera = mat4_identity();
c->materialid_picked = 0;
c->uvx_picked = 0.0;
c->uvy_picked = 0.0;
c->picker_select_material = false;
c->picker_mask_handle = ui_handle_create();
c->pick_pos_nor_tex = false;
c->pick_object_id = false;
c->posx_picked = 0.0;
c->posy_picked = 0.0;
c->posz_picked = 0.0;
c->norx_picked = 0.0;
c->nory_picked = 0.0;
c->norz_picked = 0.0;
c->draw_wireframe = false;
c->wireframe_handle = ui_handle_create();
c->draw_texels = false;
c->texels_handle = ui_handle_create();
c->colorid_handle = ui_handle_create();
c->layers_export = EXPORT_MODE_VISIBLE;
c->decal_preview = false;
c->decal_x = 0.0;
c->decal_y = 0.0;
// c.cache_draws = false;
c->write_icon_on_export = false;
c->particle_hit_x = 0.0;