コード例 #1
0
        void DrawHardpoints(ICamera cam)
        {
            var matrix = GetModelMatrix();

            GizmoRender.Scale = gizmoScale;
            GizmoRender.Begin();

            foreach (var tr in gizmos)
            {
                if (tr.Enabled || tr.Override != null)
                {
                    var transform = tr.Override ?? tr.Definition.Transform;
                    //arc
                    if (tr.Definition is RevoluteHardpointDefinition)
                    {
                        var rev = (RevoluteHardpointDefinition)tr.Definition;
                        var min = tr.Override == null ? rev.Min : tr.EditingMin;
                        var max = tr.Override == null ? rev.Max : tr.EditingMax;
                        GizmoRender.AddGizmoArc(transform * (tr.Parent == null ? Matrix4.Identity : tr.Parent.Transform) * matrix, min, max);
                    }
                    //draw (red for editing, light pink for normal)
                    GizmoRender.AddGizmo(transform * (tr.Parent == null ? Matrix4.Identity : tr.Parent.Transform) * matrix, tr.Override != null ? Color4.Red : Color4.LightPink);
                }
            }
            GizmoRender.RenderGizmos(cam, rstate);
        }
コード例 #2
0
        void DrawSkeleton(ICamera cam)
        {
            var matrix = GetModelMatrix();

            GizmoRender.Scale = gizmoScale;
            GizmoRender.Begin();
            var df = (DF.DfmFile)drawable;

            foreach (var c in df.Constructs.Constructs)
            {
                var b1 = c.BoneA;
                var b2 = c.BoneB;
                if (string.IsNullOrEmpty(c.BoneB))
                {
                    b2 = c.ParentName;
                    b1 = c.BoneA;
                }
                var     conMat = c.Rotation * Matrix4.CreateTranslation(c.Origin);
                DF.Bone bone1  = null;
                DF.Bone bone2  = null;
                foreach (var k in df.Parts.Values)
                {
                    if (k.objectName == b1)
                    {
                        bone1 = k.Bone;
                    }
                    if (k.objectName == b2)
                    {
                        bone2 = k.Bone;
                    }
                }
                if (bone1 == null || bone2 == null)
                {
                    continue;
                }
                GizmoRender.AddGizmo(bone2.BoneToRoot * bone1.BoneToRoot * conMat * matrix);
            }

            /*foreach(var b in df.Bones.Values)
             * {
             *  var tr = b.BoneToRoot;
             *  tr.Transpose();
             *  if (b.Construct != null)
             *      tr *= b.Construct.Transform;
             *  tr *= matrix;
             *
             *  GizmoRender.AddGizmo(tr, true, true);
             * }*/
            GizmoRender.RenderGizmos(cam, rstate);
        }
コード例 #3
0
        void DrawSkeleton(ICamera cam)
        {
            var matrix = GetModelMatrix();

            GizmoRender.Scale = gizmoScale;
            GizmoRender.Begin();

            var dfm = (DF.DfmFile)drawable;

            foreach (var b in dfm.Bones)
            {
                GizmoRender.AddGizmo(b.Value.BoneToRoot * matrix, Color4.Green);
            }
            GizmoRender.RenderGizmos(cam, rstate);
        }
コード例 #4
0
        void DrawHardpoints(ICamera cam)
        {
            var matrix = Matrix4.CreateRotationX(rotation.Y) * Matrix4.CreateRotationY(rotation.X);

            GizmoRender.Begin();

            foreach (var tr in gizmos)
            {
                if (tr.Enabled)
                {
                    GizmoRender.AddGizmo(tr.Definition.Transform * (tr.Parent == null ? Matrix4.Identity : tr.Parent.Transform) * matrix);
                }
            }
            GizmoRender.RenderGizmos(cam, rstate);
        }
コード例 #5
0
        void DrawHardpoints(ICamera cam)
        {
            var matrix = GetModelMatrix();

            GizmoRender.Scale = gizmoScale;
            GizmoRender.Begin();

            foreach (var tr in gizmos)
            {
                if (tr.Enabled || tr.Override != null)
                {
                    var transform = tr.Override ?? tr.Definition.Transform;
                    //highlight edited cube
                    if (tr.Override != null)
                    {
                        GizmoRender.CubeColor = Color4.CornflowerBlue;
                        GizmoRender.CubeAlpha = 0.5f;
                    }
                    else
                    {
                        GizmoRender.CubeColor = Color4.Purple;
                        GizmoRender.CubeAlpha = 0.3f;
                    }
                    //arc
                    if (tr.Definition is RevoluteHardpointDefinition)
                    {
                        var rev = (RevoluteHardpointDefinition)tr.Definition;
                        var min = tr.Override == null ? rev.Min : tr.EditingMin;
                        var max = tr.Override == null ? rev.Max : tr.EditingMax;
                        GizmoRender.AddGizmoArc(transform * (tr.Parent == null ? Matrix4.Identity : tr.Parent.Transform) * matrix, min, max);
                    }
                    //
                    GizmoRender.AddGizmo(transform * (tr.Parent == null ? Matrix4.Identity : tr.Parent.Transform) * matrix);
                }
            }
            GizmoRender.RenderGizmos(cam, rstate);
        }
コード例 #6
0
        void DrawHardpoints(ICamera cam)
        {
            var            matrix     = Matrix4.CreateRotationX(rotation.Y) * Matrix4.CreateRotationY(rotation.X);
            List <Matrix4> hardpoints = new List <Matrix4>();

            if (drawable is CmpFile)
            {
                foreach (var p in ((CmpFile)drawable).Parts)
                {
                    var parentHp = p.Value.Construct != null ? p.Value.Construct.Transform : Matrix4.Identity;
                    parentHp *= matrix;
                    foreach (var hp in p.Value.Model.Hardpoints)
                    {
                        hardpoints.Add(hp.Transform * parentHp);
                    }
                }
            }
            else if (drawable is ModelFile)
            {
                foreach (var hp in ((ModelFile)drawable).Hardpoints)
                {
                    hardpoints.Add(hp.Transform * matrix);
                }
            }
            if (hardpoints.Count == 0)
            {
                return;
            }
            GizmoRender.Begin();
            foreach (var tr in hardpoints)
            {
                //X
                GizmoRender.AddGizmo(tr);
            }
            GizmoRender.RenderGizmos(cam, rstate);
        }