Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ObjectManager.h
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 20 Lines | |||||
class CActorDef; | class CActorDef; | ||||
class CConfigDBHook; | class CConfigDBHook; | ||||
class CMeshManager; | class CMeshManager; | ||||
class CObjectBase; | class CObjectBase; | ||||
class CObjectEntry; | class CObjectEntry; | ||||
class CSkeletonAnimManager; | class CSkeletonAnimManager; | ||||
class CSimulation2; | class CSimulation2; | ||||
class CTerrain; | class CTerrain; | ||||
class CWater; | |||||
class CWorld; | |||||
/////////////////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////////////////// | ||||
// CObjectManager: manager class for all possible actor types | // CObjectManager: manager class for all possible actor types | ||||
class CObjectManager | class CObjectManager | ||||
{ | { | ||||
NONCOPYABLE(CObjectManager); | NONCOPYABLE(CObjectManager); | ||||
public: | public: | ||||
// Unique identifier of an actor variation | // Unique identifier of an actor variation | ||||
Show All 17 Lines | enum class VariantDiversity | ||||
NONE, | NONE, | ||||
LIMITED, | LIMITED, | ||||
FULL | FULL | ||||
}; | }; | ||||
public: | public: | ||||
// constructor, destructor | // constructor, destructor | ||||
CObjectManager(CMeshManager& meshManager, CSkeletonAnimManager& skeletonAnimManager, CSimulation2& simulation); | CObjectManager(CMeshManager& meshManager, CSkeletonAnimManager& skeletonAnimManager, CWorld& world, CSimulation2& simulation); | ||||
~CObjectManager(); | ~CObjectManager(); | ||||
// Provide access to the manager classes for meshes and animations - they're | // Provide access to the manager classes for meshes and animations - they're | ||||
// needed when objects are being created and so this seems like a convenient | // needed when objects are being created and so this seems like a convenient | ||||
// place to centralise access. | // place to centralise access. | ||||
CMeshManager& GetMeshManager() const { return m_MeshManager; } | CMeshManager& GetMeshManager() const { return m_MeshManager; } | ||||
CSkeletonAnimManager& GetSkeletonAnimManager() const { return m_SkeletonAnimManager; } | CSkeletonAnimManager& GetSkeletonAnimManager() const { return m_SkeletonAnimManager; } | ||||
Show All 22 Lines | public: | ||||
CObjectEntry* FindObjectVariation(const CStrW& objname, const std::vector<const std::set<CStr>*>& completeSelections); | CObjectEntry* FindObjectVariation(const CStrW& objname, const std::vector<const std::set<CStr>*>& completeSelections); | ||||
/** | /** | ||||
* Get the terrain object that actors managed by this manager should be linked | * Get the terrain object that actors managed by this manager should be linked | ||||
* with (primarily for the purpose of decals) | * with (primarily for the purpose of decals) | ||||
*/ | */ | ||||
CTerrain* GetTerrain(); | CTerrain* GetTerrain(); | ||||
/** | |||||
* Get the water object that actors managed by this manager should be linked | |||||
* with (primarily for the purpose of decals & floating units) | |||||
*/ | |||||
CWater* GetWater(); | |||||
VariantDiversity GetVariantDiversity() const; | VariantDiversity GetVariantDiversity() const; | ||||
/** | /** | ||||
* Reload any scripts that were loaded from the given filename. | * Reload any scripts that were loaded from the given filename. | ||||
* (This is used to implement hotloading.) | * (This is used to implement hotloading.) | ||||
*/ | */ | ||||
Status ReloadChangedFile(const VfsPath& path); | Status ReloadChangedFile(const VfsPath& path); | ||||
/** | /** | ||||
* Reload actors that have a quality setting. Used when changing the actor quality. | * Reload actors that have a quality setting. Used when changing the actor quality. | ||||
*/ | */ | ||||
void ActorQualityChanged(); | void ActorQualityChanged(); | ||||
/** | /** | ||||
* Reload actors. Used when changing the variant diversity. | * Reload actors. Used when changing the variant diversity. | ||||
*/ | */ | ||||
void VariantDiversityChanged(); | void VariantDiversityChanged(); | ||||
CMeshManager& m_MeshManager; | CMeshManager& m_MeshManager; | ||||
CSkeletonAnimManager& m_SkeletonAnimManager; | CSkeletonAnimManager& m_SkeletonAnimManager; | ||||
CSimulation2& m_Simulation; | CSimulation2& m_Simulation; | ||||
CWorld& m_World; | |||||
u8 m_QualityLevel = 100; | u8 m_QualityLevel = 100; | ||||
std::unique_ptr<CConfigDBHook> m_QualityHook; | std::unique_ptr<CConfigDBHook> m_QualityHook; | ||||
VariantDiversity m_VariantDiversity = VariantDiversity::FULL; | VariantDiversity m_VariantDiversity = VariantDiversity::FULL; | ||||
std::unique_ptr<CConfigDBHook> m_VariantDiversityHook; | std::unique_ptr<CConfigDBHook> m_VariantDiversityHook; | ||||
template<typename T> | template<typename T> | ||||
Show All 13 Lines |
Wildfire Games · Phabricator