/****************************************************************************
 * Copyright (c) 2024 MAK Technologies, Inc.
 * All rights reserved.
 ****************************************************************************/

/*********************************************************************/
/**
 *t  diguyLinkController
 **
 *b    Link against: libdiguy
 */

#pragma once

#ifdef SWIG
%module diguyLinkController
#else
#define CPLUSPLUS_ONLY
#endif

#ifdef CPLUSPLUS_ONLY
#include <diguy_constants.h>

class bdiLink;
class bdiLinkController;
class diguyCharacter;
class diguyLinkController;
class diguyGraphicsShape;
class diguyGraphicsShaderInstance;

#endif

#include <declspec_diguy.h>

//------------------------------------------------------------------------------
/*!
 ** \brief A class that allows end users to override a character's animation on a joint level.
 ** this class complements the diguyPoseOverride system with one that is a bit more scriptable
 ** and can handle automatic animation effects.
 **
 ** \ingroup diguyCore
 */

class BDI_DECLSPEC_diguy diguyLinkController
{

public:

/*****************************************************************************/
/**
 *2  Accessor Functions
 **
 **    The functions in this section provide access to data in this object.
 **    They are designed to be called by DI-Guy programmers.
 **
 **   Unless otherwise noted all functions in this class section are callable from:
 **
 *-    - C++
 *-    - Script
 */

   /*l
    *b  Description:
    **
    **    Returns the name of the link.  This pointer will never be NULL.
    **
    *b  Returns:
    **
    **    name of the link that this controller modifies
    */
   const char* get_name();

   //! sets the desired translation of the joint with an interpolation time, by default this will be in the space of the
   //! parent joint and absolute.
   int set_translation_override(float x, float y, float z, float ramp_time = .25f);

   //! sets the desired translation of the joint with a velocity, this will continue moving till stopped
   int set_translation_override(float x, float y, float z, float vx, float vy, float vz, float ramp_time = .25f);

   //! gives the joint a velocity, this will continue moving till stopped
   int set_translation_velocity(float vx, float vy, float vz, float ramp_time = .25f);

   //! ends the desired translation of the joint, this will fade out the change
   int end_translation_override(float ramp_time = .25f);

   //! should the translation add to the incoming translation value or replace, defaults to 0 - replace
   int set_translation_additive(int additive);

   //! should the translation be applied post the joints rotation ie in the local space of this joint
   //! defaults to 0 - parent joint space
   int set_translation_post_rotation(int post_rotation);

   //! sets an amount of time to take to restore to the original untweeked value once the desired translation
   //! is achieved
   int set_translation_restore_time(float snap_back_time);

   //! sets the desired rotation of the joint with an interpolation time, by default this will be in the space of the
   //! parent joint and absolute.
   int set_rotation_override(float rz, float rx, float ry, float ramp_time = .25f);

   //! sets the desired rotation of the joint with a velocity, this will continue moving till stopped
   int set_rotation_override(float rz, float rx, float ry, float vrz, float vrx, float vry, float ramp_time = .25f);

   //! gives the joint a rotational velocity, this will continue moving till stopped
   int set_rotation_velocity(float vrz, float vrx, float vry, float ramp_time = .25f);

   //! ends the desired rotation of the joint, this will fade out the change
   int end_rotation_override(float ramp_time = .25f);

   //! should the rotation add to the incoming rotation value or replace, defaults to 0 - replace
   int set_rotation_additive(int additive);

   //! sets an amount of time to take to restore to the original untweeked value once the desired rotation
   //! is achieved
   int set_rotation_restore_time(float time);


/**
 *x  The functions and variables past this point are for internal use only.
 **   No external access to them is expected or necessary.
 */
#ifdef CPLUSPLUS_ONLY

   bdiLinkController* get_scripted_object() {return m_scripted_object;}

protected:

   /*l
    **    A protected constructor.  Constructors are called automatically
    **    by DI-Guy.
    */
   diguyLinkController(bdiLinkController* internal_data);

   /*l
    **    A protected destructor.  Destructors are called automatically
    **    by DI-Guy.
    */
   virtual ~diguyLinkController();

private:

   /*l
    **    A pointer to internal data.
    */
   bdiLinkController* m_scripted_object;

   friend class bdiLink;
   friend class bdiLinkController;

#endif

};
