コード例 #1
0
        public void Render_SystemCall()
        {
            Camera bkCamera = Camera.current;

            if (!IsRenderIgnoreCamera(bkCamera))
            {
                CameraBackgroundSettings bkSettings = _bkSettings;
                if (_cameraToBkSettings.ContainsKey(bkCamera))
                {
                    bkSettings = _cameraToBkSettings[bkCamera];
                }
                if (bkSettings.IsVisible)
                {
                    Transform cameraTransform = bkCamera.transform;

                    QuadShape3D bkQuad         = new QuadShape3D();
                    float       farPlaneWidth  = bkCamera.GetFrustumWidthFromDistance(bkCamera.farClipPlane);
                    float       farPlaneHeight = bkCamera.GetFrustumHeightFromDistance(bkCamera.farClipPlane);
                    bkQuad.Size     = new Vector3(farPlaneWidth + 0.01f, farPlaneHeight + 0.01f, 1.0f);
                    bkQuad.Rotation = cameraTransform.rotation;
                    bkQuad.Center   = cameraTransform.position + cameraTransform.forward * bkCamera.farClipPlane * 0.98f;

                    Material material = MaterialPool.Get.LinearGradientCameraBk;
                    material.SetColor("_FirstColor", bkSettings.FirstColor);
                    material.SetColor("_SecondColor", bkSettings.SecondColor);
                    material.SetFloat("_GradientOffset", bkSettings.GradientOffset);
                    material.SetFloat("_FarPlaneHeight", bkQuad.Size.y);
                    material.SetPass(0);
                    bkQuad.RenderSolid();
                }
            }
        }
コード例 #2
0
        public GizmoQuad3DBorder(GizmoPlaneSlider3D planeSlider, GizmoHandle targetHandle, QuadShape3D targetQuad)
        {
            _planeSlider = planeSlider;

            _targetHandle = targetHandle;
            _targetQuad   = targetQuad;

            _borderQuadIndex        = _targetHandle.Add3DShape(_borderQuad);
            _borderQuad.RaycastMode = Shape3DRaycastMode.Wire;

            _topBoxIndex         = _targetHandle.Add3DShape(_topBox);
            _rightBoxIndex       = _targetHandle.Add3DShape(_rightBox);
            _bottomBoxIndex      = _targetHandle.Add3DShape(_bottomBox);
            _leftBoxIndex        = _targetHandle.Add3DShape(_leftBox);
            _topLeftBoxIndex     = _targetHandle.Add3DShape(_topLeftBox);
            _topRightBoxIndex    = _targetHandle.Add3DShape(_topRightBox);
            _bottomRightBoxIndex = _targetHandle.Add3DShape(_bottomRightBox);
            _bottomLeftBoxIndex  = _targetHandle.Add3DShape(_bottomLeftBox);

            _sortedBoxIndices.Add(_topBoxIndex);
            _sortedBoxIndices.Add(_rightBoxIndex);
            _sortedBoxIndices.Add(_bottomBoxIndex);
            _sortedBoxIndices.Add(_leftBoxIndex);
            _sortedBoxIndices.Add(_topLeftBoxIndex);
            _sortedBoxIndices.Add(_topRightBoxIndex);
            _sortedBoxIndices.Add(_bottomRightBoxIndex);
            _sortedBoxIndices.Add(_bottomLeftBoxIndex);

            _controllerData.Border              = this;
            _controllerData.PlaneSlider         = _planeSlider;
            _controllerData.Gizmo               = Gizmo;
            _controllerData.TargetHandle        = _targetHandle;
            _controllerData.TargetQuad          = _targetQuad;
            _controllerData.BorderQuad          = _borderQuad;
            _controllerData.TopBox              = _topBox;
            _controllerData.RightBox            = _rightBox;
            _controllerData.BottomBox           = _bottomBox;
            _controllerData.LeftBox             = _leftBox;
            _controllerData.TopLeftBox          = _topLeftBox;
            _controllerData.TopRightBox         = _topRightBox;
            _controllerData.BottomRightBox      = _bottomRightBox;
            _controllerData.BottomLeftBox       = _bottomLeftBox;
            _controllerData.BorderQuadIndex     = _borderQuadIndex;
            _controllerData.TopBoxIndex         = _topBoxIndex;
            _controllerData.RightBoxIndex       = _rightBoxIndex;
            _controllerData.BottomBoxIndex      = _bottomBoxIndex;
            _controllerData.LeftBoxIndex        = _leftBoxIndex;
            _controllerData.TopLeftBoxIndex     = _topLeftBoxIndex;
            _controllerData.TopRightBoxIndex    = _topRightBoxIndex;
            _controllerData.BottomRightBoxIndex = _bottomRightBoxIndex;
            _controllerData.BottomLeftBoxIndex  = _bottomLeftBoxIndex;

            _controllers[(int)GizmoQuad3DBorderType.Thin] = new GizmoThinQuad3DBorderController(_controllerData);
            _controllers[(int)GizmoQuad3DBorderType.Box]  = new GizmoBoxQuad3DBorderController(_controllerData);

            Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
        }