| 1 | /**************************************************************************/ |
| 2 | /* sky.h */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 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 | |
| 31 | #ifndef SKY_H |
| 32 | #define SKY_H |
| 33 | |
| 34 | #include "core/os/thread.h" |
| 35 | #include "scene/resources/material.h" |
| 36 | #include "scene/resources/texture.h" |
| 37 | |
| 38 | class Sky : public Resource { |
| 39 | GDCLASS(Sky, Resource); |
| 40 | |
| 41 | public: |
| 42 | enum RadianceSize { |
| 43 | RADIANCE_SIZE_32, |
| 44 | RADIANCE_SIZE_64, |
| 45 | RADIANCE_SIZE_128, |
| 46 | RADIANCE_SIZE_256, |
| 47 | RADIANCE_SIZE_512, |
| 48 | RADIANCE_SIZE_1024, |
| 49 | RADIANCE_SIZE_2048, |
| 50 | RADIANCE_SIZE_MAX |
| 51 | }; |
| 52 | |
| 53 | enum ProcessMode { |
| 54 | PROCESS_MODE_AUTOMATIC, |
| 55 | PROCESS_MODE_QUALITY, |
| 56 | PROCESS_MODE_INCREMENTAL, |
| 57 | PROCESS_MODE_REALTIME |
| 58 | }; |
| 59 | |
| 60 | private: |
| 61 | RID sky; |
| 62 | ProcessMode mode = PROCESS_MODE_AUTOMATIC; |
| 63 | RadianceSize radiance_size = RADIANCE_SIZE_256; |
| 64 | Ref<Material> sky_material; |
| 65 | |
| 66 | protected: |
| 67 | static void _bind_methods(); |
| 68 | |
| 69 | public: |
| 70 | void set_radiance_size(RadianceSize p_size); |
| 71 | RadianceSize get_radiance_size() const; |
| 72 | |
| 73 | void set_process_mode(ProcessMode p_mode); |
| 74 | ProcessMode get_process_mode() const; |
| 75 | |
| 76 | void set_material(const Ref<Material> &p_material); |
| 77 | Ref<Material> get_material() const; |
| 78 | |
| 79 | virtual RID get_rid() const override; |
| 80 | |
| 81 | Sky(); |
| 82 | ~Sky(); |
| 83 | }; |
| 84 | |
| 85 | VARIANT_ENUM_CAST(Sky::RadianceSize) |
| 86 | VARIANT_ENUM_CAST(Sky::ProcessMode) |
| 87 | |
| 88 | #endif // SKY_H |
| 89 | |