Cesium for Unreal 2.15.0
Loading...
Searching...
No Matches
Cesium3DTileset.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Cesium3DTilesSelection/Tileset.h"
6#include "Cesium3DTilesSelection/ViewState.h"
7#include "Cesium3DTilesSelection/ViewUpdateResult.h"
12#include "CesiumGeoreference.h"
13#include "CesiumIonServer.h"
16#include "CoreMinimal.h"
18#include "Engine/EngineTypes.h"
19#include "GameFramework/Actor.h"
20#include "Interfaces/IHttpRequest.h"
21#include "PrimitiveSceneProxy.h"
22#include <PhysicsEngine/BodyInstance.h>
23#include <atomic>
24#include <chrono>
25#include <glm/mat4x4.hpp>
26#include <unordered_map>
27#include <vector>
28#include "Cesium3DTileset.generated.h"
29
30#ifdef CESIUM_DEBUG_TILE_STATES
31#include <Cesium3DTilesSelection/DebugTileStateDatabase.h>
32#endif
33
34class UMaterialInterface;
35class ACesiumCartographicSelection;
37class UCesiumBoundingVolumePoolComponent;
38class CesiumViewExtension;
39struct FCesiumCamera;
40
41namespace Cesium3DTilesSelection {
42class Tileset;
43class TilesetView;
45} // namespace Cesium3DTilesSelection
46
47/**
48 * The delegate for OnCesium3DTilesetLoadFailure, which is triggered when
49 * the tileset encounters a load error.
50 */
52 FCesium3DTilesetLoadFailure,
54
56 FCesiumSampleHeightMostDetailedCallback,
58 const TArray<FCesiumSampleHeightResult>&,
59 const TArray<FString>&);
60
61/**
62 * The delegate for the Acesium3DTileset::OnTilesetLoaded,
63 * which is triggered from UpdateLoadStatus
64 */
66
67CESIUMRUNTIME_API extern FCesium3DTilesetLoadFailure
69
70UENUM(BlueprintType)
71enum class ETilesetSource : uint8 {
72 /**
73 * The tileset will be loaded from Cesium Ion using the provided IonAssetID
74 * and IonAccessToken.
75 */
76 FromCesiumIon UMETA(DisplayName = "From Cesium Ion"),
77
78 /**
79 * The tileset will be loaded from the specified Url.
80 */
81 FromUrl UMETA(DisplayName = "From Url"),
82
83 /**
84 * The tileset will be loaded from the georeference ellipsoid.
85 */
86 FromEllipsoid UMETA(DisplayName = "From Ellipsoid")
87};
88
89UENUM(BlueprintType)
90enum class EApplyDpiScaling : uint8 { Yes, No, UseProjectDefault };
91
92UCLASS()
93class CESIUMRUNTIME_API ACesium3DTileset : public AActor {
94 GENERATED_BODY()
95
96public:
99
100private:
101 UPROPERTY(VisibleAnywhere, Category = "Cesium") USceneComponent* Root;
102
103 UPROPERTY(
104 Meta =
105 (AllowPrivateAccess,
106 DeprecatedProperty,
107 DeprecationMessage =
108 "Use the Mobility property on the RootComponent instead."))
109 TEnumAsByte<EComponentMobility::Type> Mobility_DEPRECATED =
110 EComponentMobility::Static;
111
112public:
113 UFUNCTION(BlueprintCallable, meta = (DeprecatedFunction))
114 EComponentMobility::Type GetMobility() const {
115 return this->RootComponent->Mobility;
116 }
117 UFUNCTION(BlueprintCallable, meta = (DeprecatedFunction))
118 void SetMobility(EComponentMobility::Type NewMobility);
119
120 /**
121 * @brief Initiates an asynchronous query for the height of this tileset at a
122 * list of cartographic positions, where the Longitude (X) and Latitude (Y)
123 * are given in degrees. The most detailed available tiles are used to
124 * determine each height.
125 *
126 * The height of the input positions is ignored, unless height sampling fails
127 * at that location. The output height is expressed in meters above the
128 * ellipsoid (usually WGS84), which should not be confused with a height above
129 * mean sea level.
130 *
131 * @param LongitudeLatitudeHeightArray The cartographic positions for which to
132 * sample heights. The Longitude (X) and Latitude (Y) are expressed in
133 * degrees, while Height (Z) is given in meters.
134 * @param OnHeightsSampled A callback that is invoked in the game thread when
135 * heights have been sampled for all positions.
136 */
138 const TArray<FVector>& LongitudeLatitudeHeightArray,
139 FCesiumSampleHeightMostDetailedCallback OnHeightsSampled);
140
141private:
142 /**
143 * The designated georeference actor controlling how the actor's
144 * coordinate system relates to the coordinate system in this Unreal Engine
145 * level.
146 *
147 * If this is null, the Tileset will find and use the first Georeference
148 * Actor in the level, or create one if necessary. To get the active/effective
149 * Georeference from Blueprints or C++, use ResolvedGeoreference instead.
150 */
151 UPROPERTY(
152 EditAnywhere,
153 BlueprintReadWrite,
154 BlueprintGetter = GetGeoreference,
155 BlueprintSetter = SetGeoreference,
156 Category = "Cesium",
157 Meta = (AllowPrivateAccess))
158 TSoftObjectPtr<ACesiumGeoreference> Georeference;
159
160 /**
161 * The resolved georeference used by this Tileset. This is not serialized
162 * because it may point to a Georeference in the PersistentLevel while this
163 * tileset is in a sublevel. If the Georeference property is specified,
164 * however then this property will have the same value.
165 *
166 * This property will be null before ResolveGeoreference is called.
167 */
168 UPROPERTY(
169 Transient,
170 VisibleAnywhere,
171 BlueprintReadOnly,
172 Category = "Cesium",
173 Meta = (AllowPrivateAccess))
174 ACesiumGeoreference* ResolvedGeoreference = nullptr;
175
176public:
177 /** @copydoc ACesium3DTileset::Georeference */
178 UFUNCTION(BlueprintCallable, Category = "Cesium")
179 TSoftObjectPtr<ACesiumGeoreference> GetGeoreference() const;
180
181 /** @copydoc ACesium3DTileset::Georeference */
182 UFUNCTION(BlueprintCallable, Category = "Cesium")
183 void SetGeoreference(TSoftObjectPtr<ACesiumGeoreference> NewGeoreference);
184
185 /**
186 * Resolves the Cesium Georeference to use with this Actor. Returns
187 * the value of the Georeference property if it is set. Otherwise, finds a
188 * Georeference in the World and returns it, creating it if necessary. The
189 * resolved Georeference is cached so subsequent calls to this function will
190 * return the same instance.
191 */
192 UFUNCTION(BlueprintCallable, Category = "Cesium")
194
195 /**
196 * Invalidates the cached resolved georeference, unsubscribing from it and
197 * setting it to null. The next time ResolveGeoreference is called, the
198 * Georeference will be re-resolved and re-subscribed.
199 */
200 UFUNCTION(BlueprintCallable, Category = "Cesium")
202
203private:
204 /**
205 * The actor managing this tileset's content attributions.
206 *
207 * If this is null, the Tileset will find and use the first Credit System
208 * Actor in the level, or create one if necessary. To get the active/effective
209 * Credit System from Blueprints or C++, use ResolvedCreditSystem instead.
210 */
211 UPROPERTY(
212 EditAnywhere,
213 BlueprintReadWrite,
214 BlueprintGetter = GetCreditSystem,
215 BlueprintSetter = SetCreditSystem,
216 Category = "Cesium",
217 Meta = (AllowPrivateAccess))
218 TSoftObjectPtr<ACesiumCreditSystem> CreditSystem;
219
220 /**
221 * The resolved Credit System used by this Tileset. This is not serialized
222 * because it may point to a Credit System in the PersistentLevel while this
223 * tileset is in a sublevel. If the CreditSystem property is specified,
224 * however then this property will have the same value.
225 *
226 * This property will be null before ResolveCreditSystem is called.
227 */
228 UPROPERTY(
229 Transient,
230 BlueprintReadOnly,
231 Category = "Cesium",
232 Meta = (AllowPrivateAccess))
233 ACesiumCreditSystem* ResolvedCreditSystem = nullptr;
234
235 /**
236 * The actor providing custom cameras for use with this Tileset.
237 *
238 * If this is null, the Tileset will find and use the first
239 * CesiumCameraManager Actor in the level, or create one if necessary. To get
240 * the active/effective Camera Manager from Blueprints or C++, use
241 * ResolvedCameraManager instead.
242 */
243 UPROPERTY(
244 EditAnywhere,
245 BlueprintReadWrite,
246 BlueprintGetter = GetCameraManager,
247 BlueprintSetter = SetCameraManager,
248 Category = "Cesium",
249 Meta = (AllowPrivateAccess))
250 TSoftObjectPtr<ACesiumCameraManager> CameraManager;
251
252 /**
253 * The resolved Camera Manager used by this Tileset. This is not serialized
254 * because it may point to a Camera Manager in the PersistentLevel while this
255 * tileset is in a sublevel. If the CameraManager property is specified,
256 * however then this property will have the same value.
257 *
258 * This property will be null before ResolveCameraManager is called.
259 */
260 UPROPERTY(
261 Transient,
262 BlueprintReadOnly,
263 Category = "Cesium",
264 Meta = (AllowPrivateAccess))
265 ACesiumCameraManager* ResolvedCameraManager = nullptr;
266
267 /**
268 * The bounding volume pool component that manages occlusion bounding volume
269 * proxies.
270 */
271 UPROPERTY(
272 Transient,
273 BlueprintReadOnly,
274 Category = "Cesium",
275 Meta = (AllowPrivateAccess))
276 UCesiumBoundingVolumePoolComponent* BoundingVolumePoolComponent = nullptr;
277
278 /**
279 * The custom view extension this tileset uses to pull renderer view
280 * information.
281 */
282 TSharedPtr<CesiumViewExtension, ESPMode::ThreadSafe> _cesiumViewExtension =
283 nullptr;
284
285public:
286 /** @copydoc ACesium3DTileset::CreditSystem */
287 UFUNCTION(BlueprintCallable, Category = "Cesium")
288 TSoftObjectPtr<ACesiumCreditSystem> GetCreditSystem() const;
289
290 /** @copydoc ACesium3DTileset::CreditSystem */
291 UFUNCTION(BlueprintCallable, Category = "Cesium")
292 void SetCreditSystem(TSoftObjectPtr<ACesiumCreditSystem> NewCreditSystem);
293
294 /**
295 * Resolves the Cesium Credit System to use with this Actor. Returns
296 * the value of the CreditSystem property if it is set. Otherwise, finds a
297 * Credit System in the World and returns it, creating it if necessary. The
298 * resolved Credit System is cached so subsequent calls to this function will
299 * return the same instance.
300 */
301 UFUNCTION(BlueprintCallable, Category = "Cesium")
303
304 /**
305 * Invalidates the cached resolved Credit System, setting it to null. The next
306 * time ResolveCreditSystem is called, the Credit System will be re-resolved.
307 */
308 UFUNCTION(BlueprintCallable, Category = "Cesium")
310
311 /**
312 * Whether or not to show this tileset's credits on screen.
313 */
314 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
316
317 /** @copydoc ACesium3DTileset::CameraManager */
318 UFUNCTION(BlueprintGetter, Category = "Cesium")
319 TSoftObjectPtr<ACesiumCameraManager> GetCameraManager() const;
320
321 /** @copydoc ACesium3DTileset::CameraManager */
322 UFUNCTION(BlueprintSetter, Category = "Cesium")
323 void SetCameraManager(TSoftObjectPtr<ACesiumCameraManager> NewCameraManager);
324
325 /**
326 * Resolves the Cesium Camera Manager to use with this Actor. Returns
327 * the value of the CameraManager property if it is set. Otherwise, finds a
328 * Camera Manager in the World and returns it, creating it if necessary. The
329 * resolved Camera Manager is cached so subsequent calls to this function will
330 * return the same instance.
331 */
332 UFUNCTION(BlueprintCallable, Category = "Cesium")
334
335 /**
336 * Invalidates the cached resolved Camera Manager, setting it to null. The
337 * next time ResolveCameraManager is called, the Camera Manager will be
338 * re-resolved.
339 */
340 UFUNCTION(BlueprintCallable, Category = "Cesium")
342
343 /**
344 * The maximum number of pixels of error when rendering this tileset.
345 *
346 * This is used to select an appropriate level-of-detail: A low value
347 * will cause many tiles with a high level of detail to be loaded,
348 * causing a finer visual representation of the tiles, but with a
349 * higher performance cost for loading and rendering. A higher value will
350 * cause a coarser visual representation, with lower performance
351 * requirements.
352 *
353 * When a tileset uses the older layer.json / quantized-mesh format rather
354 * than 3D Tiles, this value is effectively divided by 8.0. So the default
355 * value of 16.0 corresponds to the standard value for quantized-mesh terrain
356 * of 2.0.
357 */
358 UPROPERTY(
359 EditAnywhere,
360 BlueprintGetter = GetMaximumScreenSpaceError,
361 BlueprintSetter = SetMaximumScreenSpaceError,
362 Category = "Cesium|Level of Detail",
363 meta = (ClampMin = 0.0))
365
366 /**
367 * Scale Level-of-Detail by Display DPI. This increases the performance for
368 * mobile devices and high DPI screens.
369 */
370 UPROPERTY(
371 EditAnywhere,
372 BlueprintReadWrite,
373 Category = "Cesium|Level of Detail")
375
376 /**
377 * Whether to preload ancestor tiles.
378 *
379 * Setting this to true optimizes the zoom-out experience and provides more
380 * detail in newly-exposed areas when panning. The down side is that it
381 * requires loading more tiles.
382 */
383 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Loading")
384 bool PreloadAncestors = true;
385
386 /**
387 * Whether to preload sibling tiles.
388 *
389 * Setting this to true causes tiles with the same parent as a rendered tile
390 * to be loaded, even if they are culled. Setting this to true may provide a
391 * better panning experience at the cost of loading more tiles.
392 */
393 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Loading")
394 bool PreloadSiblings = true;
395
396 /**
397 * Whether to unrefine back to a parent tile when a child isn't done loading.
398 *
399 * When this is set to true, the tileset will guarantee that the tileset will
400 * never be rendered with holes in place of tiles that are not yet loaded,
401 * even though the tile that is rendered instead may have low resolution. When
402 * false, overall loading will be faster, but newly-visible parts of the
403 * tileset may initially be blank.
404 */
405 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Loading")
406 bool ForbidHoles = false;
407
408 /**
409 * The maximum number of tiles that may be loaded at once.
410 *
411 * When new parts of the tileset become visible, the tasks to load the
412 * corresponding tiles are put into a queue. This value determines how
413 * many of these tasks are processed at the same time. A higher value
414 * may cause the tiles to be loaded and rendered more quickly, at the
415 * cost of a higher network- and processing load.
416 */
417 UPROPERTY(
418 EditAnywhere,
419 BlueprintReadWrite,
420 Category = "Cesium|Tile Loading",
421 meta = (ClampMin = 0))
423
424 /**
425 * @brief The maximum number of bytes that may be cached.
426 *
427 * Note that this value, even if 0, will never
428 * cause tiles that are needed for rendering to be unloaded. However, if the
429 * total number of loaded bytes is greater than this value, tiles will be
430 * unloaded until the total is under this number or until only required tiles
431 * remain, whichever comes first.
432 */
433 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Loading")
434 int64 MaximumCachedBytes = 256 * 1024 * 1024;
435
436 /**
437 * The number of loading descendents a tile should allow before deciding to
438 * render itself instead of waiting.
439 *
440 * Setting this to 0 will cause each level of detail to be loaded
441 * successively. This will increase the overall loading time, but cause
442 * additional detail to appear more gradually. Setting this to a high value
443 * like 1000 will decrease the overall time until the desired level of detail
444 * is achieved, but this high-detail representation will appear at once, as
445 * soon as it is loaded completely.
446 */
447 UPROPERTY(
448 EditAnywhere,
449 BlueprintReadWrite,
450 Category = "Cesium|Tile Loading",
451 meta = (ClampMin = 0))
453
454 /**
455 * Whether to cull tiles that are outside the frustum.
456 *
457 * By default this is true, meaning that tiles that are not visible with the
458 * current camera configuration will be ignored. It can be set to false, so
459 * that these tiles are still considered for loading, refinement and
460 * rendering.
461 *
462 * This will cause more tiles to be loaded, but helps to avoid holes and
463 * provides a more consistent mesh, which may be helpful for physics.
464 *
465 * Note that this will always be disabled if UseLodTransitions is set to true.
466 */
467 UPROPERTY(
468 EditAnywhere,
469 BlueprintReadWrite,
470 Category = "Cesium|Tile Culling",
471 Meta = (EditCondition = "!UseLodTransitions", EditConditionHides))
473
474 /**
475 * Whether to cull tiles that are occluded by fog.
476 *
477 * This does not refer to the atmospheric fog of the Unreal Engine,
478 * but to an internal representation of fog: Depending on the height
479 * of the camera above the ground, tiles that are far away (close to
480 * the horizon) will be culled when this flag is enabled.
481 *
482 * Note that this will always be disabled if UseLodTransitions is set to true.
483 */
484 UPROPERTY(
485 EditAnywhere,
486 BlueprintReadWrite,
487 Category = "Cesium|Tile Culling",
488 Meta = (EditCondition = "!UseLodTransitions", EditConditionHides))
489 bool EnableFogCulling = true;
490
491 /**
492 * Whether a specified screen-space error should be enforced for tiles that
493 * are outside the frustum or hidden in fog.
494 *
495 * When "Enable Frustum Culling" and "Enable Fog Culling" are both true, tiles
496 * outside the view frustum or hidden in fog are effectively ignored, and so
497 * their level-of-detail doesn't matter. And in this scenario, this property
498 * is ignored.
499 *
500 * However, when either of those flags are false, these "would-be-culled"
501 * tiles continue to be processed, and the question arises of how to handle
502 * their level-of-detail. When this property is false, refinement terminates
503 * at these tiles, no matter what their current screen-space error. The tiles
504 * are available for physics, shadows, etc., but their level-of-detail may
505 * be very low.
506 *
507 * When set to true, these tiles are refined until they achieve the specified
508 * "Culled Screen Space Error". This allows control over the minimum quality
509 * of these would-be-culled tiles.
510 */
511 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Culling")
513
514 /**
515 * The screen-space error to be enforced for tiles that are outside the view
516 * frustum or hidden in fog.
517 *
518 * When "Enable Frustum Culling" and "Enable Fog Culling" are both true, tiles
519 * outside the view frustum or hidden in fog are effectively ignored, and so
520 * their level-of-detail doesn't matter. And in this scenario, this property
521 * is ignored.
522 *
523 * However, when either of those flags are false, these "would-be-culled"
524 * tiles continue to be processed, and the question arises of how to handle
525 * their level-of-detail. When "Enforce Culled Screen Space Error" is false,
526 * this property is ignored and refinement terminates at these tiles, no
527 * matter what their current screen-space error. The tiles are available for
528 * physics, shadows, etc., but their level-of-detail may be very low.
529 *
530 * When set to true, these tiles are refined until they achieve the
531 * screen-space error specified by this property.
532 */
533 UPROPERTY(
534 EditAnywhere,
535 BlueprintReadWrite,
536 Category = "Cesium|Tile Culling",
537 meta = (EditCondition = "EnforceCulledScreenSpaceError", ClampMin = 0.0))
539
540 // This mirrors
541 // UCesiumRuntimeSettings::EnableExperimentalOcclusionCullingFeature so that
542 // it can be used as an EditCondition.
543 UPROPERTY(Transient, VisibleDefaultsOnly, Category = "Cesium|Tile Occlusion")
545
546 /**
547 * Whether to cull tiles that are occluded.
548 *
549 * If this option is disabled, check that "Enable Experimental Occlusion
550 * Culling Feature" is enabled in the Plugins -> Cesium section of the Project
551 * Settings.
552 *
553 * When enabled, this feature will use Unreal's occlusion system to determine
554 * if tiles are actually visible on the screen. For tiles found to be
555 * occluded, the tile will not refine to show descendants, but it will still
556 * be rendered to avoid holes. This results in less tile loads and less GPU
557 * resource usage for dense, high-occlusion scenes like ground-level views in
558 * cities.
559 *
560 * This will not work for tilesets with poorly fit bounding volumes and cause
561 * more draw calls with very few extra culled tiles. When there is minimal
562 * occlusion in a scene, such as with terrain tilesets and applications
563 * focused on top-down views, this feature will yield minimal benefit and
564 * potentially cause needless overhead.
565 */
566 UPROPERTY(
567 EditAnywhere,
568 BlueprintGetter = GetEnableOcclusionCulling,
569 BlueprintSetter = SetEnableOcclusionCulling,
570 Category = "Cesium|Tile Occlusion",
571 meta = (EditCondition = "CanEnableOcclusionCulling"))
573
574 /**
575 * The number of CesiumBoundingVolumeComponents to use for querying the
576 * occlusion state of traversed tiles.
577 *
578 * Only applicable when EnableOcclusionCulling is enabled.
579 */
580 UPROPERTY(
581 EditAnywhere,
582 BlueprintGetter = GetOcclusionPoolSize,
583 BlueprintSetter = SetOcclusionPoolSize,
584 Category = "Cesium|Tile Occlusion",
585 meta =
586 (EditCondition =
587 "EnableOcclusionCulling && CanEnableOcclusionCulling",
588 ClampMin = "0",
589 ClampMax = "1000"))
590 int32 OcclusionPoolSize = 500;
591
592 /**
593 * Whether to wait for valid occlusion results before refining tiles.
594 *
595 * Only applicable when EnableOcclusionCulling is enabled. When this option
596 * is enabled, there may be small delays before tiles are refined, but there
597 * may be an overall performance advantage by avoiding loads of descendants
598 * that will be found to be occluded.
599 */
600 UPROPERTY(
601 EditAnywhere,
602 BlueprintGetter = GetDelayRefinementForOcclusion,
603 BlueprintSetter = SetDelayRefinementForOcclusion,
604 Category = "Cesium|Tile Occlusion",
605 meta =
606 (EditCondition =
607 "EnableOcclusionCulling && CanEnableOcclusionCulling"))
609
610 /**
611 * Refreshes this tileset, ensuring that all materials and other settings are
612 * applied. It is not usually necessary to invoke this, but when
613 * behind-the-scenes changes are made and not reflected in the tileset, this
614 * function can help.
615 */
616 UFUNCTION(CallInEditor, BlueprintCallable, Category = "Cesium")
618
619 /**
620 * Pauses level-of-detail and culling updates of this tileset.
621 */
622 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium|Debug")
624
625 /**
626 * If true, this tileset is ticked/updated in the editor. If false, is only
627 * ticked while playing (including Play-in-Editor).
628 */
629 UPROPERTY(EditAnywhere, Category = "Cesium|Debug")
630 bool UpdateInEditor = true;
631
632 /**
633 * If true, stats about tile selection are printed to the Output Log.
634 */
635 UPROPERTY(EditAnywhere, Category = "Cesium|Debug")
636 bool LogSelectionStats = false;
637
638 /**
639 * If true, logs stats on the assets in this tileset's shared asset system to
640 * the Output Log.
641 */
642 UPROPERTY(EditAnywhere, Category = "Cesium|Debug")
644
645 /**
646 * If true, draws debug text above each tile being rendered with information
647 * about that tile.
648 */
649 UPROPERTY(EditAnywhere, Category = "Cesium|Debug")
650 bool DrawTileInfo = false;
651
652 /**
653 * Define the collision profile for all the 3D tiles created inside this
654 * actor.
655 */
656 UPROPERTY(
657 EditAnywhere,
658 BlueprintReadOnly,
659 Category = "Collision",
660 meta = (ShowOnlyInnerProperties, SkipUCSModifiedProperties))
661 FBodyInstance BodyInstance;
662
663 /**
664 * A delegate that will be called whenever the tileset is fully loaded.
665 */
666 UPROPERTY(BlueprintAssignable, Category = "Cesium");
667 FCompletedLoadTrigger OnTilesetLoaded;
668
669 /**
670 * Use a dithering effect when transitioning between tiles of different LODs.
671 *
672 * When this is set to true, Frustrum Culling and Fog Culling are always
673 * disabled.
674 */
675 UPROPERTY(
676 EditAnywhere,
677 BlueprintGetter = GetUseLodTransitions,
678 BlueprintSetter = SetUseLodTransitions,
679 Category = "Cesium|Rendering")
680 bool UseLodTransitions = false;
681
682 /**
683 * How long dithered LOD transitions between different tiles should take, in
684 * seconds.
685 *
686 * Only relevant if UseLodTransitions is true.
687 */
688 UPROPERTY(
689 EditAnywhere,
690 BlueprintReadWrite,
691 Category = "Cesium|Rendering",
692 meta = (EditCondition = "UseLodTransitions", EditConditionHides))
694
695private:
696 UPROPERTY(BlueprintGetter = GetLoadProgress, Category = "Cesium")
697 float LoadProgress = 0.0f;
698
699 /**
700 * The type of source from which to load this tileset.
701 */
702 UPROPERTY(
703 EditAnywhere,
704 BlueprintGetter = GetTilesetSource,
705 BlueprintSetter = SetTilesetSource,
706 Category = "Cesium",
707 meta = (DisplayName = "Source"))
708 ETilesetSource TilesetSource = ETilesetSource::FromCesiumIon;
709
710 /**
711 * The URL of this tileset's "tileset.json" file.
712 *
713 * If this property is specified, the ion asset ID and token are ignored.
714 */
715 UPROPERTY(
716 EditAnywhere,
717 BlueprintGetter = GetUrl,
718 BlueprintSetter = SetUrl,
719 Category = "Cesium",
720 meta = (EditCondition = "TilesetSource==ETilesetSource::FromUrl"))
721 FString Url = "";
722
723 /**
724 * The ID of the Cesium ion asset to use.
725 *
726 * This property is ignored if the Url is specified.
727 */
728 UPROPERTY(
729 EditAnywhere,
730 BlueprintGetter = GetIonAssetID,
731 BlueprintSetter = SetIonAssetID,
732 Category = "Cesium",
733 meta =
734 (EditCondition = "TilesetSource==ETilesetSource::FromCesiumIon",
735 ClampMin = 0))
736 int64 IonAssetID;
737
738 /**
739 * The access token to use to access the Cesium ion resource.
740 */
741 UPROPERTY(
742 EditAnywhere,
743 BlueprintGetter = GetIonAccessToken,
744 BlueprintSetter = SetIonAccessToken,
745 Category = "Cesium",
746 meta = (EditCondition = "TilesetSource==ETilesetSource::FromCesiumIon"))
747 FString IonAccessToken;
748
749 UPROPERTY(
750 meta =
751 (DeprecatedProperty,
752 DeprecationMessage = "Use CesiumIonServer instead."))
753 FString IonAssetEndpointUrl_DEPRECATED;
754
755 /**
756 * The Cesium ion Server from which this tileset is loaded.
757 */
758 UPROPERTY(
759 EditAnywhere,
760 BlueprintGetter = GetCesiumIonServer,
761 BlueprintSetter = SetCesiumIonServer,
762 Category = "Cesium",
763 AdvancedDisplay,
764 meta = (EditCondition = "TilesetSource==ETilesetSource::FromCesiumIon"))
765 UCesiumIonServer* CesiumIonServer;
766
767 /**
768 * Headers to be attached to each request made for this tileset.
769 */
770 UPROPERTY(
771 EditAnywhere,
772 BlueprintGetter = GetRequestHeaders,
773 BlueprintSetter = SetRequestHeaders,
774 Category = "Cesium")
775 TMap<FString, FString> RequestHeaders;
776
777 /**
778 * Check if the Cesium ion token used to access this tileset is working
779 * correctly, and fix it if necessary.
780 */
781 UFUNCTION(CallInEditor, Category = "Cesium")
782 void TroubleshootToken();
783
784 /**
785 * Whether to generate physics meshes for this tileset.
786 *
787 * Disabling this option will improve the performance of tile loading, but it
788 * will no longer be possible to collide with the tileset since the physics
789 * meshes will not be created.
790 *
791 * Physics meshes cannot be generated for primitives containing points.
792 */
793 UPROPERTY(
794 EditAnywhere,
795 BlueprintGetter = GetCreatePhysicsMeshes,
796 BlueprintSetter = SetCreatePhysicsMeshes,
797 Category = "Cesium|Physics")
798 bool CreatePhysicsMeshes = true;
799
800 /**
801 * Whether to generate navigation collisions for this tileset.
802 *
803 * Enabling this option creates collisions for navigation when a 3D Tiles
804 * tileset is loaded. It is recommended to set "Runtime Generation" to
805 * "Static" in the navigation mesh settings in the project settings, as
806 * collision calculations become very slow.
807 */
808 UPROPERTY(
809 EditAnywhere,
810 BlueprintGetter = GetCreateNavCollision,
811 BlueprintSetter = SetCreateNavCollision,
812 Category = "Cesium|Navigation")
813 bool CreateNavCollision = false;
814
815 /**
816 * Whether to always generate a correct tangent space basis for tiles that
817 * don't have them.
818 *
819 * Normally, a per-vertex tangent space basis is only required for glTF models
820 * with a normal map. However, a custom, user-supplied material may need a
821 * tangent space basis for other purposes. When this property is set to true,
822 * tiles lacking an explicit tangent vector will have one computed
823 * automatically using the MikkTSpace algorithm. When this property is false,
824 * load time will be improved by skipping the generation of the tangent
825 * vector, but the tangent space basis will be unreliable.
826 *
827 * Note that a tileset with "Enable Water Mask" set will include tangents
828 * for tiles containing water, regardless of the value of this property.
829 */
830 UPROPERTY(
831 EditAnywhere,
832 BlueprintGetter = GetAlwaysIncludeTangents,
833 BlueprintSetter = SetAlwaysIncludeTangents,
834 Category = "Cesium|Rendering")
835 bool AlwaysIncludeTangents = false;
836
837 /**
838 * Whether to generate smooth normals when normals are missing in the glTF.
839 *
840 * According to the Gltf spec: "When normals are not specified, client
841 * implementations should calculate flat normals." However, calculating flat
842 * normals requires duplicating vertices. This option allows the gltfs to be
843 * sent with explicit smooth normals when the original gltf was missing
844 * normals.
845 */
846 UPROPERTY(
847 EditAnywhere,
848 BlueprintGetter = GetGenerateSmoothNormals,
849 BlueprintSetter = SetGenerateSmoothNormals,
850 Category = "Cesium|Rendering")
851 bool GenerateSmoothNormals = false;
852
853 /**
854 * Whether to request and render the water mask.
855 *
856 * Currently only applicable for quantized-mesh tilesets that support the
857 * water mask extension.
858 */
859 UPROPERTY(
860 EditAnywhere,
861 BlueprintGetter = GetEnableWaterMask,
862 BlueprintSetter = SetEnableWaterMask,
863 Category = "Cesium|Rendering")
864 bool EnableWaterMask = false;
865
866 /**
867 * Whether to ignore the KHR_materials_unlit extension on the glTF tiles in
868 * this tileset, if it exists, and instead render with standard lighting and
869 * shadows. This property will have no effect if the tileset does not have any
870 * tiles that use this extension.
871 *
872 * The KHR_materials_unlit extension is often applied to photogrammetry
873 * tilesets because lighting and shadows are already baked into their
874 * textures.
875 */
876 UPROPERTY(
877 EditAnywhere,
878 BlueprintGetter = GetIgnoreKhrMaterialsUnlit,
879 BlueprintSetter = SetIgnoreKhrMaterialsUnlit,
880 Category = "Cesium|Rendering",
881 meta = (DisplayName = "Ignore KHR_materials_unlit"))
882 bool IgnoreKhrMaterialsUnlit = false;
883
884 /**
885 * A custom Material to use to render opaque elements in this tileset, in
886 * order to implement custom visual effects.
887 *
888 * The custom material should generally be created by copying the Material
889 * Instance "MI_CesiumThreeOverlaysAndClipping" and customizing the copy as
890 * desired.
891 */
892 UPROPERTY(
893 EditAnywhere,
894 BlueprintGetter = GetMaterial,
895 BlueprintSetter = SetMaterial,
896 Category = "Cesium|Rendering")
897 UMaterialInterface* Material = nullptr;
898
899 /**
900 * A custom Material to use to render translucent elements of the tileset, in
901 * order to implement custom visual effects.
902 *
903 * The custom material should generally be created by copying the Material
904 * Instance "MI_CesiumThreeOverlaysAndClippingTranslucent" and customizing the
905 * copy as desired. Make sure that its Material Property Overrides -> Blend
906 * Mode is set to "Translucent".
907 */
908 UPROPERTY(
909 EditAnywhere,
910 BlueprintGetter = GetTranslucentMaterial,
911 BlueprintSetter = SetTranslucentMaterial,
912 Category = "Cesium|Rendering")
913 UMaterialInterface* TranslucentMaterial = nullptr;
914
915 /**
916 * A custom Material to use to render this tileset in areas where the
917 * watermask is, in order to implement custom visual effects.
918 * Currently only applicable for quantized-mesh tilesets that support the
919 * water mask extension.
920 *
921 * The custom material should generally be created by copying the Material
922 * Instance "MI_CesiumThreeOverlaysAndClippingAndWater" and customizing the
923 * copy as desired.
924 */
925 UPROPERTY(
926 EditAnywhere,
927 BlueprintGetter = GetWaterMaterial,
928 BlueprintSetter = SetWaterMaterial,
929 Category = "Cesium|Rendering")
930 UMaterialInterface* WaterMaterial = nullptr;
931
932 UPROPERTY(
933 EditAnywhere,
934 BlueprintGetter = GetCustomDepthParameters,
935 BlueprintSetter = SetCustomDepthParameters,
936 Category = "Rendering",
937 meta = (ShowOnlyInnerProperties))
938 FCustomDepthParameters CustomDepthParameters;
939
940 /**
941 * If this tileset contains points, their appearance can be configured with
942 * these point cloud shading parameters.
943 *
944 * These settings are not supported on mobile platforms.
945 */
946 UPROPERTY(
947 EditAnywhere,
948 BlueprintGetter = GetPointCloudShading,
949 BlueprintSetter = SetPointCloudShading,
950 Category = "Cesium|Rendering")
951 FCesiumPointCloudShading PointCloudShading;
952
953 /**
954 * Array of runtime virtual textures into which we draw the mesh for this
955 * actor. The material also needs to be set up to output to a virtual texture.
956 */
957 UPROPERTY(
958 EditAnywhere,
959 BlueprintGetter = GetRuntimeVirtualTextures,
960 BlueprintSetter = SetRuntimeVirtualTextures,
961 Category = "VirtualTexture",
962 meta = (DisplayName = "Draw in Virtual Textures"))
963 TArray<TObjectPtr<URuntimeVirtualTexture>> RuntimeVirtualTextures;
964
965 /** Controls if this component draws in the main pass as well as in the
966 * virtual texture. You must refresh the Tileset after changing this value! */
967 UPROPERTY(
968 EditAnywhere,
969 BlueprintGetter = GetVirtualTextureRenderPassType,
970 Category = VirtualTexture,
971 meta = (DisplayName = "Draw in Main Pass"))
972 ERuntimeVirtualTextureMainPassType VirtualTextureRenderPassType =
973 ERuntimeVirtualTextureMainPassType::Exclusive;
974
975 /**
976 * Translucent objects with a lower sort priority draw behind objects with a
977 * higher priority. Translucent objects with the same priority are rendered
978 * from back-to-front based on their bounds origin. This setting is also used
979 * to sort objects being drawn into a runtime virtual texture.
980 *
981 * Ignored if the object is not translucent. The default priority is zero.
982 * Warning: This should never be set to a non-default value unless you know
983 * what you are doing, as it will prevent the renderer from sorting correctly.
984 * It is especially problematic on dynamic gameplay effects.
985 */
986 UPROPERTY(
987 EditAnywhere,
988 BlueprintGetter = GetTranslucencySortPriority,
989 BlueprintSetter = SetTranslucencySortPriority,
990 AdvancedDisplay,
991 Category = Rendering)
992 int32 TranslucencySortPriority;
993
994protected:
995 UPROPERTY()
997
998public:
999 UFUNCTION(BlueprintGetter, Category = "Cesium")
1000 float GetLoadProgress() const { return LoadProgress; }
1001
1002 UFUNCTION(BlueprintGetter, Category = "Cesium")
1004
1005 UFUNCTION(BlueprintSetter, Category = "Cesium")
1006 void SetUseLodTransitions(bool InUseLodTransitions);
1007
1008 UFUNCTION(BlueprintGetter, Category = "Cesium")
1009 ETilesetSource GetTilesetSource() const { return TilesetSource; }
1010
1011 UFUNCTION(BlueprintSetter, Category = "Cesium")
1013
1014 UFUNCTION(BlueprintGetter, Category = "Cesium")
1015 FString GetUrl() const { return Url; }
1016
1017 UFUNCTION(BlueprintSetter, Category = "Cesium")
1018 void SetUrl(const FString& InUrl);
1019
1020 UFUNCTION(BlueprintGetter, Category = "Cesium")
1021 TMap<FString, FString> GetRequestHeaders() const { return RequestHeaders; }
1022
1023 UFUNCTION(BlueprintSetter, Category = "Cesium")
1024 void SetRequestHeaders(const TMap<FString, FString>& InRequestHeaders);
1025
1026 UFUNCTION(BlueprintGetter, Category = "Cesium")
1027 int64 GetIonAssetID() const { return IonAssetID; }
1028
1029 UFUNCTION(BlueprintSetter, Category = "Cesium")
1030 void SetIonAssetID(int64 InAssetID);
1031
1032 UFUNCTION(BlueprintGetter, Category = "Cesium")
1033 FString GetIonAccessToken() const { return IonAccessToken; }
1034
1035 UFUNCTION(BlueprintSetter, Category = "Cesium")
1036 void SetIonAccessToken(const FString& InAccessToken);
1037
1038 UFUNCTION(BlueprintGetter, Category = "Cesium")
1039 UCesiumIonServer* GetCesiumIonServer() const { return CesiumIonServer; }
1040
1041 UFUNCTION(BlueprintGetter, Category = "VirtualTexture")
1042 TArray<URuntimeVirtualTexture*> GetRuntimeVirtualTextures() const {
1043 return RuntimeVirtualTextures;
1044 }
1045
1046 UFUNCTION(BlueprintSetter, Category = "VirtualTexture")
1048 TArray<URuntimeVirtualTexture*> InRuntimeVirtualTextures);
1049
1050 UFUNCTION(BlueprintGetter, Category = "VirtualTexture")
1051 ERuntimeVirtualTextureMainPassType GetVirtualTextureRenderPassType() const {
1052 return VirtualTextureRenderPassType;
1053 }
1054
1055 UFUNCTION(BlueprintGetter, Category = Rendering)
1056 int32 GetTranslucencySortPriority() { return TranslucencySortPriority; }
1057
1058 UFUNCTION(BlueprintSetter, Category = Rendering)
1059 void SetTranslucencySortPriority(int32 InTranslucencySortPriority);
1060
1061 UFUNCTION(BlueprintSetter, Category = "Cesium")
1063
1064 UFUNCTION(BlueprintGetter, Category = "Cesium")
1066
1067 UFUNCTION(BlueprintSetter, Category = "Cesium")
1068 void SetMaximumScreenSpaceError(double InMaximumScreenSpaceError);
1069
1070 UFUNCTION(BlueprintGetter, Category = "Cesium|Tile Culling|Experimental")
1072
1073 UFUNCTION(BlueprintSetter, Category = "Cesium|Tile Culling|Experimental")
1074 void SetEnableOcclusionCulling(bool bEnableOcclusionCulling);
1075
1076 UFUNCTION(BlueprintGetter, Category = "Cesium|Tile Culling|Experimental")
1077 int32 GetOcclusionPoolSize() const { return OcclusionPoolSize; }
1078
1079 UFUNCTION(BlueprintSetter, Category = "Cesium|Tile Culling|Experimental")
1080 void SetOcclusionPoolSize(int32 newOcclusionPoolSize);
1081
1082 UFUNCTION(BlueprintGetter, Category = "Cesium|Tile Culling|Experimental")
1086
1087 UFUNCTION(BlueprintSetter, Category = "Cesium|Tile Culling|Experimental")
1088 void SetDelayRefinementForOcclusion(bool bDelayRefinementForOcclusion);
1089
1090 UFUNCTION(BlueprintGetter, Category = "Cesium|Physics")
1091 bool GetCreatePhysicsMeshes() const { return CreatePhysicsMeshes; }
1092
1093 UFUNCTION(BlueprintSetter, Category = "Cesium|Physics")
1094 void SetCreatePhysicsMeshes(bool bCreatePhysicsMeshes);
1095
1096 UFUNCTION(BlueprintGetter, Category = "Cesium|Navigation")
1097 bool GetCreateNavCollision() const { return CreateNavCollision; }
1098
1099 UFUNCTION(BlueprintSetter, Category = "Cesium|Navigation")
1100 void SetCreateNavCollision(bool bCreateNavCollision);
1101
1102 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1103 bool GetAlwaysIncludeTangents() const { return AlwaysIncludeTangents; }
1104
1105 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1106 void SetAlwaysIncludeTangents(bool bAlwaysIncludeTangents);
1107
1108 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1109 bool GetGenerateSmoothNormals() const { return GenerateSmoothNormals; }
1110
1111 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1112 void SetGenerateSmoothNormals(bool bGenerateSmoothNormals);
1113
1114 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1115 bool GetEnableWaterMask() const { return EnableWaterMask; }
1116
1117 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1118 void SetEnableWaterMask(bool bEnableMask);
1119
1120 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1121 bool GetIgnoreKhrMaterialsUnlit() const { return IgnoreKhrMaterialsUnlit; }
1122 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1123 void SetIgnoreKhrMaterialsUnlit(bool bIgnoreKhrMaterialsUnlit);
1124
1125 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1126 UMaterialInterface* GetMaterial() const { return Material; }
1127
1128 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1129 void SetMaterial(UMaterialInterface* InMaterial);
1130
1131 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1132 UMaterialInterface* GetTranslucentMaterial() const {
1133 return TranslucentMaterial;
1134 }
1135
1136 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1137 void SetTranslucentMaterial(UMaterialInterface* InMaterial);
1138
1139 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1140 UMaterialInterface* GetWaterMaterial() const { return WaterMaterial; }
1141
1142 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1143 void SetWaterMaterial(UMaterialInterface* InMaterial);
1144
1145 UFUNCTION(BlueprintGetter, Category = "Rendering")
1147 return CustomDepthParameters;
1148 }
1149
1150 UFUNCTION(BlueprintSetter, Category = "Rendering")
1152
1153 UFUNCTION(BlueprintGetter, Category = "Cesium|Rendering")
1155 return PointCloudShading;
1156 }
1157
1158 UFUNCTION(BlueprintSetter, Category = "Cesium|Rendering")
1160
1161 UFUNCTION(BlueprintCallable, Category = "Cesium|Rendering")
1163
1164 UFUNCTION(BlueprintCallable, Category = "Cesium|Rendering")
1166
1167 UFUNCTION(BlueprintCallable, Category = "Cesium|Rendering")
1169
1170 /**
1171 * This method is not supposed to be called by clients. It is currently
1172 * only required by the UnrealPrepareRendererResources.
1173 *
1174 * @internal
1175 * See {@link
1176 * UCesium3DTilesetRoot::GetCesiumTilesetToUnrealRelativeWorldTransform}.
1177 * @endinternal
1178 */
1180
1182 return this->_pTileset.Get();
1183 }
1185 return this->_pTileset.Get();
1186 }
1187
1188 const std::optional<FCesiumFeaturesMetadataDescription>&
1190 return this->_featuresMetadataDescription;
1191 }
1192
1193 // AActor overrides (some or most of them should be protected)
1194 virtual bool ShouldTickIfViewportsOnly() const override;
1195 virtual void Tick(float DeltaTime) override;
1196 virtual void BeginDestroy() override;
1197 virtual bool IsReadyForFinishDestroy() override;
1198 virtual void Destroyed() override;
1199 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
1200 virtual void PostLoad() override;
1201 virtual void Serialize(FArchive& Ar) override;
1202
1204
1205 // UObject overrides
1206#if WITH_EDITOR
1207 virtual void
1208 PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
1209 virtual void PostEditChangeChainProperty(
1210 FPropertyChangedChainEvent& PropertyChangedChainEvent) override;
1211 virtual void PostEditUndo() override;
1212 virtual void PostEditImport() override;
1213 virtual bool CanEditChange(const FProperty* InProperty) const override;
1214#endif
1215
1216protected:
1217 // Called when the game starts or when spawned
1218 virtual void BeginPlay() override;
1219 virtual void OnConstruction(const FTransform& Transform) override;
1220
1221 /**
1222 * Called after the C++ constructor and after the properties have
1223 * been initialized, including those loaded from config.
1224 */
1225 void PostInitProperties() override;
1226
1227 virtual void NotifyHit(
1228 class UPrimitiveComponent* MyComp,
1229 AActor* Other,
1230 class UPrimitiveComponent* OtherComp,
1231 bool bSelfMoved,
1232 FVector HitLocation,
1233 FVector HitNormal,
1234 FVector NormalImpulse,
1235 const FHitResult& Hit) override;
1236
1237private:
1238 void LoadTileset();
1239 void DestroyTileset();
1240
1241 static Cesium3DTilesSelection::ViewState CreateViewStateFromViewParameters(
1242 const FCesiumCamera& camera,
1243 const glm::dmat4& unrealWorldToTileset,
1244 UCesiumEllipsoid* ellipsoid);
1245
1246 std::vector<FCesiumCamera> GetCameras() const;
1247 std::vector<FCesiumCamera> GetPlayerCameras() const;
1248 std::vector<FCesiumCamera> GetSceneCaptures() const;
1249
1250public:
1251 /**
1252 * Update the transforms of the glTF components based on the
1253 * the transform of the root component.
1254 *
1255 * This is supposed to be called during Tick, if the transform of
1256 * the root component has changed since the previous Tick.
1257 */
1259
1260private:
1261 /**
1262 * The event handler for ACesiumGeoreference::OnEllipsoidChanged.
1263 */
1264 UFUNCTION(CallInEditor)
1265 void HandleOnGeoreferenceEllipsoidChanged(
1266 UCesiumEllipsoid* OldEllipsoid,
1267 UCesiumEllipsoid* NewEllpisoid);
1268
1269 /**
1270 * Writes the values of all properties of this actor into the
1271 * TilesetOptions, to take them into account during the next
1272 * traversal.
1273 */
1274 void updateTilesetOptionsFromProperties();
1275
1276 /**
1277 * Update all the "_last..." fields of this instance based
1278 * on the given ViewUpdateResult, printing a log message
1279 * if any value changed.
1280 *
1281 * @param result The ViewUpdateREsult
1282 */
1283 void updateLastViewUpdateResultState(
1285
1286 /**
1287 * Creates the visual representations of the given tiles to
1288 * be rendered in the current frame.
1289 *
1290 * @param tiles The tiles
1291 */
1292 void
1293 showTilesToRender(const std::vector<Cesium3DTilesSelection::Tile*>& tiles);
1294
1295 /**
1296 * Will be called after the tileset is loaded or spawned, to register
1297 * a delegate that calls OnFocusEditorViewportOnThis when this
1298 * tileset is double-clicked
1299 */
1300 void AddFocusViewportDelegate();
1301
1302#if WITH_EDITOR
1303 std::vector<FCesiumCamera> GetEditorCameras() const;
1304
1305 /**
1306 * Will focus all viewports on this tileset.
1307 *
1308 * This is called when double-clicking the tileset in the World Outliner.
1309 * It will move the tileset into the center of the view, *even if* the
1310 * tileset was not visible before, and no geometry has been created yet
1311 * for the tileset: It solely operates on the tile bounding volume that
1312 * was given in the root tile.
1313 */
1314 void OnFocusEditorViewportOnThis();
1315
1316 void RuntimeSettingsChanged(
1317 UObject* pObject,
1318 struct FPropertyChangedEvent& changed);
1319#endif
1320
1321private:
1322 TUniquePtr<Cesium3DTilesSelection::Tileset> _pTileset;
1323
1324#ifdef CESIUM_DEBUG_TILE_STATES
1325 TUniquePtr<Cesium3DTilesSelection::DebugTileStateDatabase> _pStateDebug;
1326#endif
1327
1328 std::optional<FCesiumFeaturesMetadataDescription>
1329 _featuresMetadataDescription;
1330
1331 PRAGMA_DISABLE_DEPRECATION_WARNINGS
1332 std::optional<FMetadataDescription> _metadataDescription_DEPRECATED;
1333 PRAGMA_ENABLE_DEPRECATION_WARNINGS
1334
1335 // For debug output
1336 uint32_t _lastTilesRendered;
1337 uint32_t _lastWorkerThreadTileLoadQueueLength;
1338 uint32_t _lastMainThreadTileLoadQueueLength;
1339
1340 uint32_t _lastTilesVisited;
1341 uint32_t _lastCulledTilesVisited;
1342 uint32_t _lastTilesCulled;
1343 uint32_t _lastTilesOccluded;
1344 uint32_t _lastTilesWaitingForOcclusionResults;
1345 uint32_t _lastMaxDepthVisited;
1346
1347 std::chrono::high_resolution_clock::time_point _startTime;
1348
1349 bool _captureMovieMode;
1350 bool _beforeMoviePreloadAncestors;
1351 bool _beforeMoviePreloadSiblings;
1352 int32_t _beforeMovieLoadingDescendantLimit;
1353 bool _beforeMovieUseLodTransitions;
1354
1355 bool _scaleUsingDPI;
1356
1357 // This is used as a workaround for cesium-native#186
1358 //
1359 // The tiles that are no longer supposed to be rendered in the current
1360 // frame, according to ViewUpdateResult::tilesToHideThisFrame,
1361 // are kept in this list, and hidden in the NEXT frame, because some
1362 // internal occlusion culling information from Unreal might prevent
1363 // the tiles that are supposed to be rendered instead from appearing
1364 // immediately.
1365 //
1366 // If we find a way to clear the wrong occlusion information in the
1367 // Unreal Engine, then this field may be removed, and the
1368 // tilesToHideThisFrame may be hidden immediately.
1369 std::vector<Cesium3DTilesSelection::Tile*> _tilesToHideNextFrame;
1370
1371 int32 _tilesetsBeingDestroyed;
1372
1375};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCompletedLoadTrigger)
The delegate for the Acesium3DTileset::OnTilesetLoaded, which is triggered from UpdateLoadStatus.
FCesium3DTilesetLoadFailure OnCesium3DTilesetLoadFailure
DECLARE_DELEGATE_ThreeParams(FCesiumSampleHeightMostDetailedCallback, ACesium3DTileset *, const TArray< FCesiumSampleHeightResult > &, const TArray< FString > &)
DECLARE_MULTICAST_DELEGATE_OneParam(FCesium3DTilesetLoadFailure, const FCesium3DTilesetLoadFailureDetails &)
The delegate for OnCesium3DTilesetLoadFailure, which is triggered when the tileset encounters a load ...
EApplyDpiScaling
ETilesetSource
@ UMETA
The tileset will be loaded from Cesium Ion using the provided IonAssetID and IonAccessToken.
virtual bool ShouldTickIfViewportsOnly() const override
TSoftObjectPtr< ACesiumCameraManager > GetCameraManager() const
The actor providing custom cameras for use with this Tileset.
bool PreloadAncestors
Whether to preload ancestor tiles.
FCompletedLoadTrigger OnTilesetLoaded
A delegate that will be called whenever the tileset is fully loaded.
void UpdateTransformFromCesium()
Update the transforms of the glTF components based on the the transform of the root component.
ACesiumCreditSystem * ResolveCreditSystem()
Resolves the Cesium Credit System to use with this Actor.
bool SuspendUpdate
Pauses level-of-detail and culling updates of this tileset.
int64 GetIonAssetID() const
void SetMaximumScreenSpaceError(double InMaximumScreenSpaceError)
FBodyInstance BodyInstance
Define the collision profile for all the 3D tiles created inside this actor.
bool GetCreateNavCollision() const
void InvalidateResolvedGeoreference()
Invalidates the cached resolved georeference, unsubscribing from it and setting it to null.
FCustomDepthParameters GetCustomDepthParameters() const
void SetUrl(const FString &InUrl)
bool GetDelayRefinementForOcclusion() const
void SetEnableOcclusionCulling(bool bEnableOcclusionCulling)
bool EnableFrustumCulling
Whether to cull tiles that are outside the frustum.
bool GetEnableOcclusionCulling() const
bool EnableFogCulling
Whether to cull tiles that are occluded by fog.
bool GetCreatePhysicsMeshes() const
bool GetIgnoreKhrMaterialsUnlit() const
int32 GetTranslucencySortPriority()
void SetWaterMaterial(UMaterialInterface *InMaterial)
bool DrawTileInfo
If true, draws debug text above each tile being rendered with information about that tile.
TMap< FString, FString > GetRequestHeaders() const
int32 MaximumSimultaneousTileLoads
The maximum number of tiles that may be loaded at once.
void SetMaterial(UMaterialInterface *InMaterial)
void PostInitProperties() override
Called after the C++ constructor and after the properties have been initialized, including those load...
Cesium3DTilesSelection::Tileset * GetTileset()
ERuntimeVirtualTextureMainPassType GetVirtualTextureRenderPassType() const
EApplyDpiScaling ApplyDpiScaling
Scale Level-of-Detail by Display DPI.
void SetRuntimeVirtualTextures(TArray< URuntimeVirtualTexture * > InRuntimeVirtualTextures)
const glm::dmat4 & GetCesiumTilesetToUnrealRelativeWorldTransform() const
This method is not supposed to be called by clients.
void SetOcclusionPoolSize(int32 newOcclusionPoolSize)
bool ShowCreditsOnScreen
Whether or not to show this tileset's credits on screen.
virtual void BeginPlay() override
TSoftObjectPtr< ACesiumCreditSystem > GetCreditSystem() const
The actor managing this tileset's content attributions.
virtual bool IsReadyForFinishDestroy() override
friend class UCesiumGltfPointsComponent
bool UpdateInEditor
If true, this tileset is ticked/updated in the editor.
const Cesium3DTilesSelection::Tileset * GetTileset() const
void SetEnableWaterMask(bool bEnableMask)
bool EnforceCulledScreenSpaceError
Whether a specified screen-space error should be enforced for tiles that are outside the frustum or h...
void StopMovieSequencer()
void InvalidateResolvedCameraManager()
Invalidates the cached resolved Camera Manager, setting it to null.
ETilesetSource GetTilesetSource() const
virtual ~ACesium3DTileset()
void SetMobility(EComponentMobility::Type NewMobility)
UCesiumIonServer * GetCesiumIonServer() const
bool GetGenerateSmoothNormals() const
void SetIgnoreKhrMaterialsUnlit(bool bIgnoreKhrMaterialsUnlit)
ACesiumCameraManager * ResolveCameraManager()
Resolves the Cesium Camera Manager to use with this Actor.
virtual void Destroyed() override
bool EnableOcclusionCulling
Whether to cull tiles that are occluded.
void SetRequestHeaders(const TMap< FString, FString > &InRequestHeaders)
int32 OcclusionPoolSize
The number of CesiumBoundingVolumeComponents to use for querying the occlusion state of traversed til...
void SetIonAssetID(int64 InAssetID)
FCesiumPointCloudShading GetPointCloudShading() const
int32 LoadingDescendantLimit
The number of loading descendents a tile should allow before deciding to render itself instead of wai...
void SetGeoreference(TSoftObjectPtr< ACesiumGeoreference > NewGeoreference)
The designated georeference actor controlling how the actor's coordinate system relates to the coordi...
float LodTransitionLength
How long dithered LOD transitions between different tiles should take, in seconds.
void UpdateLoadStatus()
virtual void PostLoad() override
bool ForbidHoles
Whether to unrefine back to a parent tile when a child isn't done loading.
bool LogSharedAssetStats
If true, logs stats on the assets in this tileset's shared asset system to the Output Log.
double MaximumScreenSpaceError
The maximum number of pixels of error when rendering this tileset.
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
void SetCreditSystem(TSoftObjectPtr< ACesiumCreditSystem > NewCreditSystem)
The actor managing this tileset's content attributions.
UMaterialInterface * GetMaterial() const
UMaterialInterface * GetWaterMaterial() const
void PlayMovieSequencer()
void SetCreateNavCollision(bool bCreateNavCollision)
void SetGenerateSmoothNormals(bool bGenerateSmoothNormals)
int32 GetOcclusionPoolSize() const
void InvalidateResolvedCreditSystem()
Invalidates the cached resolved Credit System, setting it to null.
void SetCreatePhysicsMeshes(bool bCreatePhysicsMeshes)
int64 MaximumCachedBytes
The maximum number of bytes that may be cached.
void PauseMovieSequencer()
const std::optional< FCesiumFeaturesMetadataDescription > & getFeaturesMetadataDescription() const
friend class UnrealPrepareRendererResources
void SetPointCloudShading(FCesiumPointCloudShading InPointCloudShading)
virtual void OnConstruction(const FTransform &Transform) override
ACesiumGeoreference * ResolveGeoreference()
Resolves the Cesium Georeference to use with this Actor.
bool DelayRefinementForOcclusion
Whether to wait for valid occlusion results before refining tiles.
UMaterialInterface * GetTranslucentMaterial() const
void SetTranslucencySortPriority(int32 InTranslucencySortPriority)
FString GetIonAccessToken() const
void RefreshTileset()
Refreshes this tileset, ensuring that all materials and other settings are applied.
bool PreloadSiblings
Whether to preload sibling tiles.
void SetTranslucentMaterial(UMaterialInterface *InMaterial)
FString GetUrl() const
EComponentMobility::Type GetMobility() const
void SetIonAccessToken(const FString &InAccessToken)
double GetMaximumScreenSpaceError()
void SetTilesetSource(ETilesetSource InSource)
virtual void BeginDestroy() override
void SetUseLodTransitions(bool InUseLodTransitions)
void SampleHeightMostDetailed(const TArray< FVector > &LongitudeLatitudeHeightArray, FCesiumSampleHeightMostDetailedCallback OnHeightsSampled)
Initiates an asynchronous query for the height of this tileset at a list of cartographic positions,...
bool GetUseLodTransitions() const
virtual void Serialize(FArchive &Ar) override
TSoftObjectPtr< ACesiumGeoreference > GetGeoreference() const
The designated georeference actor controlling how the actor's coordinate system relates to the coordi...
void SetCesiumIonServer(UCesiumIonServer *Server)
bool UseLodTransitions
Use a dithering effect when transitioning between tiles of different LODs.
bool LogSelectionStats
If true, stats about tile selection are printed to the Output Log.
void SetCameraManager(TSoftObjectPtr< ACesiumCameraManager > NewCameraManager)
The actor providing custom cameras for use with this Tileset.
double CulledScreenSpaceError
The screen-space error to be enforced for tiles that are outside the view frustum or hidden in fog.
TArray< URuntimeVirtualTexture * > GetRuntimeVirtualTextures() const
void SetAlwaysIncludeTangents(bool bAlwaysIncludeTangents)
bool GetEnableWaterMask() const
virtual void NotifyHit(class UPrimitiveComponent *MyComp, AActor *Other, class UPrimitiveComponent *OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult &Hit) override
bool GetAlwaysIncludeTangents() const
float GetLoadProgress() const
void SetDelayRefinementForOcclusion(bool bDelayRefinementForOcclusion)
void SetCustomDepthParameters(FCustomDepthParameters InCustomDepthParameters)
virtual void Tick(float DeltaTime) override
Manages custom FCesiumCameras for all ACesium3DTilesets in the world.
Manages credits / atttribution for Cesium data sources.
Controls how global geospatial coordinates are mapped to coordinates in the Unreal Engine level.
Defines a Cesium ion Server.
A camera description that ACesium3DTilesets can use to decide what tiles need to be loaded to suffici...
Options for adjusting how point clouds are rendered using 3D Tiles.