Commit f2b4d537 by Kai Westerkamp

argh

parent 4785d8d3
......@@ -364,9 +364,34 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
// creat pooint texture
TArray<FLinearColor> *Points = new TArray<FLinearColor>();
uint8* pos = start;
float minx, maxx, miny, maxy, minz, maxz;
minx = miny = minz = TNumericLimits< float >::Max();
maxx = maxy = maxz = TNumericLimits< float >::Min();
for (size_t i = 0; i < instances_length; i+=1)
{
Points->Add(FLinearColor(*((float*) pos), *((float*)(pos+4)), *((float*)(pos +8)), 1.0f));
float x = *((float*)pos);
float y = *((float*)(pos + 4));
float z = *((float*)(pos + 8));
x = (x + 1.0) / 4;
y = (x + 1.0) / 4;
z = (x + 1.0) / 4;
minx = FMath::Min(x, minx);
maxx = FMath::Max(x, maxx);
miny = FMath::Min(y, miny);
maxy = FMath::Max(y, maxy);
minz = FMath::Min(z, minz);
maxz = FMath::Max(z, maxz);
Points->Add(FLinearColor(x, y, z, 1.0f));
//UE_LOG(TILES, Warning, TEXT("%s"),*Points->Last().ToString());
pos += 12;
......@@ -377,7 +402,9 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
}
UTexture2D* Texture = UDynamicTextureUtilities::CreateTransientDynamicTexture(TextureSize, TextureSize, PF_A32B32G32R32F);
UDynamicTextureUtilities::UpdateDynamicVectorTexture(*Points, Texture);
UE_LOG(TILES, Warning, TEXT("Created Position Texture Number Points %d, TextureSize: %d, Fill: %d, "), instances_length, TextureSize, fill);
UE_LOG(TILES, Warning, TEXT("Created Position Texture Number Points %d, TextureSize: %d, Fill: %d"), instances_length, TextureSize, fill);
UE_LOG(TILES, Error, TEXT("Boundig %f Box: Min [%f/%f/%f] Max [%f/%f/%f]"), TNumericLimits< float >::Min(), minx, miny, minz,maxx, maxy, maxz );
PointCloud->setPoints(Texture);
//ass texture to mAterial
......@@ -402,7 +429,6 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
// creat pooint texture
TArray<FLinearColor> *ColorRGB = new TArray<FLinearColor>();
uint8* pos = start;
UE_LOG(TILES, Error, TEXT("Start %d Color %s"), start, *FLinearColor((*pos) / 255.0, (*(pos + 1)) / 255.0, (*(pos + 2)) / 255.0).ToString());
for (size_t i = 0; i < instances_length; i += 1)
{
FLinearColor temp = FLinearColor((*pos) / 255.0, (*(pos + 1)) / 255.0, (*(pos + 2)) / 255.0);
......
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