コード例 #1
0
ファイル: Camera.cs プロジェクト: 628426/Strive.NET
        /*
         * public void SetHeading( Vector3D heading ) {
         *      setPointer;
         *      R3DPoint3D p;
         *      p.x = heading.X + _position.X;
         *      p.y = heading.Y + _position.Y;
         *      p.z = heading.Z + _position.Z;
         *      Engine.Cameras.Camera_LookAt( ref p );
         * }
         */
        #endregion

        #region "Methods"
        public Vector2D ProjectPoint(Vector3D point)
        {
            R3DVector3D namePos = new R3DVector3D();

            namePos.x = point.X;
            namePos.y = point.Y;
            namePos.z = point.Z;
            R3DVector2D nameLoc = new R3DVector2D();

            nameLoc = Engine.Cameras.Camera_ProjectPoint(ref namePos);
            return(new Vector2D(nameLoc.x, nameLoc.y));
        }
コード例 #2
0
        /// <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.MD2System.Class_SetPointer(this.Name);
            try {
                R3DVector3D vector = VectorConverter.GetR3DVector3DFromVector3D(newRotation);
                Engine.MD2System.Model_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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: Model.cs プロジェクト: 628426/Strive.NET
        /// <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.MeshBuilder.Class_SetPointer(this.Name);

            try
            {
                R3DVector3D vector = VectorConverter.GetR3DVector3DFromVector3D(newPosition);
                Engine.MeshBuilder.Mesh_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);
        }
コード例 #6
0
ファイル: Camera.cs プロジェクト: 628426/Strive.NET
		/*
		public void SetHeading( Vector3D heading ) {
			setPointer;
			R3DPoint3D p;
			p.x = heading.X + _position.X;
			p.y = heading.Y + _position.Y;
			p.z = heading.Z + _position.Z;
			Engine.Cameras.Camera_LookAt( ref p );
		}
		*/
		#endregion

		#region "Methods"
		public Vector2D ProjectPoint( Vector3D point ) {
			R3DVector3D namePos = new R3DVector3D();
			namePos.x = point.X;
			namePos.y = point.Y;
			namePos.z = point.Z;
			R3DVector2D nameLoc = new R3DVector2D();
			nameLoc = Engine.Cameras.Camera_ProjectPoint( ref namePos );
			return new Vector2D( nameLoc.x, nameLoc.y );
		}