Skip to content

Commit

Permalink
Added AOpenDriveReader
Browse files Browse the repository at this point in the history
  • Loading branch information
brifsttar committed Apr 7, 2023
1 parent 662d1b6 commit 8e5eded
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Content/BP_OpenDriveReader.uasset
Git LFS file not shown
34 changes: 34 additions & 0 deletions Source/OpenDRIVE/Private/OpenDriveReader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "OpenDriveReader.h"
#include "OpenDriveComponent.h"
#include "Components/BillboardComponent.h"
#include "EngineUtils.h"

AOpenDriveReader::AOpenDriveReader() {
PrimaryActorTick.bCanEverTick = false;
bRunConstructionScriptOnDrag = true;

struct FConstructorStatics {
ConstructorHelpers::FObjectFinder<UTexture2D> Texture0;
FConstructorStatics()
: Texture0(TEXT("Texture2D'/Engine/EditorResources/Waypoint'")) {
}
};
static FConstructorStatics ConstructorStatics;
BillboardComponent = CreateDefaultSubobject<UBillboardComponent>(TEXT("Billboard"));
SpriteTexture = ConstructorStatics.Texture0.Object;
BillboardComponent->Sprite = SpriteTexture;
RootComponent = BillboardComponent;

OpenDrive = CreateDefaultSubobject<UOpenDriveComponent>(TEXT("OpenDRIVE"));
OpenDrive->SetupAttachment(RootComponent);
}

void AOpenDriveReader::OnConstruction(const FTransform& Transform) {
Super::OnConstruction(Transform);
RoadId = OpenDrive->GetRoadId();
LaneId = OpenDrive->GetLaneId();
JunctionId = OpenDrive->GetJunctionId();
S = OpenDrive->GetS();
T = OpenDrive->GetT();
H = OpenDrive->GetH();
}
46 changes: 46 additions & 0 deletions Source/OpenDRIVE/Public/OpenDriveReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "OpenDriveReader.generated.h"

UCLASS()
class OPENDRIVE_API AOpenDriveReader : public AActor {
GENERATED_BODY()

protected:
UPROPERTY()
class UTexture2D* SpriteTexture;

public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "OpenDRIVE")
class UOpenDriveComponent* OpenDrive;

UPROPERTY(EditDefaultsOnly, Category = "OpenDRIVE")
class UBillboardComponent* BillboardComponent;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "OpenDRIVE")
int RoadId = -1;


UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "OpenDRIVE")
int LaneId = 0;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "OpenDRIVE")
int JunctionId = -1;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "OpenDRIVE")
float S = 0.;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "OpenDRIVE")
float T = 0.;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "OpenDRIVE")
float H = 0.;

public:
AOpenDriveReader();

void OnConstruction(const FTransform& Transform) override;

};

0 comments on commit 8e5eded

Please sign in to comment.