Ejemplo n.º 1
0
        public virtual fMesh MakeGeometry(AxisGizmoFlags widget)
        {
            switch (widget)
            {
            case AxisGizmoFlags.AxisTranslateX:
                if (AxisTranslateX == null)
                {
                    AxisTranslateX = FResources.LoadMesh("transform_gizmo/axis_translate_x");
                }
                return(AxisTranslateX);

            case AxisGizmoFlags.AxisTranslateY:
                if (AxisTranslateY == null)
                {
                    AxisTranslateY = FResources.LoadMesh("transform_gizmo/axis_translate_y");
                }
                return(AxisTranslateY);

            case AxisGizmoFlags.AxisTranslateZ:
                if (AxisTranslateZ == null)
                {
                    AxisTranslateZ = FResources.LoadMesh("transform_gizmo/axis_translate_z");
                }
                return(AxisTranslateZ);


            case AxisGizmoFlags.AxisRotateX:
                if (AxisRotateX == null)
                {
                    AxisRotateX = FResources.LoadMesh("transform_gizmo/axisrotate_x");
                }
                return(AxisRotateX);

            case AxisGizmoFlags.AxisRotateY:
                if (AxisRotateY == null)
                {
                    AxisRotateY = FResources.LoadMesh("transform_gizmo/axisrotate_y");
                }
                return(AxisRotateY);

            case AxisGizmoFlags.AxisRotateZ:
                if (AxisRotateZ == null)
                {
                    AxisRotateZ = FResources.LoadMesh("transform_gizmo/axisrotate_z");
                }
                return(AxisRotateZ);


            case AxisGizmoFlags.PlaneTranslateX:
                if (PlaneTranslateX == null)
                {
                    PlaneTranslateX = FResources.LoadMesh("transform_gizmo/plane_translate_yz");
                }
                return(PlaneTranslateX);

            case AxisGizmoFlags.PlaneTranslateY:
                if (PlaneTranslateY == null)
                {
                    PlaneTranslateY = FResources.LoadMesh("transform_gizmo/plane_translate_xz");
                }
                return(PlaneTranslateY);

            case AxisGizmoFlags.PlaneTranslateZ:
                if (PlaneTranslateZ == null)
                {
                    PlaneTranslateZ = FResources.LoadMesh("transform_gizmo/plane_translate_xy");
                }
                return(PlaneTranslateZ);


            case AxisGizmoFlags.UniformScale:
                if (UniformScale == null)
                {
                    UniformScale = FResources.LoadMesh("transform_gizmo/uniform_scale");
                }
                return(UniformScale);


            default:
                throw new Exception("DefaultAxisGizmoWidgetFactory.MakeHoverMaterial: invalid widget type " + widget.ToString());
            }
        }
Ejemplo n.º 2
0
        public virtual fMaterial MakeHoverMaterial(AxisGizmoFlags widget)
        {
            switch (widget)
            {
            case AxisGizmoFlags.AxisRotateX:
            case AxisGizmoFlags.AxisTranslateX:
            case AxisGizmoFlags.PlaneTranslateX:
                if (XHover == null)
                {
                    XHover = MaterialUtil.CreateTransparentMaterial(Colorf.VideoRed);
                    if (OverrideRenderQueue != -1)
                    {
                        XHover.renderQueue = OverrideRenderQueue;
                    }
                }
                return(XHover);

            case AxisGizmoFlags.AxisRotateY:
            case AxisGizmoFlags.AxisTranslateY:
            case AxisGizmoFlags.PlaneTranslateY:
                if (YHover == null)
                {
                    YHover = MaterialUtil.CreateTransparentMaterial(Colorf.VideoGreen);
                    if (OverrideRenderQueue != -1)
                    {
                        YHover.renderQueue = OverrideRenderQueue;
                    }
                }
                return(YHover);

            case AxisGizmoFlags.AxisRotateZ:
            case AxisGizmoFlags.AxisTranslateZ:
            case AxisGizmoFlags.PlaneTranslateZ:
                if (ZHover == null)
                {
                    ZHover = MaterialUtil.CreateTransparentMaterial(Colorf.VideoBlue);
                    if (OverrideRenderQueue != -1)
                    {
                        ZHover.renderQueue = OverrideRenderQueue;
                    }
                }
                return(ZHover);

            case AxisGizmoFlags.UniformScale:
                if (AllHover == null)
                {
                    AllHover = MaterialUtil.CreateTransparentMaterial(Colorf.VideoWhite);
                    if (OverrideRenderQueue != -1)
                    {
                        AllHover.renderQueue = OverrideRenderQueue;
                    }
                }
                return(AllHover);

            default:
                throw new Exception("DefaultAxisGizmoWidgetFactory.MakeHoverMaterial: invalid widget type " + widget.ToString());
            }
        }