ZSCore Class Reference

Detailed Description

Exposes the zSpace stereo and tracker APIs.

Use this class with the ZSCore prefab to maintain a zSpace stereo camera rig in Unity. It provides head-tracked stereo rendering. You can also use it to access information about zSpace tracker target poses and stereo frustum settings.

Classes

struct   DisplayIntersectionInfo
  Struct representing display intersection information. More...

Public Types

enum   GlPluginEventType {
RenderTargetLeft = 10000,
RenderTargetRight = 10001,
FrameDone = 10002,
DisableStereo = 10003,
InitializeLRDetect = 10004,
UpdateLRDetectFullscreen = 10005,
UpdateLRDetectWindowed = 10006,
SyncLRDetectFullscreen = 10007,
SyncLRDetectWindowed = 10008
}
enum   PluginError {
Okay = 0,
NotImplemented = 1,
NotInitialized = 2,
AlreadyInitialized = 3,
InvalidParameter = 4,
InvalidContext = 5,
InvalidHandle = 6,
RuntimeIncompatible = 7,
RuntimeNotFound = 8,
SymbolNotFound = 9,
DisplayNotFound = 10,
DeviceNotFound = 11,
TargetNotFound = 12,
CapabilityNotFound = 13,
BufferTooSmall = 14
}
enum   CoordinateSpace {
Tracker = 0,
Display = 1,
Viewport = 2,
Camera = 3
}
enum   FrustumAttribute {
Ipd = 0,
ViewerScale = 1,
FovScale = 2,
HeadScale = 3,
NearClip = 4,
FarClip = 5,
GlassesOffset = 6,
CCLimit = 7,
UCLimit = 8,
CULimit = 9,
UULimit = 10,
CCDepth = 11,
UCDepth = 12
}
enum   PortalMode {
None = 0,
Angle = 1,
Position = 2,
All = ~0
}
enum   Eye {
Left = 0,
Right = 1,
Center = 2,
NumEyes
}
enum   CameraType {
Left = 0,
Right = 1,
Final = 2,
NumTypes
}
enum   TrackerTargetType {
Unknown = -1,
Head = 0,
Primary = 1,
Secondary = 2,
NumTypes
}
enum   LedColor {
Black = 0,
White = 1,
Red = 2,
Green = 3,
Blue = 4,
Cyan = 5,
Magenta = 6,
Yellow = 7
}
enum   MouseMovementMode {
Absolute = 0,
Relative = 1
}
enum   MouseButton {
Unknown = -1,
Left = 0,
Right = 1,
Center = 2
}

Public Member Functions

void  SetStereoEnabled (bool isStereoEnabled)
  Set whether stereoscopic 3D is enabled.
bool  IsStereoEnabled ()
  Check whether stereoscopic 3D rendering is enabled.
void  SetTrackingEnabled (bool isEnabled)
  Set whether tracking is enabled.
bool  IsTrackingEnabled ()
  Check whether tracking is enabled.
void  SetEyesSwapped (bool areEyesSwapped)
  Set whether the left and right eyes are swapped.
bool  AreEyesSwapped ()
  Check whether the left and right eyes are swapped.
Vector2  GetDisplayPosition ()
  Get the virtual (x, y) position of the current display.
Vector2  GetDisplaySize ()
  Get the size of the current display.
Vector2  GetDisplayResolution ()
  Get the resolution of the current display.
Vector3  GetDisplayAngle ()
  Get the angle of the current display.
Vector3  GetDisplayOffset ()
  DEPRECATED: Use GetCameraOffset() instead.
bool  IsDisplayHardwarePresent ()
  Check whether the display hardware is present (USB connected).
DisplayIntersectionInfo  IntersectDisplay (Matrix4x4 pose)
  Perform a raycast against the zSpace display given a specified tracker space pose.
void  GetViewportPosition (out int x, out int y)
  Get the viewport's top-left corner in pixels.
void  GetViewportSize (out int width, out int height)
  Get the viewport's size in pixels.
Vector3  GetViewportOffset ()
  DEPRECATED: Use GetCoordinateSpaceTransform() instead.
Matrix4x4  GetCoordinateSpaceTransform (CoordinateSpace a, CoordinateSpace b)
  Get the transformation matrix from coordinate space a to b.
Matrix4x4  GetTrackerToCameraSpaceTransform ()
  DEPRECATED: Use GetCoordinateSpaceTransform() instead.
void  SetInterPupillaryDistance (float interPupillaryDistance)
  Set the physical separation, or inter-pupillary distance, between the eyes in meters.
float  GetInterPupillaryDistance ()
  Get the physical distance between the user's eyes.
void  SetViewerScale (float viewerScale)
  Set the viewer scale.
float  GetViewerScale ()
  Get the viewer scale.
void  SetFieldOfViewScale (float fieldOfViewScale)
  Set the field of view scale for the frustum.
float  GetFieldOfViewScale ()
  Get the field of view scale.
void  SetHeadTrackingScale (float headTrackingScale)
  Set the uniform scale to be applied to the head tracked position.
float  GetHeadTrackingScale ()
  Get the uniform scale that is applied to the head tracked position.
void  SetGlassesOffset (float glassesOffset)
  Set the glasses offset for the stereo frustum in meters.
float  GetGlassesOffset ()
  Get the glasses offset for the stereo frustum.
void  SetNearClip (float nearClip)
  Set the near clip distance for the frustum in meters.
float  GetNearClip ()
  Get the near clip distance.
void  SetFarClip (float farClip)
  Set the far clip distance for the frustum in meters.
float  GetFarClip ()
  Get the far clip distance.
void  SetPortalMode (int portalModeFlags)
  Set the frustum's portal mode.
int  GetPortalMode ()
  Get the frustum's portal mode.
void  SetCameraOffset (Vector3 cameraOffset)
  Set the frustum's camera offset. This is the distance from the center of viewport to the virtual camera.
Vector3  GetCameraOffset ()
  Get the frustum's camera offset. This is the distance from the center of viewport to the virtual camera.
Matrix4x4  GetViewMatrix (Eye eye)
  Get the view matrix for a specified eye.
Matrix4x4  GetProjectionMatrix (Eye eye)
  Get the projection matrix for a specified eye.
Vector3  GetEyePosition (Eye eye)
  Get the position of a specified eye.
void  GetFrustumBounds (Eye eye, float[] bounds)
  Get the frustum bounds for a specified eye.
void  SetTrackerTargetEnabled (TrackerTargetType trackerTargetType, bool isEnabled)
  Set whether a specified tracker target is enabled.
bool  IsTrackerTargetEnabled (TrackerTargetType trackerTargetType)
  Check whether a specified tracker target is enabled.
bool  IsTrackerTargetVisible (TrackerTargetType trackerTargetType)
  Check whether a specified tracker target is visible.
Matrix4x4  GetTrackerTargetPose (TrackerTargetType trackerTargetType)
  Get the tracker space pose of a specified default tracker target.
Matrix4x4  GetTrackerTargetCameraPose (TrackerTargetType trackerTargetType)
  Get the camera space pose of a specified default tracker target.
Matrix4x4  GetTrackerTargetWorldPose (TrackerTargetType trackerTargetType)
  Get the world space pose of a specified default tracker target. This forces a recalculation based on the current camera's local to world matrix.
Matrix4x4  GetCachedTrackerTargetWorldPose (TrackerTargetType trackerTargetType)
  Get the cached world space pose of a specified default tracker target.
void  SetTrackerTargetPoseBufferingEnabled (TrackerTargetType trackerTargetType, bool isPoseBufferingEnabled)
  Set whether pose buffering is enabled for a specified tracker target.
bool  IsTrackerTargetPoseBufferingEnabled (TrackerTargetType trackerTargetType)
  Check whether pose buffering is enabled for a specified tracker target.
Matrix4x4  GetTrackerTargetBufferedPose (TrackerTargetType trackerTargetType, float lookBackTime)
  Get the tracker space buffered pose of a specified default tracker target.
Matrix4x4  GetTrackerTargetBufferedCameraPose (TrackerTargetType trackerTargetType, float lookBackTime)
  Get the camera space buffered pose of a specified default tracker target.
Matrix4x4  GetTrackerTargetBufferedWorldPose (TrackerTargetType trackerTargetType, float lookBackTime)
  Get the world space buffered pose of a specified default tracker target.
int  GetNumTrackerTargetButtons (TrackerTargetType trackerTargetType)
  Get the number of buttons associated with a specified tracker target.
bool  IsTrackerTargetButtonPressed (TrackerTargetType trackerTargetType, int buttonId)
  Check whether a specified target button is pressed.
void  SetTrackerTargetLedEnabled (TrackerTargetType trackerTargetType, bool isLedEnabled)
  Set whether the tracker target's LED is enabled.
bool  IsTrackerTargetLedEnabled (TrackerTargetType trackerTargetType)
  Check whether the tracker target's LED is enabled.
bool  IsTrackerTargetLedOn (TrackerTargetType trackerTargetType)
  Check whether the tracker target's LED is on.
void  SetTrackerTargetLedColor (TrackerTargetType trackerTargetType, LedColor ledColor)
  Set the tracker target's LED color.
LedColor  GetTrackerTargetLedColor (TrackerTargetType trackerTargetType)
  Get the tracker target's LED color.
void  SetTrackerTargetVibrationEnabled (TrackerTargetType trackerTargetType, bool isVibrationEnabled)
  Set whether the tracker target's vibration is enabled.
bool  IsTrackerTargetVibrationEnabled (TrackerTargetType trackerTargetType)
  Check whether the tracker target's vibration is enabled.
bool  IsTrackerTargetVibrating (TrackerTargetType trackerTargetType)
  Check whether the tracker target is currently vibrating.
void  StartTrackerTargetVibration (TrackerTargetType trackerTargetType, float onPeriod, float offPeriod, int numTimes)
  Start vibrating the tracker target based on a specified on period, off period, and number of times.
void  StopTrackerTargetVibration (TrackerTargetType trackerTargetType)
  Stop vibrating the tracker target if it is currently vibrating.
bool  IsTrackerTargetTapPressed (TrackerTargetType trackerTargetType)
  Check whether the tracker target is tapping the display.
void  SetMouseEmulationEnabled (bool isMouseEmulationEnabled)
  Set whether mouse emulation is enabled.
bool  IsMouseEmulationEnabled ()
  Check whether mouse emulation is enabled.
void  SetMouseEmulationTarget (TrackerTargetType trackerTargetType)
  Specify the tracker target that will emulate the mouse.
void  SetMouseEmulationMovementMode (MouseMovementMode movementMode)
  Set the movement mode for mouse emulation.
MouseMovementMode  GetMouseEmulationMovementMode ()
  Get the movement mode of mouse emulation. Refer to MouseMovementMode for details.
void  SetMouseEmulationDistance (float mouseEmulationDistance)
  Set the distance at which mouse emulation will be enabled.
float  GetMouseEmulationDistance ()
  Get the distance at which mouse emulation will be enabled.
void  SetMouseEmulationButtonMapping (int buttonId, MouseButton mouseButton)
  Map a specified tracker target button to a mouse button.
MouseButton  GetMouseEmulationButtonMapping (int buttonId)
  Get the mouse button that the specified button ID is mapped to.
Camera  GetStereoCamera (CameraType cameraType)
  Get a camera from the ZSCore stereo rig based on a specified camera type.
delegate void  CoreEventHandler (ZSCore sender)

Static Public Member Functions

static Matrix4x4  ConvertFromRightToLeft (Matrix4x4 right)
  Convert a matrix in right handed space to left handed space.

Public Attributes

GameObject  CurrentCamera = null
bool  EnableStereo = true
bool  EnableTracking = true
bool  EnableMouseEmulation = false
float  InterPupillaryDistance = 0.06f
float  ViewerScale = 1
float  FieldOfViewScale = 1
float  HeadTrackingScale = 1
float  GlassesOffset = 0.01f

Events

CoreEventHandler  Updated