1 /** 2 A CubeMap is a 6-sided 3D texture. 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.cubemap; 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.resource; 25 import godot.image; 26 /** 27 A CubeMap is a 6-sided 3D texture. 28 29 A 6-sided 3D texture typically used for faking reflections. It can be used to make an object look as if it's reflecting its surroundings. This usually delivers much better performance than other reflection methods. 30 */ 31 @GodotBaseClass struct CubeMap 32 { 33 package(godot) enum string _GODOT_internal_name = "CubeMap"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; } 37 alias _GODOT_base this; 38 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 39 package(godot) __gshared bool _classBindingInitialized = false; 40 package(godot) static struct GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_flags") GodotMethod!(long) getFlags; 44 @GodotName("get_height") GodotMethod!(long) getHeight; 45 @GodotName("get_lossy_storage_quality") GodotMethod!(double) getLossyStorageQuality; 46 @GodotName("get_side") GodotMethod!(Image, long) getSide; 47 @GodotName("get_storage") GodotMethod!(CubeMap.Storage) getStorage; 48 @GodotName("get_width") GodotMethod!(long) getWidth; 49 @GodotName("set_flags") GodotMethod!(void, long) setFlags; 50 @GodotName("set_lossy_storage_quality") GodotMethod!(void, double) setLossyStorageQuality; 51 @GodotName("set_side") GodotMethod!(void, long, Image) setSide; 52 @GodotName("set_storage") GodotMethod!(void, long) setStorage; 53 } 54 /// 55 pragma(inline, true) bool opEquals(in CubeMap other) const 56 { return _godot_object.ptr is other._godot_object.ptr; } 57 /// 58 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 59 { _godot_object.ptr = n; return null; } 60 /// 61 pragma(inline, true) bool opEquals(typeof(null) n) const 62 { return _godot_object.ptr is n; } 63 /// 64 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 65 mixin baseCasts; 66 /// Construct a new instance of CubeMap. 67 /// Note: use `memnew!CubeMap` instead. 68 static CubeMap _new() 69 { 70 static godot_class_constructor constructor; 71 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CubeMap"); 72 if(constructor is null) return typeof(this).init; 73 return cast(CubeMap)(constructor()); 74 } 75 @disable new(size_t s); 76 /// 77 enum Flags : int 78 { 79 /** 80 Generate mipmaps, to enable smooth zooming out of the texture. 81 */ 82 flagMipmaps = 1, 83 /** 84 Repeat (instead of clamp to edge). 85 */ 86 flagRepeat = 2, 87 /** 88 Turn on magnifying filter, to enable smooth zooming in of the texture. 89 */ 90 flagFilter = 4, 91 /** 92 Default flags. Generate mipmaps, repeat, and filter are enabled. 93 */ 94 flagsDefault = 7, 95 } 96 /// 97 enum Side : int 98 { 99 /** 100 Identifier for the left face of the $(D CubeMap). 101 */ 102 sideLeft = 0, 103 /** 104 Identifier for the right face of the $(D CubeMap). 105 */ 106 sideRight = 1, 107 /** 108 Identifier for the bottom face of the $(D CubeMap). 109 */ 110 sideBottom = 2, 111 /** 112 Identifier for the top face of the $(D CubeMap). 113 */ 114 sideTop = 3, 115 /** 116 Identifier for the front face of the $(D CubeMap). 117 */ 118 sideFront = 4, 119 /** 120 Identifier for the back face of the $(D CubeMap). 121 */ 122 sideBack = 5, 123 } 124 /// 125 enum Storage : int 126 { 127 /** 128 Store the $(D CubeMap) without any compression. 129 */ 130 storageRaw = 0, 131 /** 132 Store the $(D CubeMap) with strong compression that reduces image quality. 133 */ 134 storageCompressLossy = 1, 135 /** 136 Store the $(D CubeMap) with moderate compression that doesn't reduce image quality. 137 */ 138 storageCompressLossless = 2, 139 } 140 /// 141 enum Constants : int 142 { 143 sideLeft = 0, 144 storageRaw = 0, 145 sideRight = 1, 146 storageCompressLossy = 1, 147 flagMipmaps = 1, 148 sideBottom = 2, 149 storageCompressLossless = 2, 150 flagRepeat = 2, 151 sideTop = 3, 152 flagFilter = 4, 153 sideFront = 4, 154 sideBack = 5, 155 flagsDefault = 7, 156 } 157 /** 158 159 */ 160 long getFlags() const 161 { 162 checkClassBinding!(typeof(this))(); 163 return ptrcall!(long)(GDNativeClassBinding.getFlags, _godot_object); 164 } 165 /** 166 Returns the $(D CubeMap)'s height. 167 */ 168 long getHeight() const 169 { 170 checkClassBinding!(typeof(this))(); 171 return ptrcall!(long)(GDNativeClassBinding.getHeight, _godot_object); 172 } 173 /** 174 175 */ 176 double getLossyStorageQuality() const 177 { 178 checkClassBinding!(typeof(this))(); 179 return ptrcall!(double)(GDNativeClassBinding.getLossyStorageQuality, _godot_object); 180 } 181 /** 182 Returns an $(D Image) for a side of the $(D CubeMap) using one of the $(D side) constants. 183 */ 184 Ref!Image getSide(in long side) const 185 { 186 checkClassBinding!(typeof(this))(); 187 return ptrcall!(Image)(GDNativeClassBinding.getSide, _godot_object, side); 188 } 189 /** 190 191 */ 192 CubeMap.Storage getStorage() const 193 { 194 checkClassBinding!(typeof(this))(); 195 return ptrcall!(CubeMap.Storage)(GDNativeClassBinding.getStorage, _godot_object); 196 } 197 /** 198 Returns the $(D CubeMap)'s width. 199 */ 200 long getWidth() const 201 { 202 checkClassBinding!(typeof(this))(); 203 return ptrcall!(long)(GDNativeClassBinding.getWidth, _godot_object); 204 } 205 /** 206 207 */ 208 void setFlags(in long flags) 209 { 210 checkClassBinding!(typeof(this))(); 211 ptrcall!(void)(GDNativeClassBinding.setFlags, _godot_object, flags); 212 } 213 /** 214 215 */ 216 void setLossyStorageQuality(in double quality) 217 { 218 checkClassBinding!(typeof(this))(); 219 ptrcall!(void)(GDNativeClassBinding.setLossyStorageQuality, _godot_object, quality); 220 } 221 /** 222 Sets an $(D Image) for a side of the $(D CubeMap) using one of the $(D side) constants. 223 */ 224 void setSide(in long side, Image image) 225 { 226 checkClassBinding!(typeof(this))(); 227 ptrcall!(void)(GDNativeClassBinding.setSide, _godot_object, side, image); 228 } 229 /** 230 231 */ 232 void setStorage(in long mode) 233 { 234 checkClassBinding!(typeof(this))(); 235 ptrcall!(void)(GDNativeClassBinding.setStorage, _godot_object, mode); 236 } 237 /** 238 The render flags for the $(D CubeMap). See the $(D flags) constants for details. 239 */ 240 @property long flags() 241 { 242 return getFlags(); 243 } 244 /// ditto 245 @property void flags(long v) 246 { 247 setFlags(v); 248 } 249 /** 250 The lossy storage quality of the $(D CubeMap) if the storage mode is set to $(D constant STORAGE_COMPRESS_LOSSY). 251 */ 252 @property double lossyStorageQuality() 253 { 254 return getLossyStorageQuality(); 255 } 256 /// ditto 257 @property void lossyStorageQuality(double v) 258 { 259 setLossyStorageQuality(v); 260 } 261 /** 262 The $(D CubeMap)'s storage mode. See $(D storage) constants. 263 */ 264 @property CubeMap.Storage storageMode() 265 { 266 return getStorage(); 267 } 268 /// ditto 269 @property void storageMode(long v) 270 { 271 setStorage(v); 272 } 273 }