Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MasterTestProjekt
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
MasterTestProjekt
Commits
4785d8d3
Commit
4785d8d3
authored
Jun 13, 2017
by
wester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asd
parent
125a43db
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
26 deletions
+29
-26
Minimal_Default.umap
Content/MobileStarterContent/Maps/Minimal_Default.umap
+0
-0
Minimal_Default_BuiltData.uasset
...obileStarterContent/Maps/Minimal_Default_BuiltData.uasset
+0
-0
StaticPointCloudMat.uasset
Content/PointClouds/StaticPointCloudMat.uasset
+0
-0
PointCloudCol.uasset
Content/StaticMeshPointClo/Blueprints/PointCloudCol.uasset
+0
-0
PointCloudActor.cpp
Source/MasterTestProject/PointCloudActor.cpp
+8
-1
PointCloudActor.h
Source/MasterTestProject/PointCloudActor.h
+5
-1
Tileset.cpp
Source/MasterTestProject/Tileset.cpp
+16
-24
No files found.
Content/MobileStarterContent/Maps/Minimal_Default.umap
View file @
4785d8d3
No preview for this file type
Content/MobileStarterContent/Maps/Minimal_Default_BuiltData.uasset
View file @
4785d8d3
No preview for this file type
Content/PointClouds/StaticPointCloudMat.uasset
View file @
4785d8d3
No preview for this file type
Content/StaticMeshPointClo/Blueprints/PointCloudCol.uasset
View file @
4785d8d3
No preview for this file type
Source/MasterTestProject/PointCloudActor.cpp
View file @
4785d8d3
...
...
@@ -33,7 +33,14 @@ APointCloudActor::APointCloudActor(const FObjectInitializer& ObjectInitializer)
void
APointCloudActor
::
setPoints
(
UTexture2D
*
PointCloud
)
{
Material
->
SetTextureParameterValue
(
FName
(
"PointCloud"
),
PointCloud
);
Poitns
=
PointCloud
;
Points
=
PointCloud
;
StaticMeshComponent
->
SetMaterial
(
0
,
Material
);
}
void
APointCloudActor
::
setColors
(
UTexture2D
*
Colors
)
{
Material
->
SetTextureParameterValue
(
FName
(
"Colors"
),
Colors
);
this
->
Colors
=
Colors
;
StaticMeshComponent
->
SetMaterial
(
0
,
Material
);
}
...
...
Source/MasterTestProject/PointCloudActor.h
View file @
4785d8d3
...
...
@@ -14,6 +14,7 @@ public:
// Sets default values for this actor's properties
APointCloudActor
(
const
FObjectInitializer
&
ObjectInitializer
);
void
setPoints
(
UTexture2D
*
Points
);
void
setColors
(
UTexture2D
*
Colors
);
UPROPERTY
(
EditAnywhere
,
BlueprintReadWrite
,
Category
=
"Material"
)
UMaterialInstanceDynamic
*
Material
;
...
...
@@ -25,7 +26,10 @@ public:
UStaticMeshComponent
*
StaticMeshComponent
;
UPROPERTY
(
EditAnywhere
,
BlueprintReadWrite
,
Category
=
"Points"
)
UTexture2D
*
Poitns
;
UTexture2D
*
Points
;
UPROPERTY
(
EditAnywhere
,
BlueprintReadWrite
,
Category
=
"Points"
)
UTexture2D
*
Colors
;
protected
:
...
...
Source/MasterTestProject/Tileset.cpp
View file @
4785d8d3
...
...
@@ -345,6 +345,9 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
UWorld
*
const
World
=
GetWorld
();
if
(
World
)
{
APointCloudActor
*
PointCloud
=
World
->
SpawnActor
<
APointCloudActor
>
(
APointCloudActor
::
StaticClass
());
int32
TextureSize
=
FMath
::
FloorToInt
(
FMath
::
Sqrt
(
instances_length
))
+
1
;
int32
fill
=
TextureSize
*
TextureSize
-
instances_length
;
...
...
@@ -376,28 +379,19 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
UDynamicTextureUtilities
::
UpdateDynamicVectorTexture
(
*
Points
,
Texture
);
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Created Position Texture Number Points %d, TextureSize: %d, Fill: %d, "
),
instances_length
,
TextureSize
,
fill
);
UWorld
*
const
World
=
GetWorld
();
if
(
World
)
{
APointCloudActor
*
PointCloud
=
World
->
SpawnActor
<
APointCloudActor
>
(
APointCloudActor
::
StaticClass
());
PointCloud
->
setPoints
(
Texture
);
#if WITH_EDITOR
PointCloud
->
SetFolderPath
(
FName
(
*
(
"SpawnedGLTF/"
+
this
->
GetName
())));
#endif
PointCloud
->
AttachToActor
(
this
,
FAttachmentTransformRules
::
KeepWorldTransform
);
}
PointCloud
->
setPoints
(
Texture
);
//ass texture to mAterial
if
(
TextureTest
)
{
UMaterialInstanceDynamic
*
Material
=
UMaterialInstanceDynamic
::
Create
(
TextureTest
->
GetStaticMeshComponent
()
->
GetMaterial
(
0
),
nullptr
);
Material
->
SetTextureParameterValue
(
FName
(
"DynamicTexture"
),
Texture
);
TextureTest
->
GetStaticMeshComponent
()
->
SetMaterial
(
0
,
Material
);
//
TextureTest->GetStaticMeshComponent()->SetMaterial(0,Material);
}
}
else
{
UE_LOG
(
TILES
,
Error
,
TEXT
(
"Pointcloud Quantized not supported Position Required"
));
}
if
(
FeatureTableJSON
->
HasField
(
"RGB"
))
{
// RGB = uint8[3]
uint32
featureTableBinaryOffset
=
pntheader
->
getFeatureStart
()
+
pntheader
->
featureTable
.
featureTableJSONByteLength
;
...
...
@@ -408,30 +402,28 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
// creat pooint texture
TArray
<
FLinearColor
>
*
ColorRGB
=
new
TArray
<
FLinearColor
>
();
uint8
*
pos
=
start
;
UE_LOG
(
TILES
,
Error
,
TEXT
(
"
Color %s"
),
*
FLinearColor
((
*
pos
)
/
255
,
(
*
(
pos
+
1
))
/
255
,
(
*
(
pos
+
2
))
/
255
).
ToString
()
);
UE_LOG
(
TILES
,
Error
,
TEXT
(
"
Start %d Color %s"
),
start
,
*
FLinearColor
((
*
pos
)
/
255.0
,
(
*
(
pos
+
1
))
/
255.0
,
(
*
(
pos
+
2
))
/
255.0
).
ToString
()
);
for
(
size_t
i
=
0
;
i
<
instances_length
;
i
+=
1
)
{
ColorRGB
->
Add
(
FLinearColor
((
*
pos
)
/
255
,
(
*
(
pos
+
1
))
/
255
,
(
*
(
pos
+
2
))
/
255
)
);
FLinearColor
temp
=
FLinearColor
((
*
pos
)
/
255.0
,
(
*
(
pos
+
1
))
/
255.0
,
(
*
(
pos
+
2
))
/
255.0
);
ColorRGB
->
Add
(
temp
);
pos
+=
3
;
}
for
(
size_t
i
=
0
;
i
<
fill
;
i
+=
1
)
{
ColorRGB
->
Add
(
FLinearColor
(
1.0
f
,
0.0
f
,
0.0
f
));
}
UTexture2D
*
Texture
=
UDynamicTextureUtilities
::
CreateTransientDynamicTexture
(
TextureSize
,
TextureSize
,
PF_A32B32G32R32F
);
UDynamicTextureUtilities
::
UpdateDynamicVectorTexture
(
*
ColorRGB
,
Texture
);
UTexture2D
*
Color
Texture
=
UDynamicTextureUtilities
::
CreateTransientDynamicTexture
(
TextureSize
,
TextureSize
,
PF_A32B32G32R32F
);
UDynamicTextureUtilities
::
UpdateDynamicVectorTexture
(
*
ColorRGB
,
Color
Texture
);
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Created Color Texture Number Points %d, TextureSize: %d, Fill: %d, "
),
instances_length
,
TextureSize
,
fill
);
//ass texture to mAterial
if
(
TextureTest
)
{
UMaterialInstanceDynamic
*
Material
=
UMaterialInstanceDynamic
::
Create
(
TextureTest
->
GetStaticMeshComponent
()
->
GetMaterial
(
0
),
nullptr
);
Material
->
SetTextureParameterValue
(
FName
(
"DynamicTexture"
),
Texture
);
//TextureTest->GetStaticMeshComponent()->SetMaterial(0, Material);
}
PointCloud
->
setColors
(
ColorTexture
);
}
#if WITH_EDITOR
PointCloud
->
SetFolderPath
(
FName
(
*
(
"SpawnedGLTF/"
+
this
->
GetName
())));
#endif
PointCloud
->
AttachToActor
(
this
,
FAttachmentTransformRules
::
KeepWorldTransform
);
}
}
...
...
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