-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
}; |