gamma_node.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. function gamma_node_init() {
  2. array_push(nodes_material_color, gamma_node_def);
  3. map_set(parser_material_node_vectors, "GAMMA", gamma_node_vector);
  4. }
  5. function gamma_node_vector(node: ui_node_t, socket: ui_node_socket_t): string {
  6. let out_col: string = parser_material_parse_vector_input(node.inputs[0]);
  7. let gamma: string = parser_material_parse_value_input(node.inputs[1]);
  8. return "pow3(" + out_col + ", " + parser_material_to_vec3(gamma) + ")";
  9. }
  10. let gamma_node_def: ui_node_t = {
  11. id : 0,
  12. name : _tr("Gamma"),
  13. type : "GAMMA",
  14. x : 0,
  15. y : 0,
  16. color : 0xff448c6d,
  17. inputs : [
  18. {
  19. id : 0,
  20. node_id : 0,
  21. name : _tr("Color"),
  22. type : "RGBA",
  23. color : 0xffc7c729,
  24. default_value : f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  25. min : 0.0,
  26. max : 1.0,
  27. precision : 100,
  28. display : 0
  29. },
  30. {
  31. id : 0,
  32. node_id : 0,
  33. name : _tr("Gamma"),
  34. type : "VALUE",
  35. color : 0xffa1a1a1,
  36. default_value : f32_array_create_x(1.0),
  37. min : 0.0,
  38. max : 1.0,
  39. precision : 100,
  40. display : 0
  41. }
  42. ],
  43. outputs : [ {
  44. id : 0,
  45. node_id : 0,
  46. name : _tr("Color"),
  47. type : "RGBA",
  48. color : 0xffc7c729,
  49. default_value : f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
  50. min : 0.0,
  51. max : 1.0,
  52. precision : 100,
  53. display : 0
  54. } ],
  55. buttons : [],
  56. width : 0,
  57. flags : 0
  58. };