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
9e1d7880
Commit
9e1d7880
authored
Mar 07, 2017
by
wester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DownloadFile
parent
bd810866
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
112 additions
and
20 deletions
+112
-20
DefaultEngine.ini
Config/DefaultEngine.ini
+9
-0
Minimal_Default.umap
Content/MobileStarterContent/Maps/Minimal_Default.umap
+0
-0
Minimal_Default_BuiltData.uasset
...obileStarterContent/Maps/Minimal_Default_BuiltData.uasset
+0
-0
TexturedMaterial.uasset
Content/materials/TexturedMaterial.uasset
+0
-0
TexturedMaterial_2.uasset
Content/materials/TexturedMaterial_2.uasset
+0
-0
UniformAMterial.uasset
Content/materials/UniformAMterial.uasset
+0
-0
StaticGLTFComponent.cpp
Source/MasterTestProject/GLTF/StaticGLTFComponent.cpp
+0
-6
MasterTestProject.Build.cs
Source/MasterTestProject/MasterTestProject.Build.cs
+1
-1
MasterTestProjectGameModeBase.cpp
Source/MasterTestProject/MasterTestProjectGameModeBase.cpp
+83
-12
MasterTestProjectGameModeBase.h
Source/MasterTestProject/MasterTestProjectGameModeBase.h
+19
-1
No files found.
Config/DefaultEngine.ini
View file @
9e1d7880
...
...
@@ -76,3 +76,12 @@ AppliedTargetedHardwareClass=Mobile
DefaultGraphicsPerformance
=
Scalable
AppliedDefaultGraphicsPerformance
=
Scalable
[HTTP]
HttpTimeout
=
300
HttpConnectionTimeout
=
-1
HttpReceiveTimeout
=
-1
HttpSendTimeout
=
-1
HttpMaxConnectionsPerServer
=
16
bEnableHttp
=
true
bUseNullHttp
=
false
HttpDelayTime
=
0
Content/MobileStarterContent/Maps/Minimal_Default.umap
View file @
9e1d7880
No preview for this file type
Content/MobileStarterContent/Maps/Minimal_Default_BuiltData.uasset
View file @
9e1d7880
No preview for this file type
Content/materials/TexturedMaterial.uasset
View file @
9e1d7880
No preview for this file type
Content/materials/TexturedMaterial_2.uasset
deleted
100644 → 0
View file @
bd810866
File deleted
Content/materials/UniformAMterial.uasset
deleted
100644 → 0
View file @
bd810866
File deleted
Source/MasterTestProject/GLTF/StaticGLTFComponent.cpp
View file @
9e1d7880
...
...
@@ -49,12 +49,6 @@ void UStaticGLTFComponent::OnRegister()
else
{
ImportNodes
(
Scene
->
scenes
[
Scene
->
defaultScene
],
newrawmesh
,
FMatrix
());
}
}
...
...
Source/MasterTestProject/MasterTestProject.Build.cs
View file @
9e1d7880
...
...
@@ -20,7 +20,7 @@ public class MasterTestProject : ModuleRules
public
MasterTestProject
(
TargetInfo
Target
)
{
PublicDependencyModuleNames
.
AddRange
(
new
string
[]
{
"Core"
,
"CoreUObject"
,
"Engine"
,
"InputCore"
,
"ImageWrapper"
,
"RawMesh"
,
"Json"
,
"JsonUtilities"
,
"ProceduralMeshComponent"
});
PublicDependencyModuleNames
.
AddRange
(
new
string
[]
{
"Core"
,
"CoreUObject"
,
"Engine"
,
"InputCore"
,
"ImageWrapper"
,
"RawMesh"
,
"
HTTP"
,
"
Json"
,
"JsonUtilities"
,
"ProceduralMeshComponent"
});
PrivateDependencyModuleNames
.
AddRange
(
new
string
[]
{
});
...
...
Source/MasterTestProject/MasterTestProjectGameModeBase.cpp
View file @
9e1d7880
...
...
@@ -10,31 +10,43 @@ void AMasterTestProjectGameModeBase::InitGame(const FString & MapName, const FSt
Super
::
InitGame
(
MapName
,
Options
,
ErrorMessage
);
//FString file = "D:\\Dropbox\\Studium\\MasterArbeit\\3d-tiles\\examples\\tileset.json";
FString
file
=
"D:
\\
Dropbox
\\
Studium
\\
MasterArbeit
\\
3d-tiles-samples
\\
tilesets
\\
TilesetWithDiscreteLOD
\\
tileset.json"
;
//FString base = "D:\\Dropbox\\Studium\\MasterArbeit\\";
FString
base
=
"file:/H:
\\
Repositories
\\
MasterArbeit
\\
"
;
FString
file
=
base
+
"3d-tiles-samples
\\
tilesets
\\
..
\\
tilesets
\\
TilesetWithRequestVolume
\\
tileset.json"
;
rootTileset
=
nullptr
;
DownloadFile
(
file
);
FString
JsonRaw
=
""
;
FFileHelper
::
LoadFileToString
(
JsonRaw
,
*
file
);
//
FFileHelper::LoadFileToString(JsonRaw, *file);
UE_LOG
(
TILES
,
Log
,
TEXT
(
"Loading file %s"
),
*
file
);
//
UE_LOG(TILES, Log, TEXT("Loading file %s"), *file);
//UE_LOG(GLTF, Warning, TEXT("LangFile: \n %s"), *JsonRaw);
//FTileset* tileset = parseTileset(JsonRaw);
//DownloadFile(file, tileset->root.children[0].content.url);
}
FTileset
*
AMasterTestProjectGameModeBase
::
parseTileset
(
FString
JsonString
)
{
//TODO error Handling
TSharedPtr
<
FJsonObject
>
JsonParsed
;
TSharedRef
<
TJsonReader
<
TCHAR
>>
JsonReader
=
TJsonReaderFactory
<
TCHAR
>::
Create
(
Json
Raw
);
TSharedRef
<
TJsonReader
<
TCHAR
>>
JsonReader
=
TJsonReaderFactory
<
TCHAR
>::
Create
(
Json
String
);
if
(
FJsonSerializer
::
Deserialize
(
JsonReader
,
JsonParsed
))
{
FString
ExampleString
=
JsonParsed
->
GetStringField
(
"geometricError"
);
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Example:
\n
%s"
),
*
ExampleString
);
FTileset
tileset
;
bool
success
=
FJsonObjectConverter
::
JsonObjectToUStruct
<
FTileset
>
(
JsonParsed
.
ToSharedRef
()
,
&
tileset
,
0
,
0
);
//bool success = FJsonObjectConverter::JsonObjectStringToUStruct<FTileset>(JsonRaw, &tileset, 0, 0);
FTileset
*
tileset
=
new
FTileset
();
bool
success
=
FJsonObjectConverter
::
JsonObjectToUStruct
<
FTileset
>
(
JsonParsed
.
ToSharedRef
(),
tileset
,
0
,
0
);
TSharedPtr
<
FJsonObject
>
root
=
JsonParsed
->
GetObjectField
(
"root"
);
parseTile
(
root
,
&
tileset
.
root
);
parseTile
(
root
,
&
tileset
->
root
);
//UE_LOG(TILES, Warning, TEXT("Parsed: Success:%s Version:\"%s\" geometricError:%f"), success ? TEXT("True") : TEXT("False"), *tileset.asset.version, tileset.geometricError);
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Parsed: Success:%s Version:
\"
%s
\"
geometricError:%f"
),
success
?
TEXT
(
"True"
)
:
TEXT
(
"False"
),
*
tileset
.
asset
.
version
,
tileset
.
geometricError
)
;
return
tileset
;
}
return
nullptr
;
}
void
AMasterTestProjectGameModeBase
::
parseTile
(
TSharedPtr
<
FJsonObject
>
json
,
FTile
*
targetTile
)
{
...
...
@@ -56,5 +68,64 @@ void AMasterTestProjectGameModeBase::parseTile(TSharedPtr<FJsonObject> json, FTi
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Tile: Success:%s Version:
\"
%s
\"
no Childs "
),
success
?
TEXT
(
"True"
)
:
TEXT
(
"False"
),
*
targetTile
->
content
.
url
);
}
if
(
!
targetTile
->
content
.
url
.
IsEmpty
())
{
TSharedRef
<
IHttpRequest
>
request
=
DownloadFile
(
/*base url*/
,
targetTile
->
content
.
url
);
}
}
TSharedRef
<
IHttpRequest
>
AMasterTestProjectGameModeBase
::
DownloadFile
(
const
FString
&
BaseUrl
,
const
FString
&
RelativeUrl
)
{
FString
Path
,
Filename
,
Extension
;
FPaths
::
Split
(
BaseUrl
,
Path
,
Filename
,
Extension
);
FString
url
=
Path
+
"/"
+
RelativeUrl
;
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Downlaoding: BAse:%s, Relative %s "
),
*
BaseUrl
,
*
RelativeUrl
);
return
DownloadFile
(
url
);
//DownloadFile(TEXT("http://ipv4.download.thinkbroadband.com/20MB.zip"));
}
TSharedRef
<
IHttpRequest
>
AMasterTestProjectGameModeBase
::
DownloadFile
(
const
FString
&
Url
)
{
TSharedRef
<
IHttpRequest
>
HttpRequest
=
FHttpModule
::
Get
().
CreateRequest
();
HttpRequest
->
SetVerb
(
"GET"
);
HttpRequest
->
SetURL
(
Url
);
HttpRequest
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AMasterTestProjectGameModeBase
::
OnReady
);
HttpRequest
->
OnRequestProgress
().
BindUObject
(
this
,
&
AMasterTestProjectGameModeBase
::
OnProgress_Internal
);
// Execute the request
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Downlaoding: %s "
),
*
HttpRequest
->
GetURL
());
HttpRequest
->
ProcessRequest
();
return
HttpRequest
;
}
void
AMasterTestProjectGameModeBase
::
OnReady
(
FHttpRequestPtr
Request
,
FHttpResponsePtr
Response
,
bool
bWasSuccessful
)
{
if
(
Response
.
IsValid
())
{
// UE_LOG(TILES, Warning, TEXT("Downlaod Finished: %s Scucess: %s \"%s\""), *Request->GetURL(), bWasSuccessful ? TEXT("True") : TEXT("False"), *Response->GetContentAsString());
if
(
Request
->
GetURL
().
EndsWith
(
TEXT
(
".json"
)))
{
FTileset
*
tileset
=
parseTileset
(
Response
->
GetContentAsString
());
if
(
rootTileset
==
nullptr
)
{
rootTileset
=
tileset
;
}
Response
->
GetContent
();
}
}
else
{
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Downlaod Finished: %s Scucess: %s not Valid"
),
*
Request
->
GetURL
(),
bWasSuccessful
?
TEXT
(
"True"
)
:
TEXT
(
"False"
));
}
}
void
AMasterTestProjectGameModeBase
::
OnProgress_Internal
(
FHttpRequestPtr
Request
,
int32
BytesSent
,
int32
BytesReceived
)
{
UE_LOG
(
TILES
,
Warning
,
TEXT
(
"Downlaod Progress: %s Sent:%d, Received:%d "
),
*
Request
->
GetURL
(),
BytesSent
,
BytesReceived
);
}
Source/MasterTestProject/MasterTestProjectGameModeBase.h
View file @
9e1d7880
...
...
@@ -3,6 +3,8 @@
#pragma once
#include "GameFramework/GameModeBase.h"
#include "Runtime/Online/HTTP/Public/Http.h"
#include "MasterTestProjectGameModeBase.generated.h"
...
...
@@ -86,6 +88,10 @@ struct FTileContent
UPROPERTY
()
FString
url
;
TArray
<
uint8
>
content
;
// FTileset tileset;
};
...
...
@@ -158,8 +164,20 @@ class MASTERTESTPROJECT_API AMasterTestProjectGameModeBase : public AGameModeBas
public
:
virtual
void
InitGame
(
const
FString
&
MapName
,
const
FString
&
Options
,
FString
&
ErrorMessage
);
FTileset
*
parseTileset
(
FString
JsonString
);
TSharedRef
<
IHttpRequest
>
DownloadFile
(
const
FString
&
BaseUrl
,
const
FString
&
RelativeUrl
);
TSharedRef
<
IHttpRequest
>
DownloadFile
(
const
FString
&
Url
);
FTileset
*
rootTileset
;
TMap
<
FHttpRequestPtr
,
FTileContent
>
activeRequests
;
private
:
void
parseTile
(
TSharedPtr
<
FJsonObject
>
json
,
FTile
*
targetTile
);
void
OnReady
(
FHttpRequestPtr
Request
,
FHttpResponsePtr
Response
,
bool
bWasSuccessful
);
void
OnProgress_Internal
(
FHttpRequestPtr
Request
,
int32
BytesSent
,
int32
BytesReceived
);
};
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