Commit af788340 by wester

test

parent 8c7671c7
No preview for this file type
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "Tileset.h" #include "Tileset.h"
#include "PointCloudActor.h" #include "PointCloudActor.h"
#include "Kismet/KismetMathLibrary.h" #include "Kismet/KismetMathLibrary.h"
#include "UnrealNetwork.h"
ATilesetActor::ATilesetActor(const FObjectInitializer& ObjectInitializer) { ATilesetActor::ATilesetActor(const FObjectInitializer& ObjectInitializer) {
...@@ -24,23 +25,24 @@ void ATilesetActor::BeginPlay() ...@@ -24,23 +25,24 @@ void ATilesetActor::BeginPlay()
//RootComponent = CreateDefaultSubobject<UStaticMeshComponent>("TESTMesh"); //RootComponent = CreateDefaultSubobject<UStaticMeshComponent>("TESTMesh");
rootTileset = new FTileContent(); //rootTileset = new FTileContent();
rootTileset->url = relativeURL; rootTileset.url = relativeURL;
UE_LOG(TILES, Error, TEXT("Tileset load %d: %s %s"), (int)GetWorld()->IsServer(), *relativeURL, *host); UE_LOG(TILES, Error, TEXT("Tileset load %s: %s %s"), GetWorld()->IsServer() ? TEXT("Server") : TEXT("Client") , *relativeURL, *host);
//UE_LOG(TILES, Error, TEXT("Tileset load : %s %s"), *relativeURL, *host); //UE_LOG(TILES, Error, TEXT("Tileset load : %s %s"), *relativeURL, *host);
UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass()); UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass());
downloader->GetTileContent(this, rootTileset, host); downloader->GetTileContent(this, &rootTileset, host);
} }
void ATilesetActor::Tick(float DeltaSeconds) void ATilesetActor::Tick(float DeltaSeconds)
{ {
Super::Tick(DeltaSeconds); Super::Tick(DeltaSeconds);
UWorld* const World = GetWorld(); UWorld* const World = GetWorld();
if (World && GEngine && GEngine->GameViewport //game init if (World && GEngine && GEngine->GameViewport //game init
&& rootTileset && rootTileset->tileset) // tilset loaded && rootTileset.tileset) // tilset loaded
{ {
// viewport Cam pos and FOV // viewport Cam pos and FOV
APlayerController* Controller = World->GetFirstPlayerController(); APlayerController* Controller = World->GetFirstPlayerController();
...@@ -52,7 +54,7 @@ void ATilesetActor::Tick(float DeltaSeconds) ...@@ -52,7 +54,7 @@ void ATilesetActor::Tick(float DeltaSeconds)
double lambda = ViewportSize.X / FOV; double lambda = ViewportSize.X / FOV;
FTile *tile = &rootTileset->tileset->root; FTile *tile = &rootTileset.tileset->root;
//FVector ActorPos = FTransform(*tile->getAbsoluteTransform()).GetTranslation(); //FVector ActorPos = FTransform(*tile->getAbsoluteTransform()).GetTranslation();
//double dist = (CamLocation - ActorPos).Size(); //double dist = (CamLocation - ActorPos).Size();
...@@ -115,6 +117,8 @@ void FTile::setVisible(bool visible) ...@@ -115,6 +117,8 @@ void FTile::setVisible(bool visible)
UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass()); UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass());
downloader->GetTileContent(parentTilset->parentActor, &content, parentTilset->absoluteURL, this); downloader->GetTileContent(parentTilset->parentActor, &content, parentTilset->absoluteURL, this);
content.loadingStarted = true; content.loadingStarted = true;
UE_LOG(TILES, Log, TEXT("Set Tile visible %s %s:"), parentTilset->parentActor->GetWorld()->IsServer() ? TEXT("Server") : TEXT("Client") , *content.url);
} }
else { else {
UE_LOG(TILES, Error, TEXT("Parent tilset NUll")); UE_LOG(TILES, Error, TEXT("Parent tilset NUll"));
...@@ -567,3 +571,14 @@ float FBoundingVolume::getDistanceTo(FVector Position, FMatrix bouindingTransfor ...@@ -567,3 +571,14 @@ float FBoundingVolume::getDistanceTo(FVector Position, FMatrix bouindingTransfor
return distance; return distance;
} }
void ATilesetActor::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)
{
UE_LOG(TILES, Error, TEXT("test"));
DOREPLIFETIME_ACTIVE_OVERRIDE(ATilesetActor, rootTileset, false);
}
void ATilesetActor::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
DOREPLIFETIME(ATilesetActor, rootTileset);
}
...@@ -94,7 +94,10 @@ struct FTileContent ...@@ -94,7 +94,10 @@ struct FTileContent
UPROPERTY() UPROPERTY()
FString url; FString url;
UPROPERTY()
bool loadingStarted; bool loadingStarted;
TArray<uint8> content; TArray<uint8> content;
struct FTileset *tileset; struct FTileset *tileset;
TArray<class AProceduralEntity*> tiles; TArray<class AProceduralEntity*> tiles;
...@@ -150,6 +153,8 @@ struct FTile ...@@ -150,6 +153,8 @@ struct FTile
FTile() { 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 }; 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.Empty();
...@@ -188,6 +193,7 @@ struct FTileset ...@@ -188,6 +193,7 @@ struct FTileset
geometricError = -1; geometricError = -1;
parent = nullptr; parent = nullptr;
parentActor = nullptr; parentActor = nullptr;
} }
}; };
...@@ -361,12 +367,17 @@ public: ...@@ -361,12 +367,17 @@ public:
FTileset* parseTileset(FString JsonString, FString BaseURL); FTileset* parseTileset(FString JsonString, FString BaseURL);
void parse3DTile(const TArray<uint8> data, FTile *tile); void parse3DTile(const TArray<uint8> data, FTile *tile);
void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker);
//virtual bool ShouldTickIfViewportsOnly() override { return true; } //virtual bool ShouldTickIfViewportsOnly() override { return true; }
void updateScreenSpaceError(FTile* current, double currentSSE, double constant, FVector CamLocation); void updateScreenSpaceError(FTile* current, double currentSSE, double constant, FVector CamLocation);
UPROPERTY(replicated = false)
FTileContent rootTileset;
private: private:
FTileContent *rootTileset; bool doreplicateTielset = false;
void parseTile(TSharedPtr<FJsonObject> json, FTile *targetTile, FTileset* parent); void parseTile(TSharedPtr<FJsonObject> json, FTile *targetTile, FTileset* parent);
......
"C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\Win64\UE4Editor.exe" "MasterTestProject.uproject" 10.1.2.95 -game
pause
\ No newline at end of file
"C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\Win64\UE4Editor.exe" "C:\Users\wester\Documents\Unreal Projects\MasterTestProjekt\MasterTestProject.uproject" DefaultVRMap?Listen -game
pause
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment