material.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /**************************************************************************/
  2. /* material.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 MATERIAL_H
  31. #define MATERIAL_H
  32. #include "core/resource.h"
  33. #include "core/self_list.h"
  34. #include "scene/resources/shader.h"
  35. #include "scene/resources/texture.h"
  36. #include "servers/visual/shader_language.h"
  37. #include "servers/visual_server.h"
  38. class Material : public Resource {
  39. GDCLASS(Material, Resource);
  40. RES_BASE_EXTENSION("material")
  41. OBJ_SAVE_TYPE(Material);
  42. RID material;
  43. Ref<Material> next_pass;
  44. int render_priority;
  45. protected:
  46. _FORCE_INLINE_ RID _get_material() const { return material; }
  47. static void _bind_methods();
  48. virtual bool _can_do_next_pass() const { return false; }
  49. void _validate_property(PropertyInfo &property) const;
  50. public:
  51. enum {
  52. RENDER_PRIORITY_MAX = VS::MATERIAL_RENDER_PRIORITY_MAX,
  53. RENDER_PRIORITY_MIN = VS::MATERIAL_RENDER_PRIORITY_MIN,
  54. };
  55. void set_next_pass(const Ref<Material> &p_pass);
  56. Ref<Material> get_next_pass() const;
  57. void set_render_priority(int p_priority);
  58. int get_render_priority() const;
  59. virtual RID get_rid() const;
  60. virtual Shader::Mode get_shader_mode() const = 0;
  61. Material();
  62. virtual ~Material();
  63. };
  64. class ShaderMaterial : public Material {
  65. GDCLASS(ShaderMaterial, Material);
  66. Ref<Shader> shader;
  67. protected:
  68. bool _set(const StringName &p_name, const Variant &p_value);
  69. bool _get(const StringName &p_name, Variant &r_ret) const;
  70. void _get_property_list(List<PropertyInfo> *p_list) const;
  71. bool property_can_revert(const String &p_name);
  72. Variant property_get_revert(const String &p_name);
  73. static void _bind_methods();
  74. void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
  75. virtual bool _can_do_next_pass() const;
  76. void _shader_changed();
  77. public:
  78. void set_shader(const Ref<Shader> &p_shader);
  79. Ref<Shader> get_shader() const;
  80. void set_shader_param(const StringName &p_param, const Variant &p_value);
  81. Variant get_shader_param(const StringName &p_param) const;
  82. virtual Shader::Mode get_shader_mode() const;
  83. ShaderMaterial();
  84. ~ShaderMaterial();
  85. };
  86. class SpatialMaterial : public Material {
  87. GDCLASS(SpatialMaterial, Material);
  88. public:
  89. enum TextureParam {
  90. TEXTURE_ALBEDO,
  91. TEXTURE_METALLIC,
  92. TEXTURE_ROUGHNESS,
  93. TEXTURE_EMISSION,
  94. TEXTURE_NORMAL,
  95. TEXTURE_RIM,
  96. TEXTURE_CLEARCOAT,
  97. TEXTURE_FLOWMAP,
  98. TEXTURE_AMBIENT_OCCLUSION,
  99. TEXTURE_DEPTH,
  100. TEXTURE_SUBSURFACE_SCATTERING,
  101. TEXTURE_TRANSMISSION,
  102. TEXTURE_REFRACTION,
  103. TEXTURE_DETAIL_MASK,
  104. TEXTURE_DETAIL_ALBEDO,
  105. TEXTURE_DETAIL_NORMAL,
  106. TEXTURE_MAX
  107. };
  108. enum DetailUV {
  109. DETAIL_UV_1,
  110. DETAIL_UV_2
  111. };
  112. enum Feature {
  113. FEATURE_TRANSPARENT,
  114. FEATURE_EMISSION,
  115. FEATURE_NORMAL_MAPPING,
  116. FEATURE_RIM,
  117. FEATURE_CLEARCOAT,
  118. FEATURE_ANISOTROPY,
  119. FEATURE_AMBIENT_OCCLUSION,
  120. FEATURE_DEPTH_MAPPING,
  121. FEATURE_SUBSURACE_SCATTERING,
  122. FEATURE_TRANSMISSION,
  123. FEATURE_REFRACTION,
  124. FEATURE_DETAIL,
  125. FEATURE_MAX
  126. };
  127. enum BlendMode {
  128. BLEND_MODE_MIX,
  129. BLEND_MODE_ADD,
  130. BLEND_MODE_SUB,
  131. BLEND_MODE_MUL,
  132. };
  133. enum DepthDrawMode {
  134. DEPTH_DRAW_OPAQUE_ONLY,
  135. DEPTH_DRAW_ALWAYS,
  136. DEPTH_DRAW_DISABLED,
  137. DEPTH_DRAW_ALPHA_OPAQUE_PREPASS
  138. };
  139. enum CullMode {
  140. CULL_BACK,
  141. CULL_FRONT,
  142. CULL_DISABLED
  143. };
  144. enum Flags {
  145. FLAG_UNSHADED,
  146. FLAG_USE_VERTEX_LIGHTING,
  147. FLAG_DISABLE_DEPTH_TEST,
  148. FLAG_ALBEDO_FROM_VERTEX_COLOR,
  149. FLAG_SRGB_VERTEX_COLOR,
  150. FLAG_USE_POINT_SIZE,
  151. FLAG_FIXED_SIZE,
  152. FLAG_BILLBOARD_KEEP_SCALE,
  153. FLAG_UV1_USE_TRIPLANAR,
  154. FLAG_UV2_USE_TRIPLANAR,
  155. FLAG_TRIPLANAR_USE_WORLD,
  156. FLAG_AO_ON_UV2,
  157. FLAG_EMISSION_ON_UV2,
  158. FLAG_USE_ALPHA_SCISSOR,
  159. FLAG_ALBEDO_TEXTURE_FORCE_SRGB,
  160. FLAG_DONT_RECEIVE_SHADOWS,
  161. FLAG_ENSURE_CORRECT_NORMALS,
  162. FLAG_DISABLE_AMBIENT_LIGHT,
  163. FLAG_USE_SHADOW_TO_OPACITY,
  164. FLAG_ALBEDO_TEXTURE_SDF,
  165. FLAG_MAX
  166. };
  167. enum DiffuseMode {
  168. DIFFUSE_BURLEY,
  169. DIFFUSE_LAMBERT,
  170. DIFFUSE_LAMBERT_WRAP,
  171. DIFFUSE_OREN_NAYAR,
  172. DIFFUSE_TOON,
  173. };
  174. enum SpecularMode {
  175. SPECULAR_SCHLICK_GGX,
  176. SPECULAR_BLINN,
  177. SPECULAR_PHONG,
  178. SPECULAR_TOON,
  179. SPECULAR_DISABLED,
  180. };
  181. enum BillboardMode {
  182. BILLBOARD_DISABLED,
  183. BILLBOARD_ENABLED,
  184. BILLBOARD_FIXED_Y,
  185. BILLBOARD_PARTICLES,
  186. };
  187. enum TextureChannel {
  188. TEXTURE_CHANNEL_RED,
  189. TEXTURE_CHANNEL_GREEN,
  190. TEXTURE_CHANNEL_BLUE,
  191. TEXTURE_CHANNEL_ALPHA,
  192. TEXTURE_CHANNEL_GRAYSCALE
  193. };
  194. enum EmissionOperator {
  195. EMISSION_OP_ADD,
  196. EMISSION_OP_MULTIPLY
  197. };
  198. enum DistanceFadeMode {
  199. DISTANCE_FADE_DISABLED,
  200. DISTANCE_FADE_PIXEL_ALPHA,
  201. DISTANCE_FADE_PIXEL_DITHER,
  202. DISTANCE_FADE_OBJECT_DITHER,
  203. };
  204. enum AsyncMode {
  205. ASYNC_MODE_VISIBLE,
  206. ASYNC_MODE_HIDDEN,
  207. };
  208. private:
  209. union MaterialKey {
  210. struct {
  211. uint64_t feature_mask : 12;
  212. uint64_t detail_uv : 1;
  213. uint64_t blend_mode : 2;
  214. uint64_t depth_draw_mode : 2;
  215. uint64_t cull_mode : 2;
  216. uint64_t flags : 20;
  217. uint64_t detail_blend_mode : 2;
  218. uint64_t diffuse_mode : 3;
  219. uint64_t specular_mode : 3;
  220. uint64_t invalid_key : 1;
  221. uint64_t deep_parallax : 1;
  222. uint64_t billboard_mode : 2;
  223. uint64_t grow : 1;
  224. uint64_t proximity_fade : 1;
  225. uint64_t distance_fade : 2;
  226. uint64_t emission_op : 1;
  227. uint64_t texture_metallic : 1;
  228. uint64_t texture_roughness : 1;
  229. //uint64_t reserved : 6;
  230. };
  231. uint64_t key;
  232. bool operator<(const MaterialKey &p_key) const {
  233. return key < p_key.key;
  234. }
  235. };
  236. struct ShaderData {
  237. RID shader;
  238. int users;
  239. };
  240. static Map<MaterialKey, ShaderData> shader_map;
  241. MaterialKey current_key;
  242. _FORCE_INLINE_ MaterialKey _compute_key() const {
  243. MaterialKey mk;
  244. mk.key = 0;
  245. for (int i = 0; i < FEATURE_MAX; i++) {
  246. if (features[i]) {
  247. mk.feature_mask |= ((uint64_t)1 << i);
  248. }
  249. }
  250. mk.detail_uv = detail_uv;
  251. mk.blend_mode = blend_mode;
  252. mk.depth_draw_mode = depth_draw_mode;
  253. mk.cull_mode = cull_mode;
  254. for (int i = 0; i < FLAG_MAX; i++) {
  255. if (flags[i]) {
  256. mk.flags |= ((uint64_t)1 << i);
  257. }
  258. }
  259. mk.detail_blend_mode = detail_blend_mode;
  260. mk.diffuse_mode = diffuse_mode;
  261. mk.specular_mode = specular_mode;
  262. mk.billboard_mode = billboard_mode;
  263. mk.deep_parallax = deep_parallax ? 1 : 0;
  264. mk.grow = grow_enabled;
  265. mk.proximity_fade = proximity_fade_enabled;
  266. mk.distance_fade = distance_fade;
  267. mk.emission_op = emission_op;
  268. mk.texture_metallic = textures[TEXTURE_METALLIC].is_valid() ? 1 : 0;
  269. mk.texture_roughness = textures[TEXTURE_ROUGHNESS].is_valid() ? 1 : 0;
  270. return mk;
  271. }
  272. struct ShaderNames {
  273. StringName albedo;
  274. StringName specular;
  275. StringName metallic;
  276. StringName roughness;
  277. StringName emission;
  278. StringName emission_energy;
  279. StringName normal_scale;
  280. StringName rim;
  281. StringName rim_tint;
  282. StringName clearcoat;
  283. StringName clearcoat_gloss;
  284. StringName anisotropy;
  285. StringName depth_scale;
  286. StringName subsurface_scattering_strength;
  287. StringName transmission;
  288. StringName refraction;
  289. StringName point_size;
  290. StringName uv1_scale;
  291. StringName uv1_offset;
  292. StringName uv2_scale;
  293. StringName uv2_offset;
  294. StringName particles_anim_h_frames;
  295. StringName particles_anim_v_frames;
  296. StringName particles_anim_loop;
  297. StringName depth_min_layers;
  298. StringName depth_max_layers;
  299. StringName depth_flip;
  300. StringName uv1_blend_sharpness;
  301. StringName uv2_blend_sharpness;
  302. StringName grow;
  303. StringName proximity_fade_distance;
  304. StringName distance_fade_min;
  305. StringName distance_fade_max;
  306. StringName ao_light_affect;
  307. StringName metallic_texture_channel;
  308. StringName roughness_texture_channel;
  309. StringName ao_texture_channel;
  310. StringName clearcoat_texture_channel;
  311. StringName rim_texture_channel;
  312. StringName depth_texture_channel;
  313. StringName refraction_texture_channel;
  314. StringName alpha_scissor_threshold;
  315. StringName texture_names[TEXTURE_MAX];
  316. };
  317. static Mutex material_mutex;
  318. static SelfList<SpatialMaterial>::List *dirty_materials;
  319. static ShaderNames *shader_names;
  320. SelfList<SpatialMaterial> element;
  321. void _update_shader();
  322. _FORCE_INLINE_ void _queue_shader_change();
  323. _FORCE_INLINE_ bool _is_shader_dirty() const;
  324. bool is_initialized = false;
  325. Color albedo;
  326. float specular;
  327. float metallic;
  328. float roughness;
  329. Color emission;
  330. float emission_energy;
  331. float normal_scale;
  332. float rim;
  333. float rim_tint;
  334. float clearcoat;
  335. float clearcoat_gloss;
  336. float anisotropy;
  337. float depth_scale;
  338. float subsurface_scattering_strength;
  339. Color transmission;
  340. float refraction;
  341. float line_width;
  342. float point_size;
  343. float alpha_scissor_threshold;
  344. bool grow_enabled;
  345. float ao_light_affect;
  346. float grow;
  347. int particles_anim_h_frames;
  348. int particles_anim_v_frames;
  349. bool particles_anim_loop;
  350. Vector3 uv1_scale;
  351. Vector3 uv1_offset;
  352. float uv1_triplanar_sharpness;
  353. Vector3 uv2_scale;
  354. Vector3 uv2_offset;
  355. float uv2_triplanar_sharpness;
  356. DetailUV detail_uv;
  357. bool deep_parallax;
  358. int deep_parallax_min_layers;
  359. int deep_parallax_max_layers;
  360. bool depth_parallax_flip_tangent;
  361. bool depth_parallax_flip_binormal;
  362. bool proximity_fade_enabled;
  363. float proximity_fade_distance;
  364. DistanceFadeMode distance_fade;
  365. float distance_fade_max_distance;
  366. float distance_fade_min_distance;
  367. BlendMode blend_mode;
  368. BlendMode detail_blend_mode;
  369. DepthDrawMode depth_draw_mode;
  370. CullMode cull_mode;
  371. bool flags[FLAG_MAX];
  372. SpecularMode specular_mode;
  373. DiffuseMode diffuse_mode;
  374. BillboardMode billboard_mode;
  375. EmissionOperator emission_op;
  376. AsyncMode async_mode;
  377. TextureChannel metallic_texture_channel;
  378. TextureChannel roughness_texture_channel;
  379. TextureChannel ao_texture_channel;
  380. TextureChannel refraction_texture_channel;
  381. bool features[FEATURE_MAX];
  382. Ref<Texture> textures[TEXTURE_MAX];
  383. bool force_vertex_shading = false;
  384. _FORCE_INLINE_ void _validate_feature(const String &text, Feature feature, PropertyInfo &property) const;
  385. static HashMap<uint64_t, Ref<SpatialMaterial>> materials_for_2d; //used by Sprite3D and other stuff
  386. void _validate_high_end(const String &text, PropertyInfo &property) const;
  387. protected:
  388. static void _bind_methods();
  389. void _validate_property(PropertyInfo &property) const;
  390. virtual bool _can_do_next_pass() const { return true; }
  391. public:
  392. void set_albedo(const Color &p_albedo);
  393. Color get_albedo() const;
  394. void set_specular(float p_specular);
  395. float get_specular() const;
  396. void set_metallic(float p_metallic);
  397. float get_metallic() const;
  398. void set_roughness(float p_roughness);
  399. float get_roughness() const;
  400. void set_emission(const Color &p_emission);
  401. Color get_emission() const;
  402. void set_emission_energy(float p_emission_energy);
  403. float get_emission_energy() const;
  404. void set_normal_scale(float p_normal_scale);
  405. float get_normal_scale() const;
  406. void set_rim(float p_rim);
  407. float get_rim() const;
  408. void set_rim_tint(float p_rim_tint);
  409. float get_rim_tint() const;
  410. void set_ao_light_affect(float p_ao_light_affect);
  411. float get_ao_light_affect() const;
  412. void set_clearcoat(float p_clearcoat);
  413. float get_clearcoat() const;
  414. void set_clearcoat_gloss(float p_clearcoat_gloss);
  415. float get_clearcoat_gloss() const;
  416. void set_anisotropy(float p_anisotropy);
  417. float get_anisotropy() const;
  418. void set_depth_scale(float p_depth_scale);
  419. float get_depth_scale() const;
  420. void set_depth_deep_parallax(bool p_enable);
  421. bool is_depth_deep_parallax_enabled() const;
  422. void set_depth_deep_parallax_min_layers(int p_layer);
  423. int get_depth_deep_parallax_min_layers() const;
  424. void set_depth_deep_parallax_max_layers(int p_layer);
  425. int get_depth_deep_parallax_max_layers() const;
  426. void set_depth_deep_parallax_flip_tangent(bool p_flip);
  427. bool get_depth_deep_parallax_flip_tangent() const;
  428. void set_depth_deep_parallax_flip_binormal(bool p_flip);
  429. bool get_depth_deep_parallax_flip_binormal() const;
  430. void set_subsurface_scattering_strength(float p_subsurface_scattering_strength);
  431. float get_subsurface_scattering_strength() const;
  432. void set_transmission(const Color &p_transmission);
  433. Color get_transmission() const;
  434. void set_refraction(float p_refraction);
  435. float get_refraction() const;
  436. void set_line_width(float p_line_width);
  437. float get_line_width() const;
  438. void set_point_size(float p_point_size);
  439. float get_point_size() const;
  440. void set_detail_uv(DetailUV p_detail_uv);
  441. DetailUV get_detail_uv() const;
  442. void set_blend_mode(BlendMode p_mode);
  443. BlendMode get_blend_mode() const;
  444. void set_detail_blend_mode(BlendMode p_mode);
  445. BlendMode get_detail_blend_mode() const;
  446. void set_depth_draw_mode(DepthDrawMode p_mode);
  447. DepthDrawMode get_depth_draw_mode() const;
  448. void set_cull_mode(CullMode p_mode);
  449. CullMode get_cull_mode() const;
  450. void set_diffuse_mode(DiffuseMode p_mode);
  451. DiffuseMode get_diffuse_mode() const;
  452. void set_specular_mode(SpecularMode p_mode);
  453. SpecularMode get_specular_mode() const;
  454. void set_flag(Flags p_flag, bool p_enabled);
  455. bool get_flag(Flags p_flag) const;
  456. void set_texture(TextureParam p_param, const Ref<Texture> &p_texture);
  457. Ref<Texture> get_texture(TextureParam p_param) const;
  458. // Used only for shader material conversion
  459. Ref<Texture> get_texture_by_name(StringName p_name) const;
  460. void set_feature(Feature p_feature, bool p_enabled);
  461. bool get_feature(Feature p_feature) const;
  462. void set_uv1_scale(const Vector3 &p_scale);
  463. Vector3 get_uv1_scale() const;
  464. void set_uv1_offset(const Vector3 &p_offset);
  465. Vector3 get_uv1_offset() const;
  466. void set_uv1_triplanar_blend_sharpness(float p_sharpness);
  467. float get_uv1_triplanar_blend_sharpness() const;
  468. void set_uv2_scale(const Vector3 &p_scale);
  469. Vector3 get_uv2_scale() const;
  470. void set_uv2_offset(const Vector3 &p_offset);
  471. Vector3 get_uv2_offset() const;
  472. void set_uv2_triplanar_blend_sharpness(float p_sharpness);
  473. float get_uv2_triplanar_blend_sharpness() const;
  474. void set_billboard_mode(BillboardMode p_mode);
  475. BillboardMode get_billboard_mode() const;
  476. void set_particles_anim_h_frames(int p_frames);
  477. int get_particles_anim_h_frames() const;
  478. void set_particles_anim_v_frames(int p_frames);
  479. int get_particles_anim_v_frames() const;
  480. void set_particles_anim_loop(bool p_loop);
  481. bool get_particles_anim_loop() const;
  482. void set_grow_enabled(bool p_enable);
  483. bool is_grow_enabled() const;
  484. void set_grow(float p_grow);
  485. float get_grow() const;
  486. void set_alpha_scissor_threshold(float p_threshold);
  487. float get_alpha_scissor_threshold() const;
  488. void set_on_top_of_alpha();
  489. void set_proximity_fade(bool p_enable);
  490. bool is_proximity_fade_enabled() const;
  491. void set_proximity_fade_distance(float p_distance);
  492. float get_proximity_fade_distance() const;
  493. void set_distance_fade(DistanceFadeMode p_mode);
  494. DistanceFadeMode get_distance_fade() const;
  495. void set_distance_fade_max_distance(float p_distance);
  496. float get_distance_fade_max_distance() const;
  497. void set_distance_fade_min_distance(float p_distance);
  498. float get_distance_fade_min_distance() const;
  499. void set_emission_operator(EmissionOperator p_op);
  500. EmissionOperator get_emission_operator() const;
  501. void set_metallic_texture_channel(TextureChannel p_channel);
  502. TextureChannel get_metallic_texture_channel() const;
  503. void set_roughness_texture_channel(TextureChannel p_channel);
  504. TextureChannel get_roughness_texture_channel() const;
  505. void set_ao_texture_channel(TextureChannel p_channel);
  506. TextureChannel get_ao_texture_channel() const;
  507. void set_refraction_texture_channel(TextureChannel p_channel);
  508. TextureChannel get_refraction_texture_channel() const;
  509. void set_async_mode(AsyncMode p_mode);
  510. AsyncMode get_async_mode() const;
  511. static void init_shaders();
  512. static void finish_shaders();
  513. static void flush_changes();
  514. static RID get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass, bool p_billboard = false, bool p_billboard_y = false, bool p_no_depth_test = false, bool p_fixed_size = false, bool p_sdf = false);
  515. RID get_shader_rid() const;
  516. virtual Shader::Mode get_shader_mode() const;
  517. SpatialMaterial();
  518. virtual ~SpatialMaterial();
  519. };
  520. VARIANT_ENUM_CAST(SpatialMaterial::TextureParam)
  521. VARIANT_ENUM_CAST(SpatialMaterial::DetailUV)
  522. VARIANT_ENUM_CAST(SpatialMaterial::Feature)
  523. VARIANT_ENUM_CAST(SpatialMaterial::BlendMode)
  524. VARIANT_ENUM_CAST(SpatialMaterial::DepthDrawMode)
  525. VARIANT_ENUM_CAST(SpatialMaterial::CullMode)
  526. VARIANT_ENUM_CAST(SpatialMaterial::Flags)
  527. VARIANT_ENUM_CAST(SpatialMaterial::DiffuseMode)
  528. VARIANT_ENUM_CAST(SpatialMaterial::SpecularMode)
  529. VARIANT_ENUM_CAST(SpatialMaterial::BillboardMode)
  530. VARIANT_ENUM_CAST(SpatialMaterial::TextureChannel)
  531. VARIANT_ENUM_CAST(SpatialMaterial::EmissionOperator)
  532. VARIANT_ENUM_CAST(SpatialMaterial::DistanceFadeMode)
  533. VARIANT_ENUM_CAST(SpatialMaterial::AsyncMode)
  534. //////////////////////
  535. #endif // MATERIAL_H