Commit ffd001c1 by wester

Point cloud actor

parent b4c537e6
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -85,3 +85,43 @@ HttpMaxConnectionsPerServer=16
bEnableHttp=true
bUseNullHttp=false
HttpDelayTime=0
[/Script/Engine.PhysicsSettings]
DefaultGravityZ=-980.000000
DefaultTerminalVelocity=4000.000000
DefaultFluidFriction=0.300000
SimulateScratchMemorySize=262144
RagdollAggregateThreshold=4
TriangleMeshTriangleMinAreaThreshold=5.000000
bEnableAsyncScene=False
bEnableShapeSharing=False
bEnablePCM=False
bWarnMissingLocks=True
bEnable2DPhysics=False
LockedAxis=Invalid
DefaultDegreesOfFreedom=Full3D
BounceThresholdVelocity=200.000000
FrictionCombineMode=Average
RestitutionCombineMode=Average
MaxAngularVelocity=3600.000000
MaxDepenetrationVelocity=0.000000
ContactOffsetMultiplier=0.010000
MinContactOffset=0.000100
MaxContactOffset=1.000000
bSimulateSkeletalMeshOnDedicatedServer=True
DefaultShapeComplexity=CTF_UseSimpleAndComplex
bDefaultHasComplexCollision=True
bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableCCD=False
MaxPhysicsDeltaTime=0.033333
bSubstepping=False
bSubsteppingAsync=False
MaxSubstepDeltaTime=0.016667
MaxSubsteps=6
SyncSceneSmoothingFactor=0.000000
AsyncSceneSmoothingFactor=0.990000
InitialAverageFrameRate=0.016667
// Fill out your copyright notice in the Description page of Project Settings.
#include "MasterTestProject.h"
#include "PointCloudActor.h"
// Sets default values
APointCloudActor::APointCloudActor(const FObjectInitializer& ObjectInitializer)
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
//Create Static Mesh
static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshOb_AW2(TEXT("StaticMesh'/Game/PointClouds/quadchain-2-20.quadchain-2-20'"));
StaticMesh = StaticMeshOb_AW2.Object;
StaticMeshComponent = ObjectInitializer.CreateDefaultSubobject < UStaticMeshComponent >(this, TEXT("Poins"));
StaticMeshComponent->SetStaticMesh(StaticMesh);
//Create Material
static ConstructorHelpers::FObjectFinder<UMaterial> MaterialPrototype(TEXT("Material'/Game/PointClouds/StaticPointCloudMat.StaticPointCloudMat'"));
if (MaterialPrototype.Object != NULL)
{
UMaterial* TheMaterial = (UMaterial*)MaterialPrototype.Object;
Material = UMaterialInstanceDynamic::Create(TheMaterial, nullptr);
StaticMeshComponent->SetMaterial(0, Material);
}
}
void APointCloudActor::setPoints(UTexture2D* PointCloud) {
Material->SetTextureParameterValue(FName("PointCloud"), PointCloud);
Poitns = PointCloud;
StaticMeshComponent->SetMaterial(0, Material);
}
// Called when the game starts or when spawned
void APointCloudActor::BeginPlay()
{
Super::BeginPlay();
//StaticMeshComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
}
// Called every frame
void APointCloudActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "PointCloudActor.generated.h"
UCLASS()
class MASTERTESTPROJECT_API APointCloudActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
APointCloudActor(const FObjectInitializer& ObjectInitializer);
void setPoints(UTexture2D* Points);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Material")
UMaterialInstanceDynamic* Material;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Points")
UStaticMesh* StaticMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Points")
UStaticMeshComponent* StaticMeshComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Points")
UTexture2D* Poitns;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
......@@ -6,6 +6,7 @@
#include "TileDownloader.h"
#include "ue4-assimp/ProceduralEntity.h"
#include "Tileset.h"
#include "PointCloudActor.h"
#include "Kismet/KismetMathLibrary.h"
......@@ -373,6 +374,17 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
UDynamicTextureUtilities::UpdateDynamicVectorTexture(*Points, Texture);
UE_LOG(TILES, Warning, TEXT("Created Position Texture Number Points %d, TextureSize: %d, Fill: %d, "), instances_length, TextureSize, fill);
UWorld* const World = GetWorld();
if (World)
{
APointCloudActor *PointCloud = World->SpawnActor<APointCloudActor>(APointCloudActor::StaticClass());
PointCloud->setPoints(Texture);
#if WITH_EDITOR
PointCloud->SetFolderPath(FName(*("SpawnedGLTF/" + this->GetName())));
#endif
PointCloud->AttachToActor(this, FAttachmentTransformRules::KeepWorldTransform);
}
//ass texture to mAterial
if (TextureTest) {
UMaterialInstanceDynamic *Material = UMaterialInstanceDynamic::Create(TextureTest->GetStaticMeshComponent()->GetMaterial(0), nullptr);
......@@ -413,7 +425,7 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
if (TextureTest) {
UMaterialInstanceDynamic *Material = UMaterialInstanceDynamic::Create(TextureTest->GetStaticMeshComponent()->GetMaterial(0), nullptr);
Material->SetTextureParameterValue(FName("DynamicTexture"), Texture);
TextureTest->GetStaticMeshComponent()->SetMaterial(0, Material);
//TextureTest->GetStaticMeshComponent()->SetMaterial(0, Material);
}
}
......
......@@ -4,6 +4,7 @@
#include "UObject/NoExportTypes.h"
#include "DynamicTextureUtilities.h"
#include "Tileset.generated.h"
......@@ -344,6 +345,7 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Texture")
AStaticMeshActor *TextureTest = NULL;
// Called when the game starts or when spawned
virtual void BeginPlay() override;
......
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