Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ufdvw
ImmersiveAnalytics
Commits
fc35916f
Commit
fc35916f
authored
Apr 22, 2019
by
Jan Kremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed scaling origin. Working on transparency...
parent
75b05553
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
169 additions
and
6 deletions
+169
-6
Config/DefaultInput.ini
Config/DefaultInput.ini
+2
-0
Content/Test.umap
Content/Test.umap
+0
-0
Content/Test_BuiltData.uasset
Content/Test_BuiltData.uasset
+0
-0
Intermediate/Config/CoalescedSourceConfigs/Input.ini
Intermediate/Config/CoalescedSourceConfigs/Input.ini
+2
-0
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloud.cpp
...oudPlugin/Source/PointCloudRuntime/Private/PointCloud.cpp
+54
-1
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloudComponent.cpp
.../Source/PointCloudRuntime/Private/PointCloudComponent.cpp
+4
-0
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloudHelper.cpp
...gin/Source/PointCloudRuntime/Private/PointCloudHelper.cpp
+2
-1
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloudRendering.cpp
.../Source/PointCloudRuntime/Private/PointCloudRendering.cpp
+92
-1
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Public/PointCloud.h
...tCloudPlugin/Source/PointCloudRuntime/Public/PointCloud.h
+6
-1
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Public/PointCloudHelper.h
...Plugin/Source/PointCloudRuntime/Public/PointCloudHelper.h
+1
-0
Source/ImmersiveAnalytics/Plot3D.cpp
Source/ImmersiveAnalytics/Plot3D.cpp
+5
-2
Source/ImmersiveAnalytics/Plot3D.h
Source/ImmersiveAnalytics/Plot3D.h
+1
-0
No files found.
Config/DefaultInput.ini
View file @
fc35916f
...
...
@@ -98,6 +98,8 @@ DoubleClickTime=0.200000
+
AxisMappings
=
(AxisName="NonVR_LeftHand_Roll",Scale=-1.000000,Key=Gamepad_DPad_Right)
+
AxisMappings
=
(AxisName="NonVR_LeftHand_Roll",Scale=1.000000,Key=Gamepad_DPad_Left)
+
AxisMappings
=
(AxisName="NonVR_RightHand_Pitch",Scale=-1.000000,Key=Gamepad_FaceButton_Bottom)
+
AxisMappings
=
(AxisName="NonVR_LeftHand_MoveX",Scale=1.000000,Key=NumPadFour)
+
AxisMappings
=
(AxisName="NonVR_LeftHand_MoveX",Scale=-1.000000,Key=NumPadSix)
DefaultTouchInterface
=
/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
ConsoleKey
=
None
-ConsoleKeys
=
Tilde
...
...
Content/Test.umap
View file @
fc35916f
No preview for this file type
Content/Test_BuiltData.uasset
View file @
fc35916f
No preview for this file type
Intermediate/Config/CoalescedSourceConfigs/Input.ini
View file @
fc35916f
...
...
@@ -95,6 +95,8 @@ AxisMappings=(AxisName="NonVR_LeftHand_Pitch",Scale=-1.000000,Key=Gamepad_DPad_D
AxisMappings
=
(AxisName="NonVR_LeftHand_Roll",Scale=-1.000000,Key=Gamepad_DPad_Right)
AxisMappings
=
(AxisName="NonVR_LeftHand_Roll",Scale=1.000000,Key=Gamepad_DPad_Left)
AxisMappings
=
(AxisName="NonVR_RightHand_Pitch",Scale=-1.000000,Key=Gamepad_FaceButton_Bottom)
AxisMappings
=
(AxisName="NonVR_LeftHand_MoveX",Scale=1.000000,Key=NumPadFour)
AxisMappings
=
(AxisName="NonVR_LeftHand_MoveX",Scale=-1.000000,Key=NumPadSix)
ConsoleKey
=
None
ConsoleKeys
=
Tilde
ConsoleKeys
=
Caret
...
...
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloud.cpp
View file @
fc35916f
...
...
@@ -9,6 +9,8 @@
#include "Engine/Texture2D.h"
#include "UObject/ConstructorHelpers.h"
#include "Logging/MessageLog.h"
#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"
#include "Runtime/Engine/Classes/GameFramework/Pawn.h"
#define IS_PROPERTY(Name) PropertyChangedEvent.MemberProperty->GetName().Equals(#Name)
...
...
@@ -423,7 +425,7 @@ int32 UPointCloud::GetPointCount(bool bCountOnlyEnabled) const
return
bCountOnlyEnabled
?
FPointCloudHelper
::
CountEnabledPoints
(
Points
)
:
Points
.
Num
();
}
void
UPointCloud
::
Rebuild
(
bool
bForced
)
void
UPointCloud
::
Rebuild
(
bool
bForced
,
bool
bForceRenderDataDirty
)
{
if
(
bForced
)
{
...
...
@@ -435,6 +437,11 @@ void UPointCloud::Rebuild(bool bForced)
bTreeDirty
|=
bReductionDirty
;
bool
bBoundsDirty
=
bTransformDirty
;
if
(
bForceRenderDataDirty
)
{
bRenderDataDirty
=
true
;
}
float
MaxProgress
=
(
2
*
bTransformDirty
)
+
(
2
*
bReductionDirty
)
+
bTreeDirty
+
bMaterialDirty
+
bBoundsDirty
+
bRenderDataDirty
+
1
;
FScopedSlowTask
Progress
(
MaxProgress
,
LOCTEXT
(
"Rebuild"
,
"Rebuilding Cloud..."
));
...
...
@@ -721,6 +728,52 @@ void UPointCloud::SetPointCloudData(TArray<FPointCloudPoint> &InPoints, bool bRe
}
}
void
UPointCloud
::
SortPoints
()
{
struct
FCompareParticleOrderZ
{
FORCEINLINE
bool
operator
()(
const
FVector
&
A
,
const
FVector
&
B
)
const
{
return
B
.
Z
<
A
.
Z
;
}
};
FVector
CamLocation
=
UGameplayStatics
::
GetPlayerCameraManager
(
WorldContextObject
,
0
)
->
GetCameraLocation
();
TArray
<
FVector
>
PointOrder
=
TArray
<
FVector
>
();
PointOrder
.
Init
(
FVector
(
0
,
0
,
0
),
Points
.
Num
());
for
(
int32
PointIndex
=
0
;
PointIndex
<
Points
.
Num
();
PointIndex
++
)
{
FVector
Location
=
Points
[
PointIndex
].
Location
;
float
InZ
=
(
CamLocation
-
Location
).
SizeSquared
();
PointOrder
[
PointIndex
]
=
FVector
(
PointIndex
,
0
,
InZ
);
//PointOrder[PointIndex].X = PointIndex;
//PointOrder[PointIndex].Z = InZ;
}
Sort
(
&
(
PointOrder
[
0
]),
Points
.
Num
(),
FCompareParticleOrderZ
());
TArray
<
FPointCloudPoint
>
NewPoints
=
TArray
<
FPointCloudPoint
>
();
NewPoints
.
Init
(
FPointCloudPoint
(),
Points
.
Num
());
for
(
int32
i
=
0
;
i
<
Points
.
Num
();
i
++
)
{
int32
PointIndex
=
PointOrder
[
i
].
X
;
NewPoints
[
PointIndex
]
=
Points
[
i
];
}
Points
=
NewPoints
;
UE_LOG
(
LogTemp
,
Warning
,
TEXT
(
"[0] %f"
),
PointOrder
[
0
].
Z
);
UE_LOG
(
LogTemp
,
Warning
,
TEXT
(
"[1] %f"
),
PointOrder
[
1
].
Z
);
UE_LOG
(
LogTemp
,
Warning
,
TEXT
(
"[2] %f"
),
PointOrder
[
2
].
Z
);
UE_LOG
(
LogTemp
,
Warning
,
TEXT
(
"[100] %f"
),
PointOrder
[
100
].
Z
);
UE_LOG
(
LogTemp
,
Warning
,
TEXT
(
"[400] %f"
),
PointOrder
[
400
].
Z
);
Rebuild
(
false
,
true
);
}
void
UPointCloud
::
SetSettings
(
UPointCloudSettings
*
Settings
)
{
if
(
Settings
)
...
...
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloudComponent.cpp
View file @
fc35916f
...
...
@@ -3,6 +3,7 @@
#include "PointCloudComponent.h"
#include "Engine/CollisionProfile.h"
#include "PointCloud.h"
#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"
UPointCloudComponent
::
UPointCloudComponent
(
const
FObjectInitializer
&
ObjectInitializer
)
:
Super
(
ObjectInitializer
)
...
...
@@ -55,6 +56,9 @@ void UPointCloudComponent::SetPointCloud(UPointCloud *InPointCloud)
{
RemovePointCloudListener
();
PointCloud
=
InPointCloud
;
APawn
*
Pawn
=
UGameplayStatics
::
GetPlayerPawn
(
GetOwner
(),
0
);
UObject
*
Object
=
Cast
<
UObject
>
(
Pawn
);
PointCloud
->
WorldContextObject
=
Object
;
AttachPointCloudListener
();
OnPointCloudRebuilt
();
}
...
...
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloudHelper.cpp
View file @
fc35916f
...
...
@@ -964,10 +964,11 @@ FBox FPointCloudHelper::CalculateBounds(const TArray<FPointCloudPoint>& Points)
for
(
int32
Index
=
0
;
Index
<
Points
.
Num
();
Index
++
)
{
/*
if (!Points[Index].IsEnabled())
{
continue;
}
}
*/
BoundingBox
+=
Points
[
Index
].
Location
;
}
...
...
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Private/PointCloudRendering.cpp
View file @
fc35916f
...
...
@@ -307,12 +307,14 @@ struct FPointCloudProxy
TArray
<
FPointCloudIndexBuffer
>
IndexBuffers
;
private:
UPointCloud
*
PointCloud
;
UPointCloudComponent
*
Component
;
FTransform
CurrentTransform
;
bool
bDirty
;
public:
UPointCloud
*
PointCloud
;
FPointCloudProxy
()
:
bDirty
(
true
)
{}
~
FPointCloudProxy
()
{
...
...
@@ -442,6 +444,30 @@ public:
#endif
Collector
.
AddMesh
(
ViewIndex
,
MeshBatch
);
/*
const FSceneView* View = Views[ViewIndex];
const FPointCloudSceneProxy* Proxy = this;
int32 ParticleCount = PointCloudProxy.IndexBuffers[LOD].NumPrimitives;
FParticleOrder* ParticleOrder = NULL;
ParticleOrder = (FParticleOrder*)FMemStack::Get().Alloc(sizeof(FParticleOrder)* ParticleCount, alignof(FParticleOrder));
SortSpriteParticles(ParticleCount, View, Proxy->GetLocalToWorld(), ParticleOrder, Proxy->PointCloudProxy.PointCloud);
FGlobalDynamicVertexBuffer::FAllocation Allocation;
// Allocate memory for render data.
int32 NumVerticesPerParticleInBuffer = 4;
int32 VertexStride = sizeof(FParticleSpriteVertex);
Allocation = FGlobalDynamicVertexBuffer::Get().Allocate(ParticleCount * VertexStride * NumVerticesPerParticleInBuffer);
// Fill vertex buffers.
GetVertexAndIndexData(Allocation.Buffer, ParticleOrder, ParticleCount, VertexStride);
// TODO
*/
}
}
}
...
...
@@ -451,6 +477,71 @@ public:
}
}
/*
void SortSpriteParticles(int32 ParticleCount, const FSceneView* View, const FMatrix& LocalToWorld, FParticleOrder* ParticleOrder, UPointCloud * PointCloud) const
{
struct FCompareParticleOrderZ
{
FORCEINLINE bool operator()(const FParticleOrder& A, const FParticleOrder& B) const { return B.Z < A.Z; }
};
for (int32 ParticleIndex = 0; ParticleIndex < ParticleCount; ParticleIndex++)
{
//DECLARE_PARTICLE(Particle, ParticleData + ParticleStride * ParticleIndices[ParticleIndex]);
FVector Location = PointCloud->GetPointCloudData()[ParticleIndex].Location;
float InZ;
if (true)
{
InZ = View->ViewMatrices.GetViewProjectionMatrix().TransformPosition(LocalToWorld.TransformPosition(Location)).W;
}
else
{
InZ = View->ViewMatrices.GetViewProjectionMatrix().TransformPosition(Location).W;
}
ParticleOrder[ParticleIndex].ParticleIndex = ParticleIndex;
ParticleOrder[ParticleIndex].Z = InZ;
}
Sort(ParticleOrder, ParticleCount, FCompareParticleOrderZ());
}
bool GetVertexAndIndexData(void* VertexData, FParticleOrder* ParticleOrder, int32 ParticleCount, int32 VertexStride) const
{
// Pack the data
int32 ParticleIndex;
uint8* TempVert = (uint8*)VertexData;
FParticleSpriteVertex* FillVertex;
FVector ParticlePosition;
FVector ParticleOldPosition;
for (int32 i = 0; i < ParticleCount; i++)
{
ParticleIndex = ParticleOrder[i].ParticleIndex;
DECLARE_PARTICLE_CONST(Particle, ParticleData + Source.ParticleStride * ParticleIndices[ParticleIndex]);
if (i + 1 < ParticleCount)
{
int32 NextIndex = ParticleOrder[i + 1].ParticleIndex;
DECLARE_PARTICLE_CONST(NextParticle, ParticleData + Source.ParticleStride * ParticleIndices[NextIndex]);
FPlatformMisc::Prefetch(&NextParticle);
}
ParticlePosition = Particle.Location;
ParticleOldPosition = Particle.OldLocation;
FillVertex = (FParticleSpriteVertex*)TempVert;
FillVertex->Position = ParticlePosition;
FillVertex->Color = Particle.Color;
TempVert += VertexStride;
}
return true;
}*/
virtual
FPrimitiveViewRelevance
GetViewRelevance
(
const
FSceneView
*
View
)
const
override
{
FPrimitiveViewRelevance
Result
;
...
...
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Public/PointCloud.h
View file @
fc35916f
...
...
@@ -451,7 +451,7 @@ public:
/** Rebuilds the cloud using current settings */
UFUNCTION
(
BlueprintCallable
,
Category
=
"Point Cloud"
)
void
Rebuild
(
bool
bForced
=
false
);
void
Rebuild
(
bool
bForced
=
false
,
bool
bForceRenderDataDirty
=
false
);
/** Permanently strips all disabled points */
UFUNCTION
(
BlueprintCallable
,
Category
=
"Point Cloud"
)
...
...
@@ -488,6 +488,9 @@ public:
UFUNCTION
(
BlueprintCallable
,
Category
=
"Point Cloud"
)
void
SetPointCloudData
(
UPARAM
(
ref
)
TArray
<
FPointCloudPoint
>
&
InPoints
,
bool
bRebuildCloud
=
true
);
UFUNCTION
(
BlueprintCallable
,
Category
=
"Point Cloud"
)
void
SortPoints
();
/** Bulk sets the new settings from the ones provided */
void
SetSettings
(
UPointCloudSettings
*
Settings
);
...
...
@@ -495,6 +498,8 @@ public:
FORCEINLINE
float
GetDistanceThreshold
(
uint8
LOD
)
{
return
DistanceThresholds
[
LOD
];
}
UObject
*
WorldContextObject
;
private:
void
CalculateDistanceThresholds
();
void
CacheAssetRegistryTags
();
...
...
Plugins/PointCloudPlugin/Source/PointCloudRuntime/Public/PointCloudHelper.h
View file @
fc35916f
...
...
@@ -3,6 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "PointCloud.h"
#include "PointCloudShared.h"
class
UMaterial
;
...
...
Source/ImmersiveAnalytics/Plot3D.cpp
View file @
fc35916f
...
...
@@ -5,6 +5,7 @@
#include "PointCloudComponent.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
#include "Runtime/Core/Public/Async/ParallelFor.h"
#include "PointCloudHelper.h"
// Sets default values
APlot3D
::
APlot3D
()
...
...
@@ -85,7 +86,7 @@ void APlot3D::InitPoints()
void
APlot3D
::
InitCloud
()
{
PointCloud
=
NewObject
<
UPointCloud
>
();
PointCloud
->
Offset
=
EPointCloudOffset
::
None
;
PointCloud
->
Offset
=
EPointCloudOffset
::
Center
;
PointCloud
->
SetRenderingMethod
(
EPointCloudRenderMethod
::
Sprite_Lit_RGB
,
false
);
PointCloud
->
SpriteMask
=
EPointCloudSpriteMask
::
Circle
;
//PointCloud->SpriteTexture =
...
...
@@ -111,12 +112,14 @@ FColor APlot3D::CalculateColorOfPoint(int32 Index, float Min, float Max)
void
APlot3D
::
RebuildCloud
()
{
PointCloud
->
SetPointCloudData
(
Points
,
true
);
Center
=
FPointCloudHelper
::
CalculateBounds
(
Points
).
GetCenter
();
}
FVector
APlot3D
::
CalculateWorldLocOfPoint
(
FPointCloudPoint
*
Point
)
{
FVector
ActorScale
=
GetActorScale3D
()
*
100
;
FVector
Vec
=
FVector
(
ActorScale
.
X
*
Point
->
Location
.
X
*
-
1
,
ActorScale
.
Y
*
Point
->
Location
.
Y
,
ActorScale
.
Z
*
Point
->
Location
.
Z
);
FVector
Vec
=
FVector
(
ActorScale
.
X
*
(
Point
->
Location
.
X
-
Center
.
X
)
*
-
1
,
ActorScale
.
Y
*
(
Point
->
Location
.
Y
-
Center
.
Y
)
,
ActorScale
.
Z
*
(
Point
->
Location
.
Z
-
Center
.
Z
)
);
FVector
RotatedVec
=
GetActorRotation
().
RotateVector
(
Vec
);
FVector
SumVec
=
GetActorLocation
()
+
RotatedVec
;
return
SumVec
;
...
...
Source/ImmersiveAnalytics/Plot3D.h
View file @
fc35916f
...
...
@@ -29,6 +29,7 @@ private:
FColor
CalculateColorOfPoint
(
int32
Index
,
float
Min
,
float
Max
);
void
RebuildCloud
();
FVector
CalculateWorldLocOfPoint
(
FPointCloudPoint
*
Point
);
FVector
Center
;
UPROPERTY
(
Category
=
PointCloudActor
,
VisibleAnywhere
,
BlueprintReadOnly
,
meta
=
(
ExposeFunctionCategories
=
"Rendering,Components|PointCloud"
,
AllowPrivateAccess
=
"true"
))
class
UPointCloudComponent
*
PointCloudComponent
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment