Commit 6e1ee0e8 by wester

i3dm start

parent c87f5748
......@@ -67,7 +67,7 @@ void ATilesetActor::Tick(float DeltaSeconds)
double SSE2 = tile->geometricError * C;
//UE_LOG(TILES, Error, TEXT("SSError= %f,SSE2= %f, GeoError = %f, Dist %f"), ScreenSpaceError1, SSE2, tile.geometricError, dist);
}
......@@ -78,8 +78,16 @@ double FTile::getScreenSpaceError(double lambda, FVector CamLocation)
FVector ActorPos = FTransform(*this->getAbsoluteTransform()).GetTranslation();
double dist = (CamLocation - ActorPos).Size();
if (content.url.EndsWith("i3d")) {
}
//SSE http://folk.uio.no/inftt/Div/visualization2.pdf
return lambda * this->geometricError / dist;
double sse = lambda * this->geometricError / dist;
//UE_LOG(TILES, Error, TEXT("sse = %f, geoE = %f Dist %f"), sse, this->geometricError, dist);
return sse;
}
void FTile::setVisible(bool visible)
......@@ -87,6 +95,7 @@ void FTile::setVisible(bool visible)
if (content.tiles.Num() == 0 && !content.tileset) {
if (!content.loadingStarted && visible && !content.url.IsEmpty()) {
if (parentTilset) {
UTileDownloader *downloader = NewObject<UTileDownloader>(UTileDownloader::StaticClass());
downloader->GetTileContent(parentTilset->parentActor, &content, parentTilset->absoluteURL, this);
......@@ -112,16 +121,13 @@ void FTile::setVisible(bool visible)
void ATilesetActor::updateScreenSpaceError(FTile* current, double currentSSE, double constant, FVector CamLocation)
{
double ScreenSpaceError1 = current->getScreenSpaceError(constant, CamLocation);
if (ScreenSpaceError1 > LODtreshold && current->children.Num() > 0) {
for (FTile* child : current->children)
{
updateScreenSpaceError(child, 0, constant, CamLocation);
}
current->setVisible(false);
}
else {
......@@ -203,6 +209,8 @@ 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);
}
}
void ATilesetActor::parseBatched3DTile(const TArray<uint8> data, FTile * tile)
......@@ -304,6 +312,7 @@ void ATilesetActor::parseInstanced3DTile(const TArray<uint8> data, FTile * tile)
void ATilesetActor::parse3DTile(const TArray<uint8> data, FTile *tile)
{
TileHeader *header = (TileHeader*) data.GetData();
tile->content.content = data;
UE_LOG(TILES, Warning, TEXT("Shared Tile Header: Magic: %s Version %d lenght %d, array lenght %d "), *header->getMagicAsFString(), header->version, header->byteLength, data.Num());
......
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