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
448885aa
Commit
448885aa
authored
Mar 01, 2017
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Json to Struct
parent
3bda5499
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
10 deletions
+159
-10
Minimal_Default.umap
Content/MobileStarterContent/Maps/Minimal_Default.umap
+0
-0
Minimal_Default_BuiltData.uasset
...obileStarterContent/Maps/Minimal_Default_BuiltData.uasset
+0
-0
MasterTestProject.Build.cs
Source/MasterTestProject/MasterTestProject.Build.cs
+2
-2
MasterTestProject.cpp
Source/MasterTestProject/MasterTestProject.cpp
+1
-0
MasterTestProject.h
Source/MasterTestProject/MasterTestProject.h
+2
-0
MasterTestProjectGameModeBase.cpp
Source/MasterTestProject/MasterTestProjectGameModeBase.cpp
+14
-8
MasterTestProjectGameModeBase.h
Source/MasterTestProject/MasterTestProjectGameModeBase.h
+140
-0
No files found.
Content/MobileStarterContent/Maps/Minimal_Default.umap
View file @
448885aa
No preview for this file type
Content/MobileStarterContent/Maps/Minimal_Default_BuiltData.uasset
View file @
448885aa
No preview for this file type
Source/MasterTestProject/MasterTestProject.Build.cs
View file @
448885aa
...
@@ -18,9 +18,9 @@ public class MasterTestProject : ModuleRules
...
@@ -18,9 +18,9 @@ public class MasterTestProject : ModuleRules
public
MasterTestProject
(
TargetInfo
Target
)
public
MasterTestProject
(
TargetInfo
Target
)
{
{
PublicDependencyModuleNames
.
AddRange
(
new
string
[]
{
"Core"
,
"CoreUObject"
,
"Engine"
,
"InputCore"
,
"ImageWrapper"
,
"RawMesh"
,
"Json
"
,
"ProceduralMeshComponent"
});
PublicDependencyModuleNames
.
AddRange
(
new
string
[]
{
"Core"
,
"CoreUObject"
,
"Engine"
,
"InputCore"
,
"ImageWrapper"
,
"RawMesh"
,
"Json"
,
"JsonUtilities
"
,
"ProceduralMeshComponent"
});
PrivateDependencyModuleNames
.
AddRange
(
new
string
[]
{
});
PrivateDependencyModuleNames
.
AddRange
(
new
string
[]
{
});
...
...
Source/MasterTestProject/MasterTestProject.cpp
View file @
448885aa
...
@@ -7,3 +7,4 @@ IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, MasterTestProject, "Maste
...
@@ -7,3 +7,4 @@ IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, MasterTestProject, "Maste
//General Log
//General Log
DEFINE_LOG_CATEGORY
(
GLTF
);
DEFINE_LOG_CATEGORY
(
GLTF
);
DEFINE_LOG_CATEGORY
(
TILES
);
Source/MasterTestProject/MasterTestProject.h
View file @
448885aa
...
@@ -6,3 +6,5 @@
...
@@ -6,3 +6,5 @@
//General Log
//General Log
DECLARE_LOG_CATEGORY_EXTERN
(
GLTF
,
Log
,
All
);
DECLARE_LOG_CATEGORY_EXTERN
(
GLTF
,
Log
,
All
);
DECLARE_LOG_CATEGORY_EXTERN
(
TILES
,
Log
,
All
);
Source/MasterTestProject/MasterTestProjectGameModeBase.cpp
View file @
448885aa
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include "MasterTestProject.h"
#include "MasterTestProject.h"
#include "JsonReader.h"
#include "JsonReader.h"
#include "JsonObjectConverter.h"
#include "MasterTestProjectGameModeBase.h"
#include "MasterTestProjectGameModeBase.h"
...
@@ -13,16 +14,21 @@ void AMasterTestProjectGameModeBase::InitGame(const FString & MapName, const FSt
...
@@ -13,16 +14,21 @@ void AMasterTestProjectGameModeBase::InitGame(const FString & MapName, const FSt
FString
JsonRaw
=
""
;
FString
JsonRaw
=
""
;
FFileHelper
::
LoadFileToString
(
JsonRaw
,
*
file
);
FFileHelper
::
LoadFileToString
(
JsonRaw
,
*
file
);
UE_LOG
(
GLTF
,
Log
,
TEXT
(
"Loading file %s"
),
*
file
);
UE_LOG
(
TILES
,
Log
,
TEXT
(
"Loading file %s"
),
*
file
);
//UE_LOG(GLTF, Warning, TEXT("LangFile: \n %s"), *JsonRaw);
//UE_LOG(GLTF, Warning, TEXT("LangFile: \n %s"), *JsonRaw);
TSharedPtr
<
FJsonObject
>
JsonParsed
;
//TSharedPtr<FJsonObject> JsonParsed;
TSharedRef
<
TJsonReader
<
TCHAR
>>
JsonReader
=
TJsonReaderFactory
<
TCHAR
>::
Create
(
JsonRaw
);
//TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(JsonRaw);
if
(
FJsonSerializer
::
Deserialize
(
JsonReader
,
JsonParsed
))
//if (FJsonSerializer::Deserialize(JsonReader, JsonParsed))
{
//{
FString
ExampleString
=
JsonParsed
->
GetStringField
(
"geometricError"
);
// FString ExampleString = JsonParsed->GetStringField("geometricError");
UE_LOG
(
GLTF
,
Warning
,
TEXT
(
"Example:
\n
%s"
),
*
ExampleString
);
// UE_LOG(TILES, Warning, TEXT("Example: \n %s"), *ExampleString);
}
//}
FTileset
tileset
;
bool
success
=
FJsonObjectConverter
::
JsonObjectStringToUStruct
<
FTileset
>
(
JsonRaw
,
&
tileset
,
0
,
0
);
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Parsed: Success:%s Version:
\"
%s
\"
geometricError:%f"
),
success
?
TEXT
(
"True"
)
:
TEXT
(
"False"
),
*
tileset
.
asset
.
version
,
tileset
.
geometricError
);
}
}
...
...
Source/MasterTestProject/MasterTestProjectGameModeBase.h
View file @
448885aa
...
@@ -6,6 +6,146 @@
...
@@ -6,6 +6,146 @@
#include "MasterTestProjectGameModeBase.generated.h"
#include "MasterTestProjectGameModeBase.generated.h"
USTRUCT
()
struct
FAsset
{
GENERATED_USTRUCT_BODY
()
UPROPERTY
()
FString
version
;
UPROPERTY
()
FString
tilesetVersion
;
FAsset
()
{
version
=
""
;
tilesetVersion
=
""
;
}
};
USTRUCT
()
struct
FProperties
{
GENERATED_USTRUCT_BODY
()
UPROPERTY
()
float
maximum
;
UPROPERTY
()
float
minimum
;
};
USTRUCT
()
struct
FPropertieDict
{
GENERATED_USTRUCT_BODY
()
//FIXME should be a map or so, found no Unreal doc, values are from an example
/*"patternProperties" : {
".*": {
"$ref": "properties.schema.json"
}
}*/
UPROPERTY
()
FProperties
Longitude
;
UPROPERTY
()
FProperties
Latitude
;
UPROPERTY
()
FProperties
Height
;
};
USTRUCT
()
struct
FBoundingVolume
{
GENERATED_USTRUCT_BODY
()
//TODO only one in Unreal
UPROPERTY
()
TArray
<
float
>
box
;
//12 Elemete
UPROPERTY
()
TArray
<
float
>
region
;
//6 Elemete
UPROPERTY
()
TArray
<
float
>
sphere
;
//4 Elemete
};
USTRUCT
()
struct
FTileContent
{
GENERATED_USTRUCT_BODY
()
UPROPERTY
()
FBoundingVolume
boundingVolume
;
UPROPERTY
()
FString
url
;
};
USTRUCT
()
struct
FTile
{
GENERATED_USTRUCT_BODY
()
UPROPERTY
()
FBoundingVolume
boundingVolume
;
UPROPERTY
()
FBoundingVolume
viewerRequestVolume
;
UPROPERTY
()
float
geometricError
;
UPROPERTY
()
FString
refine
;
//TODO: "enum" : ["add", "replace"]
UPROPERTY
()
TArray
<
float
>
transform
;
//16 Elemete
//TODO "default" : [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ]
UPROPERTY
()
FTileContent
content
;
UPROPERTY
()
TArray
<
FTile
>
children
;
FTile
()
{
float
transformDefault
[]
=
{
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
};
transform
.
Empty
();
transform
.
Append
(
transformDefault
,
16
);
}
};
USTRUCT
()
struct
FTileset
{
GENERATED_USTRUCT_BODY
()
UPROPERTY
()
FAsset
asset
;
UPROPERTY
()
FPropertieDict
properties
;
UPROPERTY
()
float
geometricError
;
UPROPERTY
()
FTile
root
;
FTileset
()
{
geometricError
=
-
1
;
}
};
/**
/**
*
*
*/
*/
...
...
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