Ejemplo n.º 1
0
 public override void RenderWire()
 {
     if (_wireRenderDesc.WireEdgeFlags == WireEdgeFlags.All)
     {
         Graphics.DrawMeshNow(MeshPool.Get.UnitWireQuadXY, Matrix4x4.TRS(_center, _rotation, new Vector3(_size.x, _size.y, 1.0f)));
     }
     else
     {
         var cornerPoints = GetCornerPoints();
         if ((_wireRenderDesc.WireEdgeFlags & WireEdgeFlags.Top) != 0)
         {
             GLRenderer.DrawLine3D(cornerPoints[(int)QuadCorner.TopLeft], cornerPoints[(int)QuadCorner.TopRight]);
         }
         if ((_wireRenderDesc.WireEdgeFlags & WireEdgeFlags.Right) != 0)
         {
             GLRenderer.DrawLine3D(cornerPoints[(int)QuadCorner.TopRight], cornerPoints[(int)QuadCorner.BottomRight]);
         }
         if ((_wireRenderDesc.WireEdgeFlags & WireEdgeFlags.Bottom) != 0)
         {
             GLRenderer.DrawLine3D(cornerPoints[(int)QuadCorner.BottomRight], cornerPoints[(int)QuadCorner.BottomLeft]);
         }
         if ((_wireRenderDesc.WireEdgeFlags & WireEdgeFlags.Left) != 0)
         {
             GLRenderer.DrawLine3D(cornerPoints[(int)QuadCorner.BottomLeft], cornerPoints[(int)QuadCorner.TopLeft]);
         }
     }
 }
Ejemplo n.º 2
0
        public void Render(IEnumerable <GameObject> gameObjects, Camera camera)
        {
            if (gameObjects == null)
            {
                return;
            }

            var material = GizmoLineMaterial.Get;

            material.ResetValuesToSensibleDefaults();

            foreach (var gameObj in gameObjects)
            {
                Transform transform  = gameObj.transform;
                Vector3   axesOrigin = transform.position;
                Vector3   right      = transform.right;
                Vector3   up         = transform.up;
                Vector3   look       = transform.forward;

                float zoomFactor = 1.0f;
                if (LookAndFeel.UseZoomFactor)
                {
                    zoomFactor = camera.EstimateZoomFactor(axesOrigin);
                }
                float axisLength = LookAndFeel.AxisLength * zoomFactor;

                Vector3 startPt = axesOrigin - right * axisLength;
                Vector3 endPt   = axesOrigin + right * axisLength;
                material.SetColor(LookAndFeel.XAxisColor);
                material.SetPass(0);
                GLRenderer.DrawLine3D(startPt, endPt);

                startPt = axesOrigin - up * axisLength;
                endPt   = axesOrigin + up * axisLength;
                material.SetColor(LookAndFeel.YAxisColor);
                material.SetPass(0);
                GLRenderer.DrawLine3D(startPt, endPt);

                startPt = axesOrigin - look * axisLength;
                endPt   = axesOrigin + look * axisLength;
                material.SetColor(LookAndFeel.ZAxisColor);
                material.SetPass(0);
                GLRenderer.DrawLine3D(startPt, endPt);
            }
        }
Ejemplo n.º 3
0
 public override void RenderWire()
 {
     GLRenderer.DrawLine3D(_startPoint, _endPoint);
 }