3using System.Collections;
4using System.Collections.Generic;
5using System.Threading.Tasks;
6using Unity.Mathematics;
50 [ReinteropNativeImplementation(
"CesiumForUnityNative::Cesium3DTilesetImpl",
"Cesium3DTilesetImpl.h")]
51 [AddComponentMenu(
"Cesium/Cesium 3D Tileset")]
52 [IconAttribute(
"Packages/com.cesium.unity/Editor/Resources/Cesium-24x24.png")]
53 public partial class Cesium3DTileset : MonoBehaviour, IDisposable, ISerializationCallbackReceiver
58 this.DisposeImplementation();
61 #region Events and Delegates
92 internal void BroadcastNewGameObjectCreated(GameObject go)
100 internal static event Action OnSetShowCreditsOnScreen;
106 private bool _showCreditsOnScreen =
false;
114 get => this._showCreditsOnScreen;
117 this._showCreditsOnScreen = value;
118 this.SetShowCreditsOnScreen(this._showCreditsOnScreen);
135 get => this._tilesetSource;
138 this._tilesetSource = value;
144 private string _url =
"";
161 private long _ionAssetID = 0;
169 get => this._ionAssetID;
172 this._ionAssetID = value;
178 private string _ionAccessToken =
"";
186 get => this._ionAccessToken;
189 this._ionAccessToken = value;
204 if (this._ionServer ==
null)
208 if (this._useDefaultServer)
213 this._useDefaultServer =
false;
218 return this._ionServer;
223 this._ionServer = value;
229 private float _maximumScreenSpaceError = 16.0f;
251 get => this._maximumScreenSpaceError;
254 this._maximumScreenSpaceError = value;
260 private bool _preloadAncestors =
true;
272 get => this._preloadAncestors;
275 this._preloadAncestors = value;
281 private bool _preloadSiblings =
true;
293 get => this._preloadSiblings;
296 this._preloadSiblings = value;
302 private bool _forbidHoles =
false;
316 get => this._forbidHoles;
319 this._forbidHoles = value;
325 private uint _maximumSimultaneousTileLoads = 20;
339 get => this._maximumSimultaneousTileLoads;
342 this._maximumSimultaneousTileLoads = value;
348 private long _maximumCachedBytes = 512 * 1024 * 1024;
362 get => this._maximumCachedBytes;
365 this._maximumCachedBytes = value;
371 private uint _loadingDescendantLimit = 20;
386 get => this._loadingDescendantLimit;
389 this._loadingDescendantLimit = value;
395 private bool _enableFrustumCulling =
true;
416 get => this._enableFrustumCulling;
419 this._enableFrustumCulling = value;
425 private bool _enableFogCulling =
true;
443 get => this._enableFogCulling;
446 this._enableFogCulling = value;
453 private bool _enforceCulledScreenSpaceError =
true;
482 get => this._enforceCulledScreenSpaceError;
485 this._enforceCulledScreenSpaceError = value;
491 private float _culledScreenSpaceError = 64.0f;
519 get => this._culledScreenSpaceError;
522 this._culledScreenSpaceError = value;
528 private Material _opaqueMaterial =
null;
535 get => this._opaqueMaterial;
538 this._opaqueMaterial = value;
571 private bool _generateSmoothNormals =
false;
584 get => this._generateSmoothNormals;
587 this._generateSmoothNormals = value;
602 get => this._pointCloudShading;
606 private bool _suspendUpdate =
false;
613 get => this._suspendUpdate;
616 this._suspendUpdate = value;
626 private bool _previousSuspendUpdate =
false;
628 internal bool previousSuspendUpdate
630 get => this._previousSuspendUpdate;
633 this._previousSuspendUpdate = value;
638 private bool _showTilesInHierarchy =
false;
645 get => this._showTilesInHierarchy;
648 this._showTilesInHierarchy = value;
654 private bool _updateInEditor =
true;
661 get => this._updateInEditor;
664 this._updateInEditor = value;
670 private bool _logSelectionStats =
false;
677 get => this._logSelectionStats;
678 set { this._logSelectionStats = value; }
682 private bool _createPhysicsMeshes =
true;
694 get => this._createPhysicsMeshes;
697 this._createPhysicsMeshes = value;
704 #region Public Methods
752 #region Private Methods
754 private partial
void SetShowCreditsOnScreen(
bool value);
756 private partial
void Start();
757 private partial
void Update();
758 private partial
void OnValidate();
760 private partial
void OnEnable();
761 private partial
void OnDisable();
763 internal partial
void UpdateOverlayMaterialKeys();
767 #region Backward Compatibility
769 void ISerializationCallbackReceiver.OnBeforeSerialize()
773 void ISerializationCallbackReceiver.OnAfterDeserialize()
778 if (this._ionServer ==
null)
779 this._useDefaultServer =
true;
784 private bool _useDefaultServer =
false;
A tileset in the 3D Tiles format.
partial Task< CesiumSampleHeightResult > SampleHeightMostDetailed(params double3[] longitudeLatitudeHeightPositions)
Initiates an asynchronous query for the height of this tileset at a list of cartographic positions,...
bool logSelectionStats
Whether to log details about the tile selection process.
Action< GameObject > OnTileGameObjectCreated
Occurs when a new GameObject is instantiated for a Tile in the tileset.
static TilesetLoadFailureDelegate OnCesium3DTilesetLoadFailure
An event that is raised when the tileset encounters an error that prevents it from loading.
bool preloadAncestors
Whether to preload ancestor tiles.
CesiumPointCloudShading pointCloudShading
The CesiumPointCloudShading attached to this tileset.
CesiumDataSource tilesetSource
The source of the data for this tileset: Cesium ion or a regular URL.
bool enableFogCulling
Whether to cull tiles that are occluded by fog.
bool suspendUpdate
Pauses level-of-detail and culling updates of this tileset.
float maximumScreenSpaceError
The maximum number of pixels of error when rendering this tileset.
delegate void TilesetLoadFailureDelegate(Cesium3DTilesetLoadFailureDetails details)
Encapsulates a method that receives details of a tileset load failure.
bool enableFrustumCulling
Whether to cull tiles that are outside the frustum.
string ionAccessToken
The Cesium ion access token to use when loading the tileset from Cesium ion.
partial float ComputeLoadProgress()
Estimate the percentage of the tiles for the current view that have been loaded.
bool createPhysicsMeshes
Whether to generate physics meshes for this tileset.
partial void FocusTileset()
Zoom the Editor camera to this tileset.
Material opaqueMaterial
The Material to use to render opaque parts of tiles.
bool showTilesInHierarchy
Whether to show tiles as individual game objects in the hierarchy window.
float culledScreenSpaceError
The screen-space error to be enforced for tiles that are outside the frustum or hidden in fog.
long maximumCachedBytes
The maximum number of bytes that may be cached for this tileset.
bool enforceCulledScreenSpaceError
Whether a specified screen-space error should be enforced for tiles that are outside the frustum or h...
uint loadingDescendantLimit
The number of loading descendents a tile should allow before deciding to render itself instead of wai...
bool generateSmoothNormals
Whether to generate smooth normals when normals are missing in the glTF.
bool forbidHoles
Whether to prevent refinement of a parent tile when a child isn't done loading.
long ionAssetID
The Cesium ion asset ID from which to load the tileset.
CesiumIonServer ionServer
The Cesium ion server from which this tileset is loaded.
partial void RecreateTileset()
Destroy and recreate the tilset.
bool showCreditsOnScreen
Whether or not to force this tileset's credits to be shown on the main screen.
string url
The URL from which to load the tileset.
bool preloadSiblings
Whether to preload sibling tiles.
bool updateInEditor
If true, this tileset is ticked/updated in the editor.
uint maximumSimultaneousTileLoads
The maximum number of tiles that may be loaded simultaneously.
Defines a Cesium ion Server.
static CesiumIonServer serverForNewObjects
Gets the current Cesium ion server that should be assigned to newly-created objects.
static CesiumIonServer defaultServer
Gets the default Cesium ion Server (ion.cesium.com).
Options for adjusting how point clouds are rendered using 3D Tiles.
CesiumDataSource
Specifies the source of a Cesium dataset.
@ FromCesiumIon
The dataset is from Cesium ion.
@ FromEllipsoid
The dataset is generated from the georeference ellipsoid.
@ FromUrl
The dataset is from a regular web URL.
Holds details of a Cesium3DTileset load failure.