camera_texture_node.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. function camera_texture_node_init() {
  2. array_push(nodes_material_texture, camera_texture_node_def);
  3. map_set(parser_material_node_vectors, "TEX_CAMERA", camera_texture_node_vector);
  4. }
  5. function camera_texture_node_vector(node: ui_node_t, socket: ui_node_socket_t): string {
  6. let tex_name: string = "texcamera_" + parser_material_node_name(node);
  7. node_shader_add_texture(parser_material_kong, "" + tex_name, "_camera_texture");
  8. let store: string = parser_material_store_var_name(node);
  9. parser_material_write(parser_material_kong, "var " + store + "_res: float3 = sample(" + tex_name + ", sampler_linear, tex_coord).rgb;");
  10. return store + "_res";
  11. }
  12. let camera_texture_node_def: ui_node_t = {
  13. id : 0,
  14. name : _tr("Camera Texture"),
  15. type : "TEX_CAMERA", // extension
  16. x : 0,
  17. y : 0,
  18. color : 0xff4982a0,
  19. inputs : [],
  20. outputs : [ {
  21. id : 0,
  22. node_id : 0,
  23. name : _tr("Color"),
  24. type : "RGBA",
  25. color : 0xffc7c729,
  26. default_value : f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  27. min : 0.0,
  28. max : 1.0,
  29. precision : 100,
  30. display : 0
  31. } ],
  32. buttons : [],
  33. width : 0,
  34. flags : 0
  35. };