Quartz UI ↗
Browse docs
On this page
Private preview · 0.57.0-devView Markdown

QuartzUISpatialProjection: declaration reference

0.57.0-dev · beta source documentation. Native, Blueprint, Editor and rendering examples are source-reviewed, not executed in Unreal during this scan. See validation and limits.

Pinned source (source: Source/QuartzUIRuntime/Public/QuartzUISpatialProjection.h) · integration recipe · practical guide

FQuartzUISpatialProjectionSettings

Public type. Immediate game-thread projection utility for web-rendered world widgets. Sample after camera updates and publish through the web presentation path. The plugin does not render substitute native marker primitives.

Prerequisites / integration: Exact-player app/view and real supported RHI for rendering; project-owned HTML/materials. Use the QuartzUISpatialProjection recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: ProjectWorldLocations; pair output indices with stable IDs. Copied coordinates; host updates after camera pose.

Avoid: Double DPI conversion or one browser per marker. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUISpatialProjection.h#L16)

FQuartzUISpatialProjectionResult

Public type. One result in a stable, input-index-matched world projection batch.

Prerequisites / integration: Exact-player app/view and real supported RHI for rendering; project-owned HTML/materials. Use the QuartzUISpatialProjection recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: ProjectWorldLocations; pair output indices with stable IDs. Copied coordinates; host updates after camera pose.

Avoid: Double DPI conversion or one browser per marker. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUISpatialProjection.h#L56)

FQuartzUISpatialProjection

Public type. Allocation-bounded native batch projector used by gameplay adapters.

Prerequisites / integration: Exact-player app/view and real supported RHI for rendering; project-owned HTML/materials. Use the QuartzUISpatialProjection recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: ProjectWorldLocations; pair output indices with stable IDs. Copied coordinates; host updates after camera pose.

Avoid: Double DPI conversion or one browser per marker. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUISpatialProjection.h#L82)

UQuartzUISpatialBlueprintLibrary

Public type. Blueprint access to the same one-projection-data-per-batch native path.

Prerequisites / integration: Exact-player app/view and real supported RHI for rendering; project-owned HTML/materials. Use the QuartzUISpatialProjection recipe in the host module QuartzUIRuntime.

Minimal example / lifecycle: ProjectWorldLocations; pair output indices with stable IDs. Copied coordinates; host updates after camera pose.

Avoid: Double DPI conversion or one browser per marker. Match the exact declaration below; dependent DTOs/enums are values used by this owner, not independent systems.

Exact source line (source: Source/QuartzUIRuntime/Public/QuartzUISpatialProjection.h#L94)

Complete header

Source snapshot, not an additional example. Unreal annotations distinguish exposed Blueprint nodes from native-only/private methods.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"

#include "QuartzUISpatialProjection.generated.h"

class APlayerController;

/**
 * Immediate game-thread projection utility for web-rendered world widgets.
 * Sample after camera updates and publish through the web presentation path.
 * The plugin does not render substitute native marker primitives.
 */
USTRUCT(BlueprintType)
struct QUARTZUIRUNTIME_API FQuartzUISpatialProjectionSettings
{
	GENERATED_BODY()

	/** Return coordinates relative to the exact local player's viewport. */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial")
	bool bPlayerViewportRelative = true;

	/**
	 * Convert screen pixels through Unreal's viewport-host geometry into UMG/Slate
	 * widget coordinates. These coordinates are not browser CSS pixels.
	 */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial")
	bool bApplyDPIScale = true;

	/** Pixel-snap before widget-space conversion, matching Unreal's UMG helper. */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial")
	bool bRoundToPixel = true;

	/**
	 * Optional caller policy only. The camera-late projected layer defaults to a
	 * constant pixel size and true world surfaces use natural perspective.
	 */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial", meta = (ClampMin = "0.0"))
	float NearScaleDistance = 0.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial", meta = (ClampMin = "0.0"))
	float FarScaleDistance = 0.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial", meta = (ClampMin = "0.0"))
	float ScaleAtNearDistance = 1.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "QuartzUI|Spatial", meta = (ClampMin = "0.0"))
	float ScaleAtFarDistance = 1.0f;

	float GetScaleForDistance(float Distance) const;
};

/** One result in a stable, input-index-matched world projection batch. */
USTRUCT(BlueprintType)
struct QUARTZUIRUNTIME_API FQuartzUISpatialProjectionResult
{
	GENERATED_BODY()

	/** UMG/Slate widget coordinates when DPI conversion is enabled; otherwise pixels. */
	UPROPERTY(BlueprintReadOnly, Category = "QuartzUI|Spatial")
	FVector2D Position = FVector2D::ZeroVector;

	/** Distance from the current projection view origin in Unreal units. */
	UPROPERTY(BlueprintReadOnly, Category = "QuartzUI|Spatial")
	float Distance = 0.0f;

	/** Optional native distance scale computed from the shared batch settings. */
	UPROPERTY(BlueprintReadOnly, Category = "QuartzUI|Spatial")
	float Scale = 1.0f;

	/** True when the point is in front of the camera and projection remained valid. */
	UPROPERTY(BlueprintReadOnly, Category = "QuartzUI|Spatial")
	bool bProjected = false;

	/** True when the projected anchor lies inside this player's constrained view rect. */
	UPROPERTY(BlueprintReadOnly, Category = "QuartzUI|Spatial")
	bool bOnScreen = false;
};

/** Allocation-bounded native batch projector used by gameplay adapters. */
class QUARTZUIRUNTIME_API FQuartzUISpatialProjection final
{
public:
	static bool ProjectWorldLocations(
		const APlayerController* PlayerController,
		TConstArrayView<FVector> WorldLocations,
		const FQuartzUISpatialProjectionSettings& Settings,
		TArray<FQuartzUISpatialProjectionResult>& OutResults);
};

/** Blueprint access to the same one-projection-data-per-batch native path. */
UCLASS()
class QUARTZUIRUNTIME_API UQuartzUISpatialBlueprintLibrary final : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	/**
	 * Projects every input with one camera/projection-data lookup. Results always
	 * match WorldLocations by index, including points behind the camera.
	 */
	UFUNCTION(BlueprintCallable, Category = "QuartzUI|Spatial")
	static bool ProjectWorldLocations(
		const APlayerController* PlayerController,
		const TArray<FVector>& WorldLocations,
		const FQuartzUISpatialProjectionSettings& Settings,
		TArray<FQuartzUISpatialProjectionResult>& OutResults);
};