org.outernet.cesium-unity 1.15.3-linux.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +420 -0
- package/CHANGES.md.meta +7 -0
- package/Editor/BuildCesiumForUnity.cs +186 -0
- package/Editor/BuildCesiumForUnity.cs.meta +11 -0
- package/Editor/Cesium3DTilesetEditor.cs +542 -0
- package/Editor/Cesium3DTilesetEditor.cs.meta +11 -0
- package/Editor/CesiumBingMapsRasterOverlayEditor.cs +66 -0
- package/Editor/CesiumBingMapsRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumCameraControllerEditor.cs +174 -0
- package/Editor/CesiumCameraControllerEditor.cs.meta +11 -0
- package/Editor/CesiumCameraManagerEditor.cs +65 -0
- package/Editor/CesiumCameraManagerEditor.cs.meta +11 -0
- package/Editor/CesiumCartographicPolygonEditor.cs +23 -0
- package/Editor/CesiumCartographicPolygonEditor.cs.meta +11 -0
- package/Editor/CesiumDebugColorizeTilesRasterOverlayEditor.cs +41 -0
- package/Editor/CesiumDebugColorizeTilesRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumEditor.asmdef +26 -0
- package/Editor/CesiumEditor.asmdef.meta +7 -0
- package/Editor/CesiumEditorStyle.cs +188 -0
- package/Editor/CesiumEditorStyle.cs.meta +11 -0
- package/Editor/CesiumEditorUtility.cs +394 -0
- package/Editor/CesiumEditorUtility.cs.meta +11 -0
- package/Editor/CesiumEditorWindow.cs +447 -0
- package/Editor/CesiumEditorWindow.cs.meta +11 -0
- package/Editor/CesiumFlyToControllerEditor.cs +76 -0
- package/Editor/CesiumFlyToControllerEditor.cs.meta +11 -0
- package/Editor/CesiumGeoreferenceEditor.cs +277 -0
- package/Editor/CesiumGeoreferenceEditor.cs.meta +11 -0
- package/Editor/CesiumGlobeAnchorEditor.cs +202 -0
- package/Editor/CesiumGlobeAnchorEditor.cs.meta +11 -0
- package/Editor/CesiumInspectorGUI.cs +187 -0
- package/Editor/CesiumInspectorGUI.cs.meta +11 -0
- package/Editor/CesiumIonAsset.cs +192 -0
- package/Editor/CesiumIonAsset.cs.meta +11 -0
- package/Editor/CesiumIonAssetsWindow.cs +257 -0
- package/Editor/CesiumIonAssetsWindow.cs.meta +11 -0
- package/Editor/CesiumIonRasterOverlayEditor.cs +87 -0
- package/Editor/CesiumIonRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumIonServerManager.cs +153 -0
- package/Editor/CesiumIonServerManager.cs.meta +11 -0
- package/Editor/CesiumIonServerSelector.cs +127 -0
- package/Editor/CesiumIonServerSelector.cs.meta +11 -0
- package/Editor/CesiumIonSession.cs +102 -0
- package/Editor/CesiumIonSession.cs.meta +11 -0
- package/Editor/CesiumPolygonRasterOverlayEditor.cs +102 -0
- package/Editor/CesiumPolygonRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumRasterOverlayEditor.cs +230 -0
- package/Editor/CesiumRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumSubSceneEditor.cs +201 -0
- package/Editor/CesiumSubSceneEditor.cs.meta +11 -0
- package/Editor/CesiumTileMapServiceRasterOverlayEditor.cs +88 -0
- package/Editor/CesiumTileMapServiceRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumWebMapServiceRasterOverlayEditor.cs +111 -0
- package/Editor/CesiumWebMapServiceRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumWebMapTileServiceRasterOverlayEditor.cs +277 -0
- package/Editor/CesiumWebMapTileServiceRasterOverlayEditor.cs.meta +3 -0
- package/Editor/CompileCesiumForUnityNative.cs +581 -0
- package/Editor/CompileCesiumForUnityNative.cs.meta +11 -0
- package/Editor/ConfigureReinterop.cs +255 -0
- package/Editor/ConfigureReinterop.cs.meta +11 -0
- package/Editor/Helpers.cs +102 -0
- package/Editor/Helpers.cs.meta +11 -0
- package/Editor/IonAssetsMultiColumnHeader.cs +45 -0
- package/Editor/IonAssetsMultiColumnHeader.cs.meta +11 -0
- package/Editor/IonAssetsTreeView.cs +214 -0
- package/Editor/IonAssetsTreeView.cs.meta +11 -0
- package/Editor/IonMissingAssetWindow.cs +65 -0
- package/Editor/IonMissingAssetWindow.cs.meta +11 -0
- package/Editor/IonTokenTroubleshootingWindow.cs +615 -0
- package/Editor/IonTokenTroubleshootingWindow.cs.meta +11 -0
- package/Editor/NativeDownloadHandler.cs +35 -0
- package/Editor/NativeDownloadHandler.cs.meta +11 -0
- package/Editor/QuickAddItem.cs +43 -0
- package/Editor/QuickAddItem.cs.meta +11 -0
- package/Editor/Resources/Cesium-128x128.png +0 -0
- package/Editor/Resources/Cesium-128x128.png.meta +98 -0
- package/Editor/Resources/Cesium-24x24.png +0 -0
- package/Editor/Resources/Cesium-24x24.png.meta +123 -0
- package/Editor/Resources/Cesium-64x64.png +0 -0
- package/Editor/Resources/Cesium-64x64.png.meta +98 -0
- package/Editor/Resources/Cesium-for-Unity-dark.png +0 -0
- package/Editor/Resources/Cesium-for-Unity-dark.png.meta +123 -0
- package/Editor/Resources/Cesium-for-Unity-light.png +0 -0
- package/Editor/Resources/Cesium-for-Unity-light.png.meta +123 -0
- package/Editor/Resources/Cesium-icon-16x16.png +0 -0
- package/Editor/Resources/Cesium-icon-16x16.png.meta +98 -0
- package/Editor/Resources/FontAwesome/attribution.txt +9 -0
- package/Editor/Resources/FontAwesome/attribution.txt.meta +7 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.png +0 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/check-solid.png +0 -0
- package/Editor/Resources/FontAwesome/check-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/check-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/check-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/folder.png +0 -0
- package/Editor/Resources/FontAwesome/folder.png.meta +147 -0
- package/Editor/Resources/FontAwesome/folder.svg +5 -0
- package/Editor/Resources/FontAwesome/folder.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.png +0 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/key-solid.png +0 -0
- package/Editor/Resources/FontAwesome/key-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/key-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/key-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/plus-solid.png +0 -0
- package/Editor/Resources/FontAwesome/plus-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/plus-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/plus-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/times-solid.png +0 -0
- package/Editor/Resources/FontAwesome/times-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/times-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/times-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome.meta +8 -0
- package/Editor/Resources.meta +8 -0
- package/Editor/SelectIonTokenWindow.cs +249 -0
- package/Editor/SelectIonTokenWindow.cs.meta +11 -0
- package/Editor/arm64.meta +8 -0
- package/Editor/csc.rsp +1 -0
- package/Editor/csc.rsp.meta +7 -0
- package/Editor/libCesiumForUnityNative-Editor.so +0 -0
- package/Editor/libCesiumForUnityNative-Editor.so.meta +2 -0
- package/Editor/libCesiumForUnityNative-Runtime.so +0 -0
- package/Editor/libCesiumForUnityNative-Runtime.so.meta +2 -0
- package/Editor/x86_64.meta +8 -0
- package/Editor.meta +8 -0
- package/LICENSE +201 -0
- package/LICENSE.meta +7 -0
- package/Plugins/Standalone/libCesiumForUnityNative-Runtime.so +0 -0
- package/Plugins/Standalone/libCesiumForUnityNative-Runtime.so.meta +2 -0
- package/Plugins/Standalone.meta +8 -0
- package/Plugins.meta +8 -0
- package/README.md +39 -0
- package/README.md.meta +7 -0
- package/Reinterop.deps.json +172 -0
- package/Reinterop.deps.json.meta +7 -0
- package/Reinterop.dll +0 -0
- package/Reinterop.dll.meta +79 -0
- package/Runtime/Cesium3DTile.cs +37 -0
- package/Runtime/Cesium3DTile.cs.meta +11 -0
- package/Runtime/Cesium3DTileset.cs +788 -0
- package/Runtime/Cesium3DTileset.cs.meta +11 -0
- package/Runtime/Cesium3DTilesetLoadFailureDetails.cs +65 -0
- package/Runtime/Cesium3DTilesetLoadFailureDetails.cs.meta +11 -0
- package/Runtime/CesiumBackwardCompatibility.cs +163 -0
- package/Runtime/CesiumBackwardCompatibility.cs.meta +11 -0
- package/Runtime/CesiumBingMapsRasterOverlay.cs +72 -0
- package/Runtime/CesiumBingMapsRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumCameraController.cs +827 -0
- package/Runtime/CesiumCameraController.cs.meta +11 -0
- package/Runtime/CesiumCameraManager.cs +105 -0
- package/Runtime/CesiumCameraManager.cs.meta +11 -0
- package/Runtime/CesiumCartographicPolygon.cs +152 -0
- package/Runtime/CesiumCartographicPolygon.cs.meta +11 -0
- package/Runtime/CesiumCreditSystem.cs +343 -0
- package/Runtime/CesiumCreditSystem.cs.meta +11 -0
- package/Runtime/CesiumCreditSystemUI.cs +402 -0
- package/Runtime/CesiumCreditSystemUI.cs.meta +11 -0
- package/Runtime/CesiumDebugColorizeTilesRasterOverlay.cs +21 -0
- package/Runtime/CesiumDebugColorizeTilesRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumEllipsoid.cs +107 -0
- package/Runtime/CesiumEllipsoid.cs.meta +11 -0
- package/Runtime/CesiumFeature.cs +279 -0
- package/Runtime/CesiumFeature.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdAttribute.cs +61 -0
- package/Runtime/CesiumFeatureIdAttribute.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdSet.cs +165 -0
- package/Runtime/CesiumFeatureIdSet.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdTexture.cs +68 -0
- package/Runtime/CesiumFeatureIdTexture.cs.meta +11 -0
- package/Runtime/CesiumFlyToController.cs +539 -0
- package/Runtime/CesiumFlyToController.cs.meta +11 -0
- package/Runtime/CesiumGeoreference.cs +628 -0
- package/Runtime/CesiumGeoreference.cs.meta +11 -0
- package/Runtime/CesiumGlobeAnchor.cs +664 -0
- package/Runtime/CesiumGlobeAnchor.cs.meta +11 -0
- package/Runtime/CesiumGlobeAnchorBackwardCompatibility0dot2dot0.cs +105 -0
- package/Runtime/CesiumGlobeAnchorBackwardCompatibility0dot2dot0.cs.meta +11 -0
- package/Runtime/CesiumIntMatN.cs +398 -0
- package/Runtime/CesiumIntMatN.cs.meta +11 -0
- package/Runtime/CesiumIntVecN.cs +525 -0
- package/Runtime/CesiumIntVecN.cs.meta +11 -0
- package/Runtime/CesiumIonRasterOverlay.cs +110 -0
- package/Runtime/CesiumIonRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumIonServer.cs +137 -0
- package/Runtime/CesiumIonServer.cs.meta +11 -0
- package/Runtime/CesiumMetadata.cs +33 -0
- package/Runtime/CesiumMetadata.cs.meta +11 -0
- package/Runtime/CesiumMetadataValue.cs +1764 -0
- package/Runtime/CesiumMetadataValue.cs.meta +11 -0
- package/Runtime/CesiumMetadataValueType.cs +203 -0
- package/Runtime/CesiumMetadataValueType.cs.meta +11 -0
- package/Runtime/CesiumModelMetadata.cs +26 -0
- package/Runtime/CesiumModelMetadata.cs.meta +11 -0
- package/Runtime/CesiumObjectPool.cs +74 -0
- package/Runtime/CesiumObjectPool.cs.meta +11 -0
- package/Runtime/CesiumObjectPools.cs +39 -0
- package/Runtime/CesiumObjectPools.cs.meta +11 -0
- package/Runtime/CesiumOriginShift.cs +146 -0
- package/Runtime/CesiumOriginShift.cs.meta +11 -0
- package/Runtime/CesiumPointCloudRenderer.cs +246 -0
- package/Runtime/CesiumPointCloudRenderer.cs.meta +11 -0
- package/Runtime/CesiumPointCloudShading.cs +76 -0
- package/Runtime/CesiumPointCloudShading.cs.meta +11 -0
- package/Runtime/CesiumPolygonRasterOverlay.cs +109 -0
- package/Runtime/CesiumPolygonRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumPrimitiveFeatures.cs +130 -0
- package/Runtime/CesiumPrimitiveFeatures.cs.meta +11 -0
- package/Runtime/CesiumPropertyArray.cs +64 -0
- package/Runtime/CesiumPropertyArray.cs.meta +11 -0
- package/Runtime/CesiumPropertyTable.cs +126 -0
- package/Runtime/CesiumPropertyTable.cs.meta +11 -0
- package/Runtime/CesiumPropertyTableProperty.cs +1734 -0
- package/Runtime/CesiumPropertyTableProperty.cs.meta +11 -0
- package/Runtime/CesiumRasterOverlay.cs +239 -0
- package/Runtime/CesiumRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumRasterOverlayLoadFailureDetails.cs +65 -0
- package/Runtime/CesiumRasterOverlayLoadFailureDetails.cs.meta +11 -0
- package/Runtime/CesiumRuntime.asmdef +32 -0
- package/Runtime/CesiumRuntime.asmdef.meta +7 -0
- package/Runtime/CesiumRuntime.cs +3 -0
- package/Runtime/CesiumRuntime.cs.meta +11 -0
- package/Runtime/CesiumRuntimeSettings.cs +188 -0
- package/Runtime/CesiumRuntimeSettings.cs.meta +11 -0
- package/Runtime/CesiumSampleHeightResult.cs +47 -0
- package/Runtime/CesiumSampleHeightResult.cs.meta +11 -0
- package/Runtime/CesiumSimplePlanarEllipsoidCurve.cs +93 -0
- package/Runtime/CesiumSimplePlanarEllipsoidCurve.cs.meta +11 -0
- package/Runtime/CesiumSubScene.cs +473 -0
- package/Runtime/CesiumSubScene.cs.meta +11 -0
- package/Runtime/CesiumTileExcluder.cs +47 -0
- package/Runtime/CesiumTileExcluder.cs.meta +11 -0
- package/Runtime/CesiumTileMapServiceRasterOverlay.cs +93 -0
- package/Runtime/CesiumTileMapServiceRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumWebMapServiceRasterOverlay.cs +129 -0
- package/Runtime/CesiumWebMapServiceRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumWebMapTileServiceRasterOverlay.cs +414 -0
- package/Runtime/CesiumWebMapTileServiceRasterOverlay.cs.meta +3 -0
- package/Runtime/CesiumWgs84Ellipsoid.cs +75 -0
- package/Runtime/CesiumWgs84Ellipsoid.cs.meta +11 -0
- package/Runtime/ConfigureReinterop.cs +926 -0
- package/Runtime/ConfigureReinterop.cs.meta +11 -0
- package/Runtime/Helpers.cs +122 -0
- package/Runtime/Helpers.cs.meta +11 -0
- package/Runtime/ICesiumRestartable.cs +17 -0
- package/Runtime/ICesiumRestartable.cs.meta +11 -0
- package/Runtime/NativeCoroutine.cs +28 -0
- package/Runtime/NativeCoroutine.cs.meta +11 -0
- package/Runtime/NativeDownloadHandler.cs +29 -0
- package/Runtime/NativeDownloadHandler.cs.meta +11 -0
- package/Runtime/Resources/CesiumCreditSystem.prefab +78 -0
- package/Runtime/Resources/CesiumCreditSystem.prefab.meta +7 -0
- package/Runtime/Resources/CesiumCreditSystemRuntimeTheme.tss +2 -0
- package/Runtime/Resources/CesiumCreditSystemRuntimeTheme.tss.meta +11 -0
- package/Runtime/Resources/CesiumCreditSystemUI.uxml +4 -0
- package/Runtime/Resources/CesiumCreditSystemUI.uxml.meta +10 -0
- package/Runtime/Resources/CesiumCreditSystemUIPanelSettings.asset +38 -0
- package/Runtime/Resources/CesiumCreditSystemUIPanelSettings.asset.meta +8 -0
- package/Runtime/Resources/CesiumDefaultTilesetMaterial.mat +232 -0
- package/Runtime/Resources/CesiumDefaultTilesetMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph +14271 -0
- package/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph.meta +10 -0
- package/Runtime/Resources/CesiumPointCloudShading.hlsl +156 -0
- package/Runtime/Resources/CesiumPointCloudShading.hlsl.meta +7 -0
- package/Runtime/Resources/CesiumPointCloudShadingMaterial.mat +125 -0
- package/Runtime/Resources/CesiumPointCloudShadingMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumPointCloudShadingShader.shader +73 -0
- package/Runtime/Resources/CesiumPointCloudShadingShader.shader.meta +10 -0
- package/Runtime/Resources/CesiumRasterOverlay.shadersubgraph +2207 -0
- package/Runtime/Resources/CesiumRasterOverlay.shadersubgraph.meta +10 -0
- package/Runtime/Resources/CesiumSelectTexCoords.shadersubgraph +722 -0
- package/Runtime/Resources/CesiumSelectTexCoords.shadersubgraph.meta +10 -0
- package/Runtime/Resources/CesiumUnlitTilesetMaterial.mat +261 -0
- package/Runtime/Resources/CesiumUnlitTilesetMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumUnlitTilesetShader.shadergraph +5873 -0
- package/Runtime/Resources/CesiumUnlitTilesetShader.shadergraph.meta +10 -0
- package/Runtime/Resources/DynamicCamera.prefab +253 -0
- package/Runtime/Resources/DynamicCamera.prefab.meta +7 -0
- package/Runtime/Resources/TransformTextureCoordinates.shadersubgraph +2171 -0
- package/Runtime/Resources/TransformTextureCoordinates.shadersubgraph.meta +10 -0
- package/Runtime/Resources/green1x1.png +0 -0
- package/Runtime/Resources/green1x1.png.meta +123 -0
- package/Runtime/Resources.meta +8 -0
- package/Runtime/TestGltfModel.cs +56 -0
- package/Runtime/TestGltfModel.cs.meta +11 -0
- package/Runtime/TestReinterop.cs +21 -0
- package/Runtime/TestReinterop.cs.meta +11 -0
- package/Runtime/UnityLifetime.cs +27 -0
- package/Runtime/UnityLifetime.cs.meta +11 -0
- package/Runtime/WaitForTask.cs +25 -0
- package/Runtime/WaitForTask.cs.meta +11 -0
- package/Runtime/csc.rsp +1 -0
- package/Runtime/csc.rsp.meta +7 -0
- package/Runtime.meta +8 -0
- package/ThirdParty.json +27 -0
- package/ThirdParty.json.meta +7 -0
- package/WGS84.asset +18 -0
- package/WGS84.asset.meta +8 -0
- package/package.json +29 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Rendering;
|
|
3
|
+
using UnityEngine.XR;
|
|
4
|
+
|
|
5
|
+
#if UNITY_EDITOR
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
namespace CesiumForUnity
|
|
10
|
+
{
|
|
11
|
+
internal struct Cesium3DTileInfo
|
|
12
|
+
{
|
|
13
|
+
public bool usesAdditiveRefinement;
|
|
14
|
+
public float geometricError;
|
|
15
|
+
public Vector3 dimensions;
|
|
16
|
+
public bool isTranslucent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[ExecuteInEditMode]
|
|
20
|
+
[AddComponentMenu("")]
|
|
21
|
+
internal class CesiumPointCloudRenderer : MonoBehaviour
|
|
22
|
+
{
|
|
23
|
+
private Cesium3DTileset _tileset;
|
|
24
|
+
|
|
25
|
+
private Mesh _mesh;
|
|
26
|
+
private MeshFilter _meshFilter;
|
|
27
|
+
private MeshRenderer _meshRenderer;
|
|
28
|
+
private GraphicsBuffer _meshVertexBuffer;
|
|
29
|
+
|
|
30
|
+
private int _pointCount = 0;
|
|
31
|
+
private Material _pointMaterial;
|
|
32
|
+
|
|
33
|
+
private Bounds _bounds;
|
|
34
|
+
|
|
35
|
+
private Vector4 _attenuationParameters;
|
|
36
|
+
private Vector4 _constantColor;
|
|
37
|
+
|
|
38
|
+
private Cesium3DTileInfo _tileInfo;
|
|
39
|
+
|
|
40
|
+
public Cesium3DTileInfo tileInfo
|
|
41
|
+
{
|
|
42
|
+
set => this._tileInfo = value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void OnEnable()
|
|
46
|
+
{
|
|
47
|
+
this._tileset = this.gameObject.GetComponentInParent<Cesium3DTileset>();
|
|
48
|
+
|
|
49
|
+
this._meshFilter = this.gameObject.GetComponent<MeshFilter>();
|
|
50
|
+
this._mesh = this._meshFilter.sharedMesh;
|
|
51
|
+
this._meshRenderer = this.gameObject.GetComponent<MeshRenderer>();
|
|
52
|
+
|
|
53
|
+
this._pointCount = this._mesh.vertexCount;
|
|
54
|
+
this._pointMaterial = UnityEngine.Object.Instantiate(
|
|
55
|
+
Resources.Load<Material>("CesiumPointCloudShadingMaterial"));
|
|
56
|
+
|
|
57
|
+
GraphicsBuffer sourceBuffer = this._mesh.GetVertexBuffer(0);
|
|
58
|
+
|
|
59
|
+
bool usingDirect11 = SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11;
|
|
60
|
+
if (usingDirect11)
|
|
61
|
+
{
|
|
62
|
+
this._meshVertexBuffer = new GraphicsBuffer(
|
|
63
|
+
GraphicsBuffer.Target.Structured | GraphicsBuffer.Target.CopyDestination,
|
|
64
|
+
sourceBuffer.count,
|
|
65
|
+
sourceBuffer.stride);
|
|
66
|
+
Graphics.CopyBuffer(sourceBuffer, this._meshVertexBuffer);
|
|
67
|
+
sourceBuffer.Release();
|
|
68
|
+
} else
|
|
69
|
+
{
|
|
70
|
+
this._mesh.vertexBufferTarget |= GraphicsBuffer.Target.Structured;
|
|
71
|
+
this._meshVertexBuffer = sourceBuffer;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (this._mesh.HasVertexAttribute(VertexAttribute.Color))
|
|
75
|
+
{
|
|
76
|
+
this._pointMaterial.EnableKeyword("HAS_POINT_COLORS");
|
|
77
|
+
}
|
|
78
|
+
else
|
|
79
|
+
{
|
|
80
|
+
Material material = this._meshRenderer.sharedMaterial;
|
|
81
|
+
|
|
82
|
+
if (material.HasColor("_Color"))
|
|
83
|
+
{
|
|
84
|
+
this._constantColor = material.color;
|
|
85
|
+
}
|
|
86
|
+
else if (material.HasVector("_baseColorFactor"))
|
|
87
|
+
{
|
|
88
|
+
this._constantColor = material.GetVector("_baseColorFactor");
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
{
|
|
92
|
+
this._constantColor = Color.gray;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (this._mesh.HasVertexAttribute(VertexAttribute.Normal))
|
|
97
|
+
{
|
|
98
|
+
this._pointMaterial.EnableKeyword("HAS_POINT_NORMALS");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassInstanced ||
|
|
102
|
+
XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassMultiview)
|
|
103
|
+
{
|
|
104
|
+
this._pointMaterial.EnableKeyword("INSTANCING_ON");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private float GetGeometricError(CesiumPointCloudShading pointCloudShading)
|
|
109
|
+
{
|
|
110
|
+
float geometricError = this._tileInfo.geometricError;
|
|
111
|
+
if (geometricError > 0.0f)
|
|
112
|
+
{
|
|
113
|
+
return geometricError;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (pointCloudShading.baseResolution > 0.0f)
|
|
117
|
+
{
|
|
118
|
+
return pointCloudShading.baseResolution;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Estimate the geometric error.
|
|
122
|
+
Vector3 dimensions = this._tileInfo.dimensions;
|
|
123
|
+
float volume = dimensions.x * dimensions.y * dimensions.z;
|
|
124
|
+
return Mathf.Pow(volume / this._pointCount, 1.0f / 3.0f);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private void UpdateAttenuationParameters()
|
|
128
|
+
{
|
|
129
|
+
float maximumPointSize =
|
|
130
|
+
this._tileInfo.usesAdditiveRefinement ?
|
|
131
|
+
5.0f :
|
|
132
|
+
this._tileset.maximumScreenSpaceError;
|
|
133
|
+
|
|
134
|
+
if (this._tileset.pointCloudShading.maximumAttenuation > 0.0f)
|
|
135
|
+
{
|
|
136
|
+
maximumPointSize = this._tileset.pointCloudShading.maximumAttenuation;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (Screen.dpi > 0)
|
|
140
|
+
{
|
|
141
|
+
// Approximation of device pixel ratio
|
|
142
|
+
maximumPointSize *= Screen.dpi / 150;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
CesiumPointCloudShading pointCloudShading = this._tileset.pointCloudShading;
|
|
146
|
+
|
|
147
|
+
float geometricError = this.GetGeometricError(pointCloudShading);
|
|
148
|
+
geometricError *= pointCloudShading.geometricErrorScale;
|
|
149
|
+
|
|
150
|
+
// Depth multiplier
|
|
151
|
+
Camera camera = Camera.main;
|
|
152
|
+
float sseDenominator = 2.0f * Mathf.Tan(0.5f * Mathf.Deg2Rad * camera.fieldOfView);
|
|
153
|
+
float depthMultplier = camera.scaledPixelHeight / sseDenominator;
|
|
154
|
+
|
|
155
|
+
this._attenuationParameters =
|
|
156
|
+
new Vector4(maximumPointSize, geometricError, depthMultplier, 0);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private Vector3[] positionsScratch = new Vector3[3];
|
|
160
|
+
|
|
161
|
+
private void UpdateBounds()
|
|
162
|
+
{
|
|
163
|
+
Matrix4x4 transformMatrix = this.gameObject.transform.localToWorldMatrix;
|
|
164
|
+
|
|
165
|
+
Bounds localBounds = this._mesh.bounds;
|
|
166
|
+
positionsScratch[0] = localBounds.center;
|
|
167
|
+
positionsScratch[1] = localBounds.min;
|
|
168
|
+
positionsScratch[2] = localBounds.max;
|
|
169
|
+
|
|
170
|
+
this._bounds = GeometryUtility.CalculateBounds(positionsScratch, transformMatrix);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private void DestroyResources()
|
|
174
|
+
{
|
|
175
|
+
if (this._meshVertexBuffer != null)
|
|
176
|
+
{
|
|
177
|
+
this._meshVertexBuffer.Release();
|
|
178
|
+
this._meshVertexBuffer = null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (this._pointMaterial != null)
|
|
182
|
+
{
|
|
183
|
+
#if UNITY_EDITOR
|
|
184
|
+
if (!EditorApplication.isPlaying) {
|
|
185
|
+
DestroyImmediate(this._pointMaterial);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
#endif
|
|
189
|
+
Destroy(this._pointMaterial);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private void UpdateMaterial()
|
|
194
|
+
{
|
|
195
|
+
this._pointMaterial.SetBuffer("_inPoints", this._meshVertexBuffer);
|
|
196
|
+
this._pointMaterial.SetMatrix("_worldTransform", this.gameObject.transform.localToWorldMatrix);
|
|
197
|
+
this._pointMaterial.SetVector("_attenuationParameters", this._attenuationParameters);
|
|
198
|
+
this._pointMaterial.SetVector("_constantColor", this._constantColor);
|
|
199
|
+
|
|
200
|
+
if (this._tileInfo.isTranslucent || this._constantColor.w < 1.0f)
|
|
201
|
+
{
|
|
202
|
+
this._pointMaterial.SetOverrideTag("RenderType", "Transparent");
|
|
203
|
+
this._pointMaterial.renderQueue = (int)RenderQueue.Transparent;
|
|
204
|
+
this._pointMaterial.SetInt("_SrcBlend", (int)BlendMode.SrcAlpha);
|
|
205
|
+
this._pointMaterial.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
|
|
206
|
+
}
|
|
207
|
+
else
|
|
208
|
+
{
|
|
209
|
+
this._pointMaterial.SetInt("_SrcBlend", (int)BlendMode.One);
|
|
210
|
+
this._pointMaterial.SetInt("_DstBlend", (int)BlendMode.Zero);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private void DrawPointsWithAttenuation()
|
|
215
|
+
{
|
|
216
|
+
this.UpdateBounds();
|
|
217
|
+
this.UpdateAttenuationParameters();
|
|
218
|
+
this.UpdateMaterial();
|
|
219
|
+
|
|
220
|
+
Graphics.DrawProcedural(
|
|
221
|
+
this._pointMaterial,
|
|
222
|
+
this._bounds,
|
|
223
|
+
MeshTopology.Triangles,
|
|
224
|
+
this._pointCount * 6,
|
|
225
|
+
1);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
void Update()
|
|
229
|
+
{
|
|
230
|
+
if (this._tileset.pointCloudShading.attenuation)
|
|
231
|
+
{
|
|
232
|
+
this.DrawPointsWithAttenuation();
|
|
233
|
+
this._meshRenderer.enabled = false;
|
|
234
|
+
}
|
|
235
|
+
else
|
|
236
|
+
{
|
|
237
|
+
this._meshRenderer.enabled = true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
void OnDisable()
|
|
242
|
+
{
|
|
243
|
+
this.DestroyResources();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace CesiumForUnity
|
|
5
|
+
{
|
|
6
|
+
[Serializable]
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Options for adjusting how point clouds are rendered using 3D Tiles.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class CesiumPointCloudShading
|
|
11
|
+
{
|
|
12
|
+
[SerializeField]
|
|
13
|
+
private bool _attenuation = false;
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// Whether or not to perform point attenuation. Attenuation controls the size of
|
|
17
|
+
/// the points rendered based on the geometric error of their tile.
|
|
18
|
+
/// </summary>
|
|
19
|
+
public bool attenuation
|
|
20
|
+
{
|
|
21
|
+
get => this._attenuation;
|
|
22
|
+
set => this._attenuation = value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[SerializeField]
|
|
26
|
+
private float _geometricErrorScale = 1.0f;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// The scale to be applied to the tile's geometric error before it is used
|
|
30
|
+
/// to compute attenuation. Larger values will result in larger points.
|
|
31
|
+
/// </summary>
|
|
32
|
+
public float geometricErrorScale
|
|
33
|
+
{
|
|
34
|
+
get => this._geometricErrorScale;
|
|
35
|
+
set
|
|
36
|
+
{
|
|
37
|
+
this._geometricErrorScale = Mathf.Max(value, 0.0f);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[SerializeField]
|
|
42
|
+
private float _maximumAttenuation = 0.0f;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// The maximum point attenuation in pixels. If this is zero, the Cesium3DTileset's
|
|
46
|
+
/// maximumScreenSpaceError will be used as the maximum point attenuation.
|
|
47
|
+
/// </summary>
|
|
48
|
+
public float maximumAttenuation
|
|
49
|
+
{
|
|
50
|
+
get => this._maximumAttenuation;
|
|
51
|
+
set
|
|
52
|
+
{
|
|
53
|
+
this._maximumAttenuation = Mathf.Max(value, 0.0f);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[SerializeField]
|
|
58
|
+
private float _baseResolution = 0.0f;
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
/// The average base resolution for the dataset in meters. For example,
|
|
62
|
+
/// a base resolution of 0.05 assumes an original capture resolution of
|
|
63
|
+
/// 5 centimeters between neighboring points.
|
|
64
|
+
/// <para>
|
|
65
|
+
/// This is used in place of geometric error when the tile's geometric error is 0.
|
|
66
|
+
/// If this value is zero, each tile with a geometric error of 0 will have its
|
|
67
|
+
/// geometric error approximated instead.
|
|
68
|
+
/// </para>
|
|
69
|
+
/// </summary>
|
|
70
|
+
public float baseResolution
|
|
71
|
+
{
|
|
72
|
+
get => this._baseResolution;
|
|
73
|
+
set => this._baseResolution = Mathf.Max(value, 0.0f);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
using Reinterop;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace CesiumForUnity
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// A raster overlay that rasterizes polygons and drapes them over the tileset.
|
|
9
|
+
/// This is useful for clipping out parts of a tileset or applying specific material
|
|
10
|
+
/// effects in an area.
|
|
11
|
+
/// </summary>
|
|
12
|
+
/// <remarks>
|
|
13
|
+
/// Polygon raster overlays will only work in Unity 2022.2 or later.
|
|
14
|
+
/// </remarks>
|
|
15
|
+
[ReinteropNativeImplementation(
|
|
16
|
+
"CesiumForUnityNative::CesiumPolygonRasterOverlayImpl", "CesiumPolygonRasterOverlayImpl.h")]
|
|
17
|
+
#if UNITY_2022_2_OR_NEWER
|
|
18
|
+
[AddComponentMenu("Cesium/Cesium Polygon Raster Overlay")]
|
|
19
|
+
#else
|
|
20
|
+
[AddComponentMenu("")]
|
|
21
|
+
#endif
|
|
22
|
+
[IconAttribute("Packages/com.cesium.unity/Editor/Resources/Cesium-24x24.png")]
|
|
23
|
+
public partial class CesiumPolygonRasterOverlay : CesiumRasterOverlay
|
|
24
|
+
{
|
|
25
|
+
[SerializeField]
|
|
26
|
+
private List<CesiumCartographicPolygon> _polygons;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// The polygons to rasterize for this overlay.
|
|
30
|
+
/// </summary>
|
|
31
|
+
public List<CesiumCartographicPolygon> polygons
|
|
32
|
+
{
|
|
33
|
+
get => this._polygons;
|
|
34
|
+
set
|
|
35
|
+
{
|
|
36
|
+
this._polygons = value;
|
|
37
|
+
this.Refresh();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[SerializeField]
|
|
42
|
+
private bool _invertSelection = false;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Whether to invert the selection specified by the polygons.
|
|
46
|
+
/// </summary>
|
|
47
|
+
/// <remarks>
|
|
48
|
+
/// <para>
|
|
49
|
+
/// When this setting is false, the areas inside the polygons are rasterized and therefore
|
|
50
|
+
/// hidden from the rest of the tileset. In other words, they appear to cut holes in the
|
|
51
|
+
/// tileset.
|
|
52
|
+
/// </para>
|
|
53
|
+
/// <para>
|
|
54
|
+
/// When this setting is true, the areas outside of all the polygons will be rasterized instead.
|
|
55
|
+
/// This will hide everything except for the areas inside the polygons.
|
|
56
|
+
/// </para>
|
|
57
|
+
/// </remarks>
|
|
58
|
+
public bool invertSelection
|
|
59
|
+
{
|
|
60
|
+
get => this._invertSelection;
|
|
61
|
+
set
|
|
62
|
+
{
|
|
63
|
+
this._invertSelection = value;
|
|
64
|
+
this.Refresh();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[SerializeField]
|
|
69
|
+
private bool _excludeSelectedTiles = true;
|
|
70
|
+
|
|
71
|
+
/// <summary>
|
|
72
|
+
/// Whether tiles that fall entirely within the rasterized selection should be
|
|
73
|
+
/// excluded from loading and rendering.
|
|
74
|
+
/// </summary>
|
|
75
|
+
/// <remarks>
|
|
76
|
+
/// <para>
|
|
77
|
+
/// For better performance, this should be enabled when this overlay will be used for clipping.
|
|
78
|
+
/// But when this overlay is used for other effects, this option should be disabled to avoid
|
|
79
|
+
/// missing tiles.
|
|
80
|
+
/// </para>
|
|
81
|
+
/// <para>
|
|
82
|
+
/// Note that if <see cref="invertSelection"/> is true, this will cull tiles that are outside
|
|
83
|
+
/// of all the polygons. If it is false, this will cull tiles that are completely inside at
|
|
84
|
+
/// least one polygon.
|
|
85
|
+
/// </para>
|
|
86
|
+
/// </remarks>
|
|
87
|
+
public bool excludeSelectedTiles
|
|
88
|
+
{
|
|
89
|
+
get => this._excludeSelectedTiles;
|
|
90
|
+
set
|
|
91
|
+
{
|
|
92
|
+
this._excludeSelectedTiles = value;
|
|
93
|
+
this.Refresh();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#if UNITY_EDITOR
|
|
98
|
+
private void Reset()
|
|
99
|
+
{
|
|
100
|
+
this.materialKey = "Clipping";
|
|
101
|
+
}
|
|
102
|
+
#endif
|
|
103
|
+
|
|
104
|
+
/// <inheritdoc/>
|
|
105
|
+
protected override partial void AddToTileset(Cesium3DTileset tileset);
|
|
106
|
+
/// <inheritdoc/>
|
|
107
|
+
protected override partial void RemoveFromTileset(Cesium3DTileset tileset);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace CesiumForUnity
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Represents the EXT_mesh_features of a glTF primitive in a <see cref="Cesium3DTileset"/>.
|
|
9
|
+
/// It holds views of the feature ID sets associated with this primitive.
|
|
10
|
+
/// </summary>
|
|
11
|
+
/// <remarks>
|
|
12
|
+
/// This component is automatically added to primitive game objects if they
|
|
13
|
+
/// contain the extension.
|
|
14
|
+
/// </remarks>
|
|
15
|
+
[IconAttribute("Packages/com.cesium.unity/Editor/Resources/Cesium-24x24.png")]
|
|
16
|
+
[AddComponentMenu("")]
|
|
17
|
+
public partial class CesiumPrimitiveFeatures : MonoBehaviour
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// The <see cref="CesiumFeatureIdSet"/>s available on this primitive.
|
|
21
|
+
/// </summary>
|
|
22
|
+
public CesiumFeatureIdSet[] featureIdSets
|
|
23
|
+
{
|
|
24
|
+
get; internal set;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#region Helper functions
|
|
28
|
+
|
|
29
|
+
// Cache a list of indices to prevent the allocation of a new array every time
|
|
30
|
+
// GetFirstVertexFromTriangle is called.
|
|
31
|
+
private static List<int> _indices;
|
|
32
|
+
|
|
33
|
+
private static int GetFirstVertexFromTriangle(MeshFilter meshFilter, int triangleIndex)
|
|
34
|
+
{
|
|
35
|
+
if (meshFilter == null || meshFilter.mesh == null)
|
|
36
|
+
{
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (CesiumPrimitiveFeatures._indices == null)
|
|
41
|
+
{
|
|
42
|
+
CesiumPrimitiveFeatures._indices = new List<int>();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
meshFilter.mesh.GetTriangles(CesiumPrimitiveFeatures._indices, 0);
|
|
46
|
+
int targetVertex = triangleIndex * 3;
|
|
47
|
+
return targetVertex < CesiumPrimitiveFeatures._indices.Count ? CesiumPrimitiveFeatures._indices[targetVertex] : -1;
|
|
48
|
+
}
|
|
49
|
+
#endregion
|
|
50
|
+
|
|
51
|
+
#region Public methods
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Given a successful raycast hit, finds the index of the first vertex
|
|
54
|
+
/// from the hit triangle.
|
|
55
|
+
/// </summary>
|
|
56
|
+
/// <param name="hitInfo">The raycast hit.</param>
|
|
57
|
+
/// <returns>The index of the first vertex on the triangle, or -1 if the hit was unsuccessful.</returns>
|
|
58
|
+
public static int GetFirstVertexFromHitTriangle(RaycastHit hitInfo)
|
|
59
|
+
{
|
|
60
|
+
MeshFilter meshFilter = hitInfo.transform.GetComponent<MeshFilter>();
|
|
61
|
+
return GetFirstVertexFromTriangle(meshFilter, hitInfo.triangleIndex);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// <summary>
|
|
65
|
+
/// Gets all the feature ID sets of the given type. If the primitive has no sets
|
|
66
|
+
/// of that type, the returned array will be empty.
|
|
67
|
+
/// </summary>
|
|
68
|
+
/// <param name="type"> The desired feature ID set type.</param>
|
|
69
|
+
/// <returns>An array of feature ID sets of the specified type, if any exist on the CesiumPrimitiveFeatures.</returns>
|
|
70
|
+
public CesiumFeatureIdSet[] GetFeatureIdSetsOfType(CesiumFeatureIdSetType type)
|
|
71
|
+
{
|
|
72
|
+
return Array.FindAll(this.featureIdSets, set => (set.type == type));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// Gets the feature ID associated with the given triangle, specified by index.
|
|
77
|
+
/// </summary>
|
|
78
|
+
/// <remarks>
|
|
79
|
+
/// A primitive may have multiple feature ID sets, so this allows a feature ID
|
|
80
|
+
/// set to be specified by index.This value should index into the array of
|
|
81
|
+
/// CesiumFeatureIdSets in the CesiumPrimitiveFeatures. If the specified
|
|
82
|
+
/// feature ID set index is invalid, this returns -1.
|
|
83
|
+
/// </remarks>
|
|
84
|
+
/// <param name="triangleIndex">The index of the target triangle.</param>
|
|
85
|
+
/// <param name="featureIdSetIndex">The index of the target feature ID set.</param>
|
|
86
|
+
/// <returns>The feature ID, or -1 if the specified triangle or feature ID set is invalid.</returns>
|
|
87
|
+
|
|
88
|
+
public Int64 GetFeatureIdFromTriangle(int triangleIndex, Int64 featureIdSetIndex = 0)
|
|
89
|
+
{
|
|
90
|
+
MeshFilter meshFilter = this.gameObject.GetComponent<MeshFilter>();
|
|
91
|
+
if (meshFilter == null || featureIdSetIndex < 0 || featureIdSetIndex >= this.featureIdSets.Length)
|
|
92
|
+
{
|
|
93
|
+
return -1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
CesiumFeatureIdSet featureIdSet = this.featureIdSets[featureIdSetIndex];
|
|
97
|
+
|
|
98
|
+
return featureIdSet.GetFeatureIdForVertex(
|
|
99
|
+
GetFirstVertexFromTriangle(meshFilter, triangleIndex));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// <summary>
|
|
103
|
+
/// Gets the feature ID from the given raycast hit, assuming it has hit a
|
|
104
|
+
/// glTF primitive component containing this CesiumPrimitiveFeatures.
|
|
105
|
+
/// </summary>
|
|
106
|
+
/// <remarks>
|
|
107
|
+
/// A primitive may have multiple feature ID sets, so this allows a feature ID
|
|
108
|
+
/// set to be specified by index. This value should index into the array of
|
|
109
|
+
/// CesiumFeatureIdSets in the CesiumPrimitiveFeatures. If the specified
|
|
110
|
+
/// feature ID set index is invalid, this returns -1.
|
|
111
|
+
/// </remarks>
|
|
112
|
+
/// <param name="hitInfo">The raycast hit info.</param>
|
|
113
|
+
/// <param name="featureIdSetIndex">The index of the target feature ID set.</param>
|
|
114
|
+
/// <returns>The feature ID, or -1 if the specified feature ID set is invalid.</returns>
|
|
115
|
+
public Int64 GetFeatureIdFromRaycastHit(RaycastHit hitInfo, Int64 featureIdSetIndex = 0)
|
|
116
|
+
{
|
|
117
|
+
if (hitInfo.transform.GetComponent<CesiumPrimitiveFeatures>() != this ||
|
|
118
|
+
featureIdSetIndex < 0 || featureIdSetIndex >= this.featureIdSets.Length)
|
|
119
|
+
{
|
|
120
|
+
return -1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
CesiumFeatureIdSet featureIdSet = this.featureIdSets[featureIdSetIndex];
|
|
124
|
+
|
|
125
|
+
return featureIdSet.GetFeatureIdFromRaycastHit(hitInfo);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#endregion
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
|
|
3
|
+
namespace CesiumForUnity
|
|
4
|
+
{
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Represents an array value from a property in glTF metadata. The values belong
|
|
7
|
+
/// to one of the supported property types in EXT_structural_metadata.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class CesiumPropertyArray
|
|
10
|
+
{
|
|
11
|
+
internal CesiumMetadataValue[] values { get; set; }
|
|
12
|
+
|
|
13
|
+
internal CesiumPropertyArray()
|
|
14
|
+
{
|
|
15
|
+
this.values = new CesiumMetadataValue[0];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
internal CesiumPropertyArray(CesiumMetadataValue[] values)
|
|
19
|
+
{
|
|
20
|
+
this.values = values;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// The value type of the elements in the array. Some of these types are
|
|
25
|
+
/// not accessible from Unity, but can be converted to a close-fitting type.
|
|
26
|
+
/// </summary>
|
|
27
|
+
public CesiumMetadataValueType elementValueType
|
|
28
|
+
{
|
|
29
|
+
get; internal set;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets the number of elements in the array. Returns 0 if the elements have
|
|
34
|
+
/// an unknown type.
|
|
35
|
+
/// </summary>
|
|
36
|
+
public Int64 length
|
|
37
|
+
{
|
|
38
|
+
get { return this.values.LongLength; }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Retrieves an element from the array as a CesiumMetadataValue. The value
|
|
43
|
+
/// can then be retrieved as a specific C# or Unity type.
|
|
44
|
+
///
|
|
45
|
+
/// If the index is out-of-bounds, this returns a bogus CesiumMetadataValue
|
|
46
|
+
/// of an unknown type.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="index">The desired index</param>
|
|
49
|
+
/// <returns>The element as a CesiumMetadataValue.</returns>
|
|
50
|
+
public CesiumMetadataValue this[Int64 index]
|
|
51
|
+
{
|
|
52
|
+
get
|
|
53
|
+
{
|
|
54
|
+
if (index < 0 || index >= this.length)
|
|
55
|
+
{
|
|
56
|
+
return new CesiumMetadataValue();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return values[index];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
}
|