dCinema improvements

* Visiblity and effect records
* Recorder will catch effects from behaviors
* Documentation for setting up a scene to play automatically.
* Documentation for server-side preconditions.
This commit is contained in:
wincent
2023-10-29 17:37:26 +01:00
parent e4320d3e63
commit cdc9dda3c4
14 changed files with 418 additions and 25 deletions

View File

@@ -15,11 +15,21 @@
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
std::unordered_map<int32_t, std::vector<int32_t>> RenderComponent::m_AnimationGroupCache{};
RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component(parent) {
m_Effects = std::vector<Effect*>();
m_LastAnimationName = "";
if (componentId == -1) return;
const auto& it = m_AnimationGroupCache.find(componentId);
if (it != m_AnimationGroupCache.end()) {
m_animationGroupIds = it->second;
return;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM RenderComponent WHERE id = ?;");
query.bind(1, componentId);
auto result = query.execQuery();
@@ -41,6 +51,8 @@ RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component
}
}
result.finalize();
m_AnimationGroupCache[componentId] = m_animationGroupIds;
}
RenderComponent::~RenderComponent() {

View File

@@ -147,6 +147,11 @@ private:
* Cache of queries that look for the length of each effect, indexed by effect ID
*/
static std::unordered_map<int32_t, float> m_DurationCache;
/**
* Cache for animation groups, indexed by the component ID
*/
static std::unordered_map<int32_t, std::vector<int32_t>> m_AnimationGroupCache;
};
#endif // RENDERCOMPONENT_H