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
c87f5748
Commit
c87f5748
authored
Apr 20, 2017
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple lazy loading
parent
3816d3b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
Tileset.cpp
Source/MasterTestProject/Tileset.cpp
+14
-7
Tileset.h
Source/MasterTestProject/Tileset.h
+4
-1
No files found.
Source/MasterTestProject/Tileset.cpp
View file @
c87f5748
...
@@ -85,7 +85,18 @@ double FTile::getScreenSpaceError(double lambda, FVector CamLocation)
...
@@ -85,7 +85,18 @@ double FTile::getScreenSpaceError(double lambda, FVector CamLocation)
void
FTile
::
setVisible
(
bool
visible
)
void
FTile
::
setVisible
(
bool
visible
)
{
{
if
(
content
.
tiles
.
Num
()
==
0
&&
!
content
.
tileset
)
{
if
(
content
.
tiles
.
Num
()
==
0
&&
!
content
.
tileset
)
{
if
(
visible
)
{
if
(
!
content
.
loadingStarted
&&
visible
&&
!
content
.
url
.
IsEmpty
())
{
if
(
parentTilset
)
{
UTileDownloader
*
downloader
=
NewObject
<
UTileDownloader
>
(
UTileDownloader
::
StaticClass
());
downloader
->
GetTileContent
(
parentTilset
->
parentActor
,
&
content
,
parentTilset
->
absoluteURL
,
this
);
content
.
loadingStarted
=
true
;
}
else
{
UE_LOG
(
TILES
,
Error
,
TEXT
(
"Parent tilset NUll"
));
}
//load
//load
}
}
...
@@ -121,7 +132,7 @@ void ATilesetActor::updateScreenSpaceError(FTile* current, double currentSSE, do
...
@@ -121,7 +132,7 @@ void ATilesetActor::updateScreenSpaceError(FTile* current, double currentSSE, do
child
->
setVisible
(
false
);
child
->
setVisible
(
false
);
}
}
UE_LOG
(
TILES
,
Error
,
TEXT
(
"Set Visible %s SSError= %f"
),
*
current
->
content
.
url
,
ScreenSpaceError1
);
//
UE_LOG(TILES, Error, TEXT("Set Visible %s SSError= %f"), *current->content.url, ScreenSpaceError1);
}
}
...
@@ -156,6 +167,7 @@ FTileset* ATilesetActor::parseTileset(FString JsonString, FString BaseURL)
...
@@ -156,6 +167,7 @@ FTileset* ATilesetActor::parseTileset(FString JsonString, FString BaseURL)
FTileset
*
tileset
=
new
FTileset
();
FTileset
*
tileset
=
new
FTileset
();
bool
success
=
FJsonObjectConverter
::
JsonObjectToUStruct
<
FTileset
>
(
JsonParsed
.
ToSharedRef
(),
tileset
,
0
,
0
);
bool
success
=
FJsonObjectConverter
::
JsonObjectToUStruct
<
FTileset
>
(
JsonParsed
.
ToSharedRef
(),
tileset
,
0
,
0
);
tileset
->
absoluteURL
=
BaseURL
;
tileset
->
absoluteURL
=
BaseURL
;
tileset
->
parentActor
=
this
;
TSharedPtr
<
FJsonObject
>
root
=
JsonParsed
->
GetObjectField
(
"root"
);
TSharedPtr
<
FJsonObject
>
root
=
JsonParsed
->
GetObjectField
(
"root"
);
ATilesetActor
::
parseTile
(
root
,
&
tileset
->
root
,
tileset
);
ATilesetActor
::
parseTile
(
root
,
&
tileset
->
root
,
tileset
);
...
@@ -191,11 +203,6 @@ void ATilesetActor::parseTile(TSharedPtr<FJsonObject> json, FTile *targetTile, F
...
@@ -191,11 +203,6 @@ void ATilesetActor::parseTile(TSharedPtr<FJsonObject> json, FTile *targetTile, F
UE_LOG
(
TILES
,
Log
,
TEXT
(
"Parsed Tile %s: Success:%s Version:
\"
%s
\"
no Childs "
),
*
targetTile
->
content
.
url
,
success
?
TEXT
(
"True"
)
:
TEXT
(
"False"
),
*
targetTile
->
content
.
url
);
UE_LOG
(
TILES
,
Log
,
TEXT
(
"Parsed Tile %s: Success:%s Version:
\"
%s
\"
no Childs "
),
*
targetTile
->
content
.
url
,
success
?
TEXT
(
"True"
)
:
TEXT
(
"False"
),
*
targetTile
->
content
.
url
);
}
}
if
(
!
targetTile
->
content
.
url
.
IsEmpty
())
{
UTileDownloader
*
downloader
=
NewObject
<
UTileDownloader
>
(
UTileDownloader
::
StaticClass
());
downloader
->
GetTileContent
(
this
,
&
targetTile
->
content
,
parent
->
absoluteURL
,
targetTile
);
}
}
}
void
ATilesetActor
::
parseBatched3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
)
void
ATilesetActor
::
parseBatched3DTile
(
const
TArray
<
uint8
>
data
,
FTile
*
tile
)
...
...
Source/MasterTestProject/Tileset.h
View file @
c87f5748
...
@@ -90,13 +90,14 @@ struct FTileContent
...
@@ -90,13 +90,14 @@ struct FTileContent
UPROPERTY
()
UPROPERTY
()
FString
url
;
FString
url
;
//
bool loadingStarted;
bool
loadingStarted
;
TArray
<
uint8
>
content
;
TArray
<
uint8
>
content
;
struct
FTileset
*
tileset
;
struct
FTileset
*
tileset
;
TArray
<
class
AProceduralEntity
*>
tiles
;
TArray
<
class
AProceduralEntity
*>
tiles
;
FTileContent
()
{
FTileContent
()
{
tileset
=
nullptr
;
tileset
=
nullptr
;
loadingStarted
=
false
;
}
}
};
};
...
@@ -174,10 +175,12 @@ struct FTileset
...
@@ -174,10 +175,12 @@ struct FTileset
FString
absoluteURL
;
FString
absoluteURL
;
FTile
*
parent
;
FTile
*
parent
;
class
ATilesetActor
*
parentActor
;
FTileset
()
{
FTileset
()
{
geometricError
=
-
1
;
geometricError
=
-
1
;
parent
=
nullptr
;
parent
=
nullptr
;
parentActor
=
nullptr
;
}
}
};
};
...
...
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