예제 #1
0
        /// <summary>
        /// Setear centro del gizmo y ajustar tamaño segun distancia con la camara
        /// </summary>
        public void setCenter(Vector3 gizmoCenter, MeshCreatorCamera camera)
        {
            this.gizmoCenter = gizmoCenter;
            float increment = MeshCreatorUtils.getTranslateGizmoSizeIncrement(camera, gizmoCenter);

            boxX.Size = Vector3.Multiply(new Vector3(LARGE_AXIS_SIZE, SHORT_AXIS_SIZE, SHORT_AXIS_SIZE), increment);
            boxY.Size = Vector3.Multiply(new Vector3(SHORT_AXIS_SIZE, LARGE_AXIS_SIZE, SHORT_AXIS_SIZE), increment);
            boxZ.Size = Vector3.Multiply(new Vector3(SHORT_AXIS_SIZE, SHORT_AXIS_SIZE, LARGE_AXIS_SIZE), increment);
            boxXZ.Size = Vector3.Multiply(new Vector3(INTERMEDIATE_AXIS_SIZE, SHORT_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE), increment);
            boxXY.Size = Vector3.Multiply(new Vector3(INTERMEDIATE_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE, SHORT_AXIS_SIZE), increment);
            boxYZ.Size = Vector3.Multiply(new Vector3(SHORT_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE), increment);

            boxX.Position = gizmoCenter + Vector3.Multiply(boxX.Size, 0.5f) + new Vector3(SHORT_AXIS_SIZE, 0, 0);
            boxY.Position = gizmoCenter + Vector3.Multiply(boxY.Size, 0.5f) + new Vector3(0, SHORT_AXIS_SIZE, 0);
            boxZ.Position = gizmoCenter + Vector3.Multiply(boxZ.Size, 0.5f) + new Vector3(0, 0, SHORT_AXIS_SIZE);
            boxXZ.Position = gizmoCenter + new Vector3(boxXZ.Size.X / 2, 0, boxXZ.Size.Z / 2);
            boxXY.Position = gizmoCenter + new Vector3(boxXY.Size.X / 2, boxXY.Size.Y / 2, 0);
            boxYZ.Position = gizmoCenter + new Vector3(0, boxYZ.Size.Y / 2, boxYZ.Size.Z / 2);

            boxX.updateValues();
            boxY.updateValues();
            boxZ.updateValues();
            boxXZ.updateValues();
            boxXY.updateValues();
            boxYZ.updateValues();
        }
예제 #2
0
        /// <summary>
        /// Setear centro del gizmo y ajustar tamaño segun distancia con la camara
        /// </summary>
        public void setCenter(TGCVector3 gizmoCenter, MeshCreatorCamera camera)
        {
            GizmoCenter = gizmoCenter;
            var increment = MeshCreatorUtils.getTranslateGizmoSizeIncrement(camera, gizmoCenter);

            boxX.Size  = TGCVector3.Multiply(new TGCVector3(LARGE_AXIS_SIZE, SHORT_AXIS_SIZE, SHORT_AXIS_SIZE), increment);
            boxY.Size  = TGCVector3.Multiply(new TGCVector3(SHORT_AXIS_SIZE, LARGE_AXIS_SIZE, SHORT_AXIS_SIZE), increment);
            boxZ.Size  = TGCVector3.Multiply(new TGCVector3(SHORT_AXIS_SIZE, SHORT_AXIS_SIZE, LARGE_AXIS_SIZE), increment);
            boxXZ.Size = TGCVector3.Multiply(new TGCVector3(INTERMEDIATE_AXIS_SIZE, SHORT_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE), increment);
            boxXY.Size = TGCVector3.Multiply(new TGCVector3(INTERMEDIATE_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE, SHORT_AXIS_SIZE), increment);
            boxYZ.Size = TGCVector3.Multiply(new TGCVector3(SHORT_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE, INTERMEDIATE_AXIS_SIZE), increment);

            boxX.Position  = gizmoCenter + TGCVector3.Multiply(boxX.Size, 0.5f) + new TGCVector3(SHORT_AXIS_SIZE, 0, 0);
            boxY.Position  = gizmoCenter + TGCVector3.Multiply(boxY.Size, 0.5f) + new TGCVector3(0, SHORT_AXIS_SIZE, 0);
            boxZ.Position  = gizmoCenter + TGCVector3.Multiply(boxZ.Size, 0.5f) + new TGCVector3(0, 0, SHORT_AXIS_SIZE);
            boxXZ.Position = gizmoCenter + new TGCVector3(boxXZ.Size.X / 2, 0, boxXZ.Size.Z / 2);
            boxXY.Position = gizmoCenter + new TGCVector3(boxXY.Size.X / 2, boxXY.Size.Y / 2, 0);
            boxYZ.Position = gizmoCenter + new TGCVector3(0, boxYZ.Size.Y / 2, boxYZ.Size.Z / 2);

            boxX.updateValues();
            boxY.updateValues();
            boxZ.updateValues();
            boxXZ.updateValues();
            boxXY.updateValues();
            boxYZ.updateValues();
        }
예제 #3
0
        /// <summary>
        /// Hacer zoom a un grupo de primitivas
        /// </summary>
        public static void zoomPrimitives(MeshCreatorCamera camera, List <EditPolyPrimitive> primitives, Matrix transform)
        {
            TgcBoundingBox aabb = getSelectionBoundingBox(primitives);

            if (aabb != null)
            {
                camera.CameraCenter = Vector3.TransformCoordinate(aabb.calculateBoxCenter(), transform);
            }
        }
예제 #4
0
        /// <summary>
        /// Poner la camara en front view respecto de un conjunto de primitivas
        /// </summary>
        public static void setCameraFrontView(MeshCreatorCamera camera, List <EditPolyPrimitive> primitives, Matrix transform)
        {
            TgcBoundingBox aabb = getSelectionBoundingBox(primitives);
            Vector3        lookAt;

            if (aabb != null)
            {
                lookAt = Vector3.TransformCoordinate(aabb.calculateBoxCenter(), transform);
            }
            else
            {
                lookAt = new Vector3(0, 0, 0);
            }
            camera.setFixedView(lookAt, 0, 0, camera.CameraDistance);
        }
예제 #5
0
        /// <summary>
        ///     Poner la camara en left view respecto de un conjunto de primitivas
        /// </summary>
        public static void setCameraLeftView(MeshCreatorCamera camera, List <EditPolyPrimitive> primitives,
                                             TGCMatrix transform)
        {
            var        aabb = getSelectionBoundingBox(primitives);
            TGCVector3 lookAt;

            if (aabb != null)
            {
                lookAt = TGCVector3.TransformCoordinate(aabb.calculateBoxCenter(), transform);
            }
            else
            {
                lookAt = TGCVector3.Empty;
            }
            camera.setFixedView(lookAt, 0, FastMath.PI_HALF, camera.CameraDistance);
        }
예제 #6
0
 /// <summary>
 /// Poner la camara en front view respecto de un conjunto de primitivas
 /// </summary>
 public static void setCameraFrontView(MeshCreatorCamera camera, List<EditPolyPrimitive> primitives, Matrix transform)
 {
     TgcBoundingBox aabb = getSelectionBoundingBox(primitives);
     Vector3 lookAt;
     if (aabb != null)
     {
         lookAt = Vector3.TransformCoordinate(aabb.calculateBoxCenter(), transform);
     }
     else
     {
         lookAt = new Vector3(0, 0, 0);
     }
     camera.setFixedView(lookAt, 0, 0, camera.CameraDistance);
 }
예제 #7
0
 /// <summary>
 /// Hacer zoom a un grupo de primitivas
 /// </summary>
 public static void zoomPrimitives(MeshCreatorCamera camera, List<EditPolyPrimitive> primitives, Matrix transform)
 {
     TgcBoundingBox aabb = getSelectionBoundingBox(primitives);
     if(aabb != null)
     {
         camera.CameraCenter = Vector3.TransformCoordinate(aabb.calculateBoxCenter(), transform);
     }
 }