| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- // Description : CryMovie animation node for shadow settings
- #include <AzCore/Serialization/SerializeContext.h>
- #include "ShadowsSetupNode.h"
- #include "Maestro/Types/AnimNodeType.h"
- #include "Maestro/Types/AnimValueType.h"
- #include "Maestro/Types/AnimParamType.h"
- //////////////////////////////////////////////////////////////////////////
- namespace ShadowSetupNode
- {
- bool s_shadowSetupParamsInit = false;
- AZStd::vector<CAnimNode::SParamInfo> s_shadowSetupParams;
- void AddSupportedParam(const char* sName, AnimParamType paramId, AnimValueType valueType)
- {
- CAnimNode::SParamInfo param;
- param.name = sName;
- param.paramType = paramId;
- param.valueType = valueType;
- s_shadowSetupParams.push_back(param);
- }
- };
- //-----------------------------------------------------------------------------
- CShadowsSetupNode::CShadowsSetupNode()
- : CShadowsSetupNode(0)
- {
- }
- //-----------------------------------------------------------------------------
- CShadowsSetupNode::CShadowsSetupNode(const int id)
- : CAnimNode(id, AnimNodeType::ShadowSetup)
- {
- CShadowsSetupNode::Initialize();
- }
- //-----------------------------------------------------------------------------
- void CShadowsSetupNode::Initialize()
- {
- if (!ShadowSetupNode::s_shadowSetupParamsInit)
- {
- ShadowSetupNode::s_shadowSetupParamsInit = true;
- ShadowSetupNode::s_shadowSetupParams.reserve(1);
- ShadowSetupNode::AddSupportedParam("GSMCache", AnimParamType::GSMCache, AnimValueType::Bool);
- }
- }
- //-----------------------------------------------------------------------------
- void CShadowsSetupNode::Animate(SAnimContext& ac)
- {
- IAnimTrack* pGsmCache = GetTrackForParameter(AnimParamType::GSMCache);
- if (pGsmCache && (pGsmCache->GetFlags() & IAnimTrack::eAnimTrackFlags_Disabled) == 0)
- {
- bool val(false);
- pGsmCache->GetValue(ac.time, val);
- }
- }
- //-----------------------------------------------------------------------------
- void CShadowsSetupNode::CreateDefaultTracks()
- {
- CreateTrack(AnimParamType::GSMCache);
- }
- //-----------------------------------------------------------------------------
- void CShadowsSetupNode::OnReset()
- {
- }
- //-----------------------------------------------------------------------------
- unsigned int CShadowsSetupNode::GetParamCount() const
- {
- return static_cast<int>(ShadowSetupNode::s_shadowSetupParams.size());
- }
- //-----------------------------------------------------------------------------
- CAnimParamType CShadowsSetupNode::GetParamType(unsigned int nIndex) const
- {
- if (nIndex < ShadowSetupNode::s_shadowSetupParams.size())
- {
- return ShadowSetupNode::s_shadowSetupParams[nIndex].paramType;
- }
- return AnimParamType::Invalid;
- }
- //-----------------------------------------------------------------------------
- bool CShadowsSetupNode::GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const
- {
- for (size_t i = 0; i < ShadowSetupNode::s_shadowSetupParams.size(); ++i)
- {
- if (ShadowSetupNode::s_shadowSetupParams[i].paramType == paramId)
- {
- info = ShadowSetupNode::s_shadowSetupParams[i];
- return true;
- }
- }
- return false;
- }
- //////////////////////////////////////////////////////////////////////////
- void CShadowsSetupNode::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
- {
- serializeContext->Class<CShadowsSetupNode, CAnimNode>()
- ->Version(1);
- }
- }
|