Asset Transformer SDK (ex Pixyz) ViewInterface Class
Read time 18 minutes
Last updated 20 hours ago Inheritance
Inherited Members
Namespace: UnityEngine.Pixyz.View
public class ViewInterface : Interface
Methods
GetLastError
public static string GetLastError()
Returns
ConfigureFunctionLogger
[HandleProcessCorruptedStateExceptions] public void ConfigureFunctionLogger(string functionName, bool enableFunction, bool enableParameters, bool enableExecutionTime)
Parameters
Type Name Description string functionName bool enableFunction bool enableParameters bool enableExecutionTime
DestroyContext
Destroy the Vulkan instance. All existing viewers and gpuScenes will also be destroyed and all view module properties will be reset.
[HandleProcessCorruptedStateExceptions] public void DestroyContext()
SuitableGPUAvailable
Returns true if a suitable device is found.
[HandleProcessCorruptedStateExceptions] public bool SuitableGPUAvailable()
Returns
AddAfterFramebufferCreateCallback
public uint AddAfterFramebufferCreateCallback(ViewInterface.AfterFramebufferCreateDelegate callback, IntPtr userData)
Parameters
Returns
RemoveAfterFramebufferCreateCallback
public void RemoveAfterFramebufferCreateCallback(uint id)
Parameters
Type Name Description uint id
AddAfterViewerPropertyChangedCallback
public uint AddAfterViewerPropertyChangedCallback(ViewInterface.AfterViewerPropertyChangedDelegate callback, IntPtr userData)
Parameters
Returns
RemoveAfterViewerPropertyChangedCallback
public void RemoveAfterViewerPropertyChangedCallback(uint id)
Parameters
Type Name Description uint id
AddBeforeFramebufferDeleteCallback
public uint AddBeforeFramebufferDeleteCallback(ViewInterface.BeforeFramebufferDeleteDelegate callback, IntPtr userData)
Parameters
Returns
RemoveBeforeFramebufferDeleteCallback
public void RemoveBeforeFramebufferDeleteCallback(uint id)
Parameters
Type Name Description uint id
AddBeforeViewerPropertyChangedCallback
public uint AddBeforeViewerPropertyChangedCallback(ViewInterface.BeforeViewerPropertyChangedDelegate callback, IntPtr userData)
Parameters
Returns
RemoveBeforeViewerPropertyChangedCallback
public void RemoveBeforeViewerPropertyChangedCallback(uint id)
Parameters
Type Name Description uint id
ApplyPlayingAnimations
WARNING: this function is tagged as 'EXPERIMENTAL' apply the animations.
[HandleProcessCorruptedStateExceptions] public void ApplyPlayingAnimations(ulong time)
Parameters
Type Name Description ulong time Current time.
GetAnimationPlayerInfo
WARNING: this function is tagged as 'EXPERIMENTAL' packs all AnimationPlayer-related info about an animation in an object.
[HandleProcessCorruptedStateExceptions] public AnimationPlayerInfo GetAnimationPlayerInfo(uint animation)
Parameters
Type Name Description uint animation Animation to get info of.
Returns
IsAnimationPlaying
WARNING: this function is tagged as 'EXPERIMENTAL' is this animation playing?.
[HandleProcessCorruptedStateExceptions] public bool IsAnimationPlaying(uint animation)
Parameters
Type Name Description uint animation Animation to check.
Returns
PauseAllAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' pauses all animations.
[HandleProcessCorruptedStateExceptions] public void PauseAllAnimation()
PauseAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' pauses an animation.
[HandleProcessCorruptedStateExceptions] public void PauseAnimation(uint animation)
Parameters
Type Name Description uint animation Animation to pause.
PlayAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' plays an animation.
[HandleProcessCorruptedStateExceptions] public void PlayAnimation(uint animation, double speed = 1, bool loop = false)
Parameters
Type Name Description uint animation Animation to play. double speed Speed. bool loop Should the animation loop?.
ResumeAllAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' resumes all animations.
[HandleProcessCorruptedStateExceptions] public void ResumeAllAnimation()
ResumeAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' resumes an animation.
[HandleProcessCorruptedStateExceptions] public void ResumeAnimation(uint animation)
Parameters
Type Name Description uint animation Animation to resume.
SetAnimationFrame
WARNING: this function is tagged as 'EXPERIMENTAL' set animation's current frame.
[HandleProcessCorruptedStateExceptions] public void SetAnimationFrame(uint animation, ulong frame)
Parameters
Type Name Description uint animation Animation to set frame. ulong frame Frame to set.
SetAnimationLoop
WARNING: this function is tagged as 'EXPERIMENTAL' set animation's looping status.
[HandleProcessCorruptedStateExceptions] public void SetAnimationLoop(uint animation, bool loop)
Parameters
Type Name Description uint animation Animation to set loop status. bool loop Should the animation loop?.
SetAnimationSpeed
WARNING: this function is tagged as 'EXPERIMENTAL' set animation's playing speed.
[HandleProcessCorruptedStateExceptions] public void SetAnimationSpeed(uint animation, double speed)
Parameters
Type Name Description uint animation Animation to set speed. double speed The speed.
StopAllAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' stops all animations.
[HandleProcessCorruptedStateExceptions] public void StopAllAnimation(bool applyDefault = true)
Parameters
Type Name Description bool applyDefault Should the default position be applied.
StopAnimation
WARNING: this function is tagged as 'EXPERIMENTAL' stops an animation.
[HandleProcessCorruptedStateExceptions] public void StopAnimation(uint animation, bool applyDefault = true)
Parameters
Type Name Description uint animation Animation to stop. bool applyDefault Should the default position be applied.
AddAnimationPausedOrStoppedCallback
public uint AddAnimationPausedOrStoppedCallback(ViewInterface.AnimationPausedOrStoppedDelegate callback, IntPtr userData)
Parameters
Returns
RemoveAnimationPausedOrStoppedCallback
public void RemoveAnimationPausedOrStoppedCallback(uint id)
Parameters
Type Name Description uint id
AddAnimationPlayedOrResumedCallback
public uint AddAnimationPlayedOrResumedCallback(ViewInterface.AnimationPlayedOrResumedDelegate callback, IntPtr userData)
Parameters
Returns
RemoveAnimationPlayedOrResumedCallback
public void RemoveAnimationPlayedOrResumedCallback(uint id)
Parameters
Type Name Description uint id
AddAnimationPlayingStatusChangedCallback
public uint AddAnimationPlayingStatusChangedCallback(ViewInterface.AnimationPlayingStatusChangedDelegate callback, IntPtr userData)
Parameters
Returns
RemoveAnimationPlayingStatusChangedCallback
public void RemoveAnimationPlayingStatusChangedCallback(uint id)
Parameters
Type Name Description uint id
GetD3D11Texture
[HandleProcessCorruptedStateExceptions] public IntPtr GetD3D11Texture(RenderMap renderMap, int viewer = -1)
Parameters
Returns
GetGLTextureHandle
[HandleProcessCorruptedStateExceptions] public int GetGLTextureHandle(RenderMap renderMap, int viewer = -1)
Parameters
Returns
GetVulkanTexture
[HandleProcessCorruptedStateExceptions] public IntPtr GetVulkanTexture(RenderMap renderMap, int viewer = -1)
Parameters
Returns
CreateGPUScene
[HandleProcessCorruptedStateExceptions] public int CreateGPUScene(OccurrenceList roots, bool constructEdges = false, bool useIsolate = true)
Parameters
Type Name Description OccurrenceList roots Roots of the subtrees that will be uploaded to GPU. bool constructEdges Construct buffer to render edges colored by topology (slower to construct). bool useIsolate Indicates if the isolate manager should be used for visibility.
Returns
DestroyGPUScene
[HandleProcessCorruptedStateExceptions] public void DestroyGPUScene(int scene)
Parameters
Type Name Description int scene GPU Scene to destroy (previously created by createGPUScene).
GetGlobalGPUScene
Returns (and create if it does not exist) a global GPU scene (with the scene root) to be used commonly by several clients.
[HandleProcessCorruptedStateExceptions] public int GetGlobalGPUScene()
Returns
GetLastAABB
Return the lastAABB computed during a frame drawing, requires the viewer property ComputeLastAABB to be True.
[HandleProcessCorruptedStateExceptions] public AABB GetLastAABB(int scene, int viewer)
Parameters
Type Name Description int scene Identifier of the GPU scene to get the last AABB from. int viewer
Returns
GetOccurrenceIndex
Returns the occurrence index in the viewer buffers. Can be used for mapping an index retrieved in a GLTextureHandle id map.
[HandleProcessCorruptedStateExceptions] public uint GetOccurrenceIndex(uint occurrence, int scene)
Parameters
Type Name Description uint occurrence Occurrence identifier. int scene Scene identifier.
Returns
GetSceneIndex
Returns the GPU scene index in the viewer buffers. Can be used for mapping an index retrieved in a GLTextureHandle id map.
[HandleProcessCorruptedStateExceptions] public uint GetSceneIndex(int scene, int viewer)
Parameters
Type Name Description int scene GPU scene identifier. int viewer Viewer identifier.
Returns
LockGPUSceneUpdate
Lock the mutex that ensure no update of the gpu scene is done between lock/unlock.
[HandleProcessCorruptedStateExceptions] public void LockGPUSceneUpdate(int scene)
Parameters
Type Name Description int scene Identifier of the GPU scene to lock update for.
LockGPUScenesUpdate
Lock the mutex that ensure no update of multiple gpu scenes is done between lock/unlock.
[HandleProcessCorruptedStateExceptions] public void LockGPUScenesUpdate(GPUSceneList scenes)
Parameters
Type Name Description GPUSceneList scenes Identifiers of the GPU scenes to lock update for.
TryLockGPUSceneUpdate
Try to lock the mutex that ensure no update of the gpu scene is done between lock/unlock, returns true if the mutex has been locked, false if it was already locked.
[HandleProcessCorruptedStateExceptions] public bool TryLockGPUSceneUpdate(int scene)
Parameters
Type Name Description int scene Identifier of the GPU scene to try to lock update for.
Returns
TryLockGPUScenesUpdate
Try to lock the mutex that ensure no update of multiple gpu scenes is done between lock/unlock, returns true if the mutex has been locked, false if it was already locked.
[HandleProcessCorruptedStateExceptions] public BoolList TryLockGPUScenesUpdate(GPUSceneList scenes)
Parameters
Type Name Description GPUSceneList scenes Identifiers of the GPU scenes to try to lock update for.
Returns
UnlockGPUSceneUpdate
Unlock the mutex that ensure no update of the gpu scene is done between lock/unlock.
[HandleProcessCorruptedStateExceptions] public void UnlockGPUSceneUpdate(int scene)
Parameters
Type Name Description int scene Identifier of the GPU scene to unlock update for.
UnlockGPUScenesUpdate
Unlock the mutex that ensure no update of multiple gpu scenes is done between lock/unlock.
[HandleProcessCorruptedStateExceptions] public void UnlockGPUScenesUpdate(GPUSceneList scenes)
Parameters
Type Name Description GPUSceneList scenes Identifiers of the GPU scenes to unlock update for.
AddGPUScene
Add a GPU scene to a viewer.
[HandleProcessCorruptedStateExceptions] public void AddGPUScene(int scene, int viewer = -1)
Parameters
Type Name Description int scene GPU Scene to render in the viewer. int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
CreateViewer
Create a new viewer.
[HandleProcessCorruptedStateExceptions] public int CreateViewer(int width, int height, GraphicsContext sharedContext = null, int nbViews = 1)
Parameters
Type Name Description int width Width of the viewer framebuffer. int height Height of the viewer framebuffer. GraphicsContext sharedContext Interop context handle. int nbViews Nb views.
Returns
DestroyViewer
[HandleProcessCorruptedStateExceptions] public void DestroyViewer(int viewer)
Parameters
Type Name Description int viewer Viewer to destroy.
DrawCappingPlane
Create an occurrence that holds the mesh of the surfaces that have been cut by the cutting plane.
[HandleProcessCorruptedStateExceptions] public uint DrawCappingPlane(uint cuttingPlane)
Parameters
Type Name Description uint cuttingPlane Cutting plane component for which we create the capping plane.
Returns
GetAutoClipping
Automatically compute the near and far planes depending on the scene.
[HandleProcessCorruptedStateExceptions] public Point2 GetAutoClipping(int viewer, Point3 cameraPos)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId). Point3 cameraPos
Returns
GetCameraFrontAxis
Get the front axis of the nth view matrix of a given viewer.
[HandleProcessCorruptedStateExceptions] public Point3 GetCameraFrontAxis(int viewer = -1, uint matrixIndex = 0)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId). uint matrixIndex Index of the view matrix to use.
Returns
GetCameraPosition
Get the position of the nth view matrix of a given viewer.
[HandleProcessCorruptedStateExceptions] public Point3 GetCameraPosition(int viewer = -1, uint matrixIndex = 0)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId). uint matrixIndex Index of the view matrix to use.
Returns
GetCameraRightAxis
Get the right axis of the nth view matrix of a given viewer.
[HandleProcessCorruptedStateExceptions] public Point3 GetCameraRightAxis(int viewer = -1, uint matrixIndex = 0)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId). uint matrixIndex Index of the view matrix to use.
Returns
GetCameraUpAxis
Get the up axis of the nth view matrix of a given viewer.
[HandleProcessCorruptedStateExceptions] public Point3 GetCameraUpAxis(int viewer = -1, uint matrixIndex = 0)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId). uint matrixIndex Index of the view matrix to use.
Returns
GetViewerProperty
Get a viewer property value.
[HandleProcessCorruptedStateExceptions] public string GetViewerProperty(string propertyName, int viewer = -1)
Parameters
Type Name Description string propertyName int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns
GetViewerPropertyInfo
Get a viewer property info.
[HandleProcessCorruptedStateExceptions] public PropertyInfo GetViewerPropertyInfo(string propertyName, int viewer = -1)
Parameters
Type Name Description string propertyName int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns
GetViewerSize
Retrieve the viewport size of a viewer.
[HandleProcessCorruptedStateExceptions] public GetViewerSizeReturn GetViewerSize(int viewer = -1)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns
GetViewerStats
Returns the number of rendered occurrences and triangles. (Warning: this function does not handle isolate nor invertVisibility viewer property).
[HandleProcessCorruptedStateExceptions] public GetViewerStatsReturn GetViewerStats(int viewer = -1)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns
IdentifySelectedEdges
WARNING: this function is tagged as 'EXPERIMENTAL' Identify selected edges.
[HandleProcessCorruptedStateExceptions] public void IdentifySelectedEdges(int scene)
Parameters
Type Name Description int scene Identifier of the GPU scene to identify the edges from.
InvertSelectPrimitives
Invert the selection of the primitives (polygons, surfaces) contained in the given rectangle.
[HandleProcessCorruptedStateExceptions] public void InvertSelectPrimitives(int xMin, int xMax, int yMin, int yMax, PrimitiveSelectionType primitiveType, int viewer = -1)
Parameters
ListViewerProperties
Get the list of viewer properties.
[HandleProcessCorruptedStateExceptions] public PropertyInfoList ListViewerProperties(int viewer = -1)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns
Pick
[HandleProcessCorruptedStateExceptions] public PickReturn Pick(int x, int y, int viewer = -1)
Parameters
Returns
PickRectangle
[HandleProcessCorruptedStateExceptions] public OccurrenceList PickRectangle(int xMin, int xMax, int yMin, int yMax, int viewer = -1, bool inDepth = false)
Parameters
Returns
RefreshViewer
Refresh the viewer.
[HandleProcessCorruptedStateExceptions] public void RefreshViewer(int viewer = -1)
Parameters
Type Name Description int viewer Viewer to refresh.
RemoveGPUScene
Remove a viewer root.
[HandleProcessCorruptedStateExceptions] public void RemoveGPUScene(int scene, int viewer = -1)
Parameters
Type Name Description int scene GPU Scene to remove from the viewer. int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
ResizeViewer
[HandleProcessCorruptedStateExceptions] public void ResizeViewer(int width, int height, int viewer = -1)
Parameters
Type Name Description int width Width of the viewer framebuffer. int height Height of the viewer framebuffer. int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
SelectPrimitives
Select the primitives (polygons, surfaces) contained in the given rectangle.
[HandleProcessCorruptedStateExceptions] public void SelectPrimitives(int xMin, int xMax, int yMin, int yMax, PrimitiveSelectionType primitiveType, int viewer = -1)
Parameters
SetDefaultViewerId
Set default viewer id. This viewer will be used in other functions taking a Viewer as a parameter. Useful if a viewer needs to be shared across different contexts.
[HandleProcessCorruptedStateExceptions] public void SetDefaultViewerId(int viewer)
Parameters
Type Name Description int viewer
SetViewerProperty
Set a viewer property value.
[HandleProcessCorruptedStateExceptions] public void SetViewerProperty(string propertyName, string propertyValue, int viewer = -1)
Parameters
Type Name Description string propertyName string propertyValue int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
UnselectPrimitives
Unselect the primitives (polygons, surfaces) contained in the given rectangle.
[HandleProcessCorruptedStateExceptions] public void UnselectPrimitives(int xMin, int xMax, int yMin, int yMax, PrimitiveSelectionType primitiveType, int viewer = -1)
Parameters
GetCompositedImage
[HandleProcessCorruptedStateExceptions] public ImageDefinition GetCompositedImage(int viewer)
Parameters
Type Name Description int viewer
Returns
GetRenderMapImage
[HandleProcessCorruptedStateExceptions] public ImageDefinition GetRenderMapImage(int viewer, RenderMap renderMap)
Parameters
Returns
TakeScreenshot
[HandleProcessCorruptedStateExceptions] public void TakeScreenshot(string fileName, int viewer)
Parameters
Type Name Description string fileName Path where to save the screenshot. int viewer
CreateStreamedViewer
Create a viewer for streaming.
[HandleProcessCorruptedStateExceptions] public StreamedViewerInfo CreateStreamedViewer(int width, int height, EncoderSettings encoderSettings = null, bool useWebRTC = false, WebRTCInfo? webRTCInfo = null)
Parameters
Type Name Description int width Width of the viewer framebuffer. int height Height of the viewer framebuffer. EncoderSettings encoderSettings Settings used for the encoder. bool useWebRTC Switch between raw websockets and webRTC. WebRTCInfo webRTCInfo Info for web rtc signaling connection.
Returns
ResizeStreamedViewer
[HandleProcessCorruptedStateExceptions] public void ResizeStreamedViewer(int width, int height, int viewer = -1, EncoderSettings encoderSettings = null)
Parameters
Type Name Description int width Width of the viewer framebuffer. int height Height of the viewer framebuffer. int viewer EncoderSettings encoderSettings Settings used for the encoder.
StartRecording
Record viewer in a file.
[HandleProcessCorruptedStateExceptions] public void StartRecording(string filePath, int viewer, EncoderSettings encoderSettings = null)
Parameters
Type Name Description string filePath File in which video while be saved. int viewer Viewer to use for recording video. EncoderSettings encoderSettings Settings used for the encoder.
StopRecording
Stop recording video.
[HandleProcessCorruptedStateExceptions] public void StopRecording(int viewer)
Parameters
Type Name Description int viewer Viewer to use for recording video.
FitCamera
Set the viewer matrices to adjust the camera to the scene.
[HandleProcessCorruptedStateExceptions] public void FitCamera(Point3 direction, CameraType cameraType = CameraType.Orthographic, double fov = 90, int viewer = -1, OccurrenceList fitToOccurrences = null)
Parameters
Type Name Description Point3 direction Camera direction. CameraType cameraType Camera type, Orthographic or Perspective. double fov Field of view (perspective mode only). int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId). OccurrenceList fitToOccurrences
GetViewerMatrices
[HandleProcessCorruptedStateExceptions] public GetViewerMatricesReturn GetViewerMatrices(int viewer = -1)
Parameters
Type Name Description int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
Returns
SetViewerMatrices
[HandleProcessCorruptedStateExceptions] public void SetViewerMatrices(Matrix4List views, Matrix4List projs, Point2 clipping, int viewer = -1)
Parameters
Type Name Description Matrix4List views Matrix4List projs Point2 clipping int viewer Viewer id returned by the createViewer function. -1 uses the default viewer id (see setDefaultViewerId).
VisibilityShoot
Render one frame of the visibility session.
[HandleProcessCorruptedStateExceptions] public OccurrenceList VisibilityShoot(int viewer = -1, bool parts = true, bool patches = true, bool polygons = true, bool countOnce = false)
Parameters
Type Name Description int viewer Viewer to use for the visibility shoot. bool parts If false, optimize when parts seen are not wanted. bool patches If false, optimize when patches seen are not wanted. bool polygons If false, optimize when polygons seen are not wanted. bool countOnce Optimize when it is not needed to count the numbers of pixels seen during the session.
Returns