Commit af788340 by wester

test

parent 8c7671c7
No preview for this file type
......@@ -8,6 +8,7 @@
#include "Tileset.h"
#include "PointCloudActor.h"
#include "Kismet/KismetMathLibrary.h"
#include "UnrealNetwork.h"
ATilesetActor::ATilesetActor(const FObjectInitializer& ObjectInitializer) {
......@@ -24,23 +25,24 @@ void ATilesetActor::BeginPlay()
//RootComponent = CreateDefaultSubobject<UStaticMeshComponent>("TESTMesh");
rootTileset = new FTileContent();
rootTileset->url = relativeURL;
//rootTileset = new FTileContent();
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);
UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass());
downloader->GetTileContent(this, rootTileset, host);
downloader->GetTileContent(this, &rootTileset, host);
}
void ATilesetActor::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
UWorld* const World = GetWorld();
if (World && GEngine && GEngine->GameViewport //game init
&& rootTileset && rootTileset->tileset) // tilset loaded
&& rootTileset.tileset) // tilset loaded
{
// viewport Cam pos and FOV
APlayerController* Controller = World->GetFirstPlayerController();
......@@ -52,7 +54,7 @@ void ATilesetActor::Tick(float DeltaSeconds)
double lambda = ViewportSize.X / FOV;
FTile *tile = &rootTileset->tileset->root;
FTile *tile = &rootTileset.tileset->root;
//FVector ActorPos = FTransform(*tile->getAbsoluteTransform()).GetTranslation();
//double dist = (CamLocation - ActorPos).Size();
......@@ -115,6 +117,8 @@ void FTile::setVisible(bool visible)
UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass());
downloader->GetTileContent(parentTilset->parentActor, &content, parentTilset->absoluteURL, this);
content.loadingStarted = true;
UE_LOG(TILES, Log, TEXT("Set Tile visible %s %s:"), parentTilset->parentActor->GetWorld()->IsServer() ? TEXT("Server") : TEXT("Client") , *content.url);
}
else {
UE_LOG(TILES, Error, TEXT("Parent tilset NUll"));
......@@ -567,3 +571,14 @@ float FBoundingVolume::getDistanceTo(FVector Position, FMatrix bouindingTransfor
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
UPROPERTY()
FString url;
UPROPERTY()
bool loadingStarted;
TArray<uint8> content;
struct FTileset *tileset;
TArray<class AProceduralEntity*> tiles;
......@@ -150,6 +153,8 @@ struct 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 };
transform.Empty();
......@@ -188,6 +193,7 @@ struct FTileset
geometricError = -1;
parent = nullptr;
parentActor = nullptr;
}
};
......@@ -361,12 +367,17 @@ public:
FTileset* parseTileset(FString JsonString, FString BaseURL);
void parse3DTile(const TArray<uint8> data, FTile *tile);
void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker);
//virtual bool ShouldTickIfViewportsOnly() override { return true; }
void updateScreenSpaceError(FTile* current, double currentSSE, double constant, FVector CamLocation);
UPROPERTY(replicated = false)
FTileContent rootTileset;
private:
FTileContent *rootTileset;
bool doreplicateTielset = false;
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