You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Set unique row IDs to table rows to generate deterministic SourceIDs. Bump current supported version. #jira UE-224812 #rnx #rb genis.sole, jordi.rovira [CL 36750126 by pere rifa in 5.5 branch]
105 lines
2.5 KiB
C++
105 lines
2.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "MuT/ASTOpMeshGeometryOperation.h"
|
|
|
|
#include "HAL/PlatformMath.h"
|
|
#include "MuR/ModelPrivate.h"
|
|
#include "MuR/RefCounted.h"
|
|
|
|
|
|
namespace mu
|
|
{
|
|
|
|
ASTOpMeshGeometryOperation::ASTOpMeshGeometryOperation()
|
|
: meshA(this)
|
|
, meshB(this)
|
|
, scalarA(this)
|
|
, scalarB(this)
|
|
{
|
|
}
|
|
|
|
|
|
ASTOpMeshGeometryOperation::~ASTOpMeshGeometryOperation()
|
|
{
|
|
// Explicit call needed to avoid recursive destruction
|
|
ASTOp::RemoveChildren();
|
|
}
|
|
|
|
|
|
bool ASTOpMeshGeometryOperation::IsEqual(const ASTOp& otherUntyped) const
|
|
{
|
|
if (otherUntyped.GetOpType() == GetOpType())
|
|
{
|
|
const ASTOpMeshGeometryOperation* other = static_cast<const ASTOpMeshGeometryOperation*>(&otherUntyped);
|
|
return meshA == other->meshA && meshB == other->meshB &&
|
|
scalarA == other->scalarA && scalarB == other->scalarB;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
uint64 ASTOpMeshGeometryOperation::Hash() const
|
|
{
|
|
uint64 res = std::hash<void*>()(meshA.child().get());
|
|
hash_combine(res, meshB.child().get());
|
|
hash_combine(res, scalarA.child().get());
|
|
hash_combine(res, scalarB.child().get());
|
|
return res;
|
|
}
|
|
|
|
|
|
mu::Ptr<ASTOp> ASTOpMeshGeometryOperation::Clone(MapChildFuncRef mapChild) const
|
|
{
|
|
Ptr<ASTOpMeshGeometryOperation> n = new ASTOpMeshGeometryOperation();
|
|
n->meshA = mapChild(meshA.child());
|
|
n->meshB = mapChild(meshB.child());
|
|
n->scalarA = mapChild(scalarA.child());
|
|
n->scalarB = mapChild(scalarB.child());
|
|
return n;
|
|
}
|
|
|
|
|
|
void ASTOpMeshGeometryOperation::ForEachChild(const TFunctionRef<void(ASTChild&)> f)
|
|
{
|
|
f(meshA);
|
|
f(meshB);
|
|
f(scalarA);
|
|
f(scalarB);
|
|
}
|
|
|
|
|
|
void ASTOpMeshGeometryOperation::Link(FProgram& program, FLinkerOptions*)
|
|
{
|
|
// Already linked?
|
|
if (!linkedAddress)
|
|
{
|
|
OP::MeshGeometryOperationArgs args;
|
|
memset(&args, 0, sizeof(args));
|
|
|
|
if (meshA) args.meshA = meshA->linkedAddress;
|
|
if (meshB) args.meshB = meshB->linkedAddress;
|
|
if (scalarA) args.scalarA = scalarA->linkedAddress;
|
|
if (scalarB) args.scalarB = scalarB->linkedAddress;
|
|
|
|
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::ME_GEOMETRYOPERATION);
|
|
AppendCode(program.m_byteCode, args);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
FSourceDataDescriptor ASTOpMeshGeometryOperation::GetSourceDataDescriptor(FGetSourceDataDescriptorContext* Context) const
|
|
{
|
|
if (meshA)
|
|
{
|
|
return meshA->GetSourceDataDescriptor(Context);
|
|
}
|
|
|
|
return {};
|
|
}
|
|
|
|
}
|