You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h

66 lines
2.4 KiB
C++

/*
* 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
*
*/
#ifndef CRYINCLUDE_CRYMOVIE_MATERIALNODE_H
#define CRYINCLUDE_CRYMOVIE_MATERIALNODE_H
#pragma once
#include "AnimNode.h"
class CAnimMaterialNode
: public CAnimNode
{
public:
AZ_CLASS_ALLOCATOR(CAnimMaterialNode, AZ::SystemAllocator, 0);
AZ_RTTI(CAnimMaterialNode, "{15B1E5EA-BB12-445E-B937-34CD559347ED}", CAnimNode);
CAnimMaterialNode();
CAnimMaterialNode(const int id);
static void Initialize();
virtual void SetName(const char* name);
//////////////////////////////////////////////////////////////////////////
// Overrides from CAnimNode
//////////////////////////////////////////////////////////////////////////
void Animate(SAnimContext& ec);
void AddTrack(IAnimTrack* track) override;
//////////////////////////////////////////////////////////////////////////
// Supported tracks description.
//////////////////////////////////////////////////////////////////////////
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
AZStd::string GetParamName(const CAnimParamType& paramType) const override;
virtual void GetKeyValueRange(float& fMin, float& fMax) const { fMin = m_fMinKeyValue; fMax = m_fMaxKeyValue; };
virtual void SetKeyValueRange(float fMin, float fMax){ m_fMinKeyValue = fMin; m_fMaxKeyValue = fMax; };
virtual void InitializeTrack(IAnimTrack* pTrack, const CAnimParamType& paramType);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
void UpdateDynamicParamsInternal() override;
private:
void AnimateNamedParameter(SAnimContext& ec, IRenderShaderResources* pShaderResources, const char* name, IAnimTrack* pTrack);
_smart_ptr<IMaterial> GetMaterialByName(const char* pName);
float m_fMinKeyValue;
float m_fMaxKeyValue;
std::vector< CAnimNode::SParamInfo > m_dynamicShaderParamInfos;
typedef AZStd::unordered_map<AZStd::string, size_t, stl::hash_string_caseless<AZStd::string>, stl::equality_string_caseless<AZStd::string> > TDynamicShaderParamsMap;
TDynamicShaderParamsMap m_nameToDynamicShaderParam;
};
#endif // CRYINCLUDE_CRYMOVIE_MATERIALNODE_H