Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion unreal/Blocks/Blocks.uproject
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "5.1",
"EngineAssociation": "5.6",
"Category": "",
"Description": "",
"Modules": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (C) Microsoft Corporation. All rights reserved.

#include "LightActorBase.h"
#include "Components/LocalLightComponent.h"

// Returns true if able to set intensity on all light components
// False if any item is nullptr
Expand Down Expand Up @@ -38,7 +39,7 @@ bool ALightActorBase::SetRadius(float NewRadius) {
for(int i = 0; i < lightComponents.Num(); i++)
{
ULocalLightComponent* localLightComponent =
dynamic_cast<ULocalLightComponent*>(lightComponents[i]);
Cast<ULocalLightComponent>(lightComponents[i]);

if (localLightComponent != nullptr) {
localLightComponent->SetAttenuationRadius(NewRadius);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "bing_maps_utils.hpp"
#include "tile_info.hpp"
#include "core_sim/log_level.hpp"

AGISRenderer::AGISRenderer()
: SimServer(nullptr),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "KismetProceduralMeshLibrary.h"
#include "Materials/Material.h"
#include "Materials/MaterialInstanceDynamic.h"
#include <string>

// Sets default values
AProcMeshActor::AProcMeshActor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "UnrealLogger.h"
#include "core_sim/link/geometry/unreal_mesh.hpp"
#include "core_sim/math_utils.hpp"
#include "UnrealHelpers.h"

namespace projectairsim = microsoft::projectairsim;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "UObject/ConstructorHelpers.h"
#include "UnrealCameraRenderRequest.h"
#include "UnrealLogger.h"
#include "UnrealTransforms.h"

namespace projectairsim = microsoft::projectairsim;

Expand Down Expand Up @@ -128,12 +129,12 @@ void UGPULidar::SetupSceneCapture(
}

// Hide debug points in case "draw-debug-points" is set to true
OutSceneCaptureComp->HideComponent(
Cast<UPrimitiveComponent>(UnrealWorld->LineBatcher));
OutSceneCaptureComp->HideComponent(
Cast<UPrimitiveComponent>(UnrealWorld->PersistentLineBatcher));
OutSceneCaptureComp->HideComponent(
Cast<UPrimitiveComponent>(UnrealWorld->ForegroundLineBatcher));
OutSceneCaptureComp->HideComponent(Cast<UPrimitiveComponent>(
UnrealWorld->GetLineBatcher(UWorld::ELineBatcherType::World)));
OutSceneCaptureComp->HideComponent(Cast<UPrimitiveComponent>(
UnrealWorld->GetLineBatcher(UWorld::ELineBatcherType::WorldPersistent)));
OutSceneCaptureComp->HideComponent(Cast<UPrimitiveComponent>(
UnrealWorld->GetLineBatcher(UWorld::ELineBatcherType::Foreground)));

OutSceneCaptureComp->RegisterComponent();
auto RenderTarget = NewObject<UTextureRenderTarget2D>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <map>

#include "core_sim/message/image_message.hpp"
#include "UnrealLogger.h"

namespace projectairsim = microsoft::projectairsim;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "UnrealCameraRenderRequest.h"
#include "core_sim/sensors/camera.hpp"
#include "core_sim/transforms/transform_utils.hpp"
#include "UnrealCamera.h"

// This class follows the example template in Unreal's AsyncWork.h for
// FAutoDeleteAsyncTask that deletes itself after completion on a background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "SceneRendering.h"

#include "LidarIntensityShader.h"
#include "PostProcess/SceneFilterRendering.h"

static const bool DEBUG_RENDER_TO_VIEWPORT = false;

Expand Down Expand Up @@ -196,12 +197,12 @@ void FLidarIntensitySceneViewExtension::PrePostProcessPass_RenderThread(
FScreenPassPipelineState(VertexShader, PixelShader,
DefaultBlendState, DepthStencilState),
[&](FRHICommandListImmediate& RHICmdList) {
VertexShader->SetParameters(RHICmdList, View);
VertexShader->SetParameters(RHICmdList.GetScratchShaderParameters(), View);
SetShaderParameters(RHICmdList, VertexShader,
VertexShader.GetVertexShader(),
*PostProcessMaterialParameters);

PixelShader->SetParameters(RHICmdList, View);
PixelShader->SetParameters(RHICmdList.GetScratchShaderParameters(), View);
SetShaderParameters(RHICmdList, PixelShader,
PixelShader.GetPixelShader(),
*PostProcessMaterialParameters);
Expand Down Expand Up @@ -288,12 +289,12 @@ void FLidarIntensitySceneViewExtension::PrePostProcessPass_RenderThread(
RDG_EVENT_NAME("FCopyBufferToCPUPass"), CopyPassParameters,
ERDGPassFlags::Readback,
[this, &InitialData, PointCloudBufferRDG, BufferSize](FRHICommandList& RHICmdList) {
InitialData = (float*)RHILockBuffer(PointCloudBufferRDG->GetRHI(), 0,
InitialData = (float*)RHICmdList.LockBuffer(PointCloudBufferRDG->GetRHI(), 0,
BufferSize, RLM_ReadOnly);

FMemory::Memcpy(LidarPointCloudData.data(), InitialData, BufferSize);

RHIUnlockBuffer(PointCloudBufferRDG->GetRHI());
RHICmdList.UnlockBuffer(PointCloudBufferRDG->GetRHI());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ class FLidarIntensitySceneViewExtension : public FSceneViewExtensionBase {
FSceneView& InView) override {};
virtual void BeginRenderViewFamily(FSceneViewFamily& InViewFamily) override {};
virtual void PreRenderViewFamily_RenderThread(
FRHICommandListImmediate& RHICmdList,
FRDGBuilder& GraphBuilder,
FSceneViewFamily& InViewFamily) override {};
virtual void PreRenderView_RenderThread(FRHICommandListImmediate& RHICmdList,
virtual void PreRenderView_RenderThread(FRDGBuilder& GraphBuilder,
FSceneView& InView) override {};
virtual void PostRenderBasePass_RenderThread(
FRHICommandListImmediate& RHICmdList, FSceneView& InView) override {};

// Only implement this, called right before post processing begins.
virtual void PrePostProcessPass_RenderThread(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

#include "CoreMinimal.h"
#include "UnrealCameraRenderRequest.h"
#include "Runtime/Engine/Classes/Engine/TextureRenderTarget2D.h"
#include "Engine/TextureRenderTarget2D.h"

#include "RHI.h"
#include "RHIStaticStates.h"
#include "Runtime/RenderCore/Public/ShaderParameterUtils.h"
#include "Runtime/RenderCore/Public/RenderResource.h"
#include "Runtime/Renderer/Public/MaterialShader.h"
#include "Runtime/RenderCore/Public/RenderGraphResources.h"
#include "ShaderParameterUtils.h"
#include "RenderResource.h"
#include "MaterialShader.h"
#include "RenderGraphResources.h"

// FScreenPassTextureViewportParameters and FScreenPassTextureInput
#include "Runtime/Renderer/Private/ScreenPass.h"
#include "Runtime/Renderer/Private/SceneTextureParameters.h"
#include "ScreenPass.h"
#include "SceneTextureParameters.h"

BEGIN_SHADER_PARAMETER_STRUCT(FLidarIntensityShaderInputParameters, )
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
Expand Down Expand Up @@ -51,9 +51,9 @@ class FLidarIntensityPS : public FLidarIntensityShader {
const ShaderMetaType::CompiledShaderInitializerType& Initializer)
: FLidarIntensityShader(Initializer) {}

void SetParameters(FRHICommandList& RHICmdList, const FSceneView& View) {
void SetParameters(FRHIBatchedShaderParameters& BatchedParameters, const FSceneView& View) {
FGlobalShader::SetParameters<FViewUniformShaderParameters>(
RHICmdList, RHICmdList.GetBoundPixelShader(), View.ViewUniformBuffer);
BatchedParameters, View.ViewUniformBuffer);
}

static void ModifyCompilationEnvironment(
Expand All @@ -73,8 +73,8 @@ class FLidarIntensityVS : public FLidarIntensityShader {
const ShaderMetaType::CompiledShaderInitializerType& Initializer)
: FLidarIntensityShader(Initializer) {}

void SetParameters(FRHICommandList& RHICmdList, const FSceneView& View) {
void SetParameters(FRHIBatchedShaderParameters& BatchedParameters, const FSceneView& View) {
FGlobalShader::SetParameters<FViewUniformShaderParameters>(
RHICmdList, RHICmdList.GetBoundVertexShader(), View.ViewUniformBuffer);
BatchedParameters, View.ViewUniformBuffer);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "core_sim/message/image_message.hpp"
#include "core_sim/sensors/camera.hpp"
#include "core_sim/transforms/transform_utils.hpp"
#include "UnrealTransforms.h"

namespace projectairsim = microsoft::projectairsim;

Expand Down Expand Up @@ -146,12 +147,12 @@ void UUnrealCamera::LoadCameraMaterials() {

void HideDebugDrawComponent(USceneCaptureComponent2D* CaptureComponent,
UWorld* UnrealWorld) {
CaptureComponent->HideComponent(Cast<UPrimitiveComponent>(
UnrealWorld->GetLineBatcher(UWorld::ELineBatcherType::World)));
CaptureComponent->HideComponent(
Cast<UPrimitiveComponent>(UnrealWorld->LineBatcher));
CaptureComponent->HideComponent(
Cast<UPrimitiveComponent>(UnrealWorld->PersistentLineBatcher));
CaptureComponent->HideComponent(
Cast<UPrimitiveComponent>(UnrealWorld->ForegroundLineBatcher));
Cast<UPrimitiveComponent>(UnrealWorld->GetLineBatcher(UWorld::ELineBatcherType::WorldPersistent)));
CaptureComponent->HideComponent(Cast<UPrimitiveComponent>(
UnrealWorld->GetLineBatcher(UWorld::ELineBatcherType::Foreground)));
}

void UUnrealCamera::CreateComponents() {
Expand Down Expand Up @@ -915,7 +916,7 @@ void UUnrealCamera::OnRendered(
FTextureRenderTargetResource* RtResource =
CaptureComponent->TextureTarget->GetRenderTargetResource();
if (RtResource) {
FRHITexture2D* Texture = RtResource->GetRenderTargetTexture();
FRHITexture* Texture = RtResource->GetRenderTargetTexture();
// Copy pixel values out of Unreal's RHI
UnrealCameraRenderRequest::RenderResult ImageResult;
auto bIsDepthImage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void OnEndPlay() {
ImageWrapperModule = nullptr;
}

void ReadPixels(FRHITexture2D* Texture, bool bPixelsAsFloat,
void ReadPixels(FRHITexture* Texture, bool bPixelsAsFloat,
RenderResult* ImageResult) {
FRHICommandListImmediate& RHICmdList =
GetImmediateCommandList_ForRenderCommand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include "CoreMinimal.h"
#include "core_sim/clock.hpp"

namespace UnrealCameraRenderRequest {

Expand All @@ -23,7 +24,7 @@ void OnEndPlay();

void OnBeginPlay();

void ReadPixels(FRHITexture2D* Texture, bool bPixelsAsFloat,
void ReadPixels(FRHITexture* Texture, bool bPixelsAsFloat,
RenderResult* ImageResult);

bool CompressUsingImageWrapper(const TArray<FColor>& UnCompressed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Runtime/Core/Public/Async/ParallelFor.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
#include "UnrealLogger.h"
#include "UnrealTransforms.h"

namespace projectairsim = microsoft::projectairsim;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "Runtime/Core/Public/Async/ParallelFor.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
#include "UnrealLogger.h"
#include "UnrealTransforms.h"
#include "core_sim/clock.hpp"

namespace projectairsim = microsoft::projectairsim;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "core_sim/clock.hpp"
#include "core_sim/sensors/lidar.hpp"
#include "core_sim/transforms/transform_utils.hpp"
#include <memory>

// comment so that generated.h is always the last include file with clang-format
#include "UnrealLidar.generated.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ inline projectairsim::Kinematics UUnrealRadar::GetKinematicsFromActor(
// cast to get their kinematics.
projectairsim::Kinematics Kin; // constructs with zero values

const AUnrealRobot* RobotActor = Cast<AUnrealRobot, AActor>(Actor);
const AUnrealEnvActor* EnvActor = Cast<AUnrealEnvActor, AActor>(Actor);
const AUnrealRobot* RobotActor = Cast<AUnrealRobot>(Actor);
const AUnrealEnvActor* EnvActor = Cast<AUnrealEnvActor>(Actor);

if (RobotActor) {
Kin = RobotActor->GetKinematics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "Runtime/Engine/Classes/Engine/StaticMesh.h"
#include "UnrealLogger.h"
#include "core_sim/transforms/transform_utils.hpp"
#include "ProceduralMeshComponent.h"

// comment so that generated.h is always the last include file with clang-format
#include "UnrealHelpers.generated.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ DECLARE_LOG_CATEGORY_EXTERN(SimPlugin, All, All);

class UnrealLogger {
public:
template <size_t N, typename... ArgTypes>
template <typename... ArgTypes>
static void Log(microsoft::projectairsim::LogLevel level,
const TCHAR (&format)[N], ArgTypes... args);
UE::Core::TCheckedFormatString<FString::FmtCharType, ArgTypes...> format, ArgTypes... args);

static void LogSim(const std::string& module,
microsoft::projectairsim::LogLevel level,
Expand All @@ -23,9 +23,9 @@ class UnrealLogger {
static std::string GetTimeStamp();
};

template <size_t N, typename... ArgTypes>
template <typename... ArgTypes>
inline void UnrealLogger::Log(microsoft::projectairsim::LogLevel level,
const TCHAR (&format)[N], ArgTypes... args) {
UE::Core::TCheckedFormatString<FString::FmtCharType, ArgTypes...> format, ArgTypes... args) {
FString LogMessage = FString::Printf(format, args...);

// Output to Unreal's native log file/console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "UnrealLogger.h"
#include "World/WeatherLib.h"
#include "core_sim/clock.hpp"
#include "Sensors/UnrealCamera.h"

namespace projectairsim = microsoft::projectairsim;

Expand Down Expand Up @@ -606,7 +607,6 @@ bool AUnrealScene::GetSimBoundingBox3D(

nlohmann::json AUnrealScene::Get3DBoundingBoxServiceMethod(
const std::string& object_name, int box_alignment) {
FRotator BoxRotation;
FOrientedBox OrientedBox;
projectairsim::BBox3D OutBBox;
auto BoxAlignment =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AUnrealScene : public AActor {
TimeNano unreal_time;
bool using_unreal_physics;

std::unique_ptr<WorldSimApi> world_api;
std::unique_ptr<class WorldSimApi> world_api;
std::shared_ptr<TimeOfDay> time_of_day;
std::vector<std::string> objects_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "UnrealLogger.h"
#include "UnrealScene.h"
#include "simserver.hpp"
#include "Constant.h"

#ifdef ENABLE_CESIUM
#include "Cesium3DTileset.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "assimp/postprocess.h"
#include "assimp/scene.h"
#include "core_sim/actor/env_actor.hpp"
#include "assimp/Importer.hpp"
#include "core_sim/geodetic_converter.hpp"

namespace projectairsim = microsoft::projectairsim;

Expand Down Expand Up @@ -1243,7 +1245,7 @@ std::vector<std::string> WorldSimApi::swapTextures(const std::string& tag,
}

if (invalidChoice) continue;
dynamic_cast<ATextureShuffleActor*>(shuffler)->SwapTexture(
Cast<ATextureShuffleActor>(shuffler)->SwapTexture(
tex_id, component_id, material_id);
swappedObjectNames.push_back(TCHAR_TO_UTF8(*shuffler->GetName()));
}
Expand Down
Loading