Cesium for Unity 1.15.4
Loading...
Searching...
No Matches
CesiumMetadataValueType.cs
Go to the documentation of this file.
1using UnityEngine;
2using Unity.Mathematics;
3using System;
4
5namespace CesiumForUnity
6{
11 {
12 Invalid = 0,
13 Scalar,
14 Vec2,
15 Vec3,
16 Vec4,
17 Mat2,
18 Mat3,
19 Mat4,
20 String,
21 Boolean,
22 Enum
23 }
24
30 {
31 None = 0,
32 Int8,
33 Uint8,
34 Int16,
35 Uint16,
36 Int32,
37 Uint32,
38 Int64,
39 Uint64,
40 Float32,
42 }
43
49 {
50 #region Fields
55
61
66 public bool isArray;
67 #endregion
68
69 #region Constructor
78 {
79 this.type = type;
80 this.componentType = componentType;
81 this.isArray = isArray;
82 }
83 #endregion
84
85 #region Static methods
86 public static CesiumMetadataValueType GetValueType(System.Object inObject)
87 {
88 if (inObject == null)
89 {
90 return new CesiumMetadataValueType();
91 }
92
93 if (inObject.GetType() == typeof(CesiumPropertyArray))
94 {
95 CesiumPropertyArray array = inObject as CesiumPropertyArray;
97 }
98
99 switch (inObject)
100 {
101 case System.Boolean:
103 case System.SByte:
105 case Byte:
107 case Int16:
109 case UInt16:
111 case Int32:
113 case UInt32:
115 case Int64:
117 case UInt64:
119 case float:
121 case double:
123 case int2:
125 case int3:
127 case int4:
129 case uint2:
131 case uint3:
133 case uint4:
135 case float2:
137 case float3:
139 case float4:
141 case double2:
143 case double3:
145 case double4:
147 case int2x2:
149 case int3x3:
151 case int4x4:
153 case CesiumIntVec2:
154 return new CesiumMetadataValueType(CesiumMetadataType.Vec2, (inObject as CesiumIntVec2?).Value.componentType, false);
155 case CesiumIntVec3:
156 return new CesiumMetadataValueType(CesiumMetadataType.Vec3, (inObject as CesiumIntVec3?).Value.componentType, false);
157 case CesiumIntVec4:
158 return new CesiumMetadataValueType(CesiumMetadataType.Vec4, (inObject as CesiumIntVec4?).Value.componentType, false);
159 case CesiumUintVec2:
160 return new CesiumMetadataValueType(CesiumMetadataType.Vec2, (inObject as CesiumUintVec2?).Value.componentType, false);
161 case CesiumUintVec3:
162 return new CesiumMetadataValueType(CesiumMetadataType.Vec3, (inObject as CesiumUintVec3?).Value.componentType, false);
163 case CesiumUintVec4:
164 return new CesiumMetadataValueType(CesiumMetadataType.Vec4, (inObject as CesiumUintVec4?).Value.componentType, false);
165 case uint2x2:
167 case uint3x3:
169 case uint4x4:
171 case float2x2:
173 case float3x3:
175 case float4x4:
177 case double2x2:
179 case double3x3:
181 case double4x4:
183 case CesiumIntMat2x2:
184 return new CesiumMetadataValueType(CesiumMetadataType.Mat2, (inObject as CesiumIntMat2x2?).Value.componentType, false);
185 case CesiumIntMat3x3:
186 return new CesiumMetadataValueType(CesiumMetadataType.Mat3, (inObject as CesiumIntMat3x3?).Value.componentType, false);
187 case CesiumIntMat4x4:
188 return new CesiumMetadataValueType(CesiumMetadataType.Mat4, (inObject as CesiumIntMat4x4?).Value.componentType, false);
189 case CesiumUintMat2x2:
190 return new CesiumMetadataValueType(CesiumMetadataType.Mat2, (inObject as CesiumUintMat2x2?).Value.componentType, false);
191 case CesiumUintMat3x3:
192 return new CesiumMetadataValueType(CesiumMetadataType.Mat3, (inObject as CesiumUintMat3x3?).Value.componentType, false);
193 case CesiumUintMat4x4:
194 return new CesiumMetadataValueType(CesiumMetadataType.Mat4, (inObject as CesiumUintMat4x4?).Value.componentType, false);
195 case System.String:
197 default:
198 return new CesiumMetadataValueType();
199 }
200 }
201 #endregion
202 }
203}
Represents an array value from a property in glTF metadata.
CesiumMetadataValueType elementValueType
The value type of the elements in the array.
CesiumMetadataType
Identifies the type of a property in EXT_structural_metadata.
CesiumMetadataComponentType
Identifies the component type of a property in EXT_structural_metadata.
Represents the value type of a metadata value or property, akin to the property types in EXT_structur...
bool isArray
Whether or not this represents an array containing elements of the specified types.
CesiumMetadataType type
The type of the metadata property or value.
CesiumMetadataComponentType componentType
The component of the metadata property or value.
CesiumMetadataValueType(CesiumMetadataType type, CesiumMetadataComponentType componentType, bool isArray)
Constructs a metadata value type from the given parameters.
static CesiumMetadataValueType GetValueType(System.Object inObject)