Files
alexei lebedev 2815323fbc [mutable] Moved the Mutable plugin out of Experimental status into Beta.
#jira UE-223488
#rb jordi.rovira
#tests Editor
#rnx

#virtualized

[CL 36035608 by alexei lebedev in ue5-main branch]
2024-09-05 07:16:19 -04:00

66 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MuT/ASTOpConstantProjector.h"
#include "HAL/PlatformMath.h"
#include "MuR/ModelPrivate.h"
#include "MuR/RefCounted.h"
namespace mu
{
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void ASTOpConstantProjector::ForEachChild(const TFunctionRef<void(ASTChild&)>)
{
}
uint64 ASTOpConstantProjector::Hash() const
{
uint64 res = std::hash<float>()(value.position[0]);
hash_combine(res, value.direction[0]);
return res;
}
bool ASTOpConstantProjector::IsEqual(const ASTOp& otherUntyped) const
{
if (otherUntyped.GetOpType() == GetOpType())
{
const ASTOpConstantProjector* other = static_cast<const ASTOpConstantProjector*>(&otherUntyped);
return value == other->value;
}
return false;
}
mu::Ptr<ASTOp> ASTOpConstantProjector::Clone(MapChildFuncRef) const
{
Ptr<ASTOpConstantProjector> n = new ASTOpConstantProjector();
n->value = value;
return n;
}
void ASTOpConstantProjector::Link(FProgram& program, FLinkerOptions*)
{
if (!linkedAddress)
{
OP::ResourceConstantArgs args;
memset(&args, 0, sizeof(args));
args.value = program.AddConstant(value);
linkedAddress = (OP::ADDRESS)program.m_opAddress.Num();
//program.m_code.push_back(op);
program.m_opAddress.Add((uint32_t)program.m_byteCode.Num());
AppendCode(program.m_byteCode, OP_TYPE::PR_CONSTANT);
AppendCode(program.m_byteCode, args);
}
}
}