1 /** 2 Abstract base $(D Resource) for coloring and shading geometry. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.material; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.resource; 23 import godot.reference; 24 /** 25 Abstract base $(D Resource) for coloring and shading geometry. 26 27 Material is a base $(D Resource) used for coloring and shading geometry. All materials inherit from it and almost all $(D VisualInstance) derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here. 28 */ 29 @GodotBaseClass struct Material 30 { 31 enum string _GODOT_internal_name = "Material"; 32 public: 33 @nogc nothrow: 34 union { godot_object _godot_object; Resource _GODOT_base; } 35 alias _GODOT_base this; 36 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 37 package(godot) __gshared bool _classBindingInitialized = false; 38 package(godot) static struct _classBinding 39 { 40 __gshared: 41 @GodotName("set_next_pass") GodotMethod!(void, Material) setNextPass; 42 @GodotName("get_next_pass") GodotMethod!(Material) getNextPass; 43 @GodotName("set_render_priority") GodotMethod!(void, long) setRenderPriority; 44 @GodotName("get_render_priority") GodotMethod!(long) getRenderPriority; 45 } 46 bool opEquals(in Material other) const { return _godot_object.ptr is other._godot_object.ptr; } 47 Material opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 48 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 49 mixin baseCasts; 50 static Material _new() 51 { 52 static godot_class_constructor constructor; 53 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Material"); 54 if(constructor is null) return typeof(this).init; 55 return cast(Material)(constructor()); 56 } 57 @disable new(size_t s); 58 /// 59 enum Constants : int 60 { 61 /** 62 63 */ 64 renderPriorityMin = -128, 65 /** 66 67 */ 68 renderPriorityMax = 127, 69 } 70 /** 71 72 */ 73 void setNextPass(Material next_pass) 74 { 75 checkClassBinding!(typeof(this))(); 76 ptrcall!(void)(_classBinding.setNextPass, _godot_object, next_pass); 77 } 78 /** 79 80 */ 81 Ref!Material getNextPass() const 82 { 83 checkClassBinding!(typeof(this))(); 84 return ptrcall!(Material)(_classBinding.getNextPass, _godot_object); 85 } 86 /** 87 88 */ 89 void setRenderPriority(in long priority) 90 { 91 checkClassBinding!(typeof(this))(); 92 ptrcall!(void)(_classBinding.setRenderPriority, _godot_object, priority); 93 } 94 /** 95 96 */ 97 long getRenderPriority() const 98 { 99 checkClassBinding!(typeof(this))(); 100 return ptrcall!(long)(_classBinding.getRenderPriority, _godot_object); 101 } 102 /** 103 104 */ 105 @property long renderPriority() 106 { 107 return getRenderPriority(); 108 } 109 /// ditto 110 @property void renderPriority(long v) 111 { 112 setRenderPriority(v); 113 } 114 /** 115 116 */ 117 @property Material nextPass() 118 { 119 return getNextPass(); 120 } 121 /// ditto 122 @property void nextPass(Material v) 123 { 124 setNextPass(v); 125 } 126 }