// 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) { } uint64 ASTOpConstantProjector::Hash() const { uint64 res = std::hash()(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(&otherUntyped); return value == other->value; } return false; } mu::Ptr ASTOpConstantProjector::Clone(MapChildFuncRef) const { Ptr 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); } } }