visual_shader_nodes.h 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806
  1. /**************************************************************************/
  2. /* visual_shader_nodes.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef VISUAL_SHADER_NODES_H
  31. #define VISUAL_SHADER_NODES_H
  32. #include "scene/resources/visual_shader.h"
  33. ///////////////////////////////////////
  34. /// CONSTANTS
  35. ///////////////////////////////////////
  36. class VisualShaderNodeScalarConstant : public VisualShaderNode {
  37. GDCLASS(VisualShaderNodeScalarConstant, VisualShaderNode);
  38. float constant;
  39. protected:
  40. static void _bind_methods();
  41. public:
  42. virtual String get_caption() const;
  43. virtual int get_input_port_count() const;
  44. virtual PortType get_input_port_type(int p_port) const;
  45. virtual String get_input_port_name(int p_port) const;
  46. virtual int get_output_port_count() const;
  47. virtual PortType get_output_port_type(int p_port) const;
  48. virtual String get_output_port_name(int p_port) const;
  49. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  50. void set_constant(float p_value);
  51. float get_constant() const;
  52. virtual Vector<StringName> get_editable_properties() const;
  53. VisualShaderNodeScalarConstant();
  54. };
  55. ///////////////////////////////////////
  56. class VisualShaderNodeBooleanConstant : public VisualShaderNode {
  57. GDCLASS(VisualShaderNodeBooleanConstant, VisualShaderNode);
  58. bool constant;
  59. protected:
  60. static void _bind_methods();
  61. public:
  62. virtual String get_caption() const;
  63. virtual int get_input_port_count() const;
  64. virtual PortType get_input_port_type(int p_port) const;
  65. virtual String get_input_port_name(int p_port) const;
  66. virtual int get_output_port_count() const;
  67. virtual PortType get_output_port_type(int p_port) const;
  68. virtual String get_output_port_name(int p_port) const;
  69. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  70. void set_constant(bool p_value);
  71. bool get_constant() const;
  72. virtual Vector<StringName> get_editable_properties() const;
  73. VisualShaderNodeBooleanConstant();
  74. };
  75. ///////////////////////////////////////
  76. class VisualShaderNodeColorConstant : public VisualShaderNode {
  77. GDCLASS(VisualShaderNodeColorConstant, VisualShaderNode);
  78. Color constant;
  79. protected:
  80. static void _bind_methods();
  81. public:
  82. virtual String get_caption() const;
  83. virtual int get_input_port_count() const;
  84. virtual PortType get_input_port_type(int p_port) const;
  85. virtual String get_input_port_name(int p_port) const;
  86. virtual int get_output_port_count() const;
  87. virtual PortType get_output_port_type(int p_port) const;
  88. virtual String get_output_port_name(int p_port) const;
  89. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  90. void set_constant(Color p_value);
  91. Color get_constant() const;
  92. virtual Vector<StringName> get_editable_properties() const;
  93. VisualShaderNodeColorConstant();
  94. };
  95. ///////////////////////////////////////
  96. class VisualShaderNodeVec3Constant : public VisualShaderNode {
  97. GDCLASS(VisualShaderNodeVec3Constant, VisualShaderNode);
  98. Vector3 constant;
  99. protected:
  100. static void _bind_methods();
  101. public:
  102. virtual String get_caption() const;
  103. virtual int get_input_port_count() const;
  104. virtual PortType get_input_port_type(int p_port) const;
  105. virtual String get_input_port_name(int p_port) const;
  106. virtual int get_output_port_count() const;
  107. virtual PortType get_output_port_type(int p_port) const;
  108. virtual String get_output_port_name(int p_port) const;
  109. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  110. void set_constant(Vector3 p_value);
  111. Vector3 get_constant() const;
  112. virtual Vector<StringName> get_editable_properties() const;
  113. VisualShaderNodeVec3Constant();
  114. };
  115. ///////////////////////////////////////
  116. class VisualShaderNodeTransformConstant : public VisualShaderNode {
  117. GDCLASS(VisualShaderNodeTransformConstant, VisualShaderNode);
  118. Transform constant;
  119. protected:
  120. static void _bind_methods();
  121. public:
  122. virtual String get_caption() const;
  123. virtual int get_input_port_count() const;
  124. virtual PortType get_input_port_type(int p_port) const;
  125. virtual String get_input_port_name(int p_port) const;
  126. virtual int get_output_port_count() const;
  127. virtual PortType get_output_port_type(int p_port) const;
  128. virtual String get_output_port_name(int p_port) const;
  129. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  130. void set_constant(Transform p_value);
  131. Transform get_constant() const;
  132. virtual Vector<StringName> get_editable_properties() const;
  133. VisualShaderNodeTransformConstant();
  134. };
  135. ///////////////////////////////////////
  136. /// TEXTURES
  137. ///////////////////////////////////////
  138. class VisualShaderNodeTexture : public VisualShaderNode {
  139. GDCLASS(VisualShaderNodeTexture, VisualShaderNode);
  140. Ref<Texture> texture;
  141. public:
  142. enum Source {
  143. SOURCE_TEXTURE,
  144. SOURCE_SCREEN,
  145. SOURCE_2D_TEXTURE,
  146. SOURCE_2D_NORMAL,
  147. SOURCE_DEPTH,
  148. SOURCE_PORT,
  149. };
  150. enum TextureType {
  151. TYPE_DATA,
  152. TYPE_COLOR,
  153. TYPE_NORMALMAP
  154. };
  155. private:
  156. Source source;
  157. TextureType texture_type;
  158. protected:
  159. static void _bind_methods();
  160. public:
  161. virtual String get_caption() const;
  162. virtual int get_input_port_count() const;
  163. virtual PortType get_input_port_type(int p_port) const;
  164. virtual String get_input_port_name(int p_port) const;
  165. virtual int get_output_port_count() const;
  166. virtual PortType get_output_port_type(int p_port) const;
  167. virtual String get_output_port_name(int p_port) const;
  168. virtual String get_input_port_default_hint(int p_port) const;
  169. virtual Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const;
  170. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  171. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  172. void set_source(Source p_source);
  173. Source get_source() const;
  174. void set_texture(Ref<Texture> p_value);
  175. Ref<Texture> get_texture() const;
  176. void set_texture_type(TextureType p_type);
  177. TextureType get_texture_type() const;
  178. virtual Vector<StringName> get_editable_properties() const;
  179. virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const;
  180. VisualShaderNodeTexture();
  181. };
  182. VARIANT_ENUM_CAST(VisualShaderNodeTexture::TextureType)
  183. VARIANT_ENUM_CAST(VisualShaderNodeTexture::Source)
  184. ///////////////////////////////////////
  185. class VisualShaderNodeCubeMap : public VisualShaderNode {
  186. GDCLASS(VisualShaderNodeCubeMap, VisualShaderNode);
  187. Ref<CubeMap> cube_map;
  188. public:
  189. enum Source {
  190. SOURCE_TEXTURE,
  191. SOURCE_PORT
  192. };
  193. enum TextureType {
  194. TYPE_DATA,
  195. TYPE_COLOR,
  196. TYPE_NORMALMAP
  197. };
  198. private:
  199. Source source;
  200. TextureType texture_type;
  201. protected:
  202. static void _bind_methods();
  203. public:
  204. virtual String get_caption() const;
  205. virtual int get_input_port_count() const;
  206. virtual PortType get_input_port_type(int p_port) const;
  207. virtual String get_input_port_name(int p_port) const;
  208. virtual String get_input_port_default_hint(int p_port) const;
  209. virtual int get_output_port_count() const;
  210. virtual PortType get_output_port_type(int p_port) const;
  211. virtual String get_output_port_name(int p_port) const;
  212. virtual Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const;
  213. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  214. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  215. void set_source(Source p_source);
  216. Source get_source() const;
  217. void set_cube_map(Ref<CubeMap> p_value);
  218. Ref<CubeMap> get_cube_map() const;
  219. void set_texture_type(TextureType p_type);
  220. TextureType get_texture_type() const;
  221. virtual Vector<StringName> get_editable_properties() const;
  222. virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const;
  223. VisualShaderNodeCubeMap();
  224. };
  225. VARIANT_ENUM_CAST(VisualShaderNodeCubeMap::TextureType)
  226. VARIANT_ENUM_CAST(VisualShaderNodeCubeMap::Source)
  227. ///////////////////////////////////////
  228. /// OPS
  229. ///////////////////////////////////////
  230. class VisualShaderNodeScalarOp : public VisualShaderNode {
  231. GDCLASS(VisualShaderNodeScalarOp, VisualShaderNode);
  232. public:
  233. enum Operator {
  234. OP_ADD,
  235. OP_SUB,
  236. OP_MUL,
  237. OP_DIV,
  238. OP_MOD,
  239. OP_POW,
  240. OP_MAX,
  241. OP_MIN,
  242. OP_ATAN2,
  243. OP_STEP
  244. };
  245. protected:
  246. Operator op;
  247. static void _bind_methods();
  248. public:
  249. virtual String get_caption() const;
  250. virtual int get_input_port_count() const;
  251. virtual PortType get_input_port_type(int p_port) const;
  252. virtual String get_input_port_name(int p_port) const;
  253. virtual int get_output_port_count() const;
  254. virtual PortType get_output_port_type(int p_port) const;
  255. virtual String get_output_port_name(int p_port) const;
  256. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  257. void set_operator(Operator p_op);
  258. Operator get_operator() const;
  259. virtual Vector<StringName> get_editable_properties() const;
  260. VisualShaderNodeScalarOp();
  261. };
  262. VARIANT_ENUM_CAST(VisualShaderNodeScalarOp::Operator)
  263. class VisualShaderNodeVectorOp : public VisualShaderNode {
  264. GDCLASS(VisualShaderNodeVectorOp, VisualShaderNode);
  265. public:
  266. enum Operator {
  267. OP_ADD,
  268. OP_SUB,
  269. OP_MUL,
  270. OP_DIV,
  271. OP_MOD,
  272. OP_POW,
  273. OP_MAX,
  274. OP_MIN,
  275. OP_CROSS,
  276. OP_ATAN2,
  277. OP_REFLECT,
  278. OP_STEP
  279. };
  280. protected:
  281. Operator op;
  282. static void _bind_methods();
  283. public:
  284. virtual String get_caption() const;
  285. virtual int get_input_port_count() const;
  286. virtual PortType get_input_port_type(int p_port) const;
  287. virtual String get_input_port_name(int p_port) const;
  288. virtual int get_output_port_count() const;
  289. virtual PortType get_output_port_type(int p_port) const;
  290. virtual String get_output_port_name(int p_port) const;
  291. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  292. void set_operator(Operator p_op);
  293. Operator get_operator() const;
  294. virtual Vector<StringName> get_editable_properties() const;
  295. VisualShaderNodeVectorOp();
  296. };
  297. VARIANT_ENUM_CAST(VisualShaderNodeVectorOp::Operator)
  298. ///////////////////////////////////////
  299. class VisualShaderNodeColorOp : public VisualShaderNode {
  300. GDCLASS(VisualShaderNodeColorOp, VisualShaderNode);
  301. public:
  302. enum Operator {
  303. OP_SCREEN,
  304. OP_DIFFERENCE,
  305. OP_DARKEN,
  306. OP_LIGHTEN,
  307. OP_OVERLAY,
  308. OP_DODGE,
  309. OP_BURN,
  310. OP_SOFT_LIGHT,
  311. OP_HARD_LIGHT
  312. };
  313. protected:
  314. Operator op;
  315. static void _bind_methods();
  316. public:
  317. virtual String get_caption() const;
  318. virtual int get_input_port_count() const;
  319. virtual PortType get_input_port_type(int p_port) const;
  320. virtual String get_input_port_name(int p_port) const;
  321. virtual int get_output_port_count() const;
  322. virtual PortType get_output_port_type(int p_port) const;
  323. virtual String get_output_port_name(int p_port) const;
  324. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  325. void set_operator(Operator p_op);
  326. Operator get_operator() const;
  327. virtual Vector<StringName> get_editable_properties() const;
  328. VisualShaderNodeColorOp();
  329. };
  330. VARIANT_ENUM_CAST(VisualShaderNodeColorOp::Operator)
  331. ///////////////////////////////////////
  332. /// TRANSFORM-TRANSFORM MULTIPLICATION
  333. ///////////////////////////////////////
  334. class VisualShaderNodeTransformMult : public VisualShaderNode {
  335. GDCLASS(VisualShaderNodeTransformMult, VisualShaderNode);
  336. public:
  337. enum Operator {
  338. OP_AxB,
  339. OP_BxA,
  340. OP_AxB_COMP,
  341. OP_BxA_COMP
  342. };
  343. protected:
  344. Operator op;
  345. static void _bind_methods();
  346. public:
  347. virtual String get_caption() const;
  348. virtual int get_input_port_count() const;
  349. virtual PortType get_input_port_type(int p_port) const;
  350. virtual String get_input_port_name(int p_port) const;
  351. virtual int get_output_port_count() const;
  352. virtual PortType get_output_port_type(int p_port) const;
  353. virtual String get_output_port_name(int p_port) const;
  354. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  355. void set_operator(Operator p_op);
  356. Operator get_operator() const;
  357. virtual Vector<StringName> get_editable_properties() const;
  358. VisualShaderNodeTransformMult();
  359. };
  360. VARIANT_ENUM_CAST(VisualShaderNodeTransformMult::Operator)
  361. ///////////////////////////////////////
  362. /// TRANSFORM-VECTOR MULTIPLICATION
  363. ///////////////////////////////////////
  364. class VisualShaderNodeTransformVecMult : public VisualShaderNode {
  365. GDCLASS(VisualShaderNodeTransformVecMult, VisualShaderNode);
  366. public:
  367. enum Operator {
  368. OP_AxB,
  369. OP_BxA,
  370. OP_3x3_AxB,
  371. OP_3x3_BxA,
  372. };
  373. protected:
  374. Operator op;
  375. static void _bind_methods();
  376. public:
  377. virtual String get_caption() const;
  378. virtual int get_input_port_count() const;
  379. virtual PortType get_input_port_type(int p_port) const;
  380. virtual String get_input_port_name(int p_port) const;
  381. virtual int get_output_port_count() const;
  382. virtual PortType get_output_port_type(int p_port) const;
  383. virtual String get_output_port_name(int p_port) const;
  384. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  385. void set_operator(Operator p_op);
  386. Operator get_operator() const;
  387. virtual Vector<StringName> get_editable_properties() const;
  388. VisualShaderNodeTransformVecMult();
  389. };
  390. VARIANT_ENUM_CAST(VisualShaderNodeTransformVecMult::Operator)
  391. ///////////////////////////////////////
  392. /// SCALAR FUNC
  393. ///////////////////////////////////////
  394. class VisualShaderNodeScalarFunc : public VisualShaderNode {
  395. GDCLASS(VisualShaderNodeScalarFunc, VisualShaderNode);
  396. public:
  397. enum Function {
  398. FUNC_SIN,
  399. FUNC_COS,
  400. FUNC_TAN,
  401. FUNC_ASIN,
  402. FUNC_ACOS,
  403. FUNC_ATAN,
  404. FUNC_SINH,
  405. FUNC_COSH,
  406. FUNC_TANH,
  407. FUNC_LOG,
  408. FUNC_EXP,
  409. FUNC_SQRT,
  410. FUNC_ABS,
  411. FUNC_SIGN,
  412. FUNC_FLOOR,
  413. FUNC_ROUND,
  414. FUNC_CEIL,
  415. FUNC_FRAC,
  416. FUNC_SATURATE,
  417. FUNC_NEGATE,
  418. FUNC_ACOSH,
  419. FUNC_ASINH,
  420. FUNC_ATANH,
  421. FUNC_DEGREES,
  422. FUNC_EXP2,
  423. FUNC_INVERSE_SQRT,
  424. FUNC_LOG2,
  425. FUNC_RADIANS,
  426. FUNC_RECIPROCAL,
  427. FUNC_ROUNDEVEN,
  428. FUNC_TRUNC,
  429. FUNC_ONEMINUS
  430. };
  431. protected:
  432. Function func;
  433. static void _bind_methods();
  434. public:
  435. virtual String get_caption() const;
  436. virtual int get_input_port_count() const;
  437. virtual PortType get_input_port_type(int p_port) const;
  438. virtual String get_input_port_name(int p_port) const;
  439. virtual int get_output_port_count() const;
  440. virtual PortType get_output_port_type(int p_port) const;
  441. virtual String get_output_port_name(int p_port) const;
  442. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  443. void set_function(Function p_func);
  444. Function get_function() const;
  445. virtual Vector<StringName> get_editable_properties() const;
  446. VisualShaderNodeScalarFunc();
  447. };
  448. VARIANT_ENUM_CAST(VisualShaderNodeScalarFunc::Function)
  449. ///////////////////////////////////////
  450. /// VECTOR FUNC
  451. ///////////////////////////////////////
  452. class VisualShaderNodeVectorFunc : public VisualShaderNode {
  453. GDCLASS(VisualShaderNodeVectorFunc, VisualShaderNode);
  454. public:
  455. enum Function {
  456. FUNC_NORMALIZE,
  457. FUNC_SATURATE,
  458. FUNC_NEGATE,
  459. FUNC_RECIPROCAL,
  460. FUNC_RGB2HSV,
  461. FUNC_HSV2RGB,
  462. FUNC_ABS,
  463. FUNC_ACOS,
  464. FUNC_ACOSH,
  465. FUNC_ASIN,
  466. FUNC_ASINH,
  467. FUNC_ATAN,
  468. FUNC_ATANH,
  469. FUNC_CEIL,
  470. FUNC_COS,
  471. FUNC_COSH,
  472. FUNC_DEGREES,
  473. FUNC_EXP,
  474. FUNC_EXP2,
  475. FUNC_FLOOR,
  476. FUNC_FRAC,
  477. FUNC_INVERSE_SQRT,
  478. FUNC_LOG,
  479. FUNC_LOG2,
  480. FUNC_RADIANS,
  481. FUNC_ROUND,
  482. FUNC_ROUNDEVEN,
  483. FUNC_SIGN,
  484. FUNC_SIN,
  485. FUNC_SINH,
  486. FUNC_SQRT,
  487. FUNC_TAN,
  488. FUNC_TANH,
  489. FUNC_TRUNC,
  490. FUNC_ONEMINUS
  491. };
  492. protected:
  493. Function func;
  494. static void _bind_methods();
  495. public:
  496. virtual String get_caption() const;
  497. virtual int get_input_port_count() const;
  498. virtual PortType get_input_port_type(int p_port) const;
  499. virtual String get_input_port_name(int p_port) const;
  500. virtual int get_output_port_count() const;
  501. virtual PortType get_output_port_type(int p_port) const;
  502. virtual String get_output_port_name(int p_port) const;
  503. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  504. void set_function(Function p_func);
  505. Function get_function() const;
  506. virtual Vector<StringName> get_editable_properties() const;
  507. VisualShaderNodeVectorFunc();
  508. };
  509. VARIANT_ENUM_CAST(VisualShaderNodeVectorFunc::Function)
  510. ///////////////////////////////////////
  511. /// COLOR FUNC
  512. ///////////////////////////////////////
  513. class VisualShaderNodeColorFunc : public VisualShaderNode {
  514. GDCLASS(VisualShaderNodeColorFunc, VisualShaderNode);
  515. public:
  516. enum Function {
  517. FUNC_GRAYSCALE,
  518. FUNC_SEPIA
  519. };
  520. protected:
  521. Function func;
  522. static void _bind_methods();
  523. public:
  524. virtual String get_caption() const;
  525. virtual int get_input_port_count() const;
  526. virtual PortType get_input_port_type(int p_port) const;
  527. virtual String get_input_port_name(int p_port) const;
  528. virtual int get_output_port_count() const;
  529. virtual PortType get_output_port_type(int p_port) const;
  530. virtual String get_output_port_name(int p_port) const;
  531. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  532. void set_function(Function p_func);
  533. Function get_function() const;
  534. virtual Vector<StringName> get_editable_properties() const;
  535. VisualShaderNodeColorFunc();
  536. };
  537. VARIANT_ENUM_CAST(VisualShaderNodeColorFunc::Function)
  538. ///////////////////////////////////////
  539. /// TRANSFORM FUNC
  540. ///////////////////////////////////////
  541. class VisualShaderNodeTransformFunc : public VisualShaderNode {
  542. GDCLASS(VisualShaderNodeTransformFunc, VisualShaderNode);
  543. public:
  544. enum Function {
  545. FUNC_INVERSE,
  546. FUNC_TRANSPOSE
  547. };
  548. protected:
  549. Function func;
  550. static void _bind_methods();
  551. public:
  552. virtual String get_caption() const;
  553. virtual int get_input_port_count() const;
  554. virtual PortType get_input_port_type(int p_port) const;
  555. virtual String get_input_port_name(int p_port) const;
  556. virtual int get_output_port_count() const;
  557. virtual PortType get_output_port_type(int p_port) const;
  558. virtual String get_output_port_name(int p_port) const;
  559. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  560. void set_function(Function p_func);
  561. Function get_function() const;
  562. virtual Vector<StringName> get_editable_properties() const;
  563. VisualShaderNodeTransformFunc();
  564. };
  565. VARIANT_ENUM_CAST(VisualShaderNodeTransformFunc::Function)
  566. ///////////////////////////////////////
  567. /// DOT
  568. ///////////////////////////////////////
  569. class VisualShaderNodeDotProduct : public VisualShaderNode {
  570. GDCLASS(VisualShaderNodeDotProduct, VisualShaderNode);
  571. public:
  572. virtual String get_caption() const;
  573. virtual int get_input_port_count() const;
  574. virtual PortType get_input_port_type(int p_port) const;
  575. virtual String get_input_port_name(int p_port) const;
  576. virtual int get_output_port_count() const;
  577. virtual PortType get_output_port_type(int p_port) const;
  578. virtual String get_output_port_name(int p_port) const;
  579. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  580. VisualShaderNodeDotProduct();
  581. };
  582. ///////////////////////////////////////
  583. /// LENGTH
  584. ///////////////////////////////////////
  585. class VisualShaderNodeVectorLen : public VisualShaderNode {
  586. GDCLASS(VisualShaderNodeVectorLen, VisualShaderNode);
  587. public:
  588. virtual String get_caption() const;
  589. virtual int get_input_port_count() const;
  590. virtual PortType get_input_port_type(int p_port) const;
  591. virtual String get_input_port_name(int p_port) const;
  592. virtual int get_output_port_count() const;
  593. virtual PortType get_output_port_type(int p_port) const;
  594. virtual String get_output_port_name(int p_port) const;
  595. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  596. VisualShaderNodeVectorLen();
  597. };
  598. ///////////////////////////////////////
  599. /// DETERMINANT
  600. ///////////////////////////////////////
  601. class VisualShaderNodeDeterminant : public VisualShaderNode {
  602. GDCLASS(VisualShaderNodeDeterminant, VisualShaderNode);
  603. public:
  604. virtual String get_caption() const;
  605. virtual int get_input_port_count() const;
  606. virtual PortType get_input_port_type(int p_port) const;
  607. virtual String get_input_port_name(int p_port) const;
  608. virtual int get_output_port_count() const;
  609. virtual PortType get_output_port_type(int p_port) const;
  610. virtual String get_output_port_name(int p_port) const;
  611. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  612. VisualShaderNodeDeterminant();
  613. };
  614. ///////////////////////////////////////
  615. /// CLAMP
  616. ///////////////////////////////////////
  617. class VisualShaderNodeScalarClamp : public VisualShaderNode {
  618. GDCLASS(VisualShaderNodeScalarClamp, VisualShaderNode);
  619. public:
  620. virtual String get_caption() const;
  621. virtual int get_input_port_count() const;
  622. virtual PortType get_input_port_type(int p_port) const;
  623. virtual String get_input_port_name(int p_port) const;
  624. virtual int get_output_port_count() const;
  625. virtual PortType get_output_port_type(int p_port) const;
  626. virtual String get_output_port_name(int p_port) const;
  627. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  628. VisualShaderNodeScalarClamp();
  629. };
  630. ///////////////////////////////////////
  631. class VisualShaderNodeVectorClamp : public VisualShaderNode {
  632. GDCLASS(VisualShaderNodeVectorClamp, VisualShaderNode);
  633. public:
  634. virtual String get_caption() const;
  635. virtual int get_input_port_count() const;
  636. virtual PortType get_input_port_type(int p_port) const;
  637. virtual String get_input_port_name(int p_port) const;
  638. virtual int get_output_port_count() const;
  639. virtual PortType get_output_port_type(int p_port) const;
  640. virtual String get_output_port_name(int p_port) const;
  641. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  642. VisualShaderNodeVectorClamp();
  643. };
  644. ///////////////////////////////////////
  645. /// DERIVATIVE FUNCTIONS
  646. ///////////////////////////////////////
  647. class VisualShaderNodeScalarDerivativeFunc : public VisualShaderNode {
  648. GDCLASS(VisualShaderNodeScalarDerivativeFunc, VisualShaderNode);
  649. public:
  650. enum Function {
  651. FUNC_SUM,
  652. FUNC_X,
  653. FUNC_Y
  654. };
  655. protected:
  656. Function func;
  657. static void _bind_methods();
  658. public:
  659. virtual String get_caption() const;
  660. virtual int get_input_port_count() const;
  661. virtual PortType get_input_port_type(int p_port) const;
  662. virtual String get_input_port_name(int p_port) const;
  663. virtual int get_output_port_count() const;
  664. virtual PortType get_output_port_type(int p_port) const;
  665. virtual String get_output_port_name(int p_port) const;
  666. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  667. void set_function(Function p_func);
  668. Function get_function() const;
  669. virtual Vector<StringName> get_editable_properties() const;
  670. VisualShaderNodeScalarDerivativeFunc();
  671. };
  672. VARIANT_ENUM_CAST(VisualShaderNodeScalarDerivativeFunc::Function)
  673. ///////////////////////////////////////
  674. class VisualShaderNodeVectorDerivativeFunc : public VisualShaderNode {
  675. GDCLASS(VisualShaderNodeVectorDerivativeFunc, VisualShaderNode);
  676. public:
  677. enum Function {
  678. FUNC_SUM,
  679. FUNC_X,
  680. FUNC_Y
  681. };
  682. protected:
  683. Function func;
  684. static void _bind_methods();
  685. public:
  686. virtual String get_caption() const;
  687. virtual int get_input_port_count() const;
  688. virtual PortType get_input_port_type(int p_port) const;
  689. virtual String get_input_port_name(int p_port) const;
  690. virtual int get_output_port_count() const;
  691. virtual PortType get_output_port_type(int p_port) const;
  692. virtual String get_output_port_name(int p_port) const;
  693. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  694. void set_function(Function p_func);
  695. Function get_function() const;
  696. virtual Vector<StringName> get_editable_properties() const;
  697. VisualShaderNodeVectorDerivativeFunc();
  698. };
  699. VARIANT_ENUM_CAST(VisualShaderNodeVectorDerivativeFunc::Function)
  700. ///////////////////////////////////////
  701. /// FACEFORWARD
  702. ///////////////////////////////////////
  703. class VisualShaderNodeFaceForward : public VisualShaderNode {
  704. GDCLASS(VisualShaderNodeFaceForward, VisualShaderNode);
  705. public:
  706. virtual String get_caption() const;
  707. virtual int get_input_port_count() const;
  708. virtual PortType get_input_port_type(int p_port) const;
  709. virtual String get_input_port_name(int p_port) const;
  710. virtual int get_output_port_count() const;
  711. virtual PortType get_output_port_type(int p_port) const;
  712. virtual String get_output_port_name(int p_port) const;
  713. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  714. VisualShaderNodeFaceForward();
  715. };
  716. ///////////////////////////////////////
  717. /// OUTER PRODUCT
  718. ///////////////////////////////////////
  719. class VisualShaderNodeOuterProduct : public VisualShaderNode {
  720. GDCLASS(VisualShaderNodeOuterProduct, VisualShaderNode);
  721. public:
  722. virtual String get_caption() const;
  723. virtual int get_input_port_count() const;
  724. virtual PortType get_input_port_type(int p_port) const;
  725. virtual String get_input_port_name(int p_port) const;
  726. virtual int get_output_port_count() const;
  727. virtual PortType get_output_port_type(int p_port) const;
  728. virtual String get_output_port_name(int p_port) const;
  729. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  730. VisualShaderNodeOuterProduct();
  731. };
  732. ///////////////////////////////////////
  733. /// STEP
  734. ///////////////////////////////////////
  735. class VisualShaderNodeVectorScalarStep : public VisualShaderNode {
  736. GDCLASS(VisualShaderNodeVectorScalarStep, VisualShaderNode);
  737. public:
  738. virtual String get_caption() const;
  739. virtual int get_input_port_count() const;
  740. virtual PortType get_input_port_type(int p_port) const;
  741. virtual String get_input_port_name(int p_port) const;
  742. virtual int get_output_port_count() const;
  743. virtual PortType get_output_port_type(int p_port) const;
  744. virtual String get_output_port_name(int p_port) const;
  745. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  746. VisualShaderNodeVectorScalarStep();
  747. };
  748. ///////////////////////////////////////
  749. /// SMOOTHSTEP
  750. ///////////////////////////////////////
  751. class VisualShaderNodeScalarSmoothStep : public VisualShaderNode {
  752. GDCLASS(VisualShaderNodeScalarSmoothStep, VisualShaderNode);
  753. public:
  754. virtual String get_caption() const;
  755. virtual int get_input_port_count() const;
  756. virtual PortType get_input_port_type(int p_port) const;
  757. virtual String get_input_port_name(int p_port) const;
  758. virtual int get_output_port_count() const;
  759. virtual PortType get_output_port_type(int p_port) const;
  760. virtual String get_output_port_name(int p_port) const;
  761. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  762. VisualShaderNodeScalarSmoothStep();
  763. };
  764. ///////////////////////////////////////
  765. class VisualShaderNodeVectorSmoothStep : public VisualShaderNode {
  766. GDCLASS(VisualShaderNodeVectorSmoothStep, VisualShaderNode);
  767. public:
  768. virtual String get_caption() const;
  769. virtual int get_input_port_count() const;
  770. virtual PortType get_input_port_type(int p_port) const;
  771. virtual String get_input_port_name(int p_port) const;
  772. virtual int get_output_port_count() const;
  773. virtual PortType get_output_port_type(int p_port) const;
  774. virtual String get_output_port_name(int p_port) const;
  775. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  776. VisualShaderNodeVectorSmoothStep();
  777. };
  778. ///////////////////////////////////////
  779. class VisualShaderNodeVectorScalarSmoothStep : public VisualShaderNode {
  780. GDCLASS(VisualShaderNodeVectorScalarSmoothStep, VisualShaderNode);
  781. public:
  782. virtual String get_caption() const;
  783. virtual int get_input_port_count() const;
  784. virtual PortType get_input_port_type(int p_port) const;
  785. virtual String get_input_port_name(int p_port) const;
  786. virtual int get_output_port_count() const;
  787. virtual PortType get_output_port_type(int p_port) const;
  788. virtual String get_output_port_name(int p_port) const;
  789. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  790. VisualShaderNodeVectorScalarSmoothStep();
  791. };
  792. ///////////////////////////////////////
  793. /// DISTANCE
  794. ///////////////////////////////////////
  795. class VisualShaderNodeVectorDistance : public VisualShaderNode {
  796. GDCLASS(VisualShaderNodeVectorDistance, VisualShaderNode);
  797. public:
  798. virtual String get_caption() const;
  799. virtual int get_input_port_count() const;
  800. virtual PortType get_input_port_type(int p_port) const;
  801. virtual String get_input_port_name(int p_port) const;
  802. virtual int get_output_port_count() const;
  803. virtual PortType get_output_port_type(int p_port) const;
  804. virtual String get_output_port_name(int p_port) const;
  805. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  806. VisualShaderNodeVectorDistance();
  807. };
  808. ///////////////////////////////////////
  809. /// REFRACT
  810. ///////////////////////////////////////
  811. class VisualShaderNodeVectorRefract : public VisualShaderNode {
  812. GDCLASS(VisualShaderNodeVectorRefract, VisualShaderNode);
  813. public:
  814. virtual String get_caption() const;
  815. virtual int get_input_port_count() const;
  816. virtual PortType get_input_port_type(int p_port) const;
  817. virtual String get_input_port_name(int p_port) const;
  818. virtual int get_output_port_count() const;
  819. virtual PortType get_output_port_type(int p_port) const;
  820. virtual String get_output_port_name(int p_port) const;
  821. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  822. VisualShaderNodeVectorRefract();
  823. };
  824. ///////////////////////////////////////
  825. /// MIX
  826. ///////////////////////////////////////
  827. class VisualShaderNodeScalarInterp : public VisualShaderNode {
  828. GDCLASS(VisualShaderNodeScalarInterp, VisualShaderNode);
  829. public:
  830. virtual String get_caption() const;
  831. virtual int get_input_port_count() const;
  832. virtual PortType get_input_port_type(int p_port) const;
  833. virtual String get_input_port_name(int p_port) const;
  834. virtual int get_output_port_count() const;
  835. virtual PortType get_output_port_type(int p_port) const;
  836. virtual String get_output_port_name(int p_port) const;
  837. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  838. VisualShaderNodeScalarInterp();
  839. };
  840. ///////////////////////////////////////
  841. class VisualShaderNodeVectorInterp : public VisualShaderNode {
  842. GDCLASS(VisualShaderNodeVectorInterp, VisualShaderNode);
  843. public:
  844. virtual String get_caption() const;
  845. virtual int get_input_port_count() const;
  846. virtual PortType get_input_port_type(int p_port) const;
  847. virtual String get_input_port_name(int p_port) const;
  848. virtual int get_output_port_count() const;
  849. virtual PortType get_output_port_type(int p_port) const;
  850. virtual String get_output_port_name(int p_port) const;
  851. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  852. VisualShaderNodeVectorInterp();
  853. };
  854. ///////////////////////////////////////
  855. class VisualShaderNodeVectorScalarMix : public VisualShaderNode {
  856. GDCLASS(VisualShaderNodeVectorScalarMix, VisualShaderNode);
  857. public:
  858. virtual String get_caption() const;
  859. virtual int get_input_port_count() const;
  860. virtual PortType get_input_port_type(int p_port) const;
  861. virtual String get_input_port_name(int p_port) const;
  862. virtual int get_output_port_count() const;
  863. virtual PortType get_output_port_type(int p_port) const;
  864. virtual String get_output_port_name(int p_port) const;
  865. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  866. VisualShaderNodeVectorScalarMix();
  867. };
  868. ///////////////////////////////////////
  869. /// COMPOSE
  870. ///////////////////////////////////////
  871. class VisualShaderNodeVectorCompose : public VisualShaderNode {
  872. GDCLASS(VisualShaderNodeVectorCompose, VisualShaderNode);
  873. public:
  874. virtual String get_caption() const;
  875. virtual int get_input_port_count() const;
  876. virtual PortType get_input_port_type(int p_port) const;
  877. virtual String get_input_port_name(int p_port) const;
  878. virtual int get_output_port_count() const;
  879. virtual PortType get_output_port_type(int p_port) const;
  880. virtual String get_output_port_name(int p_port) const;
  881. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  882. VisualShaderNodeVectorCompose();
  883. };
  884. ///////////////////////////////////////
  885. class VisualShaderNodeTransformCompose : public VisualShaderNode {
  886. GDCLASS(VisualShaderNodeTransformCompose, VisualShaderNode);
  887. public:
  888. virtual String get_caption() const;
  889. virtual int get_input_port_count() const;
  890. virtual PortType get_input_port_type(int p_port) const;
  891. virtual String get_input_port_name(int p_port) const;
  892. virtual int get_output_port_count() const;
  893. virtual PortType get_output_port_type(int p_port) const;
  894. virtual String get_output_port_name(int p_port) const;
  895. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  896. VisualShaderNodeTransformCompose();
  897. };
  898. ///////////////////////////////////////
  899. /// DECOMPOSE
  900. ///////////////////////////////////////
  901. class VisualShaderNodeVectorDecompose : public VisualShaderNode {
  902. GDCLASS(VisualShaderNodeVectorDecompose, VisualShaderNode);
  903. public:
  904. virtual String get_caption() const;
  905. virtual int get_input_port_count() const;
  906. virtual PortType get_input_port_type(int p_port) const;
  907. virtual String get_input_port_name(int p_port) const;
  908. virtual int get_output_port_count() const;
  909. virtual PortType get_output_port_type(int p_port) const;
  910. virtual String get_output_port_name(int p_port) const;
  911. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  912. VisualShaderNodeVectorDecompose();
  913. };
  914. ///////////////////////////////////////
  915. class VisualShaderNodeTransformDecompose : public VisualShaderNode {
  916. GDCLASS(VisualShaderNodeTransformDecompose, VisualShaderNode);
  917. public:
  918. virtual String get_caption() const;
  919. virtual int get_input_port_count() const;
  920. virtual PortType get_input_port_type(int p_port) const;
  921. virtual String get_input_port_name(int p_port) const;
  922. virtual int get_output_port_count() const;
  923. virtual PortType get_output_port_type(int p_port) const;
  924. virtual String get_output_port_name(int p_port) const;
  925. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  926. VisualShaderNodeTransformDecompose();
  927. };
  928. ///////////////////////////////////////
  929. /// UNIFORMS
  930. ///////////////////////////////////////
  931. class VisualShaderNodeScalarUniform : public VisualShaderNodeUniform {
  932. GDCLASS(VisualShaderNodeScalarUniform, VisualShaderNodeUniform);
  933. public:
  934. enum Hint {
  935. HINT_NONE,
  936. HINT_RANGE,
  937. HINT_RANGE_STEP,
  938. HINT_MAX,
  939. };
  940. private:
  941. Hint hint = HINT_NONE;
  942. float hint_range_min;
  943. float hint_range_max;
  944. float hint_range_step;
  945. bool default_value_enabled;
  946. float default_value;
  947. protected:
  948. static void _bind_methods();
  949. public:
  950. virtual String get_caption() const;
  951. virtual int get_input_port_count() const;
  952. virtual PortType get_input_port_type(int p_port) const;
  953. virtual String get_input_port_name(int p_port) const;
  954. virtual int get_output_port_count() const;
  955. virtual PortType get_output_port_type(int p_port) const;
  956. virtual String get_output_port_name(int p_port) const;
  957. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  958. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  959. void set_hint(Hint p_hint);
  960. Hint get_hint() const;
  961. void set_min(float p_value);
  962. float get_min() const;
  963. void set_max(float p_value);
  964. float get_max() const;
  965. void set_step(float p_value);
  966. float get_step() const;
  967. void set_default_value_enabled(bool p_enabled);
  968. bool is_default_value_enabled() const;
  969. void set_default_value(float p_value);
  970. float get_default_value() const;
  971. virtual Vector<StringName> get_editable_properties() const;
  972. VisualShaderNodeScalarUniform();
  973. };
  974. VARIANT_ENUM_CAST(VisualShaderNodeScalarUniform::Hint)
  975. ///////////////////////////////////////
  976. class VisualShaderNodeBooleanUniform : public VisualShaderNodeUniform {
  977. GDCLASS(VisualShaderNodeBooleanUniform, VisualShaderNodeUniform);
  978. private:
  979. bool default_value_enabled;
  980. bool default_value;
  981. protected:
  982. static void _bind_methods();
  983. public:
  984. virtual String get_caption() const;
  985. virtual int get_input_port_count() const;
  986. virtual PortType get_input_port_type(int p_port) const;
  987. virtual String get_input_port_name(int p_port) const;
  988. virtual int get_output_port_count() const;
  989. virtual PortType get_output_port_type(int p_port) const;
  990. virtual String get_output_port_name(int p_port) const;
  991. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  992. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  993. void set_default_value_enabled(bool p_enabled);
  994. bool is_default_value_enabled() const;
  995. void set_default_value(bool p_value);
  996. bool get_default_value() const;
  997. virtual Vector<StringName> get_editable_properties() const;
  998. VisualShaderNodeBooleanUniform();
  999. };
  1000. ///////////////////////////////////////
  1001. class VisualShaderNodeColorUniform : public VisualShaderNodeUniform {
  1002. GDCLASS(VisualShaderNodeColorUniform, VisualShaderNodeUniform);
  1003. private:
  1004. bool default_value_enabled;
  1005. Color default_value;
  1006. protected:
  1007. static void _bind_methods();
  1008. public:
  1009. virtual String get_caption() const;
  1010. virtual int get_input_port_count() const;
  1011. virtual PortType get_input_port_type(int p_port) const;
  1012. virtual String get_input_port_name(int p_port) const;
  1013. virtual int get_output_port_count() const;
  1014. virtual PortType get_output_port_type(int p_port) const;
  1015. virtual String get_output_port_name(int p_port) const;
  1016. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1017. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1018. void set_default_value_enabled(bool p_enabled);
  1019. bool is_default_value_enabled() const;
  1020. void set_default_value(const Color &p_value);
  1021. Color get_default_value() const;
  1022. virtual Vector<StringName> get_editable_properties() const;
  1023. VisualShaderNodeColorUniform();
  1024. };
  1025. ///////////////////////////////////////
  1026. class VisualShaderNodeVec3Uniform : public VisualShaderNodeUniform {
  1027. GDCLASS(VisualShaderNodeVec3Uniform, VisualShaderNodeUniform);
  1028. private:
  1029. bool default_value_enabled;
  1030. Vector3 default_value;
  1031. protected:
  1032. static void _bind_methods();
  1033. public:
  1034. virtual String get_caption() const;
  1035. virtual int get_input_port_count() const;
  1036. virtual PortType get_input_port_type(int p_port) const;
  1037. virtual String get_input_port_name(int p_port) const;
  1038. virtual int get_output_port_count() const;
  1039. virtual PortType get_output_port_type(int p_port) const;
  1040. virtual String get_output_port_name(int p_port) const;
  1041. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1042. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1043. void set_default_value_enabled(bool p_enabled);
  1044. bool is_default_value_enabled() const;
  1045. void set_default_value(const Vector3 &p_value);
  1046. Vector3 get_default_value() const;
  1047. virtual Vector<StringName> get_editable_properties() const;
  1048. VisualShaderNodeVec3Uniform();
  1049. };
  1050. ///////////////////////////////////////
  1051. class VisualShaderNodeTransformUniform : public VisualShaderNodeUniform {
  1052. GDCLASS(VisualShaderNodeTransformUniform, VisualShaderNodeUniform);
  1053. private:
  1054. bool default_value_enabled;
  1055. Transform default_value;
  1056. protected:
  1057. static void _bind_methods();
  1058. public:
  1059. virtual String get_caption() const;
  1060. virtual int get_input_port_count() const;
  1061. virtual PortType get_input_port_type(int p_port) const;
  1062. virtual String get_input_port_name(int p_port) const;
  1063. virtual int get_output_port_count() const;
  1064. virtual PortType get_output_port_type(int p_port) const;
  1065. virtual String get_output_port_name(int p_port) const;
  1066. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1067. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1068. void set_default_value_enabled(bool p_enabled);
  1069. bool is_default_value_enabled() const;
  1070. void set_default_value(const Transform &p_value);
  1071. Transform get_default_value() const;
  1072. virtual Vector<StringName> get_editable_properties() const;
  1073. VisualShaderNodeTransformUniform();
  1074. };
  1075. ///////////////////////////////////////
  1076. class VisualShaderNodeTextureUniform : public VisualShaderNodeUniform {
  1077. GDCLASS(VisualShaderNodeTextureUniform, VisualShaderNodeUniform);
  1078. public:
  1079. enum TextureType {
  1080. TYPE_DATA,
  1081. TYPE_COLOR,
  1082. TYPE_NORMALMAP,
  1083. TYPE_ANISO,
  1084. };
  1085. enum ColorDefault {
  1086. COLOR_DEFAULT_WHITE,
  1087. COLOR_DEFAULT_BLACK
  1088. };
  1089. protected:
  1090. TextureType texture_type;
  1091. ColorDefault color_default;
  1092. protected:
  1093. static void _bind_methods();
  1094. public:
  1095. virtual String get_caption() const;
  1096. virtual int get_input_port_count() const;
  1097. virtual PortType get_input_port_type(int p_port) const;
  1098. virtual String get_input_port_name(int p_port) const;
  1099. virtual String get_input_port_default_hint(int p_port) const;
  1100. virtual int get_output_port_count() const;
  1101. virtual PortType get_output_port_type(int p_port) const;
  1102. virtual String get_output_port_name(int p_port) const;
  1103. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1104. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1105. virtual bool is_code_generated() const;
  1106. virtual bool is_show_prop_names() const;
  1107. Vector<StringName> get_editable_properties() const;
  1108. void set_texture_type(TextureType p_type);
  1109. TextureType get_texture_type() const;
  1110. void set_color_default(ColorDefault p_default);
  1111. ColorDefault get_color_default() const;
  1112. VisualShaderNodeTextureUniform();
  1113. };
  1114. VARIANT_ENUM_CAST(VisualShaderNodeTextureUniform::TextureType)
  1115. VARIANT_ENUM_CAST(VisualShaderNodeTextureUniform::ColorDefault)
  1116. ///////////////////////////////////////
  1117. class VisualShaderNodeTextureUniformTriplanar : public VisualShaderNodeTextureUniform {
  1118. GDCLASS(VisualShaderNodeTextureUniformTriplanar, VisualShaderNodeTextureUniform);
  1119. public:
  1120. virtual String get_caption() const;
  1121. virtual int get_input_port_count() const;
  1122. virtual PortType get_input_port_type(int p_port) const;
  1123. virtual String get_input_port_name(int p_port) const;
  1124. virtual String get_input_port_default_hint(int p_port) const;
  1125. virtual String generate_global_per_node(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1126. virtual String generate_global_per_func(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1127. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1128. VisualShaderNodeTextureUniformTriplanar();
  1129. };
  1130. ///////////////////////////////////////
  1131. class VisualShaderNodeCubeMapUniform : public VisualShaderNodeTextureUniform {
  1132. GDCLASS(VisualShaderNodeCubeMapUniform, VisualShaderNodeTextureUniform);
  1133. public:
  1134. virtual String get_caption() const;
  1135. virtual int get_input_port_count() const;
  1136. virtual PortType get_input_port_type(int p_port) const;
  1137. virtual String get_input_port_name(int p_port) const;
  1138. virtual int get_output_port_count() const;
  1139. virtual PortType get_output_port_type(int p_port) const;
  1140. virtual String get_output_port_name(int p_port) const;
  1141. virtual String get_input_port_default_hint(int p_port) const;
  1142. virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
  1143. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1144. VisualShaderNodeCubeMapUniform();
  1145. };
  1146. ///////////////////////////////////////
  1147. /// IF
  1148. ///////////////////////////////////////
  1149. class VisualShaderNodeIf : public VisualShaderNode {
  1150. GDCLASS(VisualShaderNodeIf, VisualShaderNode);
  1151. public:
  1152. virtual String get_caption() const;
  1153. virtual int get_input_port_count() const;
  1154. virtual PortType get_input_port_type(int p_port) const;
  1155. virtual String get_input_port_name(int p_port) const;
  1156. virtual int get_output_port_count() const;
  1157. virtual PortType get_output_port_type(int p_port) const;
  1158. virtual String get_output_port_name(int p_port) const;
  1159. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const;
  1160. VisualShaderNodeIf();
  1161. };
  1162. ///////////////////////////////////////
  1163. /// SWITCH
  1164. ///////////////////////////////////////
  1165. class VisualShaderNodeSwitch : public VisualShaderNode {
  1166. GDCLASS(VisualShaderNodeSwitch, VisualShaderNode);
  1167. public:
  1168. virtual String get_caption() const;
  1169. virtual int get_input_port_count() const;
  1170. virtual PortType get_input_port_type(int p_port) const;
  1171. virtual String get_input_port_name(int p_port) const;
  1172. virtual int get_output_port_count() const;
  1173. virtual PortType get_output_port_type(int p_port) const;
  1174. virtual String get_output_port_name(int p_port) const;
  1175. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const;
  1176. VisualShaderNodeSwitch();
  1177. };
  1178. class VisualShaderNodeScalarSwitch : public VisualShaderNodeSwitch {
  1179. GDCLASS(VisualShaderNodeScalarSwitch, VisualShaderNodeSwitch);
  1180. public:
  1181. virtual String get_caption() const;
  1182. virtual PortType get_input_port_type(int p_port) const;
  1183. virtual PortType get_output_port_type(int p_port) const;
  1184. VisualShaderNodeScalarSwitch();
  1185. };
  1186. ///////////////////////////////////////
  1187. /// FRESNEL
  1188. ///////////////////////////////////////
  1189. class VisualShaderNodeFresnel : public VisualShaderNode {
  1190. GDCLASS(VisualShaderNodeFresnel, VisualShaderNode);
  1191. public:
  1192. virtual String get_caption() const;
  1193. virtual int get_input_port_count() const;
  1194. virtual PortType get_input_port_type(int p_port) const;
  1195. virtual String get_input_port_name(int p_port) const;
  1196. virtual int get_output_port_count() const;
  1197. virtual PortType get_output_port_type(int p_port) const;
  1198. virtual String get_output_port_name(int p_port) const;
  1199. virtual String get_input_port_default_hint(int p_port) const;
  1200. virtual bool is_generate_input_var(int p_port) const;
  1201. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const;
  1202. VisualShaderNodeFresnel();
  1203. };
  1204. ///////////////////////////////////////
  1205. /// Is
  1206. ///////////////////////////////////////
  1207. class VisualShaderNodeIs : public VisualShaderNode {
  1208. GDCLASS(VisualShaderNodeIs, VisualShaderNode);
  1209. public:
  1210. enum Function {
  1211. FUNC_IS_INF,
  1212. FUNC_IS_NAN,
  1213. };
  1214. protected:
  1215. Function func;
  1216. protected:
  1217. static void _bind_methods();
  1218. public:
  1219. virtual String get_caption() const;
  1220. virtual int get_input_port_count() const;
  1221. virtual PortType get_input_port_type(int p_port) const;
  1222. virtual String get_input_port_name(int p_port) const;
  1223. virtual int get_output_port_count() const;
  1224. virtual PortType get_output_port_type(int p_port) const;
  1225. virtual String get_output_port_name(int p_port) const;
  1226. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1227. void set_function(Function p_func);
  1228. Function get_function() const;
  1229. virtual Vector<StringName> get_editable_properties() const;
  1230. VisualShaderNodeIs();
  1231. };
  1232. VARIANT_ENUM_CAST(VisualShaderNodeIs::Function)
  1233. ///////////////////////////////////////
  1234. /// Compare
  1235. ///////////////////////////////////////
  1236. class VisualShaderNodeCompare : public VisualShaderNode {
  1237. GDCLASS(VisualShaderNodeCompare, VisualShaderNode);
  1238. public:
  1239. enum ComparisonType {
  1240. CTYPE_SCALAR,
  1241. CTYPE_VECTOR,
  1242. CTYPE_BOOLEAN,
  1243. CTYPE_TRANSFORM
  1244. };
  1245. enum Function {
  1246. FUNC_EQUAL,
  1247. FUNC_NOT_EQUAL,
  1248. FUNC_GREATER_THAN,
  1249. FUNC_GREATER_THAN_EQUAL,
  1250. FUNC_LESS_THAN,
  1251. FUNC_LESS_THAN_EQUAL,
  1252. };
  1253. enum Condition {
  1254. COND_ALL,
  1255. COND_ANY,
  1256. };
  1257. protected:
  1258. ComparisonType ctype;
  1259. Function func;
  1260. Condition condition;
  1261. protected:
  1262. static void _bind_methods();
  1263. public:
  1264. virtual String get_caption() const;
  1265. virtual int get_input_port_count() const;
  1266. virtual PortType get_input_port_type(int p_port) const;
  1267. virtual String get_input_port_name(int p_port) const;
  1268. virtual int get_output_port_count() const;
  1269. virtual PortType get_output_port_type(int p_port) const;
  1270. virtual String get_output_port_name(int p_port) const;
  1271. virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
  1272. void set_comparison_type(ComparisonType p_type);
  1273. ComparisonType get_comparison_type() const;
  1274. void set_function(Function p_func);
  1275. Function get_function() const;
  1276. void set_condition(Condition p_cond);
  1277. Condition get_condition() const;
  1278. virtual Vector<StringName> get_editable_properties() const;
  1279. virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const;
  1280. VisualShaderNodeCompare();
  1281. };
  1282. VARIANT_ENUM_CAST(VisualShaderNodeCompare::ComparisonType)
  1283. VARIANT_ENUM_CAST(VisualShaderNodeCompare::Function)
  1284. VARIANT_ENUM_CAST(VisualShaderNodeCompare::Condition)
  1285. #endif // VISUAL_SHADER_NODES_H