Commit 8a7e97e5 by wester

oin cloud scale, position, iscard

parent c2733c41
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,8 +11,8 @@ APointCloudActor::APointCloudActor(const FObjectInitializer& ObjectInitializer)
PrimaryActorTick.bCanEverTick = true;
//Create Static Mesh
//static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/quadchain-2-20.quadchain-2-20'"));
static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/quadchain4096.quadchain4096'"));
static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/quadchain-2-20.quadchain-2-20'"));
//static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/quadchain4096.quadchain4096'"));
//static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/quadchain32.quadchain32'"));
//static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/square.square'"));
......@@ -35,9 +35,11 @@ APointCloudActor::APointCloudActor(const FObjectInitializer& ObjectInitializer)
}
void APointCloudActor::setPoints(UTexture2D* PointCloud) {
void APointCloudActor::setPoints(UTexture2D* PointCloud, FVector pos, FVector scale){
Material->SetTextureParameterValue(FName("PointCloud"), PointCloud);
Material->SetScalarParameterValue(FName("TextureSize"), PointCloud->GetSizeX());
Material->SetVectorParameterValue(FName("CloudCenter"), pos);
Material->SetVectorParameterValue(FName("BoundigBox"), scale);
Points = PointCloud;
StaticMeshComponent->SetMaterial(0, Material);
......
......@@ -13,7 +13,7 @@ class MASTERTESTPROJECT_API APointCloudActor : public AActor
public:
// Sets default values for this actor's properties
APointCloudActor(const FObjectInitializer& ObjectInitializer);
void setPoints(UTexture2D* Points);
void setPoints(UTexture2D* Points, FVector pos, FVector scale);
void setColors(UTexture2D* Colors);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Material")
......
......@@ -425,7 +425,8 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
/* if(tstTexture)
PointCloud->setPoints(tstTexture);
else*/
PointCloud->setPoints(Texture);
PointCloud->setPoints(Texture, FVector(minx, miny, minz), FVector((maxx - minx), (maxy - miny), (maxz - minz)));
//ass texture to mAterial
if (TextureTest) {
......@@ -451,7 +452,7 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
uint8* pos = start;
for (size_t i = 0; i < instances_length; i += 1)
{
FLinearColor temp = FLinearColor((*pos) / 255.0, (*(pos + 1)) / 255.0, (*(pos + 2)) / 255.0);
FLinearColor temp = FLinearColor((*pos) / 255.0, (*(pos + 1)) / 255.0, (*(pos + 2)) / 255.0, 1.0F);
ColorRGB->Add(temp);
pos += 3;
}
......@@ -461,7 +462,7 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
}
UTexture2D* ColorTexture = UDynamicTextureUtilities::CreateTransientDynamicTexture(TextureSize, TextureSize, PF_A32B32G32R32F);
UDynamicTextureUtilities::UpdateDynamicVectorTexture(*ColorRGB, ColorTexture);
UE_LOG(TILES, Warning, TEXT("Created Color Texture Number Points %d, TextureSize: %d, Fill: %d, "), instances_length, TextureSize, fill);
UE_LOG(TILES, Warning, TEXT("Created Color Texture Number Points %d, TextureSize: %d, Fill: %d, byteOffset: %d"), instances_length, TextureSize, fill, byteOffset);
PointCloud->setColors(ColorTexture);
}
......
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