Ejemplo n.º 1
0
        private Matrix GetWorldMatrix(IEditorGameCameraService cameraService)
        {
            Matrix worldMatrix = Matrix.Identity;

            switch (Space)
            {
            case TransformationSpace.WorldSpace:
                worldMatrix.TranslationVector = AnchorEntity.Transform.WorldMatrix.TranslationVector;
                break;

            case TransformationSpace.ObjectSpace:
                var parentMatrix = Matrix.Identity;
                if (AnchorEntity.GetParent() != null)
                {
                    parentMatrix = AnchorEntity.TransformValue.Parent.WorldMatrix;
                }

                // We don't use the entity's "WorldMatrix" because it's scale could be zero, which would break the gizmo.
                worldMatrix = Matrix.RotationQuaternion(AnchorEntity.Transform.Rotation) *
                              Matrix.Translation(AnchorEntity.Transform.Position) *
                              parentMatrix;
                break;

            case TransformationSpace.ViewSpace:
                worldMatrix = Matrix.Invert(cameraService.ViewMatrix);
                worldMatrix.TranslationVector = AnchorEntity.Transform.WorldMatrix.TranslationVector;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(worldMatrix);
        }
Ejemplo n.º 2
0
 public void Load(string organization, string product, AnchorEntity anchor)
 {
     this.Organization = organization;
     this.Product      = product;
     this.Name         = anchor.Name;
     this.Target       = anchor.Target.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
 }