示例#1
0
 void SendTextureToBridge(RenderTexture texture, TEXTURE_ID id)
 {
     SDKBridge.AddTexture(new SDKTexture()
     {
         id           = id,
         texturePtr   = texture.GetNativeTexturePtr(),
         SharedHandle = System.IntPtr.Zero,
         device       = SDKUtils.GetDevice(),
         dummy        = 0,
         type         = TEXTURE_TYPE.COLOR_BUFFER,
         format       = TEXTURE_FORMAT.ARGB32,
         colorSpace   = SDKUtils.GetColorSpace(texture),
         width        = texture.width,
         height       = texture.height
     });
 }
示例#2
0
        public static void CreateBridgeOutputFrame(SDKRender render)
        {
            RENDERING_PIPELINE renderingPipeline = RENDERING_PIPELINE.UNDEFINED;

#if LIV_UNIVERSAL_RENDER
            renderingPipeline = RENDERING_PIPELINE.UNIVERSAL;
#else
            if (render.cameraInstance != null)
            {
                renderingPipeline = SDKUtils.GetRenderingPipeline(render.cameraInstance.actualRenderingPath);
            }
#endif
            SDKBridge.CreateFrame(new SDKOutputFrame()
            {
                renderingPipeline = renderingPipeline,
                trackedSpace      = SDKUtils.GetTrackedSpace(render.stageTransform == null ? render.stage : render.stageTransform)
            });
        }
示例#3
0
        /// <summary>
        /// Set the game ground plane.
        /// </summary>
        /// <remarks>
        /// <para>If you wisth to use local space coordinates use local space instead.
        /// The local space has to be relative to stage or stage transform if set.
        /// </para>
        /// </remarks>
        public void SetGroundPlane(float distance, Vector3 normal, bool useLocalSpace = false)
        {
            float   outputDistance = distance;
            Vector3 outputNormal   = normal;

            if (!useLocalSpace)
            {
                Transform localTransform = stageTransform == null ? stage : stageTransform;
                Matrix4x4 worldToLocal   = localTransform.worldToLocalMatrix;
                Vector3   localPosition  = worldToLocal.MultiplyPoint(normal * distance);
                outputNormal   = worldToLocal.MultiplyVector(normal);
                outputDistance = -Vector3.Dot(normal, localPosition);
            }

            SDKBridge.SetGroundPlane(new SDKPlane()
            {
                distance = outputDistance, normal = outputNormal
            });
        }
示例#4
0
        void SubmitSDKOutput()
        {
            SDKApplicationOutput output = SDKApplicationOutput.empty;

            output.supportedFeatures = FEATURES.BACKGROUND_RENDER |
                                       FEATURES.FOREGROUND_RENDER |
                                       FEATURES.OVERRIDE_POST_PROCESSING |
                                       FEATURES.FIX_FOREGROUND_ALPHA;

            output.sdkID              = SDKConstants.SDK_ID;
            output.sdkVersion         = SDKConstants.SDK_VERSION;
            output.engineName         = SDKConstants.ENGINE_NAME;
            output.engineVersion      = Application.unityVersion;
            output.applicationName    = Application.productName;
            output.applicationVersion = Application.version;
            output.graphicsAPI        = SystemInfo.graphicsDeviceType.ToString();
            output.xrDeviceName       = XRSettings.loadedDeviceName;

            SDKBridge.SubmitApplicationOutput(output);
        }
示例#5
0
        private void UpdateBridgeInputFrame()
        {
            if (_requestedPoseFrameIndex == Time.frameCount)
            {
                _inputFrame.ObtainControl();
                _inputFrame.pose = _requestedPose;
                _requestedPose   = SDKPose.empty;
            }
            else
            {
                _inputFrame.ReleaseControl();
            }

            if (_cameraInstance != null)
            {
                // Near and far is always driven by game
                _inputFrame.pose.nearClipPlane = _cameraInstance.nearClipPlane;
                _inputFrame.pose.farClipPlane  = _cameraInstance.farClipPlane;
            }

            SDKBridge.UpdateInputFrame(ref _inputFrame);
        }
示例#6
0
 public void Render()
 {
     UpdateBridgeResolution();
     UpdateBridgeInputFrame();
     SDKUtils.ApplyUserSpaceTransform(this);
     UpdateTextures();
     InvokePreRender();
     if (canRenderBackground)
     {
         RenderBackground();
     }
     if (canRenderForeground)
     {
         RenderForeground();
     }
     if (canRenderOptimized)
     {
         RenderOptimized();
     }
     IvokePostRender();
     SDKUtils.CreateBridgeOutputFrame(this);
     SDKBridge.IssuePluginEvent();
 }
示例#7
0
        public static bool GetResolution(ref SDKResolution sdkResolution)
        {
            if (_injection_SDKResolution.active && _injection_SDKResolution.action != null)
            {
                _injection_SDKResolution.action.Invoke();
                sdkResolution = _injection_SDKResolution.data;
                return(true);
            }

            bool output = GetStructFromLocalChannel <SDKResolution>(ref sdkResolution, 15, SDKBridge.Tag("SDKRes"));

            _injection_SDKResolution.data = sdkResolution;
            return(output);
        }
示例#8
0
 public static void SetGroundPlane(SDKPlane groundPlane)
 {
     AddStructToGlobalChannel <SDKPlane>(ref groundPlane, 2, SDKBridge.Tag("SetGND"));
 }
示例#9
0
 private void UpdateBridgeResolution()
 {
     SDKBridge.GetResolution(ref _resolution);
 }
示例#10
0
 private void ReleaseBridgePoseControl()
 {
     _inputFrame.ReleaseControl();
     SDKBridge.UpdateInputFrame(ref _inputFrame);
 }