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