Ejemplo n.º 1
0
        /// <summary>
        /// Rotates the given Position and Orientation around the Pivot Point, changing the Position and Orientation
        /// </summary>
        /// <param name="sRotationMatrix">The Rotation to apply to the object</param>
        /// <param name="sPivotPoint">The Point to rotate the object around</param>
        /// <param name="srPosition">The Position of the object (to be modified)</param>
        /// <param name="srOrientation">The Orientation of the object (to be modified)</param>
        public static void RotatePositionAndOrientation(Matrix sRotationMatrix, Vector3 sPivotPoint, ref Vector3 srPosition, ref Quaternion srOrientation)
        {
            // Rotate the Orientation about it's center to change its Orientation
            srOrientation = Orientation3D.Rotate(sRotationMatrix, srOrientation);

            // Rotate the Position around the specified Pivot Point
            srPosition = PivotPoint3D.RotatePosition(sRotationMatrix, sPivotPoint, srPosition);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Rotates the object around the Pivot Point, changing its Position, without
 /// changing its Orientation
 /// </summary>
 /// <param name="sRotationMatrix">The Rotation to apply to the object, rotating it
 /// around the Pivot Point</param>
 public void RotatePosition(Matrix sRotationMatrix)
 {
     // If the object should rotate around a point other than it's center
     if (PivotPoint != mcPositionData.Position)
     {
         // Rotate the Position around the Pivot Point
         mcPositionData.Position = PivotPoint3D.RotatePosition(sRotationMatrix, PivotPoint, mcPositionData.Position);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Copy the given PivotPoint3D object's data into this object's data
        /// </summary>
        /// <param name="cPivotPointToCopy">The PivotPoint3D object to copy from</param>
        public void CopyFrom(PivotPoint3D cPivotPointToCopy)
        {
            PivotPoint = cPivotPointToCopy.PivotPoint;
            PivotRotationalVelocity     = cPivotPointToCopy.PivotRotationalVelocity;
            PivotRotationalAcceleration = cPivotPointToCopy.PivotRotationalAcceleration;
            mbRotateOrientationToo      = cPivotPointToCopy.RotateOrientationToo;

            mcPositionData    = new Position3D(cPivotPointToCopy.PositionData);
            mcOrientationData = new Orientation3D(cPivotPointToCopy.OrientationData);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParticleEmitter"/> class.
        /// </summary>
        public ParticleEmitter()
        {
            // Initialize the Position, Orientation, and Pivot Point variables.
            _positionData    = new Position3DWithPreviousPosition();
            _orientationData = new Orientation3DWithPreviousOrientation();
            _pivotPointData  = new PivotPoint3D(_positionData, _orientationData);

            // Disable Lerping the Emitter on the first update, since the Previous Position and Orientation won't be set yet.
            LerpEmittersPositionAndOrientationOnNextUpdate = false;
            LerpEmittersPositionAndOrientation             = true;

            // Default any other properties.
            Enabled = true;
            EmitParticlesAutomatically = true;

            // Assign a unique ID to this emitter.
            ID = _particleEmitterCount++;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Copies the given Emitter's values into this instance.
        /// </summary>
        /// <param name="emitterToCopy">The emitter to copy from.</param>
        public void CopyFrom(ParticleEmitter emitterToCopy)
        {
            _positionData.CopyFrom(emitterToCopy._positionData);
            _orientationData.CopyFrom(emitterToCopy._orientationData);
            _pivotPointData = new PivotPoint3D(_positionData, _orientationData);

            Enabled = emitterToCopy.Enabled;
            EmitParticlesAutomatically = emitterToCopy.EmitParticlesAutomatically;

            _burstNumberOfParticles = emitterToCopy._burstNumberOfParticles;
            _burstTimeInSeconds     = emitterToCopy._burstTimeInSeconds;

            _particlesPerSecond = emitterToCopy._particlesPerSecond;
            _secondsPerParticle = emitterToCopy._secondsPerParticle;
            _timeElapsedSinceGeneratingLastParticle = emitterToCopy._timeElapsedSinceGeneratingLastParticle;

            BurstComplete = emitterToCopy.BurstComplete;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Copy Constructor
 /// </summary>
 /// <param name="cPivotPointToCopy">The PivotPoint3D object to copy</param>
 public PivotPoint3D(PivotPoint3D cPivotPointToCopy)
 {
     CopyFrom(cPivotPointToCopy);
 }