reman3/Rayman_X/cpa/tempgrp/AI/AIGame/CAM_Fnct.c

851 lines
31 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 "EnumFunc.h"
#include "Operator.h"
#include "Convert.h"
#include "CAM_Base.h"
#include "CAM_Tool.h"
#include "Cam_Vis.h"
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
* To retrieve a real.
* _lCurrentValue : -1 Initial
* 0 Actual current (current or visibility)
* 1 The actual one (current or work)
*=================================================================================================
*/
MTH_tdxReal CAM_fn_xGetARealParameter
(
MS_tdxHandleToCineinfo _hCineInfo,
MTH_tdxReal *_p_xInitialValue,
MTH_tdxReal *_p_xCurrentValue,
MTH_tdxReal *_p_xWorkValue,
MTH_tdxReal *_p_xVisValue,
long _lCurrentValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH_tdxReal xValue = MTH_C_ZERO;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if (_lCurrentValue == 1)
{
if (_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
xValue = *_p_xWorkValue;
else
xValue = *_p_xCurrentValue;
}
else if (_lCurrentValue == -1)
{
xValue = *_p_xInitialValue;
}
else
{
if (_hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
xValue = *_p_xVisValue;
else
xValue = *_p_xCurrentValue;
}
return xValue;
}
/*
*=================================================================================================
* To retrieve a vector.
* _lCurrentValue : -1 Initial
* 0 Actual current (current or visibility)
* 1 The actual one (current or work)
*=================================================================================================
*/
MTH3D_tdstVector *CAM_fn_p_stGetAVectorParameter
(
MS_tdxHandleToCineinfo _hCineInfo,
MTH3D_tdstVector *_p_stInitialValue,
MTH3D_tdstVector *_p_stCurrentValue,
MTH3D_tdstVector *_p_stWorkValue,
MTH3D_tdstVector *_p_stVisValue,
long _lCurrentValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH3D_tdstVector *p_stValue = NULL;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if (_lCurrentValue == 1)
{
if (_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
p_stValue = _p_stWorkValue;
else
p_stValue = _p_stCurrentValue;
}
else if (_lCurrentValue == -1)
{
p_stValue = _p_stInitialValue;
}
else
{
if (_hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
p_stValue = _p_stVisValue;
else
p_stValue = _p_stCurrentValue;
}
return p_stValue;
}
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
* Get a vector parameter.
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stGetVectorParameter(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
long lCurrentValue;
MTH3D_tdstVector *p_stInitialValue = NULL;
MTH3D_tdstVector *p_stCurrentValue = NULL;
MTH3D_tdstVector *p_stWorkValue = NULL;
MTH3D_tdstVector *p_stVisValue = NULL;
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
switch(eFuncId)
{
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetShiftTarget:
p_stInitialValue = &(hCineInfo->hInit->stShiftTarget);
p_stCurrentValue = &(hCineInfo->hCurrent->stShiftTarget);
p_stWorkValue = &(hCineInfo->hWork->stShiftTarget);
p_stVisValue = &(hCineInfo->hVisibility->stShiftTarget);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetShiftPos:
p_stInitialValue = &(hCineInfo->hInit->stShiftPos);
p_stCurrentValue = &(hCineInfo->hCurrent->stShiftPos);
p_stWorkValue = &(hCineInfo->hWork->stShiftPos);
p_stVisValue = &(hCineInfo->hVisibility->stShiftPos);
break;
/*---------------------------------------------------------------------------------------*/
default:
break;
}
M_Full_GetSetParam_p_stVertex
(
p_stValue,
CAM_fn_p_stGetAVectorParameter
(
hCineInfo,
p_stInitialValue,
p_stCurrentValue,
p_stWorkValue,
p_stVisValue,
lCurrentValue
)
);
return(p_stTree);
}
/*
*=================================================================================================
* Get a Real Parameter.
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stGetRealParameter(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
long lCurrentValue;
MTH_tdxReal *p_xInitialValue = NULL;
MTH_tdxReal *p_xCurrentValue = NULL;
MTH_tdxReal *p_xWorkValue = NULL;
MTH_tdxReal *p_xVisValue = NULL;
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
switch(eFuncId)
{
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetDistMin :
p_xInitialValue = &(hCineInfo->hInit->xDistMin);
p_xCurrentValue = &(hCineInfo->hCurrent->xDistMin);
p_xWorkValue = &(hCineInfo->hWork->xDistMin);
p_xVisValue = &(hCineInfo->hVisibility->xDistMin);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetDistMax :
p_xInitialValue = &(hCineInfo->hInit->xDistMax);
p_xCurrentValue = &(hCineInfo->hCurrent->xDistMax);
p_xWorkValue = &(hCineInfo->hWork->xDistMax);
p_xVisValue = &(hCineInfo->hVisibility->xDistMax);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetBoundDistMin :
p_xInitialValue = &(hCineInfo->hInit->xBoundDistMin);
p_xCurrentValue = &(hCineInfo->hCurrent->xBoundDistMin);
p_xWorkValue = &(hCineInfo->hWork->xBoundDistMin);
p_xVisValue = &(hCineInfo->hVisibility->xBoundDistMin);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetBoundDistMax :
p_xInitialValue = &(hCineInfo->hInit->xBoundDistMax);
p_xCurrentValue = &(hCineInfo->hCurrent->xBoundDistMax);
p_xWorkValue = &(hCineInfo->hWork->xBoundDistMax);
p_xVisValue = &(hCineInfo->hVisibility->xBoundDistMax);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleAlpha :
p_xInitialValue = &(hCineInfo->hInit->xAngleAlpha);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleAlpha);
p_xWorkValue = &(hCineInfo->hWork->xAngleAlpha);
p_xVisValue = &(hCineInfo->hVisibility->xAngleAlpha);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleShiftAlpha :
p_xInitialValue = &(hCineInfo->hInit->xAngleShiftAlpha);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleShiftAlpha);
p_xWorkValue = &(hCineInfo->hWork->xAngleShiftAlpha);
p_xVisValue = &(hCineInfo->hVisibility->xAngleShiftAlpha);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleTheta :
p_xInitialValue = &(hCineInfo->hInit->xAngleTheta);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleTheta);
p_xWorkValue = &(hCineInfo->hWork->xAngleTheta);
p_xVisValue = &(hCineInfo->hVisibility->xAngleTheta);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleShiftTheta :
p_xInitialValue = &(hCineInfo->hInit->xAngleShiftTheta);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleShiftTheta);
p_xWorkValue = &(hCineInfo->hWork->xAngleShiftTheta);
p_xVisValue = &(hCineInfo->hVisibility->xAngleShiftTheta);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetLinearSpeed:
p_xInitialValue = &(hCineInfo->hInit->xLinearSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearSpeed);
p_xWorkValue = &(hCineInfo->hWork->xLinearSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xLinearSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetLinearIncreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xLinearIncreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearIncreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xLinearIncreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xLinearIncreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetLinearDecreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xLinearDecreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearDecreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xLinearDecreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xLinearDecreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngularSpeed:
p_xInitialValue = &(hCineInfo->hInit->xAngularSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularSpeed);
p_xWorkValue = &(hCineInfo->hWork->xAngularSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xAngularSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngularIncreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xAngularIncreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularIncreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xAngularIncreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xAngularIncreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngularDecreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xAngularDecreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularDecreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xAngularDecreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xAngularDecreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetTargetSpeed:
p_xInitialValue = &(hCineInfo->hInit->xTargetSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetSpeed);
p_xWorkValue = &(hCineInfo->hWork->xTargetSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xTargetSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetTargetIncreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xTargetIncreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetIncreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xTargetIncreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xTargetIncreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetTargetDecreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xTargetDecreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetDecreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xTargetDecreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xTargetDecreaseSpeed);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetFocal :
p_xInitialValue = &(hCineInfo->hInit->xFocal);
p_xCurrentValue = &(hCineInfo->hCurrent->xFocal);
p_xWorkValue = &(hCineInfo->hWork->xFocal);
p_xVisValue = &(hCineInfo->hVisibility->xFocal);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetZMin:
p_xInitialValue = &(hCineInfo->hInit->xZMin);
p_xCurrentValue = &(hCineInfo->hCurrent->xZMin);
p_xWorkValue = &(hCineInfo->hWork->xZMin);
p_xVisValue = &(hCineInfo->hVisibility->xZMin);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetZMax:
p_xInitialValue = &(hCineInfo->hInit->xZMax);
p_xCurrentValue = &(hCineInfo->hCurrent->xZMax);
p_xWorkValue = &(hCineInfo->hWork->xZMax);
p_xVisValue = &(hCineInfo->hVisibility->xZMax);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*---------------------------------------------------------------------------------------*/
default:
break;
}
M_Full_GetSetParam_Float
(
p_stValue,
CAM_fn_xGetARealParameter
(
hCineInfo,
p_xInitialValue,
p_xCurrentValue,
p_xWorkValue,
p_xVisValue,
lCurrentValue
)
);
return(p_stTree);
}
/*
*=================================================================================================
* Get Super Object Targeted.
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetTargetedSuperObject
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
HIE_tdxHandleToSuperObject hSuperObjectTargeted;
long lCurrentValue;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
if (lCurrentValue == 1)
{
if (hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
hSuperObjectTargeted = hCineInfo->hWork->hSuperObjectTargeted;
else
hSuperObjectTargeted = hCineInfo->hCurrent->hSuperObjectTargeted;
}
else if(lCurrentValue == -1)
{
hSuperObjectTargeted = hCineInfo->hInit->hSuperObjectTargeted;
}
else
{
if (hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
hSuperObjectTargeted = hCineInfo->hVisibility->hSuperObjectTargeted;
else
hSuperObjectTargeted = hCineInfo->hCurrent->hSuperObjectTargeted;
}
M_Full_GetSetParam_Perso
(
p_stValue,
hSuperObjectTargeted
);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get Type of Viewport.
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetTypeOfViewport
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
long lTypeOfViewport;
long lCurrentValue;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
if (lCurrentValue == 1)
{
if (hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
lTypeOfViewport = (long)(hCineInfo->hWork->eTypeOfViewport);
else
lTypeOfViewport = (long)(hCineInfo->hCurrent->eTypeOfViewport);
}
else if(lCurrentValue == -1)
{
lTypeOfViewport = (long)(hCineInfo->hInit->eTypeOfViewport);
}
else
{
if (hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
lTypeOfViewport = (long)(hCineInfo->hVisibility->eTypeOfViewport);
else
lTypeOfViewport = (long)(hCineInfo->hCurrent->eTypeOfViewport);
}
M_Full_GetSetParam_Integer
(
p_stValue,
lTypeOfViewport
);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get camera type in current camera sector.
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetSectorCameraType
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
long lType;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
MS_tdxHandleToSectInfo hCamCineinfo;
HIE_tdxHandleToSuperObject hCurrentSectorCamera;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCamCineinfo = M_GetMSHandle(hCamera, SectInfo);
hCurrentSectorCamera = fn_h_SectInfoGetCurrentSector(hCamCineinfo);
lType = (long) fn_cGetSectorCameraType(hCurrentSectorCamera);
M_Full_GetSetParam_Integer
(
p_stValue,
lType
);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get the camera handle
* Parameter :
* Constant : Viewport number (1 : Main Viewport, ...)
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetCameraOfViewport
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
p_SuperObjPerso =p_SuperObjPerso;
switch(eFuncId)
{
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetCameraOfViewport :
M_EvalNextParameter(p_stValue);
M_Full_GetSetParam_Perso(p_stValue, CAM_fn_hGetActiveCamera(M_GetSetParam_lValue(p_stValue)));
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetMainCamera :
M_Full_GetSetParam_Perso(p_stValue, CAM_fn_hGetActiveCamera(CAM_e_MainViewport));
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
default :
break;
}
M_AIFatalError(E_uwAIFatalNotValidFunction);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
* Compute the target
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stComputeTargetWithTgtPerso
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
CAM_tdstUpdateCamera stStruct;
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
unsigned short uwMemoFlags;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/*
* Else we copy current to work (basic function to compute target took their
* parameters in work cineinfo) and initialise a temporary structure.
*/
CAM_fn_vSetCineinfoWorkFromCurrent(hCineInfo);
CAM_fn_vInitCameraStructure(hCamera, &stStruct);
/*
* If no perso, no target...
*/
if(stStruct.hCineinfoCurrent->hSuperObjectTargeted == NULL)
{
M_Full_GetSetParam_p_stVertex
(
p_stValue,
NULL
);
return (p_stTree);
}
/*
* We doesn't want dynamic target, and we inhibit force target to force
* function to compute target with the targeted perso.
*/
uwMemoFlags = stStruct.hCineinfoWork->uwIAFlags;
stStruct.hCineinfoWork->uwIAFlags |= C_IAFlags_NoDynamicTarget;
stStruct.hCineinfoWork->uwIAFlags &= ~C_IAFlags_TargetIsAlreadyComputed;
/*
* Compute target.
*/
CAM_fn_vComputeReferencePoint(&stStruct);
CAM_fn_vComputeTarget(&stStruct);
/*
* Restore flags.
*/
stStruct.hCineinfoWork->uwIAFlags = uwMemoFlags;
/*
* Return value.
*/
M_Full_GetSetParam_p_stVertex
(
p_stValue,
&stStruct.stCptPos.stTarget
);
return(p_stTree);
}
/*
*=================================================================================================
* Get the current target Position
* No Parameter.
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stComputeCurrentTarget
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
MS_tdxHandleToDynam h_Dynam;
DNM_tdstParsingDatas *p_stParsingDatas;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
if((h_Dynam = M_GetMSHandle(hCamera, Dynam)) == NULL )
return (p_stTree);
if((p_stParsingDatas = fn_p_stDynamGetParsingDatas(h_Dynam)) == NULL)
return (p_stTree);
M_Full_GetSetParam_p_stVertex
(
p_stValue,
DNM_M_p_stCPDGetTarget(p_stParsingDatas)
);
return(p_stTree);
}
/*
*=================================================================================================
* Get the best pos for a camera.
* No Parameter.
*=================================================================================================
*/
extern char cRefAxisIsAlreadyComputed;
extern char cNoDynChangeTheta;
extern char cCanTestStatic;
tdstNodeInterpret *CAM_fn_p_stGetBestPos
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineinfo;
CAM_tdstUpdateCamera stStruct;
MTH3D_tdstVector stVec;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),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)
{
M_Full_GetSetParam_p_stVertex
(
p_stValue,
&(hCamera->hGlobalMatrix->stTranslationVector)
);
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);
if(stStruct.hCineinfo->eState == CAM_e_State_FailureVisibility)
{
MTH3D_M_vCopyVector(&stVec, &stStruct.hCineinfo->stLastFailedWanted);
/* ANNECY MT - 12/07/99 { */
hCineinfo->bCanDoBestPos = FALSE;
/* END ANNECY MT } */
}
else
{
MTH3D_M_vNullVector(&stVec);
}
stStruct.hCineinfo->eState = CAM_e_State_GoToOptimal;
M_Full_GetSetParam_p_stVertex
(
p_stValue,
&stVec
);
return(p_stTree);
}