예제 #1
0
        public void Update()
        {
            text.Text     = Value.ToString();
            text.Position = Vector3.TransformCoordinate(new Vector3(0, 1.5f, 0), WorldMatrix);
            text.Radius   = 0.7f * Vector3.TransformNormal(Vector3.Normalize(new Vector3(1, 1, 1)), WorldMatrix).Length();

            text.Update();

            plusBoxEnt.WorldMatrix = Matrix.Scaling(plusBox.GetSize()) *
                                     Matrix.Translation(plusBox.GetCenter()) * WorldMatrix;
            minBoxEnt.WorldMatrix = Matrix.Scaling(minBox.GetSize()) *
                                    Matrix.Translation(minBox.GetCenter()) * WorldMatrix;

            var old = TW.Graphics.LineManager3D.WorldMatrix;

            TW.Graphics.LineManager3D.WorldMatrix = WorldMatrix;
            if (intersectsBox(TW.Data.Get <CameraInfo>().GetCenterScreenRay(), minBox))
            {
                TW.Graphics.LineManager3D.AddBox(minBox, Color.Black.dx());
            }
            if (intersectsBox(TW.Data.Get <CameraInfo>().GetCenterScreenRay(), plusBox))
            {
                TW.Graphics.LineManager3D.AddBox(plusBox, Color.Black.dx());
            }
            TW.Graphics.LineManager3D.WorldMatrix = old;
        }
        private void showDataValueRect(GameVoxel target, int value)
        {
            var max = target.GetBoundingBox().Maximum;
            var min = target.GetBoundingBox().Minimum;
            var pos = (max + min) * 0.5f + new Vector3(0, 6.5f, 0);

            dataValueRectangle.Position    = pos;
            dataValueRectangle.IsBillboard = true;
            dataValueRectangle.Text        = value.ToString();// target.DataValue.ToString();
            dataValueRectangle.Radius      = 3;
            dataValueRectangle.Update();
        }