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
1b637bdd
Commit
1b637bdd
authored
Mar 29, 2017
by
wester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instances
parent
756191bf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
13 deletions
+28
-13
Minimal_Default.umap
Content/MobileStarterContent/Maps/Minimal_Default.umap
+0
-0
Minimal_Default_BuiltData.uasset
...obileStarterContent/Maps/Minimal_Default_BuiltData.uasset
+0
-0
Tileset.cpp
Source/MasterTestProject/Tileset.cpp
+3
-6
Tileset.h
Source/MasterTestProject/Tileset.h
+6
-7
ProceduralEntity.cpp
Source/MasterTestProject/ue4-assimp/ProceduralEntity.cpp
+17
-0
ProceduralEntity.h
Source/MasterTestProject/ue4-assimp/ProceduralEntity.h
+2
-0
No files found.
Content/MobileStarterContent/Maps/Minimal_Default.umap
View file @
1b637bdd
No preview for this file type
Content/MobileStarterContent/Maps/Minimal_Default_BuiltData.uasset
View file @
1b637bdd
No preview for this file type
Source/MasterTestProject/Tileset.cpp
View file @
1b637bdd
...
@@ -118,21 +118,21 @@ void ATilesetActor::parseInstanced3DTile(const TArray<uint8> data, FTile * tile)
...
@@ -118,21 +118,21 @@ void ATilesetActor::parseInstanced3DTile(const TArray<uint8> data, FTile * tile)
gltf
->
loadModel
(
&
data
.
GetData
()[
GLTFstart
],
(
data
.
Num
()
-
GLTFstart
));
gltf
->
loadModel
(
&
data
.
GetData
()[
GLTFstart
],
(
data
.
Num
()
-
GLTFstart
));
//http
s://answers.unrealengine.com/questions/136562/is-there-a-way-to-clone-duplicate-an-actor-in-c
.html
//http
://www.dirsig.org/docs/new/coordinates
.html
if
(
JsonParsed
->
HasField
(
"POSITION"
))
{
if
(
JsonParsed
->
HasField
(
"POSITION"
))
{
uint32
featureTableBinaryOffset
=
i3dmheader
->
getFeatureStart
()
+
i3dmheader
->
featureTable
.
featureTableJSONByteLength
;
uint32
featureTableBinaryOffset
=
i3dmheader
->
getFeatureStart
()
+
i3dmheader
->
featureTable
.
featureTableJSONByteLength
;
TSharedPtr
<
FJsonObject
>
binaryBodyReference
=
JsonParsed
->
GetObjectField
(
"POSITION"
);
TSharedPtr
<
FJsonObject
>
binaryBodyReference
=
JsonParsed
->
GetObjectField
(
"POSITION"
);
int32
byteOffset
=
binaryBodyReference
->
GetIntegerField
(
"byteOffset"
);
int32
byteOffset
=
binaryBodyReference
->
GetIntegerField
(
"byteOffset"
);
TArray
<
FVector
>
positons
=
TArray
<
FVector
>
();
// getAsArray<FVector>(data.GetData(), featureTableBinaryOffset + byteOffset
, instances_length);
TArray
<
FVector
>
positons
=
getAsArray
<
FVector
>
(
data
.
GetData
(),
(
int32
)(
featureTableBinaryOffset
+
byteOffset
)
,
instances_length
);
FString
outputString
=
"["
;
FString
outputString
=
"["
;
for
(
FVector
pos
:
positons
)
for
(
FVector
pos
:
positons
)
{
{
outputString
+=
"["
+
pos
.
ToString
()
+
"] "
;
outputString
+=
"["
+
pos
.
ToString
()
+
"] "
;
gltf
->
clone
(
pos
);
}
}
outputString
+=
"]"
;
outputString
+=
"]"
;
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"InStanced 3D Model Positions %s"
),
*
outputString
);
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"InStanced 3D Model Positions %s"
),
*
outputString
);
...
@@ -144,10 +144,7 @@ void ATilesetActor::parseInstanced3DTile(const TArray<uint8> data, FTile * tile)
...
@@ -144,10 +144,7 @@ void ATilesetActor::parseInstanced3DTile(const TArray<uint8> data, FTile * tile)
}
}
}
}
}
}
void
ATilesetActor
::
parse3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
)
void
ATilesetActor
::
parse3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
)
...
...
Source/MasterTestProject/Tileset.h
View file @
1b637bdd
...
@@ -299,15 +299,14 @@ private:
...
@@ -299,15 +299,14 @@ private:
void
parseBatched3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
);
void
parseBatched3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
);
void
parseInstanced3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
);
void
parseInstanced3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
);
template
<
typename
T
>
TArray
<
T
>
getAsArray
(
uint8
*
data
,
int32
offset
,
int32
numberOfElements
);
template
<
typename
T
>
TArray
<
T
>
getAsArray
(
const
uint8
*
data
,
int32
offset
,
int32
numberOfElements
);
};
};
template
<
typename
T
>
template
<
typename
T
>
inline
TArray
<
T
>
ATilesetActor
::
getAsArray
(
uint8
*
data
,
int32
offset
,
int32
numberOfElements
)
inline
TArray
<
T
>
ATilesetActor
::
getAsArray
(
const
uint8
*
data
,
int32
offset
,
int32
numberOfElements
)
{
{
//T *ArrayPointer = (T*)(data + offset);
T
*
ArrayPointer
=
(
T
*
)(
data
+
offset
);
//TArray<T> result;
TArray
<
T
>
result
;
//result.Append(ArrayPointer, numberOfElements);
result
.
Append
(
ArrayPointer
,
numberOfElements
);
//return result;
return
result
;
return
TArray
<
T
>
();
}
}
Source/MasterTestProject/ue4-assimp/ProceduralEntity.cpp
View file @
1b637bdd
...
@@ -278,6 +278,23 @@ void AProceduralEntity::loadModel(const uint8* RawFileData, int32 lenght) {
...
@@ -278,6 +278,23 @@ void AProceduralEntity::loadModel(const uint8* RawFileData, int32 lenght) {
UE_LOG
(
GLTF
,
Log
,
TEXT
(
"GLTF loaded: %i Vertecies in %f seconds"
),
_numVertecies
,
end
-
start
);
UE_LOG
(
GLTF
,
Log
,
TEXT
(
"GLTF loaded: %i Vertecies in %f seconds"
),
_numVertecies
,
end
-
start
);
}
}
AProceduralEntity
*
AProceduralEntity
::
clone
(
const
FVector
position
)
{
FActorSpawnParameters
Parameters
;
Parameters
.
Template
=
this
;
class
AProceduralEntity
*
New
=
GetWorld
()
->
SpawnActor
<
AProceduralEntity
>
(
GetClass
(),
Parameters
);
New
->
SetOwner
(
GetOwner
());
#if WITH_EDITOR
New
->
SetFolderPath
(
this
->
GetFolderPath
());
#endif
FTransform
trans
=
FTransform
(
position
);
New
->
SetActorTransform
(
trans
);
return
New
;
}
UMaterialInterface
*
AProceduralEntity
::
GetMaterialForIndex
(
unsigned
int
index
,
const
aiScene
*
scene
){
UMaterialInterface
*
AProceduralEntity
::
GetMaterialForIndex
(
unsigned
int
index
,
const
aiScene
*
scene
){
if
(
MaterialMap
.
Contains
(
index
))
{
if
(
MaterialMap
.
Contains
(
index
))
{
return
*
MaterialMap
.
Find
(
index
);
return
*
MaterialMap
.
Find
(
index
);
...
...
Source/MasterTestProject/ue4-assimp/ProceduralEntity.h
View file @
1b637bdd
...
@@ -56,6 +56,8 @@ public:
...
@@ -56,6 +56,8 @@ public:
void
loadModel
(
const
uint8
*
RawFileData
,
int32
lenght
);
void
loadModel
(
const
uint8
*
RawFileData
,
int32
lenght
);
AProceduralEntity
*
clone
(
FVector
position
);
private
:
private
:
...
...
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