コード例 #1
0
ファイル: PressableSlider.cs プロジェクト: ccdump/Paint-1
        public override void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            base.OnDrawRuntimeGizmos(drawer);

            if (_enableGizmos)
            {
                drawer.PushMatrix();
                drawer.matrix = this.transform.localToWorldMatrix;

                drawer.color = Color.magenta;
                drawer.DrawWireCube(GetSliderStartPosition(), Vector3.one * 0.5F);

                drawer.color = Color.black;
                drawer.DrawWireCube(GetSliderEndPosition(), Vector3.one * 0.5F);


                if (isActivated)
                {
                    drawer.color = Color.cyan;
                    drawer.DrawWireCube(this.transform.InverseTransformPoint(GetActivatorWorldPosition()), Vector3.one);

                    drawer.color = Color.blue;
                    drawer.DrawWireCube(GetAxisSlideXZPosition(), Vector3.one * 0.5F);
                }

                drawer.PopMatrix();
            }
        }
コード例 #2
0
        public virtual void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (_enableGizmos)
            {
                drawer.PushMatrix();
                drawer.matrix = this.transform.localToWorldMatrix;

                drawer.color = Color.green;
                if (isActivated)
                {
                    drawer.color = Color.white;
                }
                drawer.DrawWireCube(GetActivationVolumeBoxOffset(), GetActivationVolumeBoxBounds());

                if (_gizmoColors == null)
                {
                    _gizmoColors = new RingBuffer <Color>(4);
                    _gizmoColors.Add(Color.red);
                    _gizmoColors.Add(Color.yellow);
                    _gizmoColors.Add(Color.green);
                    _gizmoColors.Add(Color.blue);
                }
                for (int i = 0; i < _layers.Length; i++)
                {
                    drawer.color = _gizmoColors.Get(i);
                    drawer.DrawWireCube(Vector3.up * _layers[i].height, new Vector3(_xWidth - 0.2F, 0.01F, _zWidth - 0.2F));
                    drawer.DrawWireCube(Vector3.up * _layers[i].height, new Vector3(_xWidth - 0.4F, 0.01F, _zWidth - 0.4F));
                    drawer.DrawWireCube(Vector3.up * _layers[i].height, new Vector3(_xWidth - 0.6F, 0.01F, _zWidth - 0.6F));
                }

                drawer.PopMatrix();
            }
        }
コード例 #3
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (!drawDebug || !this.enabled || !this.gameObject.activeInHierarchy)
            {
                return;
            }

            drawer.PushMatrix();

            drawer.matrix = Matrix4x4.TRS(this.transform.position, this.transform.rotation, this.transform.lossyScale);

            foreach (var gridPoint in new GridPointEnumerator(gridSize, numRows, numCols))
            {
                drawer.DrawPosition(gridPoint.centerPos);
            }

            drawer.matrix = Matrix4x4.TRS(
                this.transform.position,
                this.transform.rotation,
                this.transform.lossyScale.CompMul(new Vector3(1f, 1f, 0.005f)));

            drawer.color = Color.red;
            drawer.DrawWireCube(Vector3.zero, gridSize);
            drawer.color = Color.green;
            drawer.DrawWireCube(Vector3.zero, gridSize - Vector2.one * 0.001f);
            drawer.color = Color.blue;
            drawer.DrawWireCube(Vector3.zero, gridSize - Vector2.one * 0.002f);

            drawer.PopMatrix();
        }
コード例 #4
0
ファイル: TwoPoseTransformer.cs プロジェクト: ccdump/Paint-1
    public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
    {
        if (!_drawDebug)
        {
            return;
        }

        if (objectTransform == null)
        {
            return;
        }

        drawer.PushMatrix();
        drawer.matrix = objectTransform.localToWorldMatrix;

        drawer.color = LeapColor.coral;
        drawer.DrawWireCube(Vector3.zero, Vector3.one * 0.20f);

        drawer.color = LeapColor.jade;
        drawer.DrawWireCube(Vector3.zero, Vector3.one * 0.10f);

        drawer.PopMatrix();

        if (_constrainPosition && _drawPositionConstraints)
        {
            drawer.color = LeapColor.lavender;
            var dir = (Camera.main.transform.position.From(_basePosition)).normalized;
            drawer.DrawWireSphere(_basePosition,
                                  objectTransform.TransformVector(Vector3.right * _constraintDistance).magnitude);

            drawer.color = LeapColor.violet;
            drawer.DrawWireSphere(_basePosition,
                                  _maxWorldDistance);
        }
    }
コード例 #5
0
ファイル: UIActivator.cs プロジェクト: ccdump/Paint-1
 public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
 {
     if (_drawGizmos)
     {
         drawer.PushMatrix();
         drawer.matrix = this.transform.localToWorldMatrix;
         drawer.color  = Color.blue;
         drawer.DrawWireSphere(Vector3.zero, _radius);
         drawer.PopMatrix();
     }
 }
コード例 #6
0
        public static void DrawWireSphere(this RuntimeGizmoDrawer drawer,
                                          Vector3 position,
                                          Quaternion rotation,
                                          float radius)
        {
            drawer.PushMatrix();

            drawer.matrix = Matrix4x4.TRS(position, rotation, Vector3.one);

            drawer.DrawWireSphere(Vector3.zero, radius);

            drawer.PopMatrix();
        }
コード例 #7
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (this.enabled && this.gameObject.activeInHierarchy && drawRectDebug)
            {
                drawer.color = LeapColor.jade;

                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(portalObj.transform.TransformPoint(Vector3.forward * depthOffset), portalObj.transform.rotation, portalObj.transform.lossyScale);

                drawer.DrawWireCube(Vector3.zero, new Vector3(portalObj.width, portalObj.height, thickness));
                drawer.DrawWireCube(Vector3.zero, new Vector3(portalObj.width * 0.8f, portalObj.height * 0.8f, thickness));

                drawer.PopMatrix();

                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(portalObj.transform.TransformPoint(Vector3.forward * depthOffset), portalObj.transform.rotation, Vector3.one);

                drawer.color = LeapColor.magenta;
                if (!infiniteWidth || !infiniteHeight)
                {
                    var width  = 100000f;
                    var height = 100000f;

                    if (!infiniteWidth)
                    {
                        width = maxScrollWidth;
                    }
                    if (!infiniteHeight)
                    {
                        height = maxScrollHeight;
                    }

                    drawer.DrawWireCube(Vector3.zero, new Vector3(width, height, thickness));
                }

                drawer.PopMatrix();
            }
        }
コード例 #8
0
ファイル: RigidbodyGizmo.cs プロジェクト: ccdump/Paint-1
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            Rigidbody body = GetComponent <Rigidbody>();

            if (body == null)
            {
                return;
            }

            drawer.PushMatrix();
            drawer.matrix = this.transform.localToWorldMatrix;
            drawer.color  = Color.red;
            drawer.DrawWireCube(Vector3.zero, Vector3.one * 0.01F);
            drawer.PopMatrix();
        }
コード例 #9
0
        public void DrawEllipse(RuntimeGizmoDrawer drawer, Vector3 foci1, Vector3 foci2, float MinorAxis)
        {
            drawer.PushMatrix();
            Vector3    ellipseCenter   = (foci1 + foci2) / 2f;
            Quaternion ellipseRotation = Quaternion.LookRotation(foci1 - foci2);

            MajorAxis = Mathf.Sqrt(Mathf.Pow(Vector3.Distance(foci1, foci2) / 2f, 2f) + Mathf.Pow(MinorAxis / 2f, 2f)) * 2f;
            Vector3 ellipseScale = new Vector3(MinorAxis, MinorAxis, MajorAxis);

            drawer.matrix      = Matrix4x4.TRS(ellipseCenter, ellipseRotation, ellipseScale);
            sphereToWorldSpace = drawer.matrix;
            worldToSphereSpace = sphereToWorldSpace.inverse;

            drawer.DrawWireSphere(Vector3.zero, 0.5f);
            drawer.PopMatrix();
        }
コード例 #10
0
        private void DrawPinchDetectorAlignmentGizmo(PinchDetector pinchDetector, RuntimeGizmoDrawer drawer)
        {
            if (_alignmentGizmoEnabled)
            {
                drawer.PushMatrix();

                drawer.matrix = pinchDetector.transform.localToWorldMatrix;

                drawer.color = Color.red;
                drawer.DrawLine(Vector3.zero, Vector3.right * 0.01F);
                drawer.color = Color.green;
                drawer.DrawLine(Vector3.zero, Vector3.up * 0.01F);
                drawer.color = Color.blue;
                drawer.DrawLine(Vector3.zero, Vector3.forward * 0.01F);

                drawer.PopMatrix();
            }
        }
コード例 #11
0
        public void DrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (transform != null)
            {
                drawer.PushMatrix();

                drawer.matrix = Matrix4x4.TRS(transform.TransformPoint(center),
                                              transform.rotation,
                                              Quaternion.Inverse(transform.rotation)
                                              * transform.TransformVector(radii));

                drawBoxGizmos(drawer, Vector3.zero, Vector3.one);

                drawer.PopMatrix();
            }
            else
            {
                drawBoxGizmos(drawer, center, radii);
            }
        }
コード例 #12
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (_isSimulating && _drawRuntimeGizmos)
            {
                drawer.color = Color.red;

                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(_position, _rotation, Vector3.one);

                drawer.DrawWireCube(Vector3.zero, Vector3.one * 0.05f);

                drawer.color = Color.red;
                drawer.DrawLine(Vector3.zero, Vector3.right * 0.10f);
                drawer.color = Color.green;
                drawer.DrawLine(Vector3.zero, Vector3.up * 0.10f);
                drawer.color = Color.blue;
                drawer.DrawLine(Vector3.zero, Vector3.forward * 0.10f);

                drawer.PopMatrix();
            }
        }
コード例 #13
0
ファイル: Rect.cs プロジェクト: yukad2/leap_motion_with_srd
        public void DrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            drawer.PushMatrix();
            drawer.matrix = this.matrix;

            Vector3 b = localCorner01, c = localCorner11,
                    a = localCorner00, d = localCorner10;

            Vector2 shrink;
            var     invRadii = Vector3.one.CompDiv(radii.Abs()).NaNOrInfTo(0f);

            if (radii == Vector2.zero)
            {
                shrink = Vector2.zero;
            }
            else
            {
                shrink = Vector2.one * (radii * 0.02f).Abs().CompMin();
            }
            int numRectLines = 8;

            for (int i = 0; i < numRectLines; i++)
            {
                var shrinkMul = (Vector2.one - shrink.CompMul(invRadii) * i);
                drawer.DrawLine(a * shrinkMul, b * shrinkMul);
                drawer.DrawLine(b * shrinkMul, c * shrinkMul);
                drawer.DrawLine(c * shrinkMul, d * shrinkMul);
                drawer.DrawLine(d * shrinkMul, a * shrinkMul);
            }

            drawer.DrawLine(a, c);
            drawer.DrawLine(b, d);

            //drawer.matrix = Matrix4x4.Scale(new Vector3(1f, 1f, 0f)) * this.matrix;
            //drawer.DrawCube(Vector3.zero, new Vector3(radii.x, radii.y, 1f));

            drawer.PopMatrix();
        }
コード例 #14
0
ファイル: Circle.cs プロジェクト: tatoforever/AppExperiments
        public void DrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            Matrix4x4 m = Matrix4x4.identity;

            if (transform != null)
            {
                m = transform.localToWorldMatrix;
            }

            drawer.PushMatrix();
            drawer.matrix = m;

            drawer.DrawWireArc(
                center: center,
                normal: direction,
                radialStartDirection: direction.Vec().GetPerpendicular(),
                radius: radius,
                fractionOfCircleToDraw: 1f,
                numCircleSegments: 44
                );

            drawer.PopMatrix();
        }