예제 #1
0
        /// <summary>
        /// Moves the model
        /// </summary>
        /// <param name="movement">The amount to move (relative)</param>
        /// <returns>Indicates whether the move was successful</returns>
        public bool Move(Vector3D movement)
        {
            // Calculate new absolute vector:
            Vector3D newPosition = _position + movement;

            Engine.MD2System.Class_SetPointer(this.Name);
            try {
                R3DVector3D vector = VectorConverter.GetR3DVector3DFromVector3D(newPosition);
                Engine.MD2System.Model_SetPosition(ref vector);
            }
            catch (Exception e) {
                throw new ModelException("Could not set position '" + newPosition.X + "' '" + newPosition.Y + "' '" + newPosition.Z + "' for model '" + this.Name + "'", e);
            }
            _position = newPosition;
            // TODO: Implement success
            return(true);
        }
예제 #2
0
파일: Camera.cs 프로젝트: 628426/Strive.NET
        /// <summary>
        /// Rotates the camera
        /// </summary>
        /// <param name="rotation">The amount to rotate the camera</param>
        /// <returns>Indicates whether the rotation was successful</returns>
        public bool Rotate(Vector3D rotation)
        {
            Vector3D newRotation = _rotation + rotation;

            try
            {
                initialisePointer();
                R3DVector3D r = VectorConverter.GetR3DVector3DFromVector3D(newRotation);
                Engine.Cameras.Camera_SetRotation(ref r);
            }
            catch (Exception e)
            {
                throw new RenderingException("Could not set rotation '" + newRotation.X + "' '" + newRotation.Y + "' '" + newRotation.Z + "' for camera.", e);
            }
            _rotation = newRotation;
            // TODO: Implement success if needed
            return(true);
        }
예제 #3
0
파일: Camera.cs 프로젝트: 628426/Strive.NET
        /// <summary>
        /// Moves the camera
        /// </summary>
        /// <param name="movement">The amount to move the camera</param>
        /// <returns>Indicates whether the Move was successful</returns>
        public bool Move(Vector3D movement)
        {
            Vector3D newPosition = _position + movement;

            try
            {
                initialisePointer();
                R3DVector3D r = VectorConverter.GetR3DVector3DFromVector3D(newPosition);
                Engine.Cameras.Camera_SetPosition(ref r);
            }
            catch (Exception e)
            {
                throw new RenderingException("Could not set position '" + newPosition.X + "' '" + newPosition.Y + "' '" + newPosition.Z + "' for camera.", e);
            }
            _position = newPosition;
            // TODO: Implement success correctly - may not be needed for a camera
            return(true);
        }
예제 #4
0
파일: Model.cs 프로젝트: 628426/Strive.NET
        /// <summary>
        /// Rotates the model
        /// </summary>
        /// <param name="rotation">The amount to rotate</param>
        /// <returns>Indicates whether the rotation was successful</returns>
        public bool Rotate(Vector3D rotation)
        {
            // Calculate absolute rotation
            Vector3D newRotation = _rotation + rotation;

            Engine.MeshBuilder.Class_SetPointer(this.Name);

            try
            {
                R3DVector3D vector = VectorConverter.GetR3DVector3DFromVector3D(newRotation);
                Engine.MeshBuilder.Mesh_SetRotation(ref vector);
            }
            catch (Exception e)
            {
                throw new ModelException("Could not set rotation '" + newRotation.X + "' '" + newRotation.Y + "' '" + newRotation.Z + "' for model '" + this.Name + "'", e);
            }
            _rotation = newRotation;
            // TODO: Implement success
            return(true);
        }