You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This arranges all emitters in an SDetailView with some customization. Primary benefit of this is that hooking things into the UI will require almost no work and elements can still be customized for a good UX. Previous UI is still available and should work exactly as before. Quite a bit of refactoring was needed to acheive this but much of it was needed for other things anyway and/or has some nice additonal benefits. E.g. - All constant types are supported easily. - You can now create a default data object in the graph which will propagate through to the effect editor. - Adding new data object types will be very easy. Also added a delete and duplicate button for emitters in both UIs. #codereview olaf.piesche [CL 2590057 by Simon Tovey in Main branch]
75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
#include "VectorVMDataObject.generated.h"
|
|
|
|
|
|
/* Vector VM data object; encapsulates buffers, curves and other data in its derivatives
|
|
* for access by VectorVM kernels;
|
|
*/
|
|
UCLASS(EditInlineNew, MinimalAPI)
|
|
class UNiagaraDataObject : public UObject
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
public:
|
|
virtual FVector4 Sample(const FVector4& InCoords) const { return FVector4(0.0f, 0.0f, 0.0f, 0.0f); }
|
|
virtual FVector4 Write(const FVector4& InCoords, const FVector4& InValue) { return FVector4(0.0f, 0.0f, 0.0f, 0.0f); }
|
|
};
|
|
|
|
/* Curve object; encapsulates a curve for the VectorVM
|
|
*/
|
|
UCLASS(EditInlineNew, MinimalAPI)
|
|
class UNiagaraCurveDataObject : public UNiagaraDataObject
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
|
|
UPROPERTY(EditAnywhere, Category="Curve")
|
|
class UCurveVector *CurveObj;
|
|
|
|
FVector4 Sample(const FVector4& InCoords) const;
|
|
virtual FVector4 Write(const FVector4& InCoords, const FVector4& InValue) override
|
|
{
|
|
return FVector4(1.0f, 0.0f, 0.0f, 1.0f);
|
|
}
|
|
|
|
UCurveVector *GetCurveObject() { return CurveObj; }
|
|
void SetCurveObject(UCurveVector *InCurve) { CurveObj = InCurve; }
|
|
};
|
|
|
|
|
|
/* Volume data object; encapsulates volumetric data for VectorVM
|
|
*/
|
|
UCLASS(EditInlineNew, MinimalAPI, Transient)
|
|
class UNiagaraSparseVolumeDataObject : public UNiagaraDataObject
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
private:
|
|
TArray<FVector4> Data;
|
|
uint64 NumBuckets;
|
|
int32 Size;
|
|
public:
|
|
uint32 MakeHash(const FVector4& InCoords) const
|
|
{
|
|
FVector4 Coords = InCoords;
|
|
const int64 P1 = 73856093; // some large primes
|
|
const int64 P2 = 19349663;
|
|
const int64 P3 = 83492791;
|
|
Coords *= 0.1f;
|
|
uint64 N = (P1*static_cast<int64>(Coords.X)) ^ (P2*static_cast<int64>(Coords.Y)) ^ (P3*static_cast<int64>(Coords.Z));
|
|
N %= NumBuckets;
|
|
return FMath::Clamp(N, 0ULL, NumBuckets);
|
|
}
|
|
|
|
virtual FVector4 Sample(const FVector4& InCoords) const override
|
|
{
|
|
int32 Index = MakeHash(InCoords);
|
|
Index = FMath::Clamp(Index, 0, Data.Num() - 1);
|
|
return Data[Index];
|
|
}
|
|
|
|
virtual FVector4 Write(const FVector4& InCoords, const FVector4& InValue) override
|
|
{
|
|
Data[MakeHash(InCoords)] = InValue;
|
|
return InValue;
|
|
}
|
|
}; |