2185 lines
76 KiB
C
2185 lines
76 KiB
C
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
#define D_CineInfo_StructureDefine
|
|
|
|
#include "AIUseCPA.h"
|
|
#include "specif/AIOption.h"
|
|
#include "AIMacros.h"
|
|
#include "AI_Erm.h"
|
|
#include "Intell.h"
|
|
#include "StrIntel.h"
|
|
#include "AI_Struc.h"
|
|
#include "EnumProc.h"
|
|
#include "Convert.h"
|
|
#include "ActConst.h"
|
|
#include "specif/AITools.h"
|
|
#include "Operator.h"
|
|
|
|
#include "CAM_Base.h"
|
|
#include "CAM_Tool.h"
|
|
#include "CAM_Vis.h"
|
|
|
|
#define _WP_D_DEFINE_WAYPOINTS_
|
|
#include "WP_Handl.h"
|
|
/* in order to compile AI in C++ and link with GAM in C*/
|
|
#include "WP_Func.h"
|
|
#undef _WP_D_DEFINE_WAYPOINTS_
|
|
|
|
|
|
|
|
#define _WP_D_WPGRAPH_FRIEND_
|
|
#include "WPgraphe.h"
|
|
#undef _WP_D_WPGRAPH_FRIEND_
|
|
|
|
#include "WPWayPt.h"
|
|
#define _WP_D_WPARC_FREIND_
|
|
#include "WParc.h"
|
|
#undef _WP_D_WPARC_FREIND_
|
|
|
|
/*#ifdef ACTIVE_EDITOR*/
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/*#endif*/
|
|
|
|
HIE_tdxHandleToSuperObject g_hOldTargetedPerso = NULL;
|
|
|
|
/*#ifdef ACTIVE_EDITOR*/
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
/*#endif*/
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
* MAIN UPDATE POSITION CAMERA FUNCTION
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Main function to update position of camera.
|
|
* general function, no parameters
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stUpdatePosition(HIE_tdxHandleToSuperObject _hSuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
CAM_tdstUpdateCamera stStruct;
|
|
MS_tdxHandleToDynam h_Dynam;
|
|
DNM_tdstDynamics *p_stDynamics;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(_hSuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/*
|
|
* Init camera stucture.
|
|
*/
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(hCineinfo);
|
|
CAM_fn_vInitCameraStructure(_hSuperObjPerso,&stStruct);
|
|
|
|
if ((g_hOldTargetedPerso) && (g_hOldTargetedPerso != hCineinfo->hWork->hSuperObjectTargeted))
|
|
CAM_fn_vUpdateTargetPosition(hCineinfo);
|
|
|
|
/*
|
|
* Update speed of targeted actor
|
|
*/
|
|
MEC_fn_vUpdateSpeed (stStruct.hCineinfoWork->hSuperObjectTargeted);
|
|
|
|
|
|
/*
|
|
* Update Target position
|
|
*/
|
|
if( ((h_Dynam = M_GetMSHandle(stStruct.hCineinfoWork->hSuperObjectTargeted, Dynam)) == NULL) ||
|
|
((p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam)) == NULL) )
|
|
{
|
|
return(p_stTree);
|
|
}
|
|
/* ANNECY MT - 13/07/99 { */
|
|
else if (!hCineinfo->bCanDoBestPos && DNM_M_bDynamicsIsActorMove(p_stDynamics))
|
|
{
|
|
hCineinfo->bCanDoBestPos = TRUE;
|
|
}
|
|
/* END ANNECY MT } */
|
|
|
|
/* if(DNM_M_eReportGetDynamicalState(DNM_M_p_stDynamicsGetReport(p_stDynamics)) != DNM_NoMove)*/
|
|
if (!MTH3D_M_bIsNullVector(MTH_M_p_stMoveGetLinear(DNM_M_p_stReportGetAbsoluteCurrPosition(DNM_M_p_stDynamicsGetReport(p_stDynamics)))))
|
|
{
|
|
CAM_fn_vRemindSpeed(hCineinfo,DNM_M_p_stReportGetAbsoluteCurrSpeed(DNM_M_p_stDynamicsGetReport(p_stDynamics)));
|
|
CAM_fn_vRemindPos(stStruct.hCineinfo,DNM_M_p_stReportGetAbsoluteCurrPosition(DNM_M_p_stDynamicsGetReport(p_stDynamics)));
|
|
CAM_fn_vRemindTime(stStruct.hCineinfo,M_xGetUsefulDeltaTimeInSeconds(g_stEngineStructure.stEngineTimer));
|
|
}
|
|
|
|
/*
|
|
* Compute camera position.
|
|
*/
|
|
CAM_fn_vUpdateGeneralCamera(&stStruct);
|
|
|
|
/*
|
|
* Fill MACDPID structure
|
|
*/
|
|
CAM_fn_vSendParametersToParsing(&stStruct);
|
|
|
|
/*
|
|
* Request meca.
|
|
*/
|
|
/* fn_vBoolAddRequestWithDynam(_hSuperObjPerso,h_Dynam, LRM_eRequest_ActionOnCamera);*/
|
|
|
|
g_hOldTargetedPerso = hCineinfo->hWork->hSuperObjectTargeted;
|
|
/*
|
|
* Reset temporary flags.
|
|
*/
|
|
hCineinfo->ucVolIAFlags = 0;
|
|
|
|
/* fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP);*/
|
|
return (p_stTree);
|
|
}
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Change a real parameter in cineinfo.
|
|
* _lTypeOfChange : 1 - Temporary (change in work)
|
|
* 0 - Permanent (in current, visibility and work if already copied)
|
|
* _lChangingMode : -1 - Value = init
|
|
* 0 - Value = current value (current or work if already copied) + add
|
|
* 1 - Value = passed value
|
|
*=================================================================================================
|
|
*/
|
|
void CAM_fn_vChangeARealParameter
|
|
(
|
|
MS_tdxHandleToCineinfo _hCineInfo,
|
|
MTH_tdxReal *_p_xInitialValue,
|
|
MTH_tdxReal *_p_xCurrentValue,
|
|
MTH_tdxReal *_p_xVisibilityValue,
|
|
MTH_tdxReal *_p_xWorkValue,
|
|
long _lTypeOfChange,
|
|
long _lChangingMode,
|
|
MTH_tdxReal _xValue
|
|
)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MTH_tdxReal xActualValue = MTH_C_ZERO;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
if (_lTypeOfChange == 1)
|
|
{
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(_hCineInfo);
|
|
_p_xCurrentValue = _p_xWorkValue;
|
|
}
|
|
|
|
switch(_lChangingMode)
|
|
{
|
|
case -1:
|
|
xActualValue = *_p_xInitialValue;
|
|
break;
|
|
case 0:
|
|
if (_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
|
|
xActualValue = MTH_M_xAdd(*_p_xWorkValue, _xValue);
|
|
else
|
|
xActualValue = MTH_M_xAdd(*_p_xCurrentValue, _xValue);
|
|
break;
|
|
case 1:
|
|
xActualValue = _xValue;
|
|
break;
|
|
}
|
|
|
|
*_p_xCurrentValue = xActualValue;
|
|
|
|
if (_lTypeOfChange != 1)
|
|
{
|
|
*_p_xVisibilityValue = xActualValue;
|
|
*_p_xWorkValue = xActualValue;
|
|
}
|
|
}
|
|
|
|
/*
|
|
*================================================================================================
|
|
* Activate or desactivate a camera.
|
|
*=================================================================================================
|
|
*/
|
|
void CAM_fn_vActivateCamera
|
|
(
|
|
MS_tdxHandleToCineinfo _hCineInfo,
|
|
long _lTypeOfChange,
|
|
ACP_tdxBool _bActive
|
|
)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToInternalCineinfo hCineInfoCurrent;
|
|
MS_tdxHandleToInternalCineinfo hCineInfoTest;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
if (_lTypeOfChange == 1)
|
|
{
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(_hCineInfo);
|
|
hCineInfoCurrent = _hCineInfo->hWork;
|
|
hCineInfoTest = hCineInfoCurrent;
|
|
}
|
|
else
|
|
{
|
|
hCineInfoCurrent = _hCineInfo->hCurrent;
|
|
if(_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
|
|
hCineInfoTest = _hCineInfo->hWork;
|
|
else
|
|
hCineInfoTest = hCineInfoCurrent;
|
|
}
|
|
|
|
/*
|
|
* We want to active/desactive a camera that is already activated/desactivated.
|
|
*/
|
|
if (hCineInfoTest->bIsActive == _bActive)
|
|
return;
|
|
|
|
/*
|
|
* If we activate a camera, we init it.
|
|
*/
|
|
/* if(_bActive)*/
|
|
/* CAM_fn_vInitCompleteCineinfo(_hCineInfo);*/
|
|
|
|
/*
|
|
* Init the activation flag.
|
|
*/
|
|
hCineInfoCurrent->bIsActive = _bActive;
|
|
if(_bActive == FALSE)
|
|
hCineInfoCurrent->eTypeOfViewport = CAM_e_NoViewport;
|
|
|
|
if (_lTypeOfChange != 1)
|
|
{
|
|
if(_bActive == FALSE)
|
|
{
|
|
_hCineInfo->hVisibility->eTypeOfViewport = CAM_e_NoViewport;
|
|
_hCineInfo->hWork->eTypeOfViewport = CAM_e_NoViewport;
|
|
}
|
|
_hCineInfo->hVisibility->bIsActive = _bActive;
|
|
_hCineInfo->hWork->bIsActive = _bActive;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
Procedures
|
|
Change Parameters in camera's structure
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Change a vector parameter in cineinfo.
|
|
* _lTypeOfChange : 1 - Temporary (change in work)
|
|
* 0 - Permanent (in current, visibility and work if already copied)
|
|
* _lChangingMode : -1 - Value = init
|
|
* 0 - Value = current value (current or work if already copied) + add
|
|
* 1 - Value = passed value
|
|
*=================================================================================================
|
|
*/
|
|
void CAM_fn_vChangeAVectorParameter
|
|
(
|
|
MS_tdxHandleToCineinfo _hCineInfo,
|
|
MTH3D_tdstVector *_p_stInitialValue,
|
|
MTH3D_tdstVector *_p_stCurrentValue,
|
|
MTH3D_tdstVector *_p_stVisibilityValue,
|
|
MTH3D_tdstVector *_p_stWorkValue,
|
|
long _lTypeOfChange,
|
|
long _lChangingMode,
|
|
MTH3D_tdstVector *_p_stValue
|
|
)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MTH3D_tdstVector stActualValue;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
MTH3D_M_vNullVector(&stActualValue);
|
|
|
|
if (_lTypeOfChange == 1)
|
|
{
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(_hCineInfo);
|
|
_p_stCurrentValue = _p_stWorkValue;
|
|
}
|
|
|
|
switch(_lChangingMode)
|
|
{
|
|
case -1:
|
|
MTH3D_M_vCopyVector(&stActualValue, _p_stInitialValue);
|
|
break;
|
|
case 0:
|
|
if (_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
|
|
{
|
|
MTH3D_M_vAddVector(&stActualValue, _p_stWorkValue, _p_stValue);
|
|
}
|
|
else
|
|
{
|
|
MTH3D_M_vAddVector(&stActualValue, _p_stCurrentValue, _p_stValue);
|
|
}
|
|
break;
|
|
case 1:
|
|
MTH3D_M_vCopyVector(&stActualValue, _p_stValue);
|
|
break;
|
|
}
|
|
|
|
MTH3D_M_vCopyVector(_p_stCurrentValue, &stActualValue);
|
|
|
|
if (_lTypeOfChange != 1)
|
|
{
|
|
MTH3D_M_vCopyVector(_p_stVisibilityValue, &stActualValue);
|
|
MTH3D_M_vCopyVector(_p_stWorkValue, &stActualValue);
|
|
}
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to change a vector parameter
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (-1 restore, 0 set, 1 add)
|
|
* Vector -> value to set or to add to current value
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stChangeVectorParameter(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
long lChangingMode;
|
|
long lTypeOfChange;
|
|
tdstGetSetParam stValue;
|
|
MTH3D_tdstVector *p_stValue;
|
|
MTH3D_tdstVector *p_stInitialValue;
|
|
MTH3D_tdstVector *p_stCurrentValue;
|
|
MTH3D_tdstVector *p_stVisibilityValue;
|
|
MTH3D_tdstVector *p_stWorkValue;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
p_stValue = &M_GetSetParam_stVertexValue(&stValue);
|
|
|
|
switch(eProcedureId)
|
|
{
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeShiftTarget :
|
|
p_stInitialValue = &(hCineInfo->hInit->stShiftTarget);
|
|
p_stCurrentValue = &(hCineInfo->hCurrent->stShiftTarget);
|
|
p_stVisibilityValue = &(hCineInfo->hVisibility->stShiftTarget);
|
|
p_stWorkValue = &(hCineInfo->hWork->stShiftTarget);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeShiftPos :
|
|
p_stInitialValue = &(hCineInfo->hInit->stShiftPos);
|
|
p_stCurrentValue = &(hCineInfo->hCurrent->stShiftPos);
|
|
p_stVisibilityValue = &(hCineInfo->hVisibility->stShiftPos);
|
|
p_stWorkValue = &(hCineInfo->hWork->stShiftPos);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
default :
|
|
return (p_stTree);
|
|
|
|
}
|
|
|
|
CAM_fn_vChangeAVectorParameter
|
|
(
|
|
hCineInfo,
|
|
p_stInitialValue,
|
|
p_stCurrentValue,
|
|
p_stVisibilityValue,
|
|
p_stWorkValue,
|
|
lTypeOfChange,
|
|
lChangingMode,
|
|
p_stValue
|
|
);
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to change a real parameter
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (-1 restore, 0 set, 1 add)
|
|
* Real -> value to set or to add to current value
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stChangeRealParameter(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
MTH_tdxReal xValue;
|
|
long lChangingMode;
|
|
long lTypeOfChange; /* permanent or not */
|
|
tdstGetSetParam stValue;
|
|
MTH_tdxReal *p_xInitialValue=NULL;
|
|
MTH_tdxReal *p_xCurrentValue=NULL;
|
|
MTH_tdxReal *p_xVisibilityValue=NULL;
|
|
MTH_tdxReal *p_xWorkValue=NULL;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
xValue = M_GetSetParam_xValue(&stValue);
|
|
|
|
switch(eProcedureId)
|
|
{
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeDistMin :
|
|
p_xInitialValue = &(hCineInfo->hInit->xDistMin);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xDistMin);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xDistMin);
|
|
p_xWorkValue = &(hCineInfo->hWork->xDistMin);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeDistMax :
|
|
p_xInitialValue = &(hCineInfo->hInit->xDistMax);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xDistMax);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xDistMax);
|
|
p_xWorkValue = &(hCineInfo->hWork->xDistMax);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeBoundDistMin :
|
|
p_xInitialValue = &(hCineInfo->hInit->xBoundDistMin);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xBoundDistMin);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xBoundDistMin);
|
|
p_xWorkValue = &(hCineInfo->hWork->xBoundDistMin);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eProc_Cam_ChangeBoundDistMax :
|
|
p_xInitialValue = &(hCineInfo->hInit->xBoundDistMax);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xBoundDistMax);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xBoundDistMax);
|
|
p_xWorkValue = &(hCineInfo->hWork->xBoundDistMax);
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngleAlpha :
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngleAlpha);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleAlpha);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngleAlpha);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngleAlpha);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngleShiftAlpha :
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngleShiftAlpha);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleShiftAlpha);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngleShiftAlpha);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngleShiftAlpha);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngleTheta :
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngleTheta);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleTheta);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngleTheta);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngleTheta);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngleShiftTheta :
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngleShiftTheta);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleShiftTheta);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngleShiftTheta);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngleShiftTheta);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeLinearSpeed:
|
|
p_xInitialValue = &(hCineInfo->hInit->xLinearSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xLinearSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xLinearSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeLinearIncreaseSpeed :
|
|
p_xInitialValue = &(hCineInfo->hInit->xLinearIncreaseSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearIncreaseSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xLinearIncreaseSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xLinearIncreaseSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeLinearDecreaseSpeed :
|
|
p_xInitialValue = &(hCineInfo->hInit->xLinearDecreaseSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearDecreaseSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xLinearDecreaseSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xLinearDecreaseSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngularSpeed:
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngularSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngularSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngularSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngularIncreaseSpeed :
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngularIncreaseSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularIncreaseSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngularIncreaseSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngularIncreaseSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeAngularDecreaseSpeed :
|
|
p_xInitialValue = &(hCineInfo->hInit->xAngularDecreaseSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularDecreaseSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xAngularDecreaseSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xAngularDecreaseSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeTargetSpeed:
|
|
p_xInitialValue = &(hCineInfo->hInit->xTargetSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xTargetSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xTargetSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeTargetIncreaseSpeed :
|
|
p_xInitialValue = &(hCineInfo->hInit->xTargetIncreaseSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetIncreaseSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xTargetIncreaseSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xTargetIncreaseSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeTargetDecreaseSpeed :
|
|
p_xInitialValue = &(hCineInfo->hInit->xTargetDecreaseSpeed);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetDecreaseSpeed);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xTargetDecreaseSpeed);
|
|
p_xWorkValue = &(hCineInfo->hWork->xTargetDecreaseSpeed);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeFocal :
|
|
p_xInitialValue = &(hCineInfo->hInit->xFocal);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xFocal);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xFocal);
|
|
p_xWorkValue = &(hCineInfo->hWork->xFocal);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeZMin :
|
|
p_xInitialValue = &(hCineInfo->hInit->xZMin);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xZMin);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xZMin);
|
|
p_xWorkValue = &(hCineInfo->hWork->xZMin);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ChangeZMax :
|
|
p_xInitialValue = &(hCineInfo->hInit->xZMax);
|
|
p_xCurrentValue = &(hCineInfo->hCurrent->xZMax);
|
|
p_xVisibilityValue = &(hCineInfo->hVisibility->xZMax);
|
|
p_xWorkValue = &(hCineInfo->hWork->xZMax);
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
default :
|
|
break;
|
|
}
|
|
|
|
CAM_fn_vChangeARealParameter
|
|
(
|
|
hCineInfo,
|
|
p_xInitialValue,
|
|
p_xCurrentValue,
|
|
p_xVisibilityValue,
|
|
p_xWorkValue,
|
|
lTypeOfChange,
|
|
lChangingMode,
|
|
xValue
|
|
);
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to change Super Object Targeted
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (-1 restore initial, 0 reset, 1 set)
|
|
* Perso -> New Super object targeted
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stChangeTgtPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
MS_tdxHandleToInternalCineinfo hCineInfoCurrent;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
HIE_tdxHandleToSuperObject hNewSuperObjectTargeted;
|
|
HIE_tdxHandleToSuperObject hOldSuperObjectTargeted;
|
|
long lChangingMode;
|
|
long lTypeOfChange;
|
|
tdstGetSetParam stValue;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
/* MS_tdxHandleToDynam h_Dynam;*/
|
|
/* DNM_tdstDynamics *p_stDynamics;*/
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
hNewSuperObjectTargeted = (HIE_tdxHandleToSuperObject) M_GetSetParam_p_stSupObjValue(&stValue);
|
|
|
|
if (lTypeOfChange == 1)
|
|
{
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(hCineInfo);
|
|
hCineInfoCurrent = hCineInfo->hWork;
|
|
}
|
|
else
|
|
{
|
|
hCineInfoCurrent = hCineInfo->hCurrent;
|
|
}
|
|
|
|
switch(lChangingMode)
|
|
{
|
|
case -1:
|
|
hNewSuperObjectTargeted = hCineInfo->hInit->hSuperObjectTargeted;
|
|
break;
|
|
case 0:
|
|
hNewSuperObjectTargeted = NULL;
|
|
break;
|
|
case 1:
|
|
break;
|
|
}
|
|
|
|
hOldSuperObjectTargeted = hCineInfoCurrent->hSuperObjectTargeted;
|
|
hCineInfoCurrent->hSuperObjectTargeted = hNewSuperObjectTargeted;
|
|
|
|
if (lTypeOfChange != 1)
|
|
{
|
|
hCineInfo->hVisibility->hSuperObjectTargeted = hNewSuperObjectTargeted;
|
|
hCineInfo->hWork->hSuperObjectTargeted = hNewSuperObjectTargeted;
|
|
}
|
|
|
|
if ((g_hOldTargetedPerso) && (g_hOldTargetedPerso != hNewSuperObjectTargeted))
|
|
CAM_fn_vUpdateTargetPosition(hCineInfo);
|
|
|
|
/* END ANNECY MT }*/
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to set parameters for apex camera
|
|
*
|
|
* Parameters
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (-1 restore initial, 0 reset, 1 set)
|
|
* Perso -> New Super object targeted
|
|
* Real -> Ratio
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stChangeSecondTgtPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
MS_tdxHandleToInternalCineinfo hCineInfoCurrent;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
HIE_tdxHandleToSuperObject hNewSuperObjectTargeted;
|
|
MTH_tdxReal xRatio;
|
|
long lChangingMode;
|
|
long lTypeOfChange;
|
|
tdstGetSetParam stValue;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
hNewSuperObjectTargeted = (HIE_tdxHandleToSuperObject) M_GetSetParam_p_stSupObjValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
xRatio = M_GetSetParam_xValue(&stValue);
|
|
|
|
/* Be sure that we are not in computed mode anymore */
|
|
if(hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
|
|
{
|
|
CAM_fn_vSetCineinfoCurrentFromVisibility(hCineInfo);
|
|
if(hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
|
|
CAM_fn_vSetCineinfoWorkFromVisibility(hCineInfo);
|
|
}
|
|
|
|
if (lTypeOfChange == 1)
|
|
{
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(hCineInfo);
|
|
hCineInfoCurrent = hCineInfo->hWork;
|
|
}
|
|
else
|
|
{
|
|
hCineInfoCurrent = hCineInfo->hCurrent;
|
|
}
|
|
|
|
switch(lChangingMode)
|
|
{
|
|
case -1:
|
|
hNewSuperObjectTargeted = hCineInfo->hInit->hSuperObjectTargeted;
|
|
break;
|
|
case 0:
|
|
hNewSuperObjectTargeted = NULL;
|
|
break;
|
|
case 1:
|
|
break;
|
|
}
|
|
|
|
hCineInfoCurrent->hSecondSuperObjectTargeted = hNewSuperObjectTargeted;
|
|
|
|
if (lTypeOfChange != 1)
|
|
{
|
|
hCineInfo->hVisibility->hSecondSuperObjectTargeted = hNewSuperObjectTargeted;
|
|
hCineInfo->hWork->hSecondSuperObjectTargeted = hNewSuperObjectTargeted;
|
|
}
|
|
|
|
hCineInfo->xApexRatio = xRatio;
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to change the Channel
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (-1 init, 0 reset, 1 set)
|
|
* Channel -> channel number
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
|
|
tdstNodeInterpret *CAM_fn_p_stChangeChannel(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
MS_tdxHandleToInternalCineinfo hCineInfoCurrent;
|
|
long lChangingMode;
|
|
long lTypeOfChange;
|
|
char cChannelNumber;
|
|
tdstGetSetParam stValue;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
cChannelNumber = (char) M_GetSetParam_lModuleValue(&stValue);
|
|
|
|
if (lTypeOfChange == 1)
|
|
{
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(hCineInfo);
|
|
hCineInfoCurrent = hCineInfo->hWork;
|
|
}
|
|
else
|
|
{
|
|
hCineInfoCurrent = hCineInfo->hCurrent;
|
|
}
|
|
|
|
switch(lChangingMode)
|
|
{
|
|
case -1:
|
|
cChannelNumber = hCineInfo->hInit->cChannel;
|
|
break;
|
|
case 0 :
|
|
cChannelNumber = -1;
|
|
break;
|
|
case 1 :
|
|
break;
|
|
}
|
|
|
|
hCineInfoCurrent->cChannel = cChannelNumber;
|
|
|
|
if (lTypeOfChange != 1)
|
|
{
|
|
hCineInfo->hVisibility->cChannel = cChannelNumber;
|
|
hCineInfo->hWork->cChannel = cChannelNumber;
|
|
}
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to set active a camera .
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> 0 : Desactive
|
|
* 1 : Active
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
|
|
tdstNodeInterpret *CAM_fn_p_stActivate(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
tdstGetSetParam stValue;
|
|
ACP_tdxBool bActive;
|
|
long lTypeOfChange;
|
|
long lValue;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId), p_SuperObjPerso, &hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lValue = M_GetSetParam_lValue(&stValue);
|
|
if(lValue == 0)
|
|
bActive = FALSE;
|
|
else
|
|
bActive = TRUE;
|
|
|
|
CAM_fn_vActivateCamera(hCineInfo, lTypeOfChange, bActive);
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to change the camera assigned to a viewport .
|
|
*
|
|
* First parameter (CONSTANT):
|
|
* 1 -> Main Viewport
|
|
* 2 -> Secondary Viewport
|
|
* Second Parameter (CONSTANT):
|
|
* 0 -> Not Desactived the old camera
|
|
* 1 -> Deactived the old camera
|
|
* Fourth Parameter (PERSO):
|
|
* Handle of the new camera
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
|
|
tdstNodeInterpret *CAM_fn_p_stAssociateViewport(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hNewCineInfo = NULL;
|
|
MS_tdxHandleToCineinfo hOldCineInfo = NULL;
|
|
HIE_tdxHandleToSuperObject hNewCamera;
|
|
HIE_tdxHandleToSuperObject hOldCamera;
|
|
long lViewport;
|
|
long lDeactived;
|
|
tdstGetSetParam stValue;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/* Get the viewport */
|
|
M_EvalNextParameter(&stValue);
|
|
lViewport = M_GetSetParam_lValue(&stValue);
|
|
|
|
/* Get the flag of deactivation */
|
|
M_EvalNextParameter(&stValue);
|
|
lDeactived = M_GetSetParam_lValue(&stValue);
|
|
|
|
/* Get the handle of the new camera */
|
|
M_EvalNextParameter(&stValue);
|
|
hNewCamera = (HIE_tdxHandleToSuperObject)M_GetSetParam_p_stSupObjValue(&stValue);;
|
|
|
|
/* Get the handle of the old camera */
|
|
hOldCamera = CAM_fn_hGetActiveCamera(lViewport);
|
|
|
|
/*
|
|
* Check for parameters.
|
|
*/
|
|
if (hNewCamera == hOldCamera)
|
|
return (p_stTree);
|
|
if ((lViewport > CAM_Nb_Viewport) || (lViewport == CAM_e_NoViewport))
|
|
return (p_stTree);
|
|
|
|
/*
|
|
* Get cineinfo of new camera.
|
|
*/
|
|
if (hNewCamera != NULL)
|
|
hNewCineInfo = M_GetMSHandle(hNewCamera, Cineinfo);
|
|
/*
|
|
* Viewport haven't yet a camera
|
|
*/
|
|
if (hOldCamera != NULL)
|
|
hOldCineInfo = M_GetMSHandle(hOldCamera, Cineinfo);
|
|
|
|
#if defined(__DEBUG_AI__)
|
|
if ((hNewCineInfo == NULL) && (hNewCamera != NULL))
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
if (hNewCamera != NULL)
|
|
{
|
|
/*
|
|
* Activate the new camera and assign the new camera to the wanted viewport.
|
|
*---------------------------------------------------------------------------
|
|
*/
|
|
CAM_fn_vActivateCamera(hNewCineInfo, 0, TRUE);
|
|
|
|
hNewCineInfo->hWork->eTypeOfViewport = (enum e_ucListViewport_) lViewport;
|
|
CAM_fn_vAssignCameraToAViewport(lViewport, hNewCamera);
|
|
hNewCineInfo->hCurrent->eTypeOfViewport = (enum e_ucListViewport_) lViewport;
|
|
hNewCineInfo->hVisibility->eTypeOfViewport = (enum e_ucListViewport_) lViewport;
|
|
|
|
/* Micro */
|
|
GAM_fn_vChangeCharacterForMicro(hNewCamera);
|
|
}
|
|
|
|
/*
|
|
* Desactivate the old camera if necessary.
|
|
*------------------------------------------
|
|
*/
|
|
if
|
|
(
|
|
(hOldCamera != NULL)
|
|
&& (g_stEngineStructure.h_StdCamCaracter != hOldCamera) /* the standard camera should not be deactivated*/
|
|
)
|
|
{
|
|
if (lDeactived == 1)
|
|
CAM_fn_vActivateCamera(hOldCineInfo, 0, FALSE);
|
|
|
|
hOldCineInfo->hCurrent->eTypeOfViewport = CAM_e_NoViewport;
|
|
hOldCineInfo->hVisibility->eTypeOfViewport = CAM_e_NoViewport;
|
|
hOldCineInfo->hWork->eTypeOfViewport = CAM_e_NoViewport;
|
|
}
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to set IA Flags
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (1 : set, 0 reset, -1 : reinit)
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stSetIAFlags(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
long lChangingMode;
|
|
long lTypeOfChange; /* permanent or not */
|
|
tdstGetSetParam stValue;
|
|
unsigned short uwFlag = 0;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
switch (eProcedureId)
|
|
{
|
|
/*---------------------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eProc_Cam_ResetIAFlags :
|
|
uwFlag = hCineInfo->hInit->uwIAFlags;
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoDynamicTarget :
|
|
uwFlag = C_IAFlags_NoDynamicTarget;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if (hCineInfo->hInit->uwIAFlags & C_IAFlags_NoDynamicTarget)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoAverageMoveTgtPerso:
|
|
uwFlag = C_IAFlags_NoAverageMoveTgtPerso;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwIAFlags & C_IAFlags_NoAverageMoveTgtPerso)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoParseCutAngle :
|
|
uwFlag = C_IAFlags_NoParseCutAngle;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if (hCineInfo->hInit->uwIAFlags & C_IAFlags_NoParseCutAngle)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoVisibility :
|
|
uwFlag = C_IAFlags_NoVisibility;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwIAFlags & C_IAFlags_NoVisibility)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eProc_Cam_SetFlagNoVisibilityWithDynHie :
|
|
uwFlag = C_IAFlags_NoVisibilityWithDynHie;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwIAFlags & C_IAFlags_NoVisibilityWithDynHie)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoDynChangeTheta :
|
|
uwFlag = C_IAFlags_NoDynChangeTheta;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwIAFlags & C_IAFlags_NoDynChangeTheta)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eProc_Cam_SetFlagNoShiftUntilPosReached:
|
|
uwFlag = C_IAFlags_NoShiftUntilPosReached;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwIAFlags & C_IAFlags_NoShiftUntilPosReached)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoDynSpeed:
|
|
uwFlag = C_IAFlags_NoDynSpeed;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwIAFlags & C_IAFlags_NoDynSpeed)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
default :
|
|
break;
|
|
}
|
|
|
|
CAM_fn_vSetResetInternalFlag
|
|
(
|
|
hCineInfo,
|
|
&(hCineInfo->hCurrent->uwIAFlags),
|
|
&(hCineInfo->hVisibility->uwIAFlags),
|
|
&(hCineInfo->hWork->uwIAFlags),
|
|
lTypeOfChange,
|
|
lChangingMode,
|
|
uwFlag
|
|
);
|
|
|
|
return (p_stTree);
|
|
}
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to set DNM Flags
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (1 : set, 0 reset)
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stSetDNMFlags(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
long lChangingMode;
|
|
long lTypeOfChange; /* permanent or not */
|
|
tdstGetSetParam stValue;
|
|
unsigned short uwFlag = 0;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
switch (eProcedureId)
|
|
{
|
|
/*---------------------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eProc_Cam_ResetDNMFlags :
|
|
uwFlag = hCineInfo->hInit->uwDNMFlags;
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoLinearParsing :
|
|
uwFlag = DNM_CAM_C_NoLinearParsing;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoLinearParsing)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoLinearInertia :
|
|
uwFlag = DNM_CAM_C_NoLinearInertia;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoLinearInertia)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoAngularParsing :
|
|
uwFlag = DNM_CAM_C_NoAngularParsing;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoAngularParsing)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoAngularInertia :
|
|
uwFlag = DNM_CAM_C_NoAngularInertia;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoAngularInertia)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoTargetParsing :
|
|
uwFlag = DNM_CAM_C_NoTargetParsing;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoTargetParsing)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoTargetInertia :
|
|
uwFlag = DNM_CAM_C_NoTargetInertia;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoTargetInertia)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagFixedOrientation :
|
|
uwFlag = DNM_CAM_C_FixedOrientation;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_FixedOrientation)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_SetFlagNoObstacle:
|
|
uwFlag = DNM_CAM_C_NoObstacle;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoObstacle)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
/* ANNECY MT - 28/07/99 { */
|
|
case eProc_Cam_SetFlagNoCollisionWhenNotMoving:
|
|
uwFlag = DNM_CAM_C_NoCollisionWhenNotMoving;
|
|
if (lChangingMode == -1)
|
|
{
|
|
if(hCineInfo->hInit->uwDNMFlags & DNM_CAM_C_NoCollisionWhenNotMoving)
|
|
lChangingMode = 1;
|
|
else
|
|
lChangingMode = 0;
|
|
}
|
|
break;
|
|
/* END ANNECY MT } */
|
|
/*---------------------------------------------------------------------------------------*/
|
|
default :
|
|
break;
|
|
}
|
|
|
|
CAM_fn_vSetResetInternalFlag
|
|
(
|
|
hCineInfo,
|
|
&(hCineInfo->hCurrent->uwDNMFlags),
|
|
&(hCineInfo->hVisibility->uwDNMFlags),
|
|
&(hCineInfo->hWork->uwDNMFlags),
|
|
lTypeOfChange,
|
|
lChangingMode,
|
|
uwFlag
|
|
);
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
Other procedures : For private cineinfo.
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to display infos
|
|
* parameters :
|
|
* Constant -> changing mode
|
|
* 0 -> show info is unset,
|
|
* 1 -> show info is set,
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tdstNodeInterpret *CAM_fn_p_stShowInfo(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
long lMode;
|
|
tdstGetSetParam stValue;
|
|
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Get action parameter */
|
|
M_EvalNextParameter(&stValue);
|
|
lMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
/* Set new display mode */
|
|
switch(lMode)
|
|
{
|
|
case 0: hCineInfo->ucPerIAFlags &= ~C_PerIAFlags_ShowInfo; break;
|
|
case 1: hCineInfo->ucPerIAFlags |= C_PerIAFlags_ShowInfo; break;
|
|
}
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to set camera Constants
|
|
* parameters :
|
|
* Constant -> changing mode
|
|
* Real -> Value
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stChangeConstants(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
register long lMode;
|
|
MTH_tdxReal xVal;
|
|
/* MTH3D_tdstVector stVect;*/
|
|
tdstGetSetParam stValue;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
xVal = M_GetSetParam_xValue(&stValue);
|
|
|
|
|
|
/* lMode == 39 is here, because it happens very often*/
|
|
if (lMode == 39)
|
|
{
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
if(((short) xVal) & 0x0002) /* Reset work */
|
|
{
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
{
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
}
|
|
#endif
|
|
hCineInfo->ucVolIAFlags &= ~(C_VolIAFlags_CurrentAlreadyCopiedInWork);
|
|
CAM_g_stCameraConstants.wFlags &= ~((short) xVal);
|
|
return p_stTree;
|
|
}
|
|
else
|
|
{
|
|
CAM_g_stCameraConstants.wFlags |= (short) xVal;
|
|
return p_stTree;
|
|
}
|
|
}
|
|
|
|
if (lMode < 17)
|
|
{
|
|
/* lMode 1 -> 16*/
|
|
*( ((MTH_tdxReal*)(&CAM_g_stCameraConstants.xRayCameraSphereToGo1)) + (lMode-1)) = xVal;
|
|
return p_stTree;
|
|
}
|
|
if (lMode < 23)
|
|
{
|
|
/* lMode 17 -> 22*/
|
|
*( ((short*)(&CAM_g_stCameraConstants.xNumRayCameraCanGo)) + (lMode-17)) = ((short)xVal);
|
|
return p_stTree;
|
|
}
|
|
if (lMode < 30)
|
|
{
|
|
/* lMode 23 -> 29*/
|
|
return p_stTree;
|
|
}
|
|
if (lMode < 39)
|
|
{
|
|
/* lMode 30 -> 38*/
|
|
*( ((MTH_tdxReal*)(&CAM_g_stCameraConstants.xDynSpeed_LinearFactNorm)) + (lMode-30)) = xVal;
|
|
return p_stTree;
|
|
}
|
|
if (lMode == 40)
|
|
{
|
|
/* lMode 40*/
|
|
CAM_g_stCameraConstants.wFlags &= ~((short) xVal);
|
|
return p_stTree;
|
|
}
|
|
if (lMode < 44)
|
|
{
|
|
/* lMode 41 -> 43*/
|
|
*( ((MTH_tdxReal*)(&CAM_g_stCameraConstants.xBaseCutAngle)) + (lMode-41)) = xVal;
|
|
return p_stTree;
|
|
}
|
|
if (lMode == 44)
|
|
{
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
{
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
}
|
|
#endif
|
|
hCineInfo -> bCanDoBestPos = xVal ? TRUE : FALSE;
|
|
return p_stTree;
|
|
}
|
|
return p_stTree;
|
|
}
|
|
|
|
|
|
/*
|
|
switch(lMode)
|
|
{
|
|
case 1: CAM_g_stCameraConstants.xRayCameraSphereToGo1 = xVal; break;
|
|
case 2: CAM_g_stCameraConstants.xRayCameraSphereToGo2 = xVal; break;
|
|
case 3: CAM_g_stCameraConstants.xRayCameraSphereToSee1 = xVal; break;
|
|
case 4: CAM_g_stCameraConstants.xRayCameraSphereToSee2 = xVal; break;
|
|
|
|
case 5: CAM_g_stCameraConstants.xBaseAngleComputePosNormal = xVal; break;
|
|
case 6: CAM_g_stCameraConstants.xBaseAngleComputePosFailure = xVal; break;
|
|
|
|
case 7: CAM_g_stCameraConstants.xAverageForComputePos = xVal; break;
|
|
case 8: CAM_g_stCameraConstants.xAverageForComputeLinearSpeed = xVal; break;
|
|
|
|
case 9: CAM_g_stCameraConstants.xMinLinearSpeedCamera = xVal; break;
|
|
case 10: CAM_g_stCameraConstants.xMinLinearSpeedTgtPerso = xVal; break;
|
|
case 11: CAM_g_stCameraConstants.xMinAngularSpeedTgtPerso = xVal; break;
|
|
|
|
case 12: CAM_g_stCameraConstants.xEpsilonDynTgtAngle = xVal; break;
|
|
case 13: CAM_g_stCameraConstants.xEpsilonDynTgtFocalAngle = xVal; break;
|
|
case 14: CAM_g_stCameraConstants.xEpsilonForEqualVectors = xVal; break;
|
|
|
|
case 15: CAM_g_stCameraConstants.xOffsetMinDistPerso = xVal; break;
|
|
case 16: CAM_g_stCameraConstants.xDistanceForNoCut = xVal; break;
|
|
|
|
case 17: CAM_g_stCameraConstants.xNumRayCameraCanGo = (short) xVal; break;
|
|
case 18: CAM_g_stCameraConstants.xNumRayCameraCanSee = (short) xVal; break;
|
|
|
|
case 19: CAM_g_stCameraConstants.xTickTestVisibility = (short) xVal; break;
|
|
case 20: CAM_g_stCameraConstants.xTickFindBetterPos = (short) xVal; break;
|
|
case 21: CAM_g_stCameraConstants.xTickFindBetterPosIfNoMove = (short) xVal; break;
|
|
case 22: CAM_g_stCameraConstants.xTickFailureCantSee = (short) xVal; break;
|
|
|
|
case 30: CAM_g_stCameraConstants.xDynSpeed_LinearFactNorm = xVal; break;
|
|
case 31: CAM_g_stCameraConstants.xDynSpeed_LinearMax = xVal; break;
|
|
case 32: CAM_g_stCameraConstants.xDynSpeed_LinearMulPerso = xVal; break;
|
|
case 33: CAM_g_stCameraConstants.xDynSpeed_AngularFactNorm = xVal; break;
|
|
case 34: CAM_g_stCameraConstants.xDynSpeed_AngularMax = xVal; break;
|
|
case 35: CAM_g_stCameraConstants.xDynSpeed_AngularMulPerso = xVal; break;
|
|
case 36: CAM_g_stCameraConstants.xDynSpeed_TargetFactNorm = xVal; break;
|
|
case 37: CAM_g_stCameraConstants.xDynSpeed_TargetMax = xVal; break;
|
|
case 38: CAM_g_stCameraConstants.xDynSpeed_TargetMulPerso = xVal; break;
|
|
|
|
case 39:
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
if(((short) xVal) & 0x0002) // Reset work
|
|
{
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
hCineInfo->ucVolIAFlags &= ~(C_VolIAFlags_CurrentAlreadyCopiedInWork);
|
|
}
|
|
else
|
|
{
|
|
CAM_g_stCameraConstants.wFlags |= (short) xVal; break;
|
|
}
|
|
case 40: CAM_g_stCameraConstants.wFlags &= ~((short) xVal); break;
|
|
|
|
case 41: CAM_g_stCameraConstants.xBaseCutAngle = xVal; break;
|
|
case 42: CAM_g_stCameraConstants.xCutAngleFactorPos = xVal; break;
|
|
case 43: CAM_g_stCameraConstants.xCutAngleFactorTgt = xVal; break;
|
|
|
|
default: break;
|
|
}
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
extern void CAM_memcpy(void *dest, void *src, long size);
|
|
tdstNodeInterpret *CAM_fn_p_stConstants(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
switch(eProcedureId)
|
|
{
|
|
case eProc_Cam_SaveConstants:
|
|
CAM_memcpy(&CAM_g_stCopyCameraConstants, &CAM_g_stCameraConstants, sizeof(CAM_tdstCameraConstants));
|
|
break;
|
|
|
|
case eProc_Cam_RestoreConstants:
|
|
CAM_memcpy(&CAM_g_stCameraConstants, &CAM_g_stCopyCameraConstants, sizeof(CAM_tdstCameraConstants));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Procedure to set ForceTarget or ForcePosition
|
|
* parameters :
|
|
* Constant -> 0 : Permanent 1 : Temporary
|
|
* Constant -> changing mode (1 : set, 0 reset)
|
|
* Vector -> new position
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stSetForce(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineInfo;
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
long lChangingMode;
|
|
long lTypeOfChange;
|
|
tdstGetSetParam stValue;
|
|
unsigned short uwFlag = 0;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
MTH3D_tdstVector *p_stValue, stTempVector;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineInfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lTypeOfChange = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
lChangingMode = M_GetSetParam_lValue(&stValue);
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
p_stValue = &M_GetSetParam_stVertexValue(&stValue);
|
|
MTH3D_M_vCopyVector(&stTempVector, p_stValue);
|
|
|
|
switch (eProcedureId)
|
|
{
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ForceTarget :
|
|
|
|
if(lChangingMode == 1)
|
|
{
|
|
MTH3D_M_vCopyVector(&hCineInfo->stForceTarget, p_stValue);
|
|
}
|
|
uwFlag = C_IAFlags_TargetIsAlreadyComputed;
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ForcePosition :
|
|
|
|
if(lChangingMode == 1)
|
|
{
|
|
MTH3D_M_vCopyVector(&hCineInfo->stForcePosition, p_stValue);
|
|
}
|
|
uwFlag = C_IAFlags_PositionIsAlreadyComputed;
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
case eProc_Cam_ForceRefAxis :
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
p_stValue = &M_GetSetParam_stVertexValue(&stValue);
|
|
|
|
if(lChangingMode == 1)
|
|
{
|
|
MTH3D_M_vCopyVector(&hCineInfo->stForceRefAxisY, &stTempVector);
|
|
MTH3D_M_vCopyVector(&hCineInfo->stForceRefAxisZ, p_stValue);
|
|
}
|
|
uwFlag = C_IAFlags_RefAxisIsAlreadyComputed;
|
|
break;
|
|
/*---------------------------------------------------------------------------------------*/
|
|
default :
|
|
break;
|
|
}
|
|
|
|
CAM_fn_vSetResetInternalFlag
|
|
(
|
|
hCineInfo,
|
|
&(hCineInfo->hCurrent->uwIAFlags),
|
|
&(hCineInfo->hVisibility->uwIAFlags),
|
|
&(hCineInfo->hWork->uwIAFlags),
|
|
lTypeOfChange,
|
|
lChangingMode,
|
|
uwFlag
|
|
);
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* Reset camera
|
|
* No Parameter.
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
|
|
tdstNodeInterpret *CAM_fn_p_stReset(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineinfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Init camera structure */
|
|
CAM_fn_vInitCompleteCineinfo(hCineinfo);
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* To force camera to go to a failure visibility position.
|
|
* No Parameter:
|
|
*=================================================================================================
|
|
*/
|
|
extern char cRefAxisIsAlreadyComputed;
|
|
extern char cNoDynChangeTheta;
|
|
extern char cCanTestStatic;
|
|
tdstNodeInterpret *CAM_fn_p_stForceBestPos(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
CAM_tdstUpdateCamera stStruct;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineinfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* ANNECY MT - 12/07/99 { */
|
|
if (!hCineinfo->bCanDoBestPos)
|
|
{
|
|
MTH3D_M_vCopyVector(&hCineinfo->stForcePosition, &(hCamera->hGlobalMatrix->stTranslationVector));
|
|
CAM_fn_vSetResetInternalFlag
|
|
(
|
|
hCineinfo,
|
|
&(hCineinfo->hCurrent->uwIAFlags),
|
|
&(hCineinfo->hVisibility->uwIAFlags),
|
|
&(hCineinfo->hWork->uwIAFlags),
|
|
1,
|
|
1,
|
|
C_IAFlags_PositionIsAlreadyComputed
|
|
);
|
|
return(p_stTree);
|
|
}
|
|
/* END ANNECY MT } */
|
|
|
|
/*
|
|
* To have the actual good camera parameters.
|
|
*/
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(hCineinfo);
|
|
CAM_fn_vInitCameraStructure(hCamera, &stStruct);
|
|
|
|
cRefAxisIsAlreadyComputed = stStruct.hCineinfoWork->uwIAFlags & C_IAFlags_RefAxisIsAlreadyComputed ? 1 : 0;
|
|
cNoDynChangeTheta = stStruct.hCineinfoWork->uwIAFlags & C_IAFlags_NoDynChangeTheta ? 1 : 0;
|
|
cCanTestStatic = 1;
|
|
|
|
/*
|
|
* Compute target and real wanted camera pos (this is necessary
|
|
* for failure when we want a more correct position.
|
|
*/
|
|
CAM_fn_vComputeReferencePoint(&stStruct);
|
|
CAM_fn_vComputeTarget(&stStruct);
|
|
CAM_fn_vComputeRealWantedPos(&stStruct);
|
|
CAM_fn_vComputeMovePosWithDynTheta(&stStruct);
|
|
|
|
/*
|
|
* If no perso, can't do it.
|
|
*/
|
|
if(stStruct.hCineinfoCurrent->hSuperObjectTargeted == NULL)
|
|
return(p_stTree);
|
|
|
|
/*
|
|
* Force visibility failure.
|
|
*/
|
|
CAM_fn_vForceFailureVisibility(&stStruct);
|
|
CAM_fn_vComputeFailureVisibility(&stStruct);
|
|
stStruct.hCineinfoWork->uwDNMFlags |= (DNM_CAM_C_NoLinearParsing|DNM_CAM_C_NoAngularParsing);
|
|
|
|
/* ANNECY MT - 12/07/99 { */
|
|
hCineinfo->bCanDoBestPos = FALSE;
|
|
/* END ANNECY MT } */
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* To force camera to go to a failure visibility position.
|
|
* No Parameter:
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stForceNormalState(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineinfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
if (hCineinfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
|
|
CAM_fn_vSetCineinfoCurrentFromVisibility(hCineinfo);
|
|
|
|
hCineinfo->ucPerIAFlags &= ~C_PerIAFlags_ConstraintMoveVisFailure;
|
|
/* hCineinfo->ucVolIAFlags &= ~C_VolIAFlags_CurrentAlreadyCopiedInWork;*/
|
|
hCineinfo->eState = CAM_e_State_GoToOptimal;
|
|
|
|
return (p_stTree);
|
|
}
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* To force camera to follow on a rail
|
|
* No Parameter
|
|
*=================================================================================================
|
|
*/
|
|
#define CAM_M_vSetIn0ToPiBy2(V) if (V > MTH_C_PiBy2) V = MTH_M_xSub(MTH_C_Pi, V)
|
|
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tdstNodeInterpret *CAM_fn_p_stForceMovingOnRail(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
HIE_tdxHandleToSuperObject hCamera;
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
CAM_tdstUpdateCamera stStruct;
|
|
long lCurrentIndex;
|
|
long lNbWp;
|
|
WP_tdhWayPoint hWayPoint;
|
|
WP_tdhWayPoint hNextWayPoint = NULL;
|
|
WP_tdhWayPoint hPreviousWayPoint = NULL;
|
|
WP_tdhWayPoint hOldPreviousWayPoint = NULL;
|
|
MS_tdxHandleToMSWay h_MSWay;
|
|
MTH3D_tdstVector stTargetPosition;
|
|
MTH3D_tdstVector stWpPosition;
|
|
MTH3D_tdstVector stPreviousWpPosition;
|
|
MTH3D_tdstVector stOldPreviousWpPosition;
|
|
MTH3D_tdstVector stNextWpPosition;
|
|
MTH3D_tdstVector stWantedPosition;
|
|
|
|
MTH_tdxReal xDistMin, xDistMax, xDistCurrent, xDistWanted = 0;
|
|
MTH_tdxReal xDist1, xDist2, xDist3;
|
|
char cCas = 0;
|
|
ACP_tdxBool bWantedPositionIsAlreadyComputed = FALSE;
|
|
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
|
|
|
|
static long lSens = 1;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hCamera);
|
|
/********************************************************************************/
|
|
|
|
hCineinfo = M_GetMSHandle(hCamera, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
h_MSWay = M_GetMSHandle(hCamera, MSWay);
|
|
if ( h_MSWay == NULL)
|
|
return (p_stTree);
|
|
|
|
/* Init camera structure */
|
|
CAM_fn_vSetCineinfoWorkFromCurrent(hCineinfo);
|
|
CAM_fn_vInitCameraStructure(hCamera, &stStruct);
|
|
|
|
/*
|
|
* Get dist min & dist max
|
|
*/
|
|
xDistMin = hCineinfo->hWork->xDistMin;
|
|
xDistMax = hCineinfo->hWork->xDistMax;
|
|
|
|
if (MTH_M_bEqual(xDistMin, xDistMax))
|
|
cCas = 1;
|
|
|
|
/*
|
|
* Get target position
|
|
*/
|
|
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectMatrix(hCineinfo->hWork->hSuperObjectTargeted), &stTargetPosition);
|
|
|
|
/*
|
|
* Compute distance between target & camera
|
|
*/
|
|
xDistCurrent = MTH3D_M_xVectorGap(&stStruct.stCurrentCameraPos, &stTargetPosition);
|
|
|
|
/*
|
|
* Test of Distance
|
|
*/
|
|
if (cCas)
|
|
{
|
|
if (!MTH_M_bEqualWithEpsilon(xDistMin, xDistCurrent, MTH_M_xFloatToReal(0.1f)))
|
|
xDistWanted = xDistMin;
|
|
else
|
|
{ MTH3D_M_vCopyVector(&stWantedPosition, &stStruct.stCurrentCameraPos);
|
|
bWantedPositionIsAlreadyComputed = TRUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (MTH_M_bLess(xDistCurrent, xDistMin))
|
|
xDistWanted = xDistMin;
|
|
else
|
|
{
|
|
if (MTH_M_bGreater(xDistCurrent, xDistMax))
|
|
xDistWanted = xDistMax;
|
|
else
|
|
{ MTH3D_M_vCopyVector(&stWantedPosition, &stStruct.stCurrentCameraPos);
|
|
xDistWanted = xDistMax;
|
|
bWantedPositionIsAlreadyComputed = TRUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
MTH3D_M_vCopyVector(&stWantedPosition, &stStruct.stCurrentCameraPos);
|
|
if (!bWantedPositionIsAlreadyComputed)
|
|
{
|
|
CAM_fn_vComputeReferencePoint(&stStruct);
|
|
|
|
/* Get the current Wp */
|
|
lCurrentIndex = MSWay_fn_lGetCurrentIndexInPath(h_MSWay);
|
|
hWayPoint = MSWay_fn_hGetWayPointOfPath (h_MSWay,lCurrentIndex);
|
|
|
|
/* Number of Wp */
|
|
lNbWp = MSWay_fn_lGetNumberWayPointInPath(h_MSWay);
|
|
/* Position of the current Wp */
|
|
WP_fnv_WayPoint_GetVertex(hWayPoint, &stWpPosition);
|
|
|
|
if (CAM_fn_bEqualVectorWithEpsilon(&stWpPosition, &stStruct.stCurrentCameraPos, WP_fnx_WayPoint_GetRadius(hWayPoint)))
|
|
/* Camera is on Wp*/
|
|
{
|
|
hPreviousWayPoint = MSWay_fn_hGetWayPointOfPath (h_MSWay,lCurrentIndex-1);
|
|
if (hPreviousWayPoint)
|
|
WP_fnv_WayPoint_GetVertex(hPreviousWayPoint, &stOldPreviousWpPosition);
|
|
else
|
|
MTH3D_M_vCopyVector(&stOldPreviousWpPosition, &stWpPosition);
|
|
|
|
hWayPoint = MSWay_fn_hGetWayPointOfPath (h_MSWay,lCurrentIndex+1);
|
|
MTH3D_M_vCopyVector(&stPreviousWpPosition, &stWpPosition);
|
|
|
|
if (hWayPoint)
|
|
WP_fnv_WayPoint_GetVertex(hWayPoint, &stWpPosition);
|
|
|
|
/* compute the distance between cameratarget and the current section of path */
|
|
xDist1= Cam_fn_xComputeProjectionRail(&stStruct.stTargetedPersoPos, &stPreviousWpPosition, &stOldPreviousWpPosition);
|
|
|
|
/* compute the distance between cameratarget and the next section of path*/
|
|
xDist2 = Cam_fn_xComputeProjectionRail(&stStruct.stTargetedPersoPos, &stPreviousWpPosition, &stWpPosition);
|
|
|
|
if (xDist1 <= xDist2)
|
|
{
|
|
lSens = -1;
|
|
MSWay_fn_lIncrementCurrentIndexInPath(h_MSWay, -1);
|
|
/* select the current section of path */
|
|
Cam_fn_vComputeMovingOnRail(&stStruct,&stWantedPosition,&stPreviousWpPosition, &stOldPreviousWpPosition,xDistWanted);
|
|
}
|
|
else
|
|
{
|
|
/* select the next section of path */
|
|
lSens = 1;
|
|
MSWay_fn_lIncrementCurrentIndexInPath(h_MSWay, 1);
|
|
Cam_fn_vComputeMovingOnRail(&stStruct,&stWantedPosition,&stWpPosition,&stPreviousWpPosition,xDistWanted);
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
hPreviousWayPoint = MSWay_fn_hGetWayPointOfPath (h_MSWay,lCurrentIndex-lSens);
|
|
if (hPreviousWayPoint)
|
|
WP_fnv_WayPoint_GetVertex(hPreviousWayPoint, &stPreviousWpPosition);
|
|
else
|
|
{
|
|
hPreviousWayPoint = hWayPoint;
|
|
MTH3D_M_vCopyVector(&stPreviousWpPosition, &stWpPosition);
|
|
}
|
|
/* compute the distance between cameratarget and the current section of path*/
|
|
xDist1 = Cam_fn_xComputeProjectionRail(&stStruct.stTargetedPersoPos, &stPreviousWpPosition, &stWpPosition);
|
|
|
|
hOldPreviousWayPoint = MSWay_fn_hGetWayPointOfPath (h_MSWay,lCurrentIndex - (2*lSens));
|
|
if (hOldPreviousWayPoint)
|
|
WP_fnv_WayPoint_GetVertex(hOldPreviousWayPoint, &stOldPreviousWpPosition);
|
|
else
|
|
{
|
|
hOldPreviousWayPoint = hPreviousWayPoint;
|
|
MTH3D_M_vCopyVector(&stOldPreviousWpPosition, &stPreviousWpPosition);
|
|
}
|
|
/* compute the distance between cameratarget and the previous section of path*/
|
|
xDist2 = Cam_fn_xComputeProjectionRail(&stStruct.stTargetedPersoPos, &stPreviousWpPosition, &stOldPreviousWpPosition);
|
|
|
|
|
|
hNextWayPoint = MSWay_fn_hGetWayPointOfPath (h_MSWay,lCurrentIndex+lSens);
|
|
if (hNextWayPoint)
|
|
{
|
|
WP_fnv_WayPoint_GetVertex(hNextWayPoint, &stNextWpPosition);
|
|
}
|
|
else
|
|
{
|
|
hNextWayPoint = hWayPoint;
|
|
MTH3D_M_vCopyVector(&stNextWpPosition, &stWpPosition);
|
|
}
|
|
/* compute the distance between cameratarget and the current section of path*/
|
|
xDist3 = Cam_fn_xComputeProjectionRail(&stStruct.stTargetedPersoPos, &stNextWpPosition, &stWpPosition);
|
|
|
|
|
|
if (xDist3 <= xDist1)
|
|
{
|
|
if (xDist3 <= xDist2)
|
|
{
|
|
MTH3D_M_vCopyVector(&stWantedPosition, &stWpPosition);
|
|
}
|
|
else
|
|
{
|
|
if (xDist1 <= xDist2)
|
|
{
|
|
Cam_fn_vComputeMovingOnRail(&stStruct,&stWantedPosition,&stWpPosition,&stPreviousWpPosition,xDistWanted);
|
|
}
|
|
else
|
|
{
|
|
if (CAM_fn_bEqualVectorWithEpsilon(&stPreviousWpPosition, &stStruct.stCurrentCameraPos, WP_fnx_WayPoint_GetRadius(hPreviousWayPoint)))
|
|
{
|
|
Cam_fn_vComputeMovingOnRail(&stStruct,&stWantedPosition,&stPreviousWpPosition,&stOldPreviousWpPosition,xDistWanted);
|
|
lSens = -lSens;
|
|
MSWay_fn_lIncrementCurrentIndexInPath(h_MSWay, lSens);
|
|
}
|
|
else
|
|
{
|
|
MTH3D_M_vCopyVector(&stWantedPosition, &stPreviousWpPosition);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (xDist1 <= xDist2)
|
|
{
|
|
Cam_fn_vComputeMovingOnRail(&stStruct,&stWantedPosition,&stWpPosition,&stPreviousWpPosition,xDistWanted);
|
|
}
|
|
else
|
|
{
|
|
if (CAM_fn_bEqualVectorWithEpsilon(&stPreviousWpPosition, &stStruct.stCurrentCameraPos, WP_fnx_WayPoint_GetRadius(hPreviousWayPoint)))
|
|
{
|
|
lSens = -lSens;
|
|
MSWay_fn_lIncrementCurrentIndexInPath(h_MSWay, lSens);
|
|
Cam_fn_vComputeMovingOnRail(&stStruct,&stWantedPosition,&stPreviousWpPosition,&stOldPreviousWpPosition,xDistWanted);
|
|
}
|
|
else
|
|
{
|
|
MTH3D_M_vCopyVector(&stWantedPosition, &stPreviousWpPosition);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Set the wanted position*/
|
|
MTH3D_M_vCopyVector(&hCineinfo->stForcePosition, &stWantedPosition);
|
|
CAM_fn_vSetResetInternalFlag
|
|
(
|
|
hCineinfo,
|
|
&(hCineinfo->hCurrent->uwIAFlags),
|
|
&(hCineinfo->hVisibility->uwIAFlags),
|
|
&(hCineinfo->hWork->uwIAFlags),
|
|
1,
|
|
1,
|
|
C_IAFlags_PositionIsAlreadyComputed
|
|
);
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
* To update the Look mode
|
|
*
|
|
*=================================================================================================
|
|
*/
|
|
tdstNodeInterpret *CAM_fn_p_stCameraMode(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
tdstGetSetParam stValue;
|
|
|
|
M_EvalNextParameter(&stValue);
|
|
g_stEngineStructure.cCameraMode = (char)M_GetSetParam_lValue(&stValue);
|
|
|
|
return (p_stTree);
|
|
}
|