material.h 18 KB

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