/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include "glmAbstractTargetProvider.h"

namespace glm
{
class Entity;

// Constant Target Provider
class GLM_SDK_API StaticArrayTargetProvider : public AbstractTargetProvider
{

  public:
    GLM_CLASS_STAT_ID( glm::MemoryStatIds::Simulation);

    typedef SmartPointer<StaticArrayTargetProvider> SP;

    StaticArrayTargetProvider(int64_t targetCount = 0, const Vector3* targets = NULL, const Quaternion* orientations = NULL);
    StaticArrayTargetProvider(const glm::Array<Vector3>& targets, const glm::Array<Quaternion>& orientations);
    virtual ~StaticArrayTargetProvider();

    virtual void computeTargets(int64_t index, BehaviorGraph& graph, const Vector3& entityPosition, glm::Array<TargetData>& outTargets, bool force = false) override;

    void setTarget(int64_t index, const Vector3& value, const Quaternion& orientation = Quaternion::getIdentity());

  private:
    /// constant target (can be updated by external)
    glm::Array<Vector3> _targets;
    glm::Array<Quaternion> _targetOrientations;
};

//-------------------------------------------------------------------------
inline void StaticArrayTargetProvider::setTarget(int64_t index, const Vector3& value, const Quaternion& orientation)
{
    _targets[index] = value;
    _targetOrientations[index] = orientation;
}
} // namespace glm
