• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LevelEditorCore.ViewControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LevelEditorCore.ViewControl的典型用法代码示例。如果您正苦于以下问题:C# ViewControl类的具体用法?C# ViewControl怎么用?C# ViewControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ViewControl类属于LevelEditorCore命名空间,在下文中一共展示了ViewControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1:

        void IManipulator.Render(ViewControl vc)
        {
            TerrainGob terrain = m_terrainEditor.TerrainEditorControl.SelectedTerrain;
            TerrainBrush brush = m_terrainEditor.TerrainEditorControl.SelectedBrush;
            TerrainMap terrainMap = m_terrainEditor.TerrainEditorControl.SelectedTerrainMap;
            if (brush == null || (!brush.CanApplyTo(terrain) && !brush.CanApplyTo(terrainMap))) return;
            
            Vec2F drawscale = new Vec2F(1.0f,1.0f);
            if (brush.CanApplyTo(terrainMap))
            {
                ImageData mapImg = terrainMap.GetSurface();
                ImageData hmImg = terrain.GetSurface();
                drawscale.X = (float)hmImg.Width / (float)mapImg.Width;
                drawscale.Y = (float)hmImg.Height / (float)mapImg.Height;
            }

            Point scrPt = vc.PointToClient(Control.MousePosition);
            if (!vc.ClientRectangle.Contains(scrPt)) return;                       
            Ray3F rayw = vc.GetWorldRay(scrPt);            
            TerrainGob.RayPickRetVal retval;
            if (terrain.RayPick(rayw, out retval))
            {
                terrain.DrawBrush(brush, drawscale, retval.hitpos);
            }           
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:25,代码来源:TerrainManipulator.cs


示例2: Pick

        public bool Pick(ViewControl vc, Point scrPt) 
        {
            m_highlightMaterialGUID = ~0ul;
            m_highlight.Clear();

            var ray = vc.GetWorldRay(scrPt);
            var endPt = ray.Origin + vc.Camera.FarZ * ray.Direction;

            var nativeVC = vc as GUILayer.IViewContext;
            if (nativeVC == null) return false;

            // do an intersection test here, and find the material under the cursor
            var pick = XLEBridgeUtils.Picking.RayPick(
                nativeVC, ray, XLEBridgeUtils.Picking.Flags.Objects);

            if (pick != null && pick.Length > 0)
            {
                m_highlightMaterialGUID = pick[0].materialGuid;
                m_highlight.Add(pick[0].documentId, pick[0].instanceId);

                using (var placements = nativeVC.SceneManager.GetPlacementsEditor())
                {
                    m_highlight.DoFixup(placements);
                }
            }

            return true;
        }
开发者ID:coreafive,项目名称:XLE,代码行数:28,代码来源:PickMaterialManipulator.cs


示例3: Render

 public override void Render(ViewControl vc)
 {                                                
     Matrix4F normWorld = GetManipulatorMatrix();
     if (normWorld == null) return;
     float s;
     Util.CalcAxisLengths(vc.Camera, normWorld.Translation, out s);
     m_translatorControl.Render(normWorld, s);        
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:8,代码来源:TranslateManipulator.cs


示例4: Pick

 public virtual bool Pick(ViewControl vc, Point scrPt)
 {
     Matrix4F normWorld = GetManipulatorMatrix();
     if (normWorld == null) return false;
     HitRayV = vc.GetRay(scrPt, vc.Camera.ProjectionMatrix);            
     HitMatrix.Set(normWorld);            
     return true;
 }
开发者ID:arsaccol,项目名称:LevelEditor,代码行数:8,代码来源:Manipulator.cs


示例5: Pick

        public override bool Pick(ViewControl vc, Point scrPt)
        {
            m_hitRegion = HitRegion.None;
            if (base.Pick(vc, scrPt) == false)
                return false;

            Camera camera = vc.Camera;
            float rad;
            Util.CalcAxisLengths(camera, HitMatrix.Translation, out rad);
            float tolerance = rad / 10.0f;

            // compute ray in object space  space.
            Matrix4F vp = camera.ViewMatrix * camera.ProjectionMatrix;
            Matrix4F wvp = HitMatrix * vp;            
            Ray3F rayL = vc.GetRay(scrPt, wvp);

            Plane3F xplane = new Plane3F(Vec3F.XAxis, Vec3F.ZeroVector);
            Plane3F yplane = new Plane3F(Vec3F.YAxis,Vec3F.ZeroVector);
            Plane3F zplane = new Plane3F(Vec3F.ZAxis,Vec3F.ZeroVector);

            Vec3F pt;
            float xdelta = float.MaxValue;            
            float ydelta = float.MaxValue;
            float zdelta = float.MaxValue;
            if(rayL.IntersectPlane(xplane,out pt))
            {
                xdelta = Math.Abs(pt.Length - rad); 
            }

            if (rayL.IntersectPlane(yplane, out pt))
            {
                ydelta = Math.Abs(pt.Length - rad);              
            }

            if (rayL.IntersectPlane(zplane, out pt))
            {
                zdelta = Math.Abs(pt.Length - rad);
            }

            if(xdelta < tolerance && xdelta < ydelta && xdelta < zdelta)
            {
                m_hitRegion = HitRegion.XAxis;                
            }
            else if(ydelta < tolerance && ydelta < zdelta)
            {
                m_hitRegion = HitRegion.YAxis;
            }
            else if(zdelta < tolerance)
            {
                m_hitRegion = HitRegion.ZAxis;
            }

            return m_hitRegion != HitRegion.None;
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:54,代码来源:RotateManipulator.cs


示例6: OnDragging

        public override void OnDragging(ViewControl vc, Point scrPt)
        {
            if (m_hitRegion == HitRegion.None || !CanManipulate(m_node))
                return;

            Matrix4F proj = vc.Camera.ProjectionMatrix;
            // create ray in view space.
            Ray3F rayV = vc.GetRay(scrPt, proj);

            Vec3F translate = m_translatorControl.OnDragging(rayV);

            Vec3F localTranslation;
            m_worldToLocal.TransformVector(translate, out localTranslation);
            m_node.Pivot = m_originalPivot + localTranslation;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:15,代码来源:TranslatePivotManipulator.cs


示例7: Pick

        public override bool Pick(ViewControl vc, Point scrPt)
        {
            m_hitRegion = HitRegion.None;
            if (base.Pick(vc, scrPt) == false)
                return false;

            m_node = GetManipulatorNode(TransformationTypes.Pivot);

            Camera camera = vc.Camera;            
            Matrix4F view = camera.ViewMatrix;
            Matrix4F vp = view * camera.ProjectionMatrix;
            Matrix4F wvp = HitMatrix * vp;

            Ray3F rayL = vc.GetRay(scrPt, wvp);
            m_hitRegion = m_translatorControl.Pick(vc, HitMatrix, view, rayL, HitRayV);
            bool picked = m_hitRegion != HitRegion.None;
            return picked;
        }
开发者ID:arsaccol,项目名称:LevelEditor,代码行数:18,代码来源:TranslatePivotManipulator.cs


示例8: Render

        public override void Render(object opaqueContext, ViewControl vc)
        {                                                
            Matrix4F normWorld = GetManipulatorMatrix();
            if (normWorld == null) return;

            var context = opaqueContext as GUILayer.SimpleRenderingContext;
            if (context == null) return;

            Vec3F pos = normWorld.Translation;
            float s = Util.CalcAxisScale(vc.Camera, pos, AxisLength, vc.Height);

            bool highlight = m_hitRegion == HitRegion.XYSquare;
            Color centerCubeColor = highlight ? Color.Gold : Color.White;

            Vec3F sv = new Vec3F(s, s, s);
            Vec3F centerCubeScale = sv * CenterCubeSize;
            Matrix4F scale = new Matrix4F(); 
            scale.Scale(centerCubeScale);
            Matrix4F centerCubeXform = scale * normWorld;
            Util3D.DrawCube(context, centerCubeXform, centerCubeColor);

            Matrix4F arrowScale = new Matrix4F();
            arrowScale.Scale(0.75f);

            Util3D.DrawArrowCap(
                context,
                arrowScale * Matrix4F.CreateTranslation(new Vec3F(1.0f, 0.0f, -0.5f)) * centerCubeXform,
                highlight ? Color.Gold : Color.Red);

            Util3D.DrawArrowCap(
                context,
                arrowScale * Matrix4F.RotAxisRH(Vec3F.ZAxis, Math.PI) * Matrix4F.CreateTranslation(new Vec3F(-1.0f, 0.0f, -0.5f)) * centerCubeXform,
                highlight ? Color.Gold : Color.Red);

            Util3D.DrawArrowCap(
                context,
                arrowScale * Matrix4F.RotAxisRH(Vec3F.ZAxis, .5 * Math.PI) * Matrix4F.CreateTranslation(new Vec3F(0.0f, 1.0f, -0.5f)) * centerCubeXform,
                highlight ? Color.Gold : Color.Green);

            Util3D.DrawArrowCap(
                context,
                arrowScale * Matrix4F.RotAxisRH(Vec3F.ZAxis, 1.5f * Math.PI) * Matrix4F.CreateTranslation(new Vec3F(0.0f, -1.0f, -0.5f)) * centerCubeXform,
                highlight ? Color.Gold : Color.Green);
        }
开发者ID:coreafive,项目名称:XLE,代码行数:44,代码来源:MoveAcrossTerrainManipulator.cs


示例9: OnEndDrag

        public void OnEndDrag(ViewControl vc, Point scrPt) 
        {
            var ray = vc.GetWorldRay(scrPt);
            var endPt = ray.Origin + vc.Camera.FarZ * ray.Direction;

            // do an intersection test here, and find the material under the cursor
            var pick = XLEBridgeUtils.Picking.RayPick(
                vc as GUILayer.IViewContext, ray, XLEBridgeUtils.Picking.Flags.Objects);

            if (pick != null && pick.Length > 0)
            {
                Context.PreviewModelName = pick[0].modelName;
                Context.PreviewModelBinding = pick[0].materialGuid; 
                Context.MaterialName = pick[0].materialName;
            }

            m_highlightMaterialGUID = ~0ul;
            m_highlight.Clear();
        }
开发者ID:coreafive,项目名称:XLE,代码行数:19,代码来源:PickMaterialManipulator.cs


示例10: Pick

        public override bool Pick(ViewControl vc, Point scrPt)
        {
            m_hitRegion = HitRegion.None;
            if (base.Pick(vc, scrPt) == false)
                return false;

            Camera camera = vc.Camera;
            float s;
            Util.CalcAxisLengths(camera, HitMatrix.Translation, out s);
            Matrix4F view = camera.ViewMatrix;
            Matrix4F vp = view  * camera.ProjectionMatrix;
            Matrix4F wvp = HitMatrix * vp;
            
            Ray3F rayL = vc.GetRay(scrPt,wvp);

            m_hitRegion = m_translatorControl.Pick(HitMatrix, view, rayL, HitRayV, s);
            
            bool picked = m_hitRegion != HitRegion.None;                      
            return picked;
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:20,代码来源:TranslateManipulator.cs


示例11: Render

        public override void Render(ViewControl vc)
        {
            Matrix4F normWorld = GetManipulatorMatrix();
            if (normWorld == null) return;

            Camera camera = vc.Camera;
            float s;
            Util.CalcAxisLengths(camera, normWorld.Translation, out s);
            m_translatorControl.Render(normWorld, s);        
            
            Matrix4F sc = new Matrix4F();
            Vec3F pos = normWorld.Translation;            
            s /= 12.0f;
            sc.Scale(s);

            Matrix4F bl = new Matrix4F();
            Util.CreateBillboard(bl, pos, camera.WorldEye, camera.Up, camera.LookAt);

            Matrix4F recXform = new Matrix4F();
            Matrix4F.Multiply(sc, bl, recXform);

            Util3D.DrawPivot(recXform, Color.Yellow);
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:23,代码来源:TranslatePivotManipulator.cs


示例12: OnEndDrag

        public override void OnEndDrag(ViewControl vc, Point scrPt)
        {
            if (CanManipulate(m_node))
            {
                var transactionContext = DesignView.Context.As<ITransactionContext>();
                try
                {
                    if (transactionContext.InTransaction)
                        transactionContext.End();
                }
                catch (InvalidTransactionException ex)
                {
                    if (transactionContext.InTransaction)
                        transactionContext.Cancel();

                    if (ex.ReportError)
                        Outputs.WriteLine(OutputMessageType.Error, ex.Message);
                }
            }

            m_hitRegion = HitRegion.None;
            m_node = null;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:23,代码来源:TranslatePivotManipulator.cs


示例13: Pick

        public override bool Pick(ViewControl vc, Point scrPt)
        {
            m_hitRegion = HitRegion.None;
            if (base.Pick(vc, scrPt) == false)
                return false;

            Camera camera = vc.Camera;
            
            Matrix4F view = camera.ViewMatrix;
            Matrix4F vp = view  * camera.ProjectionMatrix;
            Matrix4F wvp = HitMatrix * vp;
            
            Ray3F rayL = vc.GetRay(scrPt,wvp);

            float s = Util.CalcAxisScale(vc.Camera, HitMatrix.Translation, AxisLength, vc.Height);

                // There's only one hot-spot for this manipulator:
                //      a square at the manipulator origin.
            Vec3F min = new Vec3F(-0.5f, -0.5f, -0.5f);
            Vec3F max = new Vec3F(0.5f, 0.5f, 0.5f);
            AABB box = new AABB(min, max);

            float centerCubeScale = s * CenterCubeSize;
            Matrix4F centerCubeXform = new Matrix4F();
            centerCubeXform.Scale(centerCubeScale);
            centerCubeXform.Invert(centerCubeXform);
            Ray3F ray = rayL;
            ray.Transform(centerCubeXform);
            if (box.Intersect(ray))
            {
                m_hitRegion = HitRegion.XYSquare;
                return true;
            }

            m_hitRegion = HitRegion.None;
            return false;
        }
开发者ID:coreafive,项目名称:XLE,代码行数:37,代码来源:MoveAcrossTerrainManipulator.cs


示例14: Pick

 public bool Pick(ViewControl vc, Point scrPt)
 {
     m_hasHoverPt = HitTest(out m_hoverPt, scrPt, vc);
     return m_hasHoverPt;
 }
开发者ID:coreafive,项目名称:XLE,代码行数:5,代码来源:ScatterPlaceManipulator.cs


示例15: OnMouseWheel

 public override void OnMouseWheel(ViewControl vc, Point scrPt, int delta) { }
开发者ID:coreafive,项目名称:XLE,代码行数:1,代码来源:RotateManipulator.cs


示例16: Pick

        public override bool Pick(ViewControl vc, Point scrPt)
        {
            m_hitRegion = HitRegion.None;
            if (base.Pick(vc, scrPt) == false)
                return false;

            Camera camera = vc.Camera;
            float RingDiameter = 2 * AxisLength;
            float s = Util.CalcAxisScale(vc.Camera, HitMatrix.Translation, RingDiameter, vc.Height);

            float rad = s * Util3D.RingCenterRadias;
            float lrad = rad * LookRingScale;
            float tolerance = s * Util3D.RingThickness;
            
            Matrix4F billboard
                = Util.CreateBillboard(HitMatrix.Translation, vc.Camera.WorldEye, vc.Camera.Up, vc.Camera.LookAt);
            m_lookAxisHitMtrx = billboard;
            // compute ray in object space  space.
            Matrix4F vp = camera.ViewMatrix * camera.ProjectionMatrix;
            Matrix4F wvp = HitMatrix * vp;            
            Ray3F rayL = vc.GetRay(scrPt, wvp);

            Matrix4F wvp2 = billboard * vp;
            Ray3F rayL2 = vc.GetRay(scrPt, wvp2);

            Plane3F xplane = new Plane3F(Vec3F.XAxis, Vec3F.ZeroVector);
            Plane3F yplane = new Plane3F(Vec3F.YAxis,Vec3F.ZeroVector);
            Plane3F zplane = new Plane3F(Vec3F.ZAxis, Vec3F.ZeroVector);
            

            Vec3F pt;
            float xdelta    = float.MaxValue;            
            float ydelta    = float.MaxValue;
            float zdelta    = float.MaxValue;
            float lookdelta = float.MaxValue;
            if(rayL.IntersectPlane(xplane,out pt))
            {
                xdelta = Math.Abs(pt.Length - rad); 
            }

            if (rayL.IntersectPlane(yplane, out pt))
            {
                ydelta = Math.Abs(pt.Length - rad);              
            }

            if (rayL.IntersectPlane(zplane, out pt))
            {
                zdelta = Math.Abs(pt.Length - rad);
            }

            if (rayL2.IntersectPlane(zplane, out pt))
            {
                lookdelta = Math.Abs(pt.Length - lrad);
            }

            if(xdelta < tolerance && xdelta < ydelta && xdelta < zdelta
                && xdelta < lookdelta)
            {
                m_hitRegion = HitRegion.XAxis;                
            }
            else if(ydelta < tolerance && ydelta < zdelta
                && ydelta < lookdelta)
            {
                m_hitRegion = HitRegion.YAxis;
            }
            else if(zdelta < tolerance && zdelta < lookdelta)
            {
                m_hitRegion = HitRegion.ZAxis;
            }
            else if (lookdelta < tolerance)
            {
                m_hitRegion = HitRegion.LookAxis;
            }

            return m_hitRegion != HitRegion.None;
        }
开发者ID:coreafive,项目名称:XLE,代码行数:76,代码来源:RotateManipulator.cs


示例17: OnDragging

        public override void OnDragging(ViewControl vc, Point scrPt)
        {
            if (m_hitRegion == HitRegion.None || m_activeOp == null || m_activeOp.NodeList.Count == 0)
                return;
            Camera cam = vc.Camera;

            Matrix4F view = cam.ViewMatrix;
            Matrix4F proj = cam.ProjectionMatrix;

            Matrix4F axisMtrx = HitMatrix * view;
            Ray3F hitRay = HitRayV;
            Ray3F dragRay = vc.GetRay(scrPt, proj);
            
            Vec3F xAxis = axisMtrx.XAxis;
            Vec3F yAxis = axisMtrx.YAxis;
            Vec3F zAxis = axisMtrx.ZAxis;
            Vec3F origin = axisMtrx.Translation;
            
            Vec3F rotAxis = new Vec3F();            
            float theta = 0;

            float snapAngle = ((ISnapSettings)DesignView).SnapAngle;
            switch (m_hitRegion)
            {                
                case HitRegion.XAxis:
                    {
                        Plane3F xplane = new Plane3F(xAxis, origin);
                        theta = CalcAngle(origin, xplane, hitRay, dragRay, snapAngle);
                        rotAxis = HitMatrix.XAxis;                        
                    }
                    break;
                case HitRegion.YAxis:
                    {
                        Plane3F yplane = new Plane3F(yAxis, origin);
                        theta = CalcAngle(origin, yplane, hitRay, dragRay, snapAngle);
                        rotAxis = HitMatrix.YAxis;                        
                    }
                    break;
                case HitRegion.ZAxis:
                    {
                        Plane3F zplane = new Plane3F(zAxis, origin);
                        theta = CalcAngle(origin, zplane, hitRay, dragRay, snapAngle);
                        rotAxis = HitMatrix.ZAxis;
                    }
                    break;
                case HitRegion.LookAxis:
                    {                        
                        // for billboard objects the look vector is object's negative position in viewspace.
                        Vec3F lookAxis = Vec3F.Normalize(-origin);
                        Plane3F plane = new Plane3F(lookAxis, origin);
                        theta = CalcAngle(origin, plane, hitRay, dragRay, snapAngle);                        
                        rotAxis = m_lookAxisHitMtrx.ZAxis;
                    }
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            AngleAxisF axf = new AngleAxisF(-theta, rotAxis);
            Matrix4F deltaMtrx = new Matrix4F(axf);                                   
            Matrix4F rotMtrx = new Matrix4F();

            for (int i = 0; i < m_activeOp.NodeList.Count; i++)
            {
                ITransformable node = m_activeOp.NodeList[i];                              
                rotMtrx.Mul(m_rotations[i], deltaMtrx);                
                float ax, ay, az;
                rotMtrx.GetEulerAngles(out ax, out ay, out az);                                
                node.Rotation = new Vec3F(ax, ay, az);      
            }
        }
开发者ID:coreafive,项目名称:XLE,代码行数:71,代码来源:RotateManipulator.cs


示例18: OnEndDrag

 public override void OnEndDrag(ViewControl vc, Point scrPt)
 {
     if (m_activeOp != null)
     {
         m_activeOp.FinishTransaction();
         m_activeOp = null;
     }
     m_hitRegion = HitRegion.None;                        
     m_rotations = null;
 }
开发者ID:coreafive,项目名称:XLE,代码行数:10,代码来源:RotateManipulator.cs


示例19: Render

        public override void Render(ViewControl vc)
        {
            Matrix4F normWorld = GetManipulatorMatrix();
            if (normWorld == null) return;

            int axis = (int)m_hitRegion;

            // axis colors
            Color saveColor = m_axisColor[axis];
            m_axisColor[axis] = m_highlightColor;
            Color xcolor  = m_axisColor[(int)HitRegion.XAxis];
            Color ycolor  = m_axisColor[(int)HitRegion.YAxis];
            Color zcolor  = m_axisColor[(int)HitRegion.ZAxis];
            Color nxcolor = m_axisColor[(int)HitRegion.NegXAxis];
            Color nycolor = m_axisColor[(int)HitRegion.NegYAxis];
            Color nzcolor = m_axisColor[(int)HitRegion.NegZAxis];
            m_axisColor[axis] = saveColor;

            if (m_hitRegion != HitRegion.None)
            {
                normWorld.Translation = HitMatrix.Translation;
            }

            Vec3F pos = normWorld.Translation;
            float s = Util.CalcAxisScale(vc.Camera, pos, AxisLength, vc.Height);

            Vec3F sv = new Vec3F(s, s, s);
            Vec3F axscale = new Vec3F(s*AxisThickness, s, s*AxisThickness);
            bool negativeAxis = m_hitRegion == HitRegion.NegXAxis || m_hitRegion == HitRegion.NegYAxis || m_hitRegion == HitRegion.NegZAxis;
            Vec3F dragScale = new Vec3F(Math.Abs(m_scale.X),
                Math.Abs(m_scale.Y), Math.Abs(m_scale.Z));

            Matrix4F rot = new Matrix4F();
            Matrix4F scale = new Matrix4F();
            axscale.Y = negativeAxis ? s : s * dragScale.X;
            scale.Scale(axscale);
            rot.RotZ(-MathHelper.PiOver2);
            Matrix4F xform = scale * rot * normWorld;
            Util3D.DrawCylinder(xform, xcolor);

            axscale.Y = negativeAxis ? s : s * dragScale.Y;
            scale.Scale(axscale);
            xform = scale * normWorld;
            Util3D.DrawCylinder(xform, ycolor);

            axscale.Y = negativeAxis ? s : s * dragScale.Z;
            scale.Scale(axscale);
            rot.RotX(MathHelper.PiOver2);
            xform = scale * rot * normWorld;
            Util3D.DrawCylinder(xform, zcolor);

            rot.RotZ(MathHelper.PiOver2);
            axscale.Y = negativeAxis ? s * dragScale.X : s;
            scale.Scale(axscale);
            xform = scale * rot * normWorld;
            Util3D.DrawCylinder(xform, nxcolor);

            rot.RotZ(MathHelper.Pi);
            axscale.Y = negativeAxis ? s * dragScale.Y : s;
            scale.Scale(axscale);
            xform = scale * rot * normWorld;
            Util3D.DrawCylinder(xform, nycolor);

            rot.RotX(-MathHelper.PiOver2);
            axscale.Y = negativeAxis ? s * dragScale.Z : s;
            scale.Scale(axscale);
            xform = scale * rot * normWorld;
            Util3D.DrawCylinder(xform, nzcolor);

            // draw center cube
            scale.Scale(s*(1.0f / 16.0f));
            xform = scale * normWorld;
            Util3D.DrawCube(xform, Color.White);

            Vec3F handle = sv*AxisHandle;
            float handleWidth = handle.X/2;
            scale.Scale(handle);
            Matrix4F trans = new Matrix4F();

            // X handle
            float drag = m_hitRegion == HitRegion.XAxis ? dragScale.X : 1.0f;
            trans.Translation = new Vec3F(drag * sv.X - handleWidth, 0, 0);
            xform = scale * trans * normWorld;
            Util3D.DrawCube(xform, xcolor);

            // y handle
            drag = m_hitRegion == HitRegion.YAxis ? dragScale.Y : 1.0f;
            trans.Translation = new Vec3F(0, drag * sv.Y - handleWidth, 0);
            xform = scale * trans * normWorld;
            Util3D.DrawCube(xform, ycolor);

            // z handle
            drag = m_hitRegion == HitRegion.ZAxis ? dragScale.Z : 1.0f;
            trans.Translation = new Vec3F(0, 0, drag * sv.Z - handleWidth);
            xform = scale * trans * normWorld;
            Util3D.DrawCube(xform, zcolor);

            // -x handle
            drag = m_hitRegion == HitRegion.NegXAxis ? dragScale.X : 1.0f;
            trans.Translation = new Vec3F(-sv.X * drag + handleWidth, 0, 0);
//.........这里部分代码省略.........
开发者ID:ldh9451,项目名称:XLE,代码行数:101,代码来源:ExtensionManipulator.cs


示例20: Render

        public override void Render(object opaqueContext, ViewControl vc)
        {                                                                           
            Matrix4F normWorld = GetManipulatorMatrix();
            if (normWorld == null) return;

            var context = opaqueContext as GUILayer.SimpleRenderingContext;
            if (context == null) return;

            float RingDiameter = 2 * AxisLength;
            Color xcolor = (m_hitRegion == HitRegion.XAxis) ? Color.Gold : XAxisColor;
            Color ycolor = (m_hitRegion == HitRegion.YAxis ) ? Color.Gold : YAxisColor;
            Color Zcolor = (m_hitRegion == HitRegion.ZAxis ) ? Color.Gold : ZAxisColor;
            Color lColor = (m_hitRegion == HitRegion.LookAxis) ? Color.Gold : Color.Cyan;

            float s = Util.CalcAxisScale(vc.Camera, normWorld.Translation, RingDiameter, vc.Height);
            Vec3F axScale = new Vec3F(s, s, s);

            Matrix4F rot = new Matrix4F();
            Matrix4F scale = new Matrix4F();
            scale.Scale(axScale);
            rot.RotX(MathHelper.PiOver2);            
            Matrix4F xform = scale * rot * normWorld;
            Util3D.DrawRing(context, xform, Zcolor);

            rot.RotZ(-MathHelper.PiOver2);
            xform = scale * rot * normWorld;
            Util3D.DrawRing(context, xform, xcolor);
            
            xform = scale * normWorld;
            Util3D.DrawRing(context, xform, ycolor);

            Matrix4F billboard
                = Util.CreateBillboard(normWorld.Translation, vc.Camera.WorldEye, vc.Camera.Up, vc.Camera.LookAt);
            rot.RotX(MathHelper.PiOver2);
            scale.Scale(s * LookRingScale);
            xform = scale * rot * billboard;
            Util3D.DrawRing(context, xform, lColor);
        }
开发者ID:coreafive,项目名称:XLE,代码行数:38,代码来源:RotateManipulator.cs



注:本文中的LevelEditorCore.ViewControl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Lexer.Lexer类代码示例发布时间:2022-05-26
下一篇:
C# Simple.Target类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap