4 #include "VectorMathDecl.h"
5 #include "TransportEventTypes.h"
24 m_addLabel(m_labelServiceHandle, createOptions);
29 m_updateLabel(m_labelServiceHandle, updateState);
32 void RemoveLabel(
const char* labelId)
const
34 m_removeLabel(m_labelServiceHandle, labelId);
37 void AddIconTexturePage(
const u32 textureId)
const
39 m_addIconTexturePage(m_labelServiceHandle, textureId);
45 typedef void(*UpdateLabelCallback)(
const void* labelServiceHandle,
const UnityLabelUpdateState& updateState);
46 typedef void(*RemoveLabelCallback)(
const void* labelServiceHandle,
const char* labelId);
47 typedef void(*AddIconTexturePageCallback)(
const void* labelServiceHandle,
const u32 textureId);
49 const void* m_labelServiceHandle;
50 AddLabelCallback m_addLabel;
51 UpdateLabelCallback m_updateLabel;
52 RemoveLabelCallback m_removeLabel;
53 AddIconTexturePageCallback m_addIconTexturePage;
60 void* AllocateTextureBuffer(
int size,
int width,
int height,
int format,
int hasMipMaps)
const
62 return m_allocateTextureBuffer(m_textureServiceHandle, size, width, height, format, hasMipMaps);
65 GLuint BeginUploadTextureBuffer(
const void* buffer)
const
67 return m_beginUploadTextureBuffer(m_textureServiceHandle, buffer);
70 void OnTextureReceived(
const void* requestHandle,
const char* textureKey, GLuint textureID)
const
72 m_onTextureReceived(requestHandle, textureKey, textureID);
75 void ReleaseTexture(GLuint
id)
const
77 m_releaseTexture(m_textureServiceHandle,
id);
80 GLuint CreateCubemapFromFaces(
const GLuint* faceIDs)
const
82 return m_createCubemapFromFaces(m_textureServiceHandle, faceIDs);
87 typedef void* (*AllocateTextureBufferCallback)(
const void* textureServiceHandle,
int size,
int width,
int height,
int format,
int hasMipMaps);
88 typedef GLuint(*BeginUploadTextureBufferCallback)(
const void* textureServiceHandle,
const void* buffer);
89 typedef void(*OnTextureReceivedCallback)(
const void* requestHandle,
const char* textureKey, GLuint textureID);
90 typedef void(*ReleaseTextureCallback)(
const void* textureServiceHandle, GLuint id);
91 typedef GLuint(*CreateCubemapFromFacesCallback)(
const void* textureServiceHandle,
const GLuint* faceIDs);
93 const void* m_textureServiceHandle;
94 AllocateTextureBufferCallback m_allocateTextureBuffer;
95 BeginUploadTextureBufferCallback m_beginUploadTextureBuffer;
96 OnTextureReceivedCallback m_onTextureReceived;
97 ReleaseTextureCallback m_releaseTexture;
98 CreateCubemapFromFacesCallback m_createCubemapFromFaces;
104 void OnMaterialMadeDirty(
const char* textureKey,
const char* materialName)
const
106 m_onMaterialMadeDirty(m_materialRepositoryHandle, textureKey, materialName);
111 typedef void(*OnMaterialMadeDirtyCallback)(
const void* materialRepositoryHandle,
const char* textureKey,
const char* materialName);
113 const void* m_materialRepositoryHandle;
114 OnMaterialMadeDirtyCallback m_onMaterialMadeDirty;
122 typedef void* (*StartThreadCallback)(
void* startData);
124 int CreateThread(StartThreadCallback callback,
void* startData)
const
126 return m_createThread(m_threadServiceHandle, callback, startData);
129 void JoinThread(
int threadHandle)
const
131 m_joinThread(m_threadServiceHandle, threadHandle);
136 typedef int(*CreateThreadCallback)(
const void* threadServiceHandle, StartThreadCallback callback,
void* startData);
137 typedef void(*JoinThreadCallback)(
const void* threadServiceHandle,
int threadHandle);
139 const void* m_threadServiceHandle;
140 CreateThreadCallback m_createThread;
141 JoinThreadCallback m_joinThread;
151 void SetScale(
const char* objectId,
const v3& scale)
const
153 m_setScale(m_sceneServiceHandle, objectId, scale);
156 void SetTranslation(
const char* objectId,
const v3& translation)
const
158 m_setTranslation(m_sceneServiceHandle, objectId, translation);
161 void SetOrientation(
const char* objectId,
const Quaternion& rotation)
const
163 m_setOrientation(m_sceneServiceHandle, objectId, rotation);
166 void SetColor(
const char* objectId,
const v4& color)
const
168 m_setColor(m_sceneServiceHandle, objectId, color);
173 typedef void(*SetScaleCallback)(
const void* sceneServiceHandle,
const char* objectId,
const v3& scale);
174 typedef void(*SetTranslationCallback)(
const void* sceneServiceHandle,
const char* objectId,
const v3& translation);
175 typedef void(*SetOrientationCallback)(
const void* sceneServiceHandle,
const char* objectId,
const Quaternion& rotation);
176 typedef void(*SetColorCallback)(
const void* sceneServiceHandle,
const char* objectId,
const v4& color);
178 const void* m_sceneServiceHandle;
179 SetScaleCallback m_setScale;
180 SetTranslationCallback m_setTranslation;
181 SetOrientationCallback m_setOrientation;
182 SetColorCallback m_setColor;
189 void SetVisible(
const char* objectId,
bool visible)
const
191 m_setVisible(m_sceneServiceHandle, objectId, visible);
194 void AddMesh(
const char* objectId)
const
196 m_addMesh(m_sceneServiceHandle, objectId);
199 void DeleteMesh(
const char* objectId)
const
201 m_deleteMesh(m_sceneServiceHandle, objectId);
204 Unity::UnpackedMesh* AllocateUnpackedMesh(
int vertexCount,
bool hasUVs,
bool hasUV2s,
bool hasNormals,
bool hasColours,
int indexCount,
const char* meshName,
const char* materialName)
const
206 return static_cast<Unity::UnpackedMesh*
>(m_allocateUnpackedMesh(vertexCount, hasUVs, hasUV2s, hasNormals, hasColours, indexCount, meshName, materialName));
211 m_uploadUnpackedMesh(mesh);
214 void RemoveUnpackedMesh(
const char* meshId)
const
216 m_removeUnpackedMesh(meshId);
221 typedef void*(*AllocateUnpackedMeshCallback)(int, bool, bool, bool, bool, int,
const void*,
const void*);
222 typedef void(*UploadUnpackedMeshCallback)(
const void*);
223 typedef void(*RemoveUnpackedMeshCallback)(
const char*);
224 typedef void(*AddMeshCallback)(
const void* sceneServiceHandle,
const char*);
225 typedef void(*DeleteMeshCallback)(
const void* sceneServiceHandle,
const char*);
226 typedef void(*VisibilityCallback)(
const void* sceneServiceHandle,
const char*, bool);
228 const void* m_sceneServiceHandle;
229 AllocateUnpackedMeshCallback m_allocateUnpackedMesh;
230 UploadUnpackedMeshCallback m_uploadUnpackedMesh;
231 RemoveUnpackedMeshCallback m_removeUnpackedMesh;
232 AddMeshCallback m_addMesh;
233 DeleteMeshCallback m_deleteMesh;
234 VisibilityCallback m_setVisible;
245 void OnIndoorMapEntered()
const
247 m_onIndoorMapEnteredCallback(m_indoorMapsApiHandle);
250 void OnIndoorMapExited()
const
252 m_onIndoorMapExitedCallback(m_indoorMapsApiHandle);
255 void OnIndoorMapFloorChanged()
const
257 m_onIndoorMapFloorChangedCallback(m_indoorMapsApiHandle);
260 void OnIndoorMapEntityClicked(
const int entityIdsCount,
const char** entityIds)
const
262 EntityClickedInterop interop;
263 interop.stringCount = entityIdsCount;
264 interop.stringValues = entityIds;
266 m_onIndoorMapEntityClickedCallback(m_indoorMapsApiHandle, &interop);
271 m_addRenderable(m_indoorMapSceneHandle, name, interior, &renderable);
276 m_addHighlightRenderable(m_indoorMapSceneHandle, name, interior, &renderable);
279 void AddInstancedIndoorMapRenderable(
281 const char* renderableId,
282 const char* interior,
284 const int transformCount,
285 const v3* positionOffsets,
291 m_addInstancedRenderable(m_indoorMapSceneHandle, meshId, renderableId, interior, &originEcef, transformCount, positionOffsets, orientations, &renderable, indexOffset, ownsMesh);
294 void OnRenderableStateUpdated(
const char* renderableId)
const
296 m_onRenderableStateUpdated(m_indoorMapSceneHandle, renderableId);
299 void OnHighlightRenderableStateUpdated(
const char* renderableId)
const
301 m_onRenderableStateUpdatedForHighlightRenderable(m_indoorMapSceneHandle, renderableId);
304 void OnInstancedRenderableStateUpdated(
const char* renderableId)
const
306 m_onInstancedRenderableStateUpdated(m_indoorMapSceneHandle, renderableId);
309 void SetMaterial(
const char* objectID,
const void* materialHandle)
const
311 m_setMaterial(m_indoorMapSceneHandle, objectID, materialHandle);
314 void SetMaterialForInstancedRenderable(
const char* objectID,
const void* materialHandle)
const
316 m_setMaterialForInstancedRenderable(m_indoorMapSceneHandle, objectID, materialHandle);
319 void* CreateMaterial(
320 const char* indoorMapName,
321 const char* materialName,
322 int stringCount,
const char** stringKeys,
const char** stringValues,
323 int colorCount,
const char** colorNames,
const Eegeo::v4* colorValues,
324 int scalarCount,
const char** scalarNames,
const float* scalarValues,
325 int booleanCount,
const char** booleanNames,
const int* booleanValues)
const
327 MaterialDescriptorInterop interop;
328 interop.indoorMapName = indoorMapName;
329 interop.materialName = materialName;
330 interop.stringCount = stringCount;
331 interop.stringKeys = stringKeys;
332 interop.stringValues = stringValues;
333 interop.colorCount = colorCount;
334 interop.colorNames = colorNames;
335 interop.colorValues = colorValues;
336 interop.scalarCount = scalarCount;
337 interop.scalarNames = scalarNames;
338 interop.scalarValues = scalarValues;
339 interop.booleanCount = booleanCount;
340 interop.booleanNames = booleanNames;
341 interop.booleanValues = booleanValues;
342 interop.materialServiceHandle = m_indoorMapMaterialServiceHandle;
344 return m_createMaterial(&interop);
347 void DeleteMaterial(
const void* materialHandle)
const
349 m_deleteMaterial(m_indoorMapMaterialServiceHandle, materialHandle);
354 struct MaterialDescriptorInterop
356 const char* indoorMapName;
357 const char* materialName;
359 const char** stringKeys;
360 const char** stringValues;
362 const char** colorNames;
365 const char** scalarNames;
366 const float* scalarValues;
368 const char** booleanNames;
369 const int* booleanValues;
370 const void* materialServiceHandle;
373 struct EntityClickedInterop
376 const char** stringValues;
379 typedef void(*OnIndoorMapEnteredCallback)(
const void* unityIndoorMapApiHandle);
380 typedef void(*OnIndoorMapExitedCallback)(
const void* unityIndoorMapApiHandle);
381 typedef void(*OnIndoorMapFloorChangedCallback)(
const void* unityIndoorMapApiHandle);
382 typedef void(*OnIndoorMapEntityClickedCallback)(
const void* unityIndoorMapApiHandle,
const EntityClickedInterop* entityClickedInterop);
383 typedef void(*AddIndoorMapRenderableCallback)(
const void* indoorMapSceneHandle,
const char* name,
const char* interior,
const void* renderable);
384 typedef void(*AddInstancedIndoorMapRenderableCallback)(
const void* indoorMapSceneHandle,
const char* meshId,
const char* renderableId,
const char* interior,
const Eegeo::dv3* originEcef,
const int transformCount,
const v3* positionOffsets,
const Quaternion* orientations,
const void* renderable,
int indexOffset,
bool ownsMesh);
385 typedef void(*OnRenderStateUpdatedCallback)(
const void* indoorMapSceneHandle,
const char* objectId);
386 typedef void* (*CreateMaterialCallback)(
const MaterialDescriptorInterop* materialDescriptorInterop);
388 typedef void(*SetMaterialCallback)(
const void* indoorMapSceneHandle,
const char* objectID,
const void* materialHandle);
389 typedef void(*DeleteMaterialCallback)(
const void* indoorMapMaterialServiceHandle,
const void* materialHandle);
391 const void* m_indoorMapsApiHandle;
392 const void* m_indoorMapMaterialServiceHandle;
393 const void* m_indoorMapSceneHandle;
394 AddIndoorMapRenderableCallback m_addRenderable;
395 AddIndoorMapRenderableCallback m_addHighlightRenderable;
396 AddInstancedIndoorMapRenderableCallback m_addInstancedRenderable;
397 OnRenderStateUpdatedCallback m_onRenderableStateUpdated;
398 OnRenderStateUpdatedCallback m_onRenderableStateUpdatedForHighlightRenderable;
399 OnRenderStateUpdatedCallback m_onInstancedRenderableStateUpdated;
400 SetMaterialCallback m_setMaterial;
401 SetMaterialCallback m_setMaterialForInstancedRenderable;
402 OnIndoorMapEnteredCallback m_onIndoorMapEnteredCallback;
403 OnIndoorMapExitedCallback m_onIndoorMapExitedCallback;
404 OnIndoorMapFloorChangedCallback m_onIndoorMapFloorChangedCallback;
405 OnIndoorMapEntityClickedCallback m_onIndoorMapEntityClickedCallback;
406 CreateMaterialCallback m_createMaterial;
407 DeleteMaterialCallback m_deleteMaterial;
414 void PositionerTransformedPointChanged(
int positionerId)
416 m_positionerTransformedPointChangedCallback(m_positionersApiInternalHandle, positionerId);
419 void PositionersProjectionChanged()
421 m_positionersProjectionChangedCallback(m_positionersApiInternalHandle);
426 typedef void(*PositionerTransformedPointChangedCallback)(
const void* positionersApiInternalHandle,
int positionerId);
427 typedef void(*PositionersProjectionChangedCallback)(
const void* positionersApiInternalHandle);
429 const void* m_positionersApiInternalHandle;
430 PositionerTransformedPointChangedCallback m_positionerTransformedPointChangedCallback;
431 PositionersProjectionChangedCallback m_positionersProjectionChangedCallback;
438 void OnCameraEvent(
int eventType)
440 m_cameraEventCallback(m_cameraApiHandle, eventType);
445 typedef void(*CameraEventCallback)(
const void* apiHandle,
int eventType);
447 const void* m_cameraApiHandle;
448 CameraEventCallback m_cameraEventCallback;
455 void OnBuildingHighlightChanged(
int buildingId)
457 m_buildingHighlightChanged(m_buildingsApiInternalHandle, buildingId);
460 void OnBuildingHighlightColorChanged(
int buildingId,
const v4& color)
const
462 m_buildingHighlightColorChanged(m_buildingsApiInternalHandle, buildingId, color);
467 m_buildingHighlightClipPlanesChanged(m_buildingsApiInternalHandle, buildingId, clipPlanePairs, size);
471 typedef void(*BuildingHighlightChangedCallback)(
const void* buildingsApiInternalHandle,
int buildingId);
474 typedef void(*BuildingHighlightColorChangedCallback)(
const void* buildingsApiInternalHandle,
int buildingId,
const v4& color);
477 const void* m_buildingsApiInternalHandle;
478 BuildingHighlightChangedCallback m_buildingHighlightChanged;
479 BuildingHighlightColorChangedCallback m_buildingHighlightColorChanged;
480 BuildingHighlightClipPlanesChangedCallback m_buildingHighlightClipPlanesChanged;
487 void OnPrecacheOperationCompleted(
int operationId,
bool succeeded)
489 m_precacheOperationCompletedHandler(m_precacheApiHandle, operationId, succeeded);
494 typedef void(*PrecacheOperationCompletedEventHandler)(
const void* precacheApiHandle,
int operationId,
bool succeeded);
496 const void* m_precacheApiHandle;
497 PrecacheOperationCompletedEventHandler m_precacheOperationCompletedHandler;
513 void OnTransportPositionerPointOnGraphChanged(
int transportPositionerId)
515 m_transportPositionerPointOnGraphChangedHandler(m_transportApiHandle, transportPositionerId);
521 m_transportPositionerGraphChangedHandler(m_transportApiHandle, transportGraphChangedMessage.TransportNetworkType, cellKeyInterop, transportGraphChangedMessage.ChangeReason);
525 typedef void(*TransportPositionerPointOnGraphChangedHandler)(
const void* transportApiHandle,
int transportPositionerId);
526 typedef void(*TransportPositionerGraphChangedHandler)(
527 const void* transportApiHandle,
528 Eegeo::Transport::TransportNetwork::Type transportNetworkType,
530 Eegeo::Transport::TransportGraphChangeReason::Type changeReason
533 const void* m_transportApiHandle;
534 TransportPositionerPointOnGraphChangedHandler m_transportPositionerPointOnGraphChangedHandler;
535 TransportPositionerGraphChangedHandler m_transportPositionerGraphChangedHandler;
542 void OnIndoorMapEntityInformationChanged(
int indoorMapEntityInformationId)
544 m_indoorMapEntityInformationChangedHandler(m_indoorMapEntityInformationApiInternalHandle, indoorMapEntityInformationId);
548 typedef void(*IndoorMapEntityInformationChangedHandler)(
const void* indoorMapEntityInformationApiInternalHandle,
int indoorMapEntityInformationId);
550 const void* m_indoorMapEntityInformationApiInternalHandle;
551 IndoorMapEntityInformationChangedHandler m_indoorMapEntityInformationChangedHandler;
558 void OnInitialStreamingComplete()
560 m_initialStreamingCompleteHandler(m_mapApiInternalHandle);
564 typedef void(*InitialStreamingCompleteHandler)(
const void* mapApiInternalHandle);
566 const void* m_mapApiInternalHandle;
567 InitialStreamingCompleteHandler m_initialStreamingCompleteHandler;
573 void OnStreamingStarted()
575 m_streamingStartHandler(m_streamingApiInternalHandle);
577 void OnStreamingComplete()
579 m_streamingCompleteHandler(m_streamingApiInternalHandle);
583 typedef void(*StreamingStartedHandler)(
const void* streamingApiInternalHandle);
584 typedef void(*StreamingCompleteHandler)(
const void* streamingApiInternalHandle);
586 const void* m_streamingApiInternalHandle;
587 StreamingStartedHandler m_streamingStartHandler;
588 StreamingCompleteHandler m_streamingCompleteHandler;
596 typedef void (*AssertHandlerCallback)(
const char*,
const char*, int);
597 typedef void(*FatalErrorHandlerCallback)(
const char*);
599 typedef bool (*UnityResourcesWrapperLoadResourceCallback)(
const char*,
char**, int32_t*);
600 typedef void (*UnityResourcesWrapperFreeResourceBufferCallback)(
char*);
601 typedef bool (*UnityResourcesWrapperResourceExistsCallback)(
const char*);
604 static AssertHandlerCallback assertHandler;
605 static FatalErrorHandlerCallback fatalErrorHandler;
609 AssertHandlerCallback assertHandlerCallback;
610 FatalErrorHandlerCallback fatalErrorHandlerCallback;
625 UnityResourcesWrapperLoadResourceCallback loadResourceCallback;
626 UnityResourcesWrapperFreeResourceBufferCallback freeResourceBufferCallback;
627 UnityResourcesWrapperResourceExistsCallback resourceExistsCallback;