2026-03-09 13:17:15 +01:00
|
|
|
|
|
|
|
|
#include "../global.h"
|
|
|
|
|
|
2026-03-06 12:56:38 +01:00
|
|
|
void camera_texture_node_init() {
|
|
|
|
|
any_array_push(nodes_material_texture, camera_texture_node_def);
|
|
|
|
|
any_map_set(parser_material_node_vectors, "TEX_CAMERA", camera_texture_node_vector);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-07 21:12:59 +01:00
|
|
|
char *camera_texture_node_vector(ui_node_t *node, ui_node_socket_t *socket) {
|
2026-03-10 11:49:57 +01:00
|
|
|
char *tex_name = string("texcamera_%s", parser_material_node_name(node, NULL));
|
|
|
|
|
node_shader_add_texture(parser_material_kong, tex_name, "_camera_texture");
|
2026-03-07 21:12:59 +01:00
|
|
|
char *store = parser_material_store_var_name(node);
|
2026-03-10 11:49:57 +01:00
|
|
|
parser_material_write(parser_material_kong, string("var %s_res: float3 = sample(%s, sampler_linear, tex_coord).rgb;", store, tex_name));
|
|
|
|
|
return string("%s_res", store);
|
2026-03-06 12:56:38 +01:00
|
|
|
}
|