Ejemplo n.º 1
0
 public PlaneDescriptor(PlaneId planeId, PlaneQuadrantId planeQuadrant)
 {
     _id                   = planeId;
     _quadrant             = planeQuadrant;
     _firstAxisDescriptor  = PlaneIdHelper.GetFirstAxisDescriptor(planeId, planeQuadrant);
     _secondAxisDescriptor = PlaneIdHelper.GetSecondAxisDescriptor(planeId, planeQuadrant);
 }
Ejemplo n.º 2
0
        public void MakeSliderPlane(GizmoTransform sliderPlaneTransform, PlaneId planeId, GizmoLineSlider3D firstAxisSlider, GizmoLineSlider3D secondAxisSlider, Camera camera)
        {
            PlaneQuadrantId quadrantId = sliderPlaneTransform.Get3DQuadrantFacingCamera(planeId, camera);

            AlignToQuadrant(sliderPlaneTransform, planeId, quadrantId, true);

            Vector3 firstQdrAxis  = sliderPlaneTransform.GetAxis3D(PlaneIdHelper.GetFirstAxisDescriptor(planeId, quadrantId));
            Vector3 secondQdrAxis = sliderPlaneTransform.GetAxis3D(PlaneIdHelper.GetSecondAxisDescriptor(planeId, quadrantId));
            Vector3 sliderOffset  = firstQdrAxis * secondAxisSlider.GetRealSizeAlongDirection(camera, firstQdrAxis) * 0.5f +
                                    secondQdrAxis * firstAxisSlider.GetRealSizeAlongDirection(camera, secondQdrAxis) * 0.5f;

            if (LookAndFeel.PlaneType == GizmoPlane3DType.Quad)
            {
                SetQuadCornerPosition(QuadCorner.BottomLeft, sliderPlaneTransform.Position3D + sliderOffset);
            }
        }
Ejemplo n.º 3
0
        public void AlignToQuadrant(GizmoTransform transform, PlaneId planeId, PlaneQuadrantId quadrantId, bool alignXToFirstAxis)
        {
            Plane plane = transform.GetPlane3D(planeId, quadrantId);

            if (alignXToFirstAxis)
            {
                AxisDescriptor secondAxisDesc = PlaneIdHelper.GetSecondAxisDescriptor(planeId, quadrantId);
                Vector3        secondAxis     = Gizmo.Transform.GetAxis3D(secondAxisDesc);
                _transform.Rotation3D = Quaternion.LookRotation(plane.normal, secondAxis);
            }
            else
            {
                AxisDescriptor firstAxisDesc = PlaneIdHelper.GetFirstAxisDescriptor(planeId, quadrantId);
                Vector3        firstAxis     = Gizmo.Transform.GetAxis3D(firstAxisDesc);
                _transform.Rotation3D = Quaternion.LookRotation(plane.normal, firstAxis);
            }
        }
        public PlaneQuadrantId Get3DQuadrantFacingCamera(PlaneId planeId, Camera camera)
        {
            int axisIndex0 = PlaneIdHelper.PlaneIdToFirstAxisIndex(planeId);
            int axisIndex1 = PlaneIdHelper.PlaneIdToSecondAxisIndex(planeId);

            AxisSign sign0 = AxisSign.Positive;
            AxisSign sign1 = AxisSign.Positive;
            Vector3  axis0 = GetAxis3D(axisIndex0, sign0);
            Vector3  axis1 = GetAxis3D(axisIndex1, sign1);

            if (!camera.IsPointFacingCamera(Position3D, axis0))
            {
                sign0 = AxisSign.Negative;
            }
            if (!camera.IsPointFacingCamera(Position3D, axis1))
            {
                sign1 = AxisSign.Negative;
            }

            return(PlaneIdHelper.GetQuadrantFromAxesSigns(planeId, sign0, sign1));
        }