// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Core/Types/Guid.h" #include "Engine/Core/Math/Rectangle.h" #include "Engine/Core/ISerializable.h" #if USE_EDITOR // Additional options used in editor for lightmaps baking extern bool IsRunningRadiancePass; extern bool IsBakingLightmaps; extern bool EnableLightmapsUsage; #endif /// /// Single lightmap info data /// struct SavedLightmapInfo { /// /// Lightmap 0 texture ID /// Guid Lightmap0; /// /// Lightmap 1 texture ID /// Guid Lightmap1; /// /// Lightmap 2 texture ID /// Guid Lightmap2; }; /// /// Describes object reference to the lightmap /// struct LightmapEntry { /// /// Index of the lightmap /// int32 TextureIndex; /// /// Lightmap UVs area that entry occupies /// Rectangle UVsArea; /// /// Init /// LightmapEntry() : TextureIndex(INVALID_INDEX) , UVsArea(Rectangle::Empty) { } }; /// /// Describes lightmap generation options /// API_STRUCT() struct LightmapSettings : ISerializable { DECLARE_SCRIPTING_TYPE_MINIMAL(LightmapSettings); /// /// Lightmap atlas sizes (in pixels). /// API_ENUM() enum class AtlasSizes { /// /// 64x64 /// _64 = 64, /// /// 128x128 /// _128 = 128, /// /// 256x256 /// _256 = 256, /// /// 512x512 /// _512 = 512, /// /// 1024x1024 /// _1024 = 1024, /// /// 2048x2048 /// _2048 = 2048, /// /// 4096x4096 /// _4096 = 4096, }; /// /// Controls how much all lights will contribute indirect lighting. /// API_FIELD(Attributes="EditorOrder(0), Limit(0, 100.0f, 0.1f)") float IndirectLightingIntensity = 1.0f; /// /// Global scale for objects in lightmap to increase quality /// API_FIELD(Attributes="EditorOrder(10), Limit(0, 100.0f, 0.1f)") float GlobalObjectsScale = 1.0f; /// /// Amount of pixels space between charts in lightmap atlas /// API_FIELD(Attributes="EditorOrder(20), Limit(0, 16, 0.1f)") int32 ChartsPadding = 3; /// /// Single lightmap atlas size (width and height in pixels) /// API_FIELD(Attributes="EditorOrder(30)") AtlasSizes AtlasSize = AtlasSizes::_1024; /// /// Amount of indirect light GI bounce passes /// API_FIELD(Attributes="EditorOrder(40), Limit(1, 16, 0.1f)") int32 BounceCount = 1; /// /// Enable/disable compressing lightmap textures (3 textures per lightmap with RGBA data in HDR) /// API_FIELD(Attributes="EditorOrder(45)") bool CompressLightmaps = true; /// /// Enable/disable rendering static light for geometry with missing or empty material slots /// API_FIELD(Attributes="EditorOrder(50)") bool UseGeometryWithNoMaterials = true; /// /// GI quality (range [0;100]) /// API_FIELD(Attributes="EditorOrder(60), Limit(0, 100, 0.1f)") int32 Quality = 10; public: // [ISerializable] void Serialize(SerializeStream& stream, const void* otherObj) override; void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override; };