udScene

The udScene and udSceneNode objects provide an interface for storing and syncronising geolocated projects between udSDK sessions

!NOTE The GeoJSON provided by this implementation is not fully compliant with RFC7946

!WARNING Antimeridian Cutting (Section 3.1.9) and handling the poles (Secion 5.3) are not fully working in this implementation

!WARNING This module does not currently expose the functionality to sync with the server. This will be added in a future release.

Enums

enum udSceneAltitudeType

Values:

ValueDescription
udSceneAltitudeType_AbsoluteThe position is from the ellipsoid (or just ECEF).
udSceneAltitudeType_RelativeThe position is relative to the terrain.
udSceneAltitudeType_ClampThe position is clamped to the terrain.
udSceneAltitudeType_Count

enum udSceneGeometryType

These are the geometry types for nodes

Values:

ValueDescription
udPGT_NoneThere is no geometry associated with this node.
udPGT_PointpCoordinates is a single 3D position
udPGT_MultiPointArray of udPGT_Point, pCoordinates is an array of 3D positions.
udPGT_LineStringpCoordinates is an array of 3D positions forming an open line
udPGT_MultiLineStringArray of udPGT_LineString; pCoordinates is NULL and children will be present.
udPGT_PolygonpCoordinates will be a closed linear ring (the outside), there MAY be children that are interior as pChildren udPGT_MultiLineString items, these should be counted as islands of the external ring.
udPGT_MultiPolygonpCoordinates is null, children will be udPGT_Polygon (which still may have internal islands)
udPGT_GeometryCollectionArray of geometries; pCoordinates is NULL and children may be present of any type.
udPGT_CountTotal number of geometry types. Used internally but can be used as an iterator max when displaying different type modes.
udPGT_InternalUsed internally when calculating other types. Do not use.

enum udSceneNodeType

This represents the type of data stored in the node.

!NOTE The itemtypeStr in the udSceneNode is a string version. This enum serves to simplify the reading of standard types. The the string in brackets at the end of the comment is the string.

Values:

ValueDescription
udPNT_CustomNeed to check the itemtypeStr string manually.
udPNT_PointCloudA Nuclideon Unlimited Detail Point Cloud file (“UDS”).
udPNT_PointOfInterestA point, line or region describing a location of interest (“POI”).
udPNT_FolderA folder of other nodes (“Folder”).
udPNT_MediaAn Image, Movie, Audio file or other media object (“Media”).
udPNT_ViewpointAn Camera Location & Orientation (“Camera”).
udPNT_VisualisationSettingsVisualisation settings (itensity, map height etc) (“VizSet”).
udPNT_I3SAn Indexed 3d Scene Layer (I3S) or Scene Layer Package (SLPK) dataset (“I3S”).
udPNT_3DTilesA 3D tile dataset using the open-source Cesium standard format (“3DTiles”).
udPNT_WaterA region describing the location of a body of water (“Water”).
udPNT_ViewShedA point describing where to generate a view shed from (“ViewMap”).
udPNT_PolygonA polygon model, usually an OBJ or FBX (“Polygon”).
udPNT_QueryFilterA query filter to be applied to all PointCloud types in the scene (“QFilter”).
udPNT_PlacesA collection of places that can be grouped together at a distance (“Places”).
udPNT_HeightMeasurementA height measurement object (“MHeight”).
udPNT_GTFSA General Transit Feed Specification object (“GTFS”).
udPNT_LassoNodeA Lasso Selection Folder (“LNode”).
udPNT_QueryGroupA Group of Query node being represented as one node (“QGroup”).
udPNT_BasicShape
udPNT_CountTotal number of node types. Used internally but can be used as an iterator max when displaying different type modes.

enum udSceneUserFlag

This represents the flags for scene users

Values:

ValueDescription
udSceneUserFlag_HasHeadUser has a head.
udSceneUserFlag_HasAnchorAndScaleUser has a world anchor point. This usually indicates they are using a VR Cave or Table.
udSceneUserFlag_LeftHandUser has a left hand/wand.
udSceneUserFlag_RightHandUser has a right hand/wand.

enum udSceneLoadSource

This represents where the scene was loaded from/saved to most recently and where future calls to udScene_Save will go

Values:

ValueDescription
udSceneLoadSource_MemoryThe scene source exists in memory; udScene_CreateInMemory, udScene_LoadFromMemory or udScene_SaveToMemory.
udSceneLoadSource_ServerThe scene source exists from the server; udScene_CreateInServer, udScene_LoadFromServer or udScene_SaveToServer.
udSceneLoadSource_URIThe scene source exists from a file or URL; udScene_CreateInFile, udScene_LoadFromFile or udScene_SaveToFile.
udSceneLoadSource_CountTotal number of source types. Used internally but can be used as an iterator max when displaying different source types.

Functions

enum udError udScene_CreateInMemory(struct udContext *pContext, struct udScene **ppScene, const char *pName)

Create an empty, local only, instance of udScene.

ParameterDescription
pContextThe pointer to the udContext of the session to use to creae in memory
ppSceneThe pointer pointer of the udScene. This will allocate an instance of udScene into ppScene.
pNameThe name of the scene, this will be the name of the root item.

Returns: A udError value based on the result of the project creation.

enum udError udScene_CreateInFile(struct udContext *pContext, struct udScene **ppScene, const char *pName, const char *pFilename)

Create an empty, local only, instance of udScene.

ParameterDescription
pContextThe pointer to the udContext of the session to use to create ina file
ppSceneThe pointer pointer of the udScene. This will allocate an instance of udScene into ppScene.
pNameThe name of the project, this will be the name of the root item.
pFilenameThe path to create the project at.

Returns: A udError value based on the result of the project creation.

enum udError udScene_CreateInServer(struct udContext *pContext, struct udScene **ppScene, const char *pName, const char *pOrgID, const char *pProjID)

Create an empty project in the server and the local instance of udScene.

ParameterDescription
pContextThe pointer to the udContext of the session to use to load the project, read/write permissions will be based on the current session.
ppSceneThe pointer pointer of the udScene. This will allocate an instance of udScene into ppScene.
pNameThe name of the project, this will be the name of the root item.
pOrgIDThe ID for the udCloud organisation that the scene will belong to
pProjectIDThe ID for the udCloud project that the scene will belong to

Returns: A udError value based on the result of the project creation.

enum udError udScene_LoadFromMemory(struct udContext *pContext, struct udScene **ppScene, const char *pGeoJSON)

Create a local only instance of udScene filled in with the contents of a GeoJSON string.

ParameterDescription
pContextThe pointer to the udContext of the session to use to load from memory
ppSceneThe pointer pointer of the udScene. This will allocate an instance of udScene into ppScene.
pGeoJSONThe GeoJSON string of the project, this will be unpacked into udSceneNode items.

Returns: A udError value based on the result of the project creation.

enum udError udScene_LoadFromFile(struct udContext *pContext, struct udScene **ppScene, const char *pFilename)

Create a local only instance of udScene filled in with the contents of the specified project file.

ParameterDescription
pContextThe pointer to the udContext of the session to use to load from a file
ppSceneThe pointer pointer of the udScene. This will allocate an instance of udScene into ppScene.
pFilenameThe project file URL.

Returns: A udError value based on the result of the project creation.

enum udError udScene_LoadFromServer(struct udContext *pContext, struct udScene **ppScene, const char *pOrgID, const char *pProjID, const char *pSceneID, udProgressCallback *pProgressCallback, void *pProgressUserData)

Create a local instance of udScene filled in from the server.

ParameterDescription
pContextThe pointer to the udContext of the session to use to load the scene, read/write permissions will be based on the current session.
ppSceneThe pointer pointer of the udScene. This will allocate an instance of udScene into ppScene.
pOrgIDThe ID for the organisation in udCloud that the scene belongs to
pProjIDThe ID for the project in udCloud that the scene belongs to
pSceneIDThe ID for the scene that is being requested
pProgressCallbackA function callback when there are progress updates
pProgressUserDataA pointer that will be passed to the pProgressCallback

Returns: A udError value based on the result of the project creation.

enum udError udScene_MergeScenes(struct udContext *pContext, struct udScene *pScene, struct udScene *pSceneToMerge)

Update a local instance of udScene by merging elements from another udScene.

!NOTE pSceneToMerge will be empty after this operation.

ParameterDescription
pContextThe pointer to the udContext of the session to use to load the scene, read/write permissions will be based on the current session.
pSceneThe pointer of the udScene to update.
pSceneToMergeThe pointer of the udScene to merge its elements into previous udScene

Returns: A udError value based on the result of the merge.

enum udError udScene_Release(struct udScene **ppScene)

Destroy the instance of the scene.

!WARNING The pUserData item should be already released from every node before calling this.

ParameterDescription
ppSceneThe pointer pointer of the udScene. This will deallocate the instance of the scene as well as destroying all nodes.

Returns: A udError value based on the result of the scene destruction.

enum udError udScene_Save(struct udScene *pScene)

Export a scene to where it was loaded from (server or file).

ParameterDescription
pSceneThe pointer to a valid udScene that will saved. This will fail immediately for scenes loaded from memory

Returns: A udError value based on the result of the scene save

enum udError udScene_Update(struct udScene *pScene, struct udSceneUpdateInfo *pUpdateInfo)

Update a scene to where it was loaded from (server or file).

ParameterDescription
pSceneThe pointer to a valid udScene that will saved. This will fail immediately for scenes loaded from memory
pUpdateInfoThe data that would be updated

Returns: A udError value based on the result of the scene save

enum udError udScene_SaveToMemory(struct udContext *pContext, struct udScene *pScene, const char **ppMemory)

Export a scene to a GeoJSON string in memory.

!WARNING The memory is stored in the udScene and subsequent calls will destroy older versions, the buffer is released when the scene is released.

ParameterDescription
pContextThe pointer to the udContext of the session to use to save the scene to memory.
pSceneThe pointer to a valid udScene that will be exported as GeoJSON.
ppMemoryThe pointer pointer to a string that will contain the exported GeoJSON.

Returns: A udError value based on the result of the scene export.

enum udError udScene_SaveToServer(struct udContext *pContext, struct udScene *pScene, const char *pOrgID, const char *pProjID)

Create an scene in the server from an existing udScene

!NOTE pScene will point to the newly created scene if this is successful

ParameterDescription
pContextThe pointer to the udContext of the session to use to upload the scene, write permissions will be based on the current session.
pSceneThe udScene to upload.
pOrgIDThe ID for the udCloud organisation that the scene will belong to
pProjectIDThe ID for the udCloud project that the scene will belong to

Returns: A udError value based on the result of the scene creation.

enum udError udScene_SaveToFile(struct udContext *pContext, struct udScene *pScene, const char *pPath)

Create an scene in the server from an existing udScene

!NOTE pScene will point to the newly created file if this is successful

ParameterDescription
pContextThe pointer to the udContext of the session to use to save the scene to file.
pSceneThe udScene to save out.
pPathThe new path to save the scene to

Returns: A udError value based on the result of the scene creation.

enum udError udScene_GetSceneRoot(struct udScene *pScene, struct udSceneNode **ppRootNode)

Get the scene root node.

!NOTE This node will always have itemtype of type udPNT_Folder and cannot (and will not) have sibling nodes.

!NOTE The name of the scene is the name of the returned root node.

ParameterDescription
pSceneThe pointer to a valid udScene.
ppRootNodeThe pointer pointer to a node that will contain the node. The node ownership still belongs to the pScene.

Returns: A udError value based on the result of getting the root node.

enum udError udScene_GetSceneID(struct udScene *pScene, const char **ppSceneID)

Get the scene ID (for server projects).

!NOTE Returns udE_NotFound for non-server projects

ParameterDescription
pSceneThe pointer to a valid udScene.
ppSceneIDThe pointer pointer to memory that will contain the scene ID. The ownership still belongs to the pScene.

Returns: A udError value based on the result of getting the root node.

enum udError udScene_HasUnsavedChanges(struct udScene *pScene)

Get the state of unsaved local changes

ParameterDescription
pSceneThe pointer to a valid udScene.

Returns: udE_Success if there a unsaved changes, udE_NotFound when no local changes exist and other udError values for errors

enum udError udScene_GetLoadSource(struct udScene *pScene, enum udSceneLoadSource *pSource)

Gets the current source of a given udScene

ParameterDescription
pSceneThe pointer to a valid udScene.
pSourceThe pointer to memory to write the source of pScene to

Returns: udE_Success if wrote source, error otherwise

enum udError udSceneNode_Create(struct udScene *pScene, struct udSceneNode **ppNode, struct udSceneNode *pParent, const char *pType, const char *pName, const char *pURI, void *pUserData)

Create a node in a project

ParameterDescription
pSceneThe pointer to a valid udScene.
ppNodeA pointer pointer to the node that will be created. This can be NULL if getting the node back isn’t required.
pParentThe parent node of the item.
pTypeThe string representing the type of the item. This can be a defined string provided by udScene_GetTypeName or a custom type. Cannot be NULL.
pNameA human readable name for the item. If this item is NULL it will attempt to generate a name from the pURI or the pType strings.
pURIThe URL, filename or other URI containing where to find this item. These should be absolute paths where applicable (preferably HTTPS) to ensure maximum interop with other packages.
pUserDataA pointer to data provided by the application to store in the pUserData item in the udSceneNode.

Returns: A udError value based on the result of the node being created in the project.

enum udError udSceneNode_MoveChild(struct udScene *pScene, struct udSceneNode *pCurrentParent, struct udSceneNode *pNewParent, struct udSceneNode *pNode, struct udSceneNode *pInsertBeforeChild)

Move a node to reorder within the current parent or move to a different parent.

ParameterDescription
pSceneThe pointer to a valid udScene.
pCurrentParentThe current parent of pNode.
pNewParentThe intended new parent of pNode.
pNodeThe node to move.
pInsertBeforeChildThe node that will be after pNode after the move. Set as NULL to be the last child of pNewParent.

Returns: A udError value based on the result of the move.

enum udError udSceneNode_RemoveChild(struct udScene *pScene, struct udSceneNode *pParentNode, struct udSceneNode *pNode)

Remove a node from the project.

!WARNING Ensure that the pUserData point of pNode has been released before calling this.

ParameterDescription
pSceneThe pointer to a valid udScene.
pParentNodeThe parent of the node to be removed.
pNodeThe node to remove from the project.

Returns: A udError value based on the result of removing the node.

enum udError udSceneNode_SetName(struct udScene *pScene, struct udSceneNode *pNode, const char *pNodeName)

Set the human readable name of a node.

ParameterDescription
pSceneThe pointer to a valid udScene.
pNodeThe node to change the name of.
pNodeNameThe new name of the node. This is duplicated internally.

Returns: A udError value based on the result of setting the name.

enum udError udSceneNode_SetVisibility(struct udSceneNode *pNode, int visibility)

Set the visibility of the node

ParameterDescription
pNodeThe node to change the visibility.
visibilityThe new visibility of the node (non-zero for visible).

Returns: A udError value based on the result of updating the visibility.

enum udError udSceneNode_SetURI(struct udScene *pScene, struct udSceneNode *pNode, const char *pNodeURI)

Set the URI of a node.

ParameterDescription
pSceneThe pointer to a valid udScene.
pNodeThe node to change the name of.
pNodeURIThe new URI of the node. This is duplicated internally.

Returns: A udError value based on the result of setting the URI.

enum udError udSceneNode_SetBoundingBox(struct udScene *pScene, struct udSceneNode *pNode, double boundingBox[6])

Set a bounding box for the node.

ParameterDescription
pSceneThe pointer to a valid udScene.
pNodeThe node to change the bounding box of.
boundingBoxAn array of doubles representing the bounds of the node, ordered as [West, South, Floor, East, North, Ceiling]

Returns: A udError value based on the result of setting the bounding box.

enum udError udSceneNode_SetTimeSpan(struct udScene *pScene, struct udSceneNode *pNode, double start, double end)

Set a time span for the node.

ParameterDescription
pSceneThe pointer to a valid udScene.
pNodeThe node to change the time span of.
startA Unix Epoch in Seconds. The node will be relevant after this timestamp. Set to -1.0 to unassign.
endA Unix Epoch in Seconds. The node will be relevant before this timestamp. Set to -1.0 to unassign.

Returns: A udError value based on the result of setting the time span.

enum udError udSceneNode_SetGeometry(struct udScene *pScene, struct udSceneNode *pNode, enum udSceneGeometryType nodeType, int geometryCount, double *pCoordinates)

Set the new geometry of a node.

ParameterDescription
pSceneThe pointer to a valid udScene.
pNodeThe node to change the geometry of.
nodeTypeThe new type of the geometry
geometryCountHow many coordinates are being added
pCoordinatesA pointer to the new coordinates (this is an array that should be 3x the length of geometryCount). Ordered in [ longitude0, latitude0, altitude0, …, longitudeN, latitudeN, altitudeN ] order.

Returns: A udError value based on the result of setting the geometry.

enum udError udSceneNode_SetGeometryAltitudeType(struct udScene *pScene, struct udSceneNode *pSceneNode, enum udSceneAltitudeType altitudeType)

Set the altitude type for the node.

ParameterDescription
pSceneThe pointer to a valid udScene.
pNodeThe node to change the altitude type of.
altitudeTypeThe altitude type

Returns: A udError value based on the result of setting the time span.

enum udError udSceneNode_GetMetadataInt(struct udSceneNode *pNode, const char *pMetadataKey, int32_t *pInt, int32_t defaultValue)

Get a metadata item of a node as an integer.

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key.
pIntThe pointer to the memory to write the metadata to
defaultValueThe value to write to pInt if the metadata item isn’t in the udSceneNode or if it isn’t of an integer type

Returns: A udError value based on the result of reading the metadata into pInt.

enum udError udSceneNode_SetMetadataInt(struct udSceneNode *pNode, const char *pMetadataKey, int32_t iValue)

Set a metadata item of a node from an integer.

ParameterDescription
pNodeThe node to set the metadata on.
pMetadataKeyThe name of the metadata key.
iValueThe integer value to write to the metadata key

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_GetMetadataUint(struct udSceneNode *pNode, const char *pMetadataKey, uint32_t *pInt, uint32_t defaultValue)

Get a metadata item of a node as an unsigned integer.

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key.
pIntThe pointer to the memory to write the metadata to
defaultValueThe value to write to pInt if the metadata item isn’t in the udSceneNode or if it isn’t of an integer type

Returns: A udError value based on the result of reading the metadata into pInt.

enum udError udSceneNode_SetMetadataUint(struct udSceneNode *pNode, const char *pMetadataKey, uint32_t iValue)

Set a metadata item of a node from an unsigned integer.

ParameterDescription
pNodeThe node to set the metadata on.
pMetadataKeyThe name of the metadata key.
iValueThe unsigned integer value to write to the metadata key

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_GetMetadataInt64(struct udSceneNode *pNode, const char *pMetadataKey, int64_t *pInt64, int64_t defaultValue)

Get a metadata item of a node as a 64 bit integer.

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key.
pInt64The pointer to the memory to write the metadata to
defaultValueThe value to write to pInt64 if the metadata item isn’t in the udSceneNode or if it isn’t of an integer type

Returns: A udError value based on the result of reading the metadata into pInt64.

enum udError udSceneNode_SetMetadataInt64(struct udSceneNode *pNode, const char *pMetadataKey, int64_t i64Value)

Set a metadata item of a node from a 64 bit integer.

ParameterDescription
pNodeThe node to set the metadata on.
pMetadataKeyThe name of the metadata key.
i64ValueThe integer value to write to the metadata key

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_GetMetadataDouble(struct udSceneNode *pNode, const char *pMetadataKey, double *pDouble, double defaultValue)

Get a metadata item of a node as a double.

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key.
pDoubleThe pointer to the memory to write the metadata to
defaultValueThe value to write to pDouble if the metadata item isn’t in the udSceneNode or if it isn’t of an integer or floating point type

Returns: A udError value based on the result of reading the metadata into pDouble.

enum udError udSceneNode_SetMetadataDouble(struct udSceneNode *pNode, const char *pMetadataKey, double doubleValue)

Set a metadata item of a node from a double.

ParameterDescription
pNodeThe node to set the metadata on.
pMetadataKeyThe name of the metadata key.
doubleValueThe double value to write to the metadata key

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_GetMetadataBool(struct udSceneNode *pNode, const char *pMetadataKey, uint32_t *pBool, uint32_t defaultValue)

Get a metadata item of a node as a boolean.

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key.
pBoolThe pointer to the memory to write the metadata to (0=false, !0=true)
defaultValueThe value to write to pBool if the metadata item isn’t in the udSceneNode or if it isn’t of a boolean type

Returns: A udError value based on the result of reading the metadata into pBool.

enum udError udSceneNode_SetMetadataBool(struct udSceneNode *pNode, const char *pMetadataKey, uint32_t boolValue)

Set a metadata item of a node from a boolean.

ParameterDescription
pNodeThe node to set the metadata on.
pMetadataKeyThe name of the metadata key.
boolValueThe boolean value to write to the metadata key (0=false, !0=true)

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_GetMetadataString(struct udSceneNode *pNode, const char *pMetadataKey, const char **ppString, const char *pDefaultValue)

Get a metadata item of a node as a string.

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key.
ppStringThe pointer pointer to the memory of the string. This is owned by the udSceneNode and should be copied if required to be stored for a long period.
pDefaultValueThe value to write to ppString if the metadata item isn’t in the udSceneNode or if it isn’t of a string type

Returns: A udError value based on the result of reading the metadata into ppString.

enum udError udSceneNode_SetMetadataString(struct udSceneNode *pNode, const char *pMetadataKey, const char *pString)

Set a metadata item of a node from a string.

ParameterDescription
pNodeThe node to set the metadata on.
pMetadataKeyThe name of the metadata key.
pStringThe string to write to the metadata key. This is duplicated internally.

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_SetMetadataNull(struct udSceneNode *pNode, const char *pMetadataKey)

Set a metadata item of a node to null.

ParameterDescription
pNodeThe node to set the metadata item on.
pMetadataKeyThe name of the metadata key.

Returns: A udError value based on the result of writing the metadata into the node.

enum udError udSceneNode_GetMetadataObjectJSON(struct udSceneNode *pNode, const char *pMetadataKey, char *pBuffer, int bufferLen, int *pStrLen)

Get a metadata item of a node as a null terminated JSON string.

!NOTE pStrLen will be filled if pMetadataKey is valid which allows for calling it again with a bigger pBuffer

!NOTE There is intentionally no equivilent “udSceneNode_SetMetadataObjectJSON” as this time

ParameterDescription
pNodeThe node to get the metadata from.
pMetadataKeyThe name of the metadata key or NULL to get the full metadata object.
pBufferThe pointer to a preallocated buffer that you own (or NULL if trying to get the length via pStrLen).
bufferLenThe usable size of pBuffer in bytes (0 if pBuffer is NULL)
pStrLenThe size of the total string required (including null terminator)

Returns: A udError value based on the result of writing the metadata JSON into pBuffer.

const char *udScene_GetTypeName(enum udSceneNodeType itemtype)

Get the standard type string name for an itemtype

ParameterDescription
itemtypeThe udSceneNodeType value

Returns: A string containing the standard name for the item in the udSceneNodeType enum. This is internal and should not be freed.

enum udError udScene_DeleteServerProject(struct udContext *pContext, const char *pOrgID, const char *pProjID, const char *pSceneID)

Deletes a project from the server

ParameterDescription
pContextThe udContext to use to communicate with the server
pOrgIDThe ID for the udCloud organisation that the scene belongs to
pProjectIDThe ID for the udCloud project that the scene belongs to
pSceneIDThe ID of the scene to delete

Returns: A udError result (udE_Success if it was deleted, other status codes depending on result)

Sets the share status of a project on the server

ParameterDescription
pContextThe udContext to use to communicate with the server
isSharableToAnyoneWithTheLinkNot 0 if the project should be able to be loaded by anyone with the link, 0 otherwise
pOrgIDThe ID for the udCloud organisation that the scene will belong to
pProjectIDThe ID for the udCloud project that the scene will belong to
pSceneIDThe ID of the project to update the share status of

Returns: A udError result (udE_Success if it was updated, other status codes depending on result)

enum udError udScene_GetSessionID(struct udScene *pScene, const char **ppSessionID)

Get the session ID (for server projects).

!NOTE Returns udE_NotFound for non-server projects

ParameterDescription
pSceneThe pointer to a valid udScene.
ppSessionIDThe pointer pointer to memory that will contain the session ID. The ownership still belongs to the pScene.

Returns: A udError value based on the result of getting the root node.

enum udError udScene_QueueMessage(struct udScene *pScene, const char *pTargetSessionID, const char *pMessageType, const char *pMessagePayload)

Queues a message to be sent on next project update (for server projects).

ParameterDescription
pSceneThe pointer to the active udScene.
pTargetSessionIDThe session ID of the user who will receive this message. Passing in ‘nullptr’ to this parameter indicates all users (except the sender) will receive this message.
pMessageTypepMessageType User defined message type.
pMessagePayloadUser defined payload.

Returns: A udError result (udE_Success if the message was successfully queued, other status codes depending on result)

enum udError udScene_SaveThumbnail(struct udScene *pScene, const char *pImageBase64)

Saves a project thumbnail in base64 format to the server (udCloud only).

ParameterDescription
pSceneThe pointer to a valid udScene to save the thumbnail to.
pImageBase64The base64 encoded thumbnail.

Returns: A udError value based on the result of the save.

Structs

struct udScenePosition

This represents a position in 3D

!NOTE contains x,y,z and heading, pitch (generally of a camera) in the project CRS

FieldTypeDescription
xdoubleThe x coordiante of the item.
ydoubleThe y coordiante of the item.
zdoubleThe z coordiante of the item.
headingdoubleThe heading of the item.
pitchdoubleThe pitch of the item.
rolldoubleThe roll of the item.

struct udSceneNodeSelected

This represents the selected scene node of a user

FieldTypeDescription
id[37]charThe uuid of the selected node.

struct udSceneMessage

This represents the message sent to other users (or to us) in a scene during collaboration

FieldTypeDescription
pMessageTypeconst char \*The type of the message.
pMessagePayloadconst char \*The payload of the message.
pTargetSessionIDconst char \*The session ID of the message.
pReceivedFromSessionIDconst char \*The session Id where it’s been received.

struct udSceneUser

This represents the user info (used for collaboration)

FieldTypeDescription
pDisplayNameconst char \*The name to display for this user.
pSceneSessionIDconst char \*The current scene/session ID this user is log in.
lastUpdateddoubleThe time its position was been last updated [server time].
userFlagsenum udSceneUserFlagFlag to know if user is using XR.
selectedNodesCountuint32_tThe number of node selected.
selectedNodesListstruct udSceneNodeSelected \*The selected nodes.
headCamerastruct udScenePositionThe position of the head or camera for the active viewer.
handRightstruct udScenePositionThe position of the right hand for the active viewer if udSceneUserFlag_HasHands is set in userFlags.
handLeftstruct udScenePositionThe position of the left hand for the active viewer if udSceneUserFlag_HasHands is set in userFlags.
worldAnchorPointudDouble4The position of the world anchor point if udSceneUserFlag_HasAnchorAndScale is set; xyz are a position in world space and w is the scale factor.

struct udSceneNode

Stores the state of a node.

!WARNING This struct is exposed to avoid having a huge API of accessor functions but it should be treated as read only with the exception of pUserData. Making changes to the internal data will cause issues syncronising data

FieldTypeDescription
isVisibleintNon-zero if the node is visible and should be drawn in the scene.
UUID[37]charUnique identifier for this node “id”.
lastUpdatedoubleThe last time this node was updated in UTC.
itemtypeenum udSceneNodeTypeThe type of this node, see udSceneNodeType for more information.
itemtypeStr[8]charThe string representing the type of node. If its a known type during node creation itemtype will be set to something other than udPNT_Custom.
pNameconst char \*Human readable name of the item.
pURIconst char \*The address or filename that the resource can be found.
hasBoundingBoxuint32_tSet to not 0 if this nodes boundingBox item is filled out.
boundingBox[6]doubleThe bounds of this model, ordered as [West, South, Floor, East, North, Ceiling].
timeSpanBegindoubleUnix Epoch in Seconds. This node is relevant after this timestamp. -1.0 if not assigned.
timeSpanEnddoubleUnix Epoch in Seconds. This node is relevant until this timestamp. -1.0 if not assigned.
altitudeTypeenum udSceneAltitudeType
geomtypeenum udSceneGeometryTypeIndicates what geometry can be found in this model. See the udSceneGeometryType documentation for more information.
geomCountintHow many geometry items can be found on this model.
pCoordinatesdouble \*The positions of the geometry of this node (NULL this this node doesn’t have points). The format is [X0,Y0,Z0,…Xn,Yn,Zn].
pParentstruct udSceneNode \*This is the parent item of the current node (NULL if root node).
pNextSiblingstruct udSceneNode \*This is the next item in the scene (NULL if no further siblings).
pFirstChildstruct udSceneNode \*Some types (“folder”, “collection”, “polygon”…) have children nodes, NULL if there are no children.
pUserData)void (\*pUserDataCleanup)(struct udSceneNode \*pNode, void \*When a project node is deleted, this function is called first.
pUserDatavoid \*This is application specific user data. The application should traverse the tree to release these before releasing the udScene.
pInternalDatastruct udSceneNodeInternal \*Internal udSDK specific state for this node.

struct udSceneUpdateInfo

This represents the update info given/received to/by udScene_Update

!WARNING Memory is Freed on next call of udScene_Updte()

FieldTypeDescription
forceSyncuint32_tIf this is non-zero the sync to the server will happen immediately and the update call will block.
lastUpdatedTimedoubleThe timestamp that the scene was last updated (local time).
userFlagsenum udSceneUserFlagUser flags to define the device and other properties.
selectedNodesCountuint32_tThe length of pSelectedNodesList.
pSelectedNodesListstruct udSceneNodeSelected \*The list of selected nodes.
headCamerastruct udScenePositionThe position of the head or camera for the active viewer.
handRightstruct udScenePositionThe position of the right hand for the active viewer if udSceneUserFlag_HasHands is set in userFlags.
handLeftstruct udScenePositionThe position of the left hand for the active viewer if udSceneUserFlag_HasHands is set in userFlags.
worldAnchorPointudDouble4The position of the world anchor point if udSceneUserFlag_HasAnchorAndScale is set; xyz are a position in world space and w is the scale factor.
pUserListstruct udSceneUser \*The list of other users in this scene.
usersCountuint32_tThe number of users in the scene (and length of pUserList).
pReceivedMessagesstruct udSceneMessage \*The list of messages.
receivedMessagesCountuint32_tThe length of pReceivedMessages.