//BSD License  
//DXGfx® - http://www.eteractions.com
//Copyright (c) 2005
//by Guillaume Randon
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software
//and associated documentation files (the "Software"), to deal in the Software without restriction,
//including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
//and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
//subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all copies or substantial
//portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
//INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
//AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
//DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX;

namespace DXGfxLib
{
    /// <summary>
    /// This interface can be implemented by each class that is going to impose a constraint on a node position.
    /// At the moment this interface is implemented by the scene itself. Each scene node has a unique field to keep
    /// a reference to an instance of an object implementing this. If it is desired to add other objects that implement
    /// that interface and to actually use them you will most probably need to derive your own class from Scene or
    /// OutDoorScene and managed the calls yourself.
    /// </summary>
    public interface IPositionConstraint
    {
        /// <summary>
        /// An implementation of this method should move the scene node if it is in an incorrect location or has an
        /// incorrect orientation (incorrect from the perspective of the class implementing this interface).
        /// </summary>
        /// <param name="node">the node to be repositioned or reoriented if needed.</param>
        void ValidateOrMove(ref SceneNode node);

        /// <summary>
        /// This is a variation of validateOrMove, it will return a transformation matrix which relocate
        /// the aabox to an acceptable position!
        /// </summary>
        /// <param name="position">desired position for our object.</param>
        /// <param name="localBBox">a local bounding bow emcompassing the geometry for which we want
        /// to check if a new position is acceptable or relocate it!</param>
        /// <returns></returns>
        Matrix ValidateOrMove(Vector3 position, BBox localBBox);

        /// <summary>
        /// Same as above but for a camera. Constraint for a camera might be different than for another scene node.
        /// </summary>
        /// <param name="camera"></param>
        /// <param name="subject"></param>
        void ValidateCameraOrMove(ref SceneNode camera, ref SceneNode subject);
    }
}
