// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Level/SceneInfo.h"
class Scene;
class Lightmap;
///
/// Shadows Of Mordor static lighting data container (used per scene).
///
class SceneLightmapsData
{
private:
Array _lightmaps;
Scene* _scene;
public:
///
/// Initializes a new instance of the class.
///
/// The parent scene.
SceneLightmapsData(Scene* scene);
///
/// Finalizes an instance of the class.
///
~SceneLightmapsData();
public:
FORCE_INLINE Scene* GetScene() const
{
return _scene;
}
///
/// Gets lightmap at index
///
/// Lightmap index
/// Lightmap or null if missing
FORCE_INLINE Lightmap* GetLightmap(int32 index)
{
return index >= 0 && index < _lightmaps.Count() ? _lightmaps[index] : nullptr;
}
///
/// Gets loaded lightmap at index
///
/// Lightmap index
/// Lightmap or null if missing or not ready
FLAXENGINE_API Lightmap* GetReadyLightmap(int32 index);
///
/// Gets lightmaps array
///
/// Lightmaps
FORCE_INLINE const Array* GetLightmaps() const
{
return &_lightmaps;
}
public:
#if USE_EDITOR
///
/// Gets path to the lightmaps cache folder
///
/// Result path
void GetCacheFolder(String* result);
///
/// Gets name for lightmap texture asset
///
/// Result path
/// Lightmap index
/// Lightmap texture index
void GetCachedLightmapPath(String* result, int32 lightmapIndex, int32 textureIndex);
#endif
public:
///
/// Clear baked lightmaps data
///
void ClearLightmaps();
///
/// Loads the lightmaps data.
///
/// The serialized lightmaps info.
void LoadLightmaps(Array& lightmaps);
///
/// Unloads the lightmaps.
///
void UnloadLightmaps();
///
/// Saves the lightmaps data.
///
/// The serialized lightmaps info.
void SaveLightmaps(Array& lightmaps);
///
/// Updates the lightmaps collection (capacity and lightmap textures size).
///
/// The lightmaps count.
/// The textures size.
void UpdateLightmapsCollection(int32 count, int32 size);
};