// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "../Actor.h" #include "../SceneInfo.h" #include "SceneLightmapsData.h" #include "SceneCSGData.h" #include "SceneRendering.h" #include "SceneTicking.h" #include "SceneNavigation.h" class MeshCollider; /// /// The scene root object that contains a hierarchy of actors. /// API_CLASS() class FLAXENGINE_API Scene : public Actor { friend class Level; friend class ReloadScriptsAction; DECLARE_SCENE_OBJECT(Scene); /// /// Finalizes an instance of the class. /// ~Scene(); public: /// /// The scene metadata. /// SceneInfo Info; /// /// The last load time. /// DateTime LoadTime; /// /// The last save time. /// DateTime SaveTime; /// /// The scene rendering manager. /// SceneRendering Rendering; /// /// The scene ticking manager. /// SceneTicking Ticking; /// /// The navigation data. /// SceneNavigation Navigation; /// /// The static light manager for this scene. /// SceneLightmapsData LightmapsData; /// /// The CSG data container for this scene. /// CSG::SceneCSGData CSGData; /// /// Gets the lightmap settings (per scene). /// API_PROPERTY(Attributes="EditorDisplay(\"Lightmap Settings\", EditorDisplayAttribute.InlineStyle)") LightmapSettings GetLightmapSettings() const; /// /// Sets the lightmap settings (per scene). /// API_PROPERTY() void SetLightmapSettings(const LightmapSettings& value); public: /// /// Removes all baked lightmap textures from the scene. /// API_FUNCTION() void ClearLightmaps(); /// /// Builds the CSG geometry for the given scene. /// /// Requests are enqueued till the next game scripts update. /// The timeout to wait before building CSG (in milliseconds). API_FUNCTION() void BuildCSG(float timeoutMs = 50); #if USE_EDITOR /// /// Gets path to the scene file /// API_PROPERTY() String GetPath() const; /// /// Gets filename of the scene file /// API_PROPERTY() String GetFilename() const; /// /// Gets path to the scene data folder /// API_PROPERTY() String GetDataFolderPath() const; /// /// Gets the asset references (scene asset). Supported only in Editor. /// /// /// The collection of the asset ids referenced by this asset. API_FUNCTION() Array GetAssetReferences() const; #endif private: MeshCollider* TryGetCsgCollider(); StaticModel* TryGetCsgModel(); void CreateCsgCollider(); void CreateCsgModel(); void OnCsgCollisionDataChanged(); void OnCsgModelChanged(); #if COMPILE_WITH_CSG_BUILDER void OnCSGBuildEnd(); #endif public: // [Actor] void Serialize(SerializeStream& stream, const void* otherObj) override; void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override; void OnDeleteObject() override; void EndPlay() override; protected: // [Actor] void Initialize() override; void BeginPlay(SceneBeginData* data) override; void OnTransformChanged() override; };