1 /** 2 Performs a texture lookup within the visual shader graph. 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.visualshadernodetexture; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.visualshadernode; 25 import godot.resource; 26 import godot.reference; 27 import godot.texture; 28 /** 29 Performs a texture lookup within the visual shader graph. 30 31 Performs a lookup operation on the provided texture, with support for multiple texture sources to choose from. 32 */ 33 @GodotBaseClass struct VisualShaderNodeTexture 34 { 35 package(godot) enum string _GODOT_internal_name = "VisualShaderNodeTexture"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ VisualShaderNode _GODOT_base; } 39 alias _GODOT_base this; 40 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 41 package(godot) __gshared bool _classBindingInitialized = false; 42 package(godot) static struct GDNativeClassBinding 43 { 44 __gshared: 45 @GodotName("get_source") GodotMethod!(VisualShaderNodeTexture.Source) getSource; 46 @GodotName("get_texture") GodotMethod!(Texture) getTexture; 47 @GodotName("get_texture_type") GodotMethod!(VisualShaderNodeTexture.TextureType) getTextureType; 48 @GodotName("set_source") GodotMethod!(void, long) setSource; 49 @GodotName("set_texture") GodotMethod!(void, Texture) setTexture; 50 @GodotName("set_texture_type") GodotMethod!(void, long) setTextureType; 51 } 52 /// 53 pragma(inline, true) bool opEquals(in VisualShaderNodeTexture other) const 54 { return _godot_object.ptr is other._godot_object.ptr; } 55 /// 56 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 57 { _godot_object.ptr = n; return null; } 58 /// 59 pragma(inline, true) bool opEquals(typeof(null) n) const 60 { return _godot_object.ptr is n; } 61 /// 62 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 63 mixin baseCasts; 64 /// Construct a new instance of VisualShaderNodeTexture. 65 /// Note: use `memnew!VisualShaderNodeTexture` instead. 66 static VisualShaderNodeTexture _new() 67 { 68 static godot_class_constructor constructor; 69 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualShaderNodeTexture"); 70 if(constructor is null) return typeof(this).init; 71 return cast(VisualShaderNodeTexture)(constructor()); 72 } 73 @disable new(size_t s); 74 /// 75 enum TextureType : int 76 { 77 /** 78 No hints are added to the uniform declaration. 79 */ 80 typeData = 0, 81 /** 82 Adds `hint_albedo` as hint to the uniform declaration for proper sRGB to linear conversion. 83 */ 84 typeColor = 1, 85 /** 86 Adds `hint_normal` as hint to the uniform declaration, which internally converts the texture for proper usage as normal map. 87 */ 88 typeNormalmap = 2, 89 } 90 /// 91 enum Source : int 92 { 93 /** 94 Use the texture given as an argument for this function. 95 */ 96 sourceTexture = 0, 97 /** 98 Use the current viewport's texture as the source. 99 */ 100 sourceScreen = 1, 101 /** 102 Use the texture from this shader's texture built-in (e.g. a texture of a $(D Sprite)). 103 */ 104 source2dTexture = 2, 105 /** 106 Use the texture from this shader's normal map built-in. 107 */ 108 source2dNormal = 3, 109 /** 110 Use the depth texture available for this shader. 111 */ 112 sourceDepth = 4, 113 /** 114 Use the texture provided in the input port for this function. 115 */ 116 sourcePort = 5, 117 } 118 /// 119 enum Constants : int 120 { 121 sourceTexture = 0, 122 typeData = 0, 123 typeColor = 1, 124 sourceScreen = 1, 125 typeNormalmap = 2, 126 source2dTexture = 2, 127 source2dNormal = 3, 128 sourceDepth = 4, 129 sourcePort = 5, 130 } 131 /** 132 133 */ 134 VisualShaderNodeTexture.Source getSource() const 135 { 136 checkClassBinding!(typeof(this))(); 137 return ptrcall!(VisualShaderNodeTexture.Source)(GDNativeClassBinding.getSource, _godot_object); 138 } 139 /** 140 141 */ 142 Ref!Texture getTexture() const 143 { 144 checkClassBinding!(typeof(this))(); 145 return ptrcall!(Texture)(GDNativeClassBinding.getTexture, _godot_object); 146 } 147 /** 148 149 */ 150 VisualShaderNodeTexture.TextureType getTextureType() const 151 { 152 checkClassBinding!(typeof(this))(); 153 return ptrcall!(VisualShaderNodeTexture.TextureType)(GDNativeClassBinding.getTextureType, _godot_object); 154 } 155 /** 156 157 */ 158 void setSource(in long value) 159 { 160 checkClassBinding!(typeof(this))(); 161 ptrcall!(void)(GDNativeClassBinding.setSource, _godot_object, value); 162 } 163 /** 164 165 */ 166 void setTexture(Texture value) 167 { 168 checkClassBinding!(typeof(this))(); 169 ptrcall!(void)(GDNativeClassBinding.setTexture, _godot_object, value); 170 } 171 /** 172 173 */ 174 void setTextureType(in long value) 175 { 176 checkClassBinding!(typeof(this))(); 177 ptrcall!(void)(GDNativeClassBinding.setTextureType, _godot_object, value); 178 } 179 /** 180 Determines the source for the lookup. See $(D source) for options. 181 */ 182 @property VisualShaderNodeTexture.Source source() 183 { 184 return getSource(); 185 } 186 /// ditto 187 @property void source(long v) 188 { 189 setSource(v); 190 } 191 /** 192 The source texture, if needed for the selected $(D source). 193 */ 194 @property Texture texture() 195 { 196 return getTexture(); 197 } 198 /// ditto 199 @property void texture(Texture v) 200 { 201 setTexture(v); 202 } 203 /** 204 Specifies the type of the texture if $(D source) is set to $(D constant SOURCE_TEXTURE). See $(D texturetype) for options. 205 */ 206 @property VisualShaderNodeTexture.TextureType textureType() 207 { 208 return getTextureType(); 209 } 210 /// ditto 211 @property void textureType(long v) 212 { 213 setTextureType(v); 214 } 215 }